PageSourceSearch

https://app.smartdialog.ai/assets/TwoWayServiceEdit-BCnN6lIN.js

js smartdialog.ai collected 2026-10-05 12:39:11 UTC 32,296 bytes, 1 lines download raw bytes

1import{h as Me,r as x,bK as L,d as te,R as e,dL as ke,dq as ge,B as pe,ac as It,U as H,O as k,dM as xe,i as wt,j as Tt,k as Pt,n as Nt,o as Mt,am as kt,a6 as Be,ad as U,dN as me,af as We,bx as Ze,cI as Qe,a2 as Ae,b as Re,p as F,cS as fe,a4 as Ee,bP as q,b4 as Je,b5 as Xe,b6 as et,b7 as S,w as tt,G as R,cs as K,N as oe,A as X,b9 as Ie,dO as xt,y as A,E as ee,ds as At,bY as Rt,c6 as Ut,b8 as at,bG as T,dK as Ke,c$ as Ue,bZ as De,aD as we,dP as Dt,z as Fe,s as _t,dG as Ot,dQ as He,dR as Q,dS as $t,be as Lt,b_ as J,c9 as qe,q as Bt,dI as ve,dT as Wt,P as Kt,ai as he}from"./index-CpcUj6vn.js";import{u as ie,a as Se,R as Ft}from"./RoutedStepper-B2K1ef8A.js";import{C as Ht,P as qt,N as Gt}from"./NotInterestedRounded-pkMu3qIG.js";import{W as Ge,A as Vt}from"./ActionList-DlfzHCUT.js";import{S as zt}from"./SearchableSelect-D4PvvKzG.js";import{A as Yt}from"./AdminAction-DPSBG5Fm.js";import{G as _e}from"./GuideLink-Cb5YRbze.js";import{A as jt}from"./ActionEditor-DofUVy9o.js";import{S as Zt}from"./SourceSelection-CpOaFVgT.js";import{u as Qt}from"./useCodeServiceSelect-CrjyuOPs.js";import"./Stepper-DOnYgvt3.js";import"./lodash-1T78Azbp.js";import"./lodash-DqXObOj3.js";import"./UrlShortenerButton-CbNmcr18.js";import"./CreateShortLinkPopup-Cp78RFaS.js";import"./ComboBox-BZcaHpwp.js";const Jt=Me(x.createElement("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM5.63 13.19l2.49-3.2c.2-.25.58-.26.78-.01l2.1 2.53 3.1-3.99c.2-.26.6-.26.8.01l3.51 4.68c.25.33.01.8-.4.8H6.02c-.41-.01-.65-.49-.39-.82z"})),Xt=Me(x.createElement("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM9 11H7V9h2v2zm4 0h-2V9h2v2zm4 0h-2V9h2v2z"})),ea=Me(x.createElement("path",{d:"M16.75 13.96c.25.13.41.2.46.3.06.11.04.61-.21 1.18-.2.56-1.24 1.1-1.7 1.12-.46.02-.47.36-2.96-.73-2.49-1.09-3.99-3.75-4.11-3.92-.12-.17-.96-1.38-.92-2.61.05-1.22.69-1.8.95-2.04.24-.26.51-.29.68-.26h.47c.15 0 .36-.06.55.45l.69 1.87c.06.13.1.28.01.44l-.27.41-.39.42c-.12.12-.26.25-.12.5.12.26.62 1.09 1.32 1.78.91.88 1.71 1.17 1.95 1.3.24.14.39.12.54-.04l.81-.94c.19-.25.35-.19.58-.11l1.67.88M12 2a10 10 0 0 1 10 10 10 10 0 0 1-10 10c-1.97 0-3.8-.57-5.35-1.55L2 22l1.55-4.65A9.969 9.969 0 0 1 2 12 10 10 0 0 1 12 2m0 2a8 8 0 0 0-8 8c0 1.72.54 3.31 1.46 4.61L4.5 19.5l2.89-.96A7.95 7.95 0 0 0 12 20a8 8 0 0 0 8-8 8 8 0 0 0-8-8z"})),h={ADD_INPUT_SOURCE:"ADD_INPUT_SOURCE",EDIT_INPUT_SOURCE:"EDIT_INPUT_SOURCE",EDIT_UNAVAILABLE_INPUT_SOURCE:"EDIT_UNAVAILABLE_INPUT_SOURCE",EDIT_INPUT_SOURCE_CANCEL:"EDIT_INPUT_SOURCE_CANCEL",INPUTSOURCE_CREATED:"INPUTSOURCE_CREATED",INPUTSOURCE_UPDATED:"INPUTSOURCE_UPDATED",INPUTSOURCE_DELETED:"INPUTSOURCE_DELETED",SET_INPUTSOURCE_MAPPINGS:"SET_INPUTSOURCE_MAPPINGS",SET_KEYWORDS:"SET_KEYWORDS"},ta=[{label:"SMS",value:"SMS"},{label:"MMS",value:"MMS"},{label:"RCS",value:"RCS"},{label:"Instagram",value:"Instagram"},{label:"Messenger",value:"Messenger"},{label:"WeChat",value:"WeChat"},{label:"WhatsApp",value:"Whatsapp"}],aa={inputSourceTypes:ta,inputSourceMappings:[],keywords:{unavailableKeywords:[],availableKeywords:[]},addSourceClicked:!1,inputSourceType:"",editedInputSource:null,refreshInputSources:!1,editedInputSourceUnavailable:!1},na=(t,r)=>{switch(r.type){case h.ADD_INPUT_SOURCE:return{...t,addSourceClicked:!0,inputSourceType:r.data,editedInputSource:null};case h.EDIT_INPUT_SOURCE:{const{inputSource:i,inputSourceType:c}=r.data;return{...t,addSourceClicked:!1,editedInputSource:i,inputSourceType:c,editedInputSourceUnavailable:!1}}case h.EDIT_UNAVAILABLE_INPUT_SOURCE:return{...t,addSourceClicked:!1,editedInputSource:r.data,editedInputSourceUnavailable:!0};case h.EDIT_INPUT_SOURCE_CANCEL:return{...t,addSourceClicked:!1,editedInputSource:null,editedInputSourceUnavailable:!1,inputSourceType:""};case h.INPUTSOURCE_CREATED:case h.INPUTSOURCE_UPDATED:case h.INPUTSOURCE_DELETED:return{...t,addSourceClicked:!1,editedInputSource:null,refreshInputSources:!t.refreshInputSources,inputSourceType:""};case h.SET_INPUTSOURCE_MAPPINGS:return{...t,inputSourceMappings:r.data?.filter(i=>i?.inputSource?.address!=="Root")};case h.SET_KEYWORDS:return{...t,keywords:{mainKeyword:r?.data?.availableKeywords?.find(i=>!i.parentKeywordId),availableKeywords:r?.data?.availableKeywords?.filter(i=>i.parentKeywordId)??[],unavailableKeywords:r?.data?.unavailableKeywords?.filter(i=>i.parentKeywordId)??[]}};default:throw new Error(`Unhandled action type: ${r.type}`)}},la=L(()=>({select:{float:"right"}})),ra=()=>{const t=la(),{serviceId:r}=te(),{addSourceClicked:i,inputSourceTypes:c,inputSourceMappings:y}=ie(),o=Se(),[s,I]=e.useState(!1),u=ke(r,ge),l=m=>{I(m.currentTarget)},w=m=>{o({type:h.ADD_INPUT_SOURCE,data:m}),I(null)};return e.createElement("div",null,e.createElement(pe,{disabled:i||!u,color:"primary",className:t.button,onClick:l},"Add Source"),e.createElement(It,{id:"simple-menu",anchorEl:s,keepMounted:!0,open:!!s,onClose:()=>I(null)},c.map(({label:m,value:E})=>{const P=y?.filter?.(g=>g?.inputSource?.type===E)?.length===0;return e.createElement(H,{key:E,title:P?"This protocol is not configured":"",placement:"top",arrow:!0},e.createElement("div",null,e.createElement(k,{onClick:()=>w(E),disabled:P},m)))})))},Te=t=>e.createElement(xe,{width:"24px",height:"24px",viewBox:"0 0 512 512",...t},e.createElement("path",{fill:"#546e7a",d:"M256.6 8C116.5 8 8 110.3 8 248.6c0 72.3 29.7 134.8 78.1 177.9 8.4 7.5 6.6 11.9 8.1 58.2A19.9 19.9 0 0 0 122 502.3c52.9-23.3 53.6-25.1 62.6-22.7C337.9 521.8 504 423.7 504 248.6 504 110.3 396.6 8 256.6 8zm149.2 185.1l-73 115.6a37.4 37.4 0 0 1 -53.9 9.9l-58.1-43.5a15 15 0 0 0 -18 0l-78.4 59.4c-10.5 7.9-24.2-4.6-17.1-15.7l73-115.6a37.4 37.4 0 0 1 53.9-9.9l58.1 43.5a15 15 0 0 0 18 0l78.4-59.4c10.4-8 24.1 4.5 17.1 15.6z"})),Pe=t=>x.createElement(xe,{width:"24px",height:"24px",viewBox:"0 0 24 24",...t},x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"#546e7a",d:"M11.9962 0.0078125C8.73824 0.0078125 8.32971 0.021622 7.05019 0.080003C5.77333 0.138241 4.90129 0.341051 4.13824 0.637622C3.34938 0.944146 2.68038 1.35434 2.01343 2.02124C1.34652 2.68819 0.936333 3.35719 0.629809 4.14605C0.333238 4.9091 0.130429 5.78115 0.0721905 7.058C0.0138095 8.33753 0 8.74605 0 12.0041C0 15.262 0.0138095 15.6705 0.0721905 16.9501C0.130429 18.2269 0.333238 19.099 0.629809 19.862C0.936333 20.6509 1.34652 21.3199 2.01343 21.9868C2.68038 22.6537 3.34938 23.0639 4.13824 23.3705C4.90129 23.667 5.77333 23.8698 7.05019 23.9281C8.32971 23.9864 8.73824 24.0002 11.9962 24.0002C15.2542 24.0002 15.6627 23.9864 16.9422 23.9281C18.2191 23.8698 19.0911 23.667 19.8542 23.3705C20.643 23.0639 21.312 22.6537 21.979 21.9868C22.6459 21.3199 23.0561 20.6509 23.3627 19.862C23.6592 19.099 23.862 18.2269 23.9202 16.9501C23.9786 15.6705 23.9924 15.262 23.9924 12.0041C23.9924 8.74605 23.9786 8.33753 23.9202 7.058C23.862 5.78115 23.6592 4.9091 23.3627 4.14605C23.0561 3.35719 22.6459 2.68819 21.979 2.02124C21.312 1.35434 20.643 0.944146 19.8542 0.637622C19.0911 0.341051 18.2191 0.138241 16.9422 0.080003C15.6627 0.021622 15.2542 0.0078125 11.9962 0.0078125ZM7.99748 12.0041C7.99748 14.2125 9.78776 16.0028 11.9962 16.0028C14.2047 16.0028 15.995 14.2125 15.995 12.0041C15.995 9.79557 14.2047 8.00529 11.9962 8.00529C9.78776 8.00529 7.99748 9.79557 7.99748 12.0041ZM5.836 12.0041C5.836 8.60181 8.594 5.84381 11.9962 5.84381C15.3984 5.84381 18.1564 8.60181 18.1564 12.0041C18.1564 15.4062 15.3984 18.1642 11.9962 18.1642C8.594 18.1642 5.836 15.4062 5.836 12.0041ZM18.3998 7.03996C19.1949 7.03996 19.8394 6.39548 19.8394 5.60043C19.8394 4.80538 19.1949 4.16086 18.3998 4.16086C17.6048 4.16086 16.9603 4.80538 16.9603 5.60043C16.9603 6.39548 17.6048 7.03996 18.3998 7.03996Z"})),Ne=t=>x.createElement(xe,{width:"24px",height:"24px",viewBox:"0 0 64 64",...t},x.createElement("path",{fill:"#546e7a",d:"M64 43.1c0-9.4-8.9-17-20-17-11 0-20 7.6-20 17s8.9 17 20 17a23.272 23.272 0 0 0 9.6-2.1l7.9 3.4-.9-8.8a15.526 15.526 0 0 0 3.4-9.5zm-26.7-4.6a2.8 2.8 0 1 1 2.8-2.8 2.734 2.734 0 0 1-2.8 2.8zm13.5 0a2.8 2.8 0 1 1 2.8-2.8 2.8 2.8 0 0 1-2.8 2.8z"}),x.createElement("path",{fill:"#546e7a",d:"M44 23.9a27.375 27.375 0 0 1 8.7 1.5c0-.4.1-.7.1-1.1C52.8 12 41 2 26.4 2S0 12 0 24.4A20.408 20.408 0 0 0 4.5 37L3.3 48.6l10.4-4.5a29.1 29.1 0 0 0 8.4 2.4 18.61 18.61 0 0 1-.4-3.4c.1-10.6 10.1-19.2 22.3-19.2zm-8.7-13.1a3.8 3.8 0 1 1-3.8 3.8 3.8 3.8 0 0 1 3.8-3.8zm-17.8 7.5a3.714 3.714 0 0 1-3.7-3.8 3.75 3.75 0 1 1 3.7 3.8z"}));var ce={},Ve;function sa(){if(Ve)return ce;Ve=1;var t=wt(),r=Tt();
1Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var i=r(Pt()),c=t(Nt()),y=(0,c.default)(i.createElement("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM5.63 13.19l2.49-3.2c.2-.25.58-.26.78-.01l2.1 2.53 3.1-3.99c.2-.26.6-.26.8.01l3.51 4.68c.25.33.01.8-.4.8H6.02c-.41-.01-.65-.49-.39-.82z"}),"MmsRounded");return ce.default=y,ce}var ca=sa();const ze=Mt(ca),oa=L(()=>({listItem:{marginBottom:"5px"},listItemText:{textAlign:"center"}})),Ye=(t,r)=>[t?.type?t?.type:"",t?.type==="RCS"?t?.metadata?.find?.(c=>c.key===Qe)?.value??"":(r?.subNumberPattern?r?.subNumberPattern:t?.address)??"NO ADDRESS",r?.text,`${r?.price?String(parseFloat(r.price).toFixed(2)).replace(".",","):0} ${t?.currency??""}`].filter(c=>c&&c!=="").join(", "),je=e.forwardRef((t,r)=>e.createElement(Ze,{...t})),ia=()=>{const t=oa(),{keywords:{availableKeywords:r,unavailableKeywords:i},inputSourceMappings:c}=ie(),y=Se(),o=e.useCallback(u=>c?.find(l=>l?.inputSource?.id===u)?.inputSource,[c]),s=(u,l)=>{y({type:h.EDIT_INPUT_SOURCE,data:{inputSource:u,inputSourceType:l}})},I=u=>{y({type:h.EDIT_UNAVAILABLE_INPUT_SOURCE,data:u})};return e.createElement(kt,{component:"nav","aria-label":"Inputsources"},r?.map(u=>({keyword:u,inputSource:o(u?.inputSourceId)}))?.sort((u,l)=>{const w=u?.inputSource?.type?.toLowerCase(),m=l?.inputSource?.type?.toLowerCase();return w<m?-1:w>m?1:0})?.map(({keyword:u,inputSource:l})=>e.createElement(Be,{key:u.id,button:!0,className:t.listItem,component:je,onClick:()=>s(u,l?.type)},e.createElement(U,null,u?.isEnabled?e.createElement(Ht,null):e.createElement(qt,null)),e.createElement(U,null,l?.type==="SMS"&&e.createElement(me,null),l?.type==="MMS"&&e.createElement(ze,null),l?.type==="RCS"&&e.createElement(me,null),l?.type==="Whatsapp"&&e.createElement(Ge,null),l?.type==="Messenger"&&e.createElement(Te,null),l?.type==="Instagram"&&e.createElement(Pe,null),l?.type==="WeChat"&&e.createElement(Ne,null)),e.createElement(We,{className:t.listItemText,primary:Ye(l,u)}))),i?.map(u=>{const l=o(u?.inputSourceId);return e.createElement(Be,{key:u.id,button:!0,className:t.listItem,component:je,onClick:()=>I(u)},e.createElement(U,null,e.createElement(Gt,null)),e.createElement(U,null,l?.type==="SMS"&&e.createElement(me,null),l?.type==="MMS"&&e.createElement(ze,null),l?.type==="RCS"&&e.createElement(me,null),l?.type==="Whatsapp"&&e.createElement(Ge,null),l?.type==="Messenger"&&e.createElement(Te,null),l?.type==="Instagram"&&e.createElement(Pe,null),l?.type==="WeChat"&&e.createElement(Ne,null)),e.createElement(We,{className:t.listItemText,primary:Ye(l,u)}))}))},b=tt({root:{borderBottom:"none"}})(at),ua=L(()=>({formControl:{width:"100%"},smsIcon:{width:"100%",height:"100%"}})),da=()=>{const t=ua(),{error:r,success:i}=Ae(),{inputSourceType:c,inputSourceMappings:y,editedInputSource:o,editedInputSourceUnavailable:s,keywords:{mainKeyword:I}}=ie(),u=Se(),l=Re(),{serviceId:w}=te(),{selectedCustomerMaxPrice:m,selectedCustomerVats:E,selectedCustomerAlpha2Code:P}=F(a=>a.auth),g=!!o,B=ke(w,ge),[v,G]=e.useState(null),[V,ye]=e.useState("all"),[ae,ne]=e.useState(o?.text??""),[D,ue]=e.useState(!1),[le,_]=e.useState(""),[z,Y]=e.useState(0),[re,W]=e.useState("none"),[se,d]=e.useState(!1),[N,Oe]=e.useState(""),[nt,$e]=e.useState(""),[Ce,j]=e.useState(null),[Z,lt]=e.useState(""),O=e.useMemo(()=>Array.isArray(y)?y.sort((a,n)=>{const f=a?.keywordPrefix?.length??0,M=n?.keywordPrefix?.length??0;return f>M?-1:f<M?1:0}):[],[y]),C=e.useMemo(()=>O.find(a=>a?.id===le)??null,[O,le]),de=e.useMemo(()=>O.filter(a=>a?.inputSource?.type===c),[O,c]),rt=e.useMemo(()=>{let a=[];return Array.isArray(C?.allowedVats)?a=C.allowedVats:Array.isArray(E)&&(a=E.reduce((n,f)=>typeof f?.vat=="number"?[...n,f.vat]:n,[])),a.sort((n,f)=>parseFloat(n)-parseFloat(f))},[C,E]);e.useEffect(()=>{C&&ne(C?.keywordPrefix&&C?.keywordPrefix!==""?" ":"")},[C]),e.useEffect(()=>{o!==null&&(O.find(n=>n?.inputSource?.id===o?.inputSourceId&&o?.text?.startsWith?.(n?.keywordPrefix))?.maxPrice!==null?d(!0):d(!1),o?.price!==null&&o.price>0?(Y(o?.price),W(o?.vat)):(Y(0),W("none")))},[o,O]);const{payload:be,loading:st}=fe({method:"GET",endpoint:"/messaging/services/twoway/pricingtables",params:{maxPrice:m,countryCode:P}});e.useEffect(()=>{be&&G(be)},[be,l]);const{mutate:ct}=Ee(a=>({method:"POST",endpoint:"/messaging/services/twoway/inputsources/keywords",body:a})),{mutate:ot}=Ee(a=>({method:"PATCH",endpoint:`/messaging/services/twoway/inputsources/keywords/${o?.id}`,body:a})),{mutate:it}=Ee(()=>({method:"DELETE",endpoint:`/messaging/services/twoway/inputsources/keywords/${o?.id}`}));e.useEffect(()=>{ue(!!o?.isEnabled)},[o]),e.useEffect(()=>{const a=O.find(n=>n?.inputSource?.id===o?.inputSourceId&&o?.text.startsWith(n?.keywordPrefix??""));_(a?.id),a!==void 0&&a?.maxPrice!==null&&a?.inputSource?.billingType!=="None"?d(!0):d(!1)},[o,O]);const ut=async()=>{let a="";C?.subNumberPattern&&(a=C.subNumberPattern?.substring(C.inputSource?.address.length),a=`${a.substring(0,a.length-Ce.length)}${Ce}`);const n={parentKeywordId:I?.id,inputSourceId:C?.inputSource?.id??o?.id??"",enable:D,serviceId:w,text:C?.keywordPrefix?`${C.keywordPrefix}${ae}`:ae??o?.text??"",...C?.subNumberPattern?{subNumberPattern:`${C?.inputSource?.address}${a}`}:{},...z&&z>0?{price:z}:{},...re!=="none"?{vat:re}:{}};if(g){const{error:f,status:M,errorMessages:$}=await ot(n);await l(T(!1)),f&&M===409?r("Error updating keyword. Keyword already in use"):f&&M===400&&n.inputSourceId===""?r("Please select an Inputsource"):f?r($):(u({type:h.INPUTSOURCE_UPDATED}),i("Keyword updated"))}else{const{error:f,status:M,errorMessages:$}=await ct(n);await l(T(!1)),f&&M===409?r("Error creating keyword. Keyword already in use"):f&&M===400&&n.inputSourceId===""?r("Please select an Inputsource"):f?r($):(u({type:h.INPUTSOURCE_CREATED}),l(Ke()),i("Keyword created"))}},dt=()=>{u({type:h.EDIT_INPUT_SOURCE_CANCEL}),l(T(!1))},mt=async()=>{const{error:a,errorMessages:n}=await it();await l(T(!1)),a?r(n):(u({type:h.INPUTSOURCE_DELETED}),l(Ke()),i("Keyword deleted"))},pt=a=>{ue(a.target.checked),l(T(!0))},Et=a=>(c==="SMS"||c==="MMS")&&m>0&&E?a?.maxPrice===null?"No billing available.":m>a?.maxPrice?`Available max price is ${String(parseFloat(a.maxPrice).toFixed(2)).replace(".",",")} ${a?.inputSource?.currency??""}.`:`Available max price is ${String(parseFloat(m).toFixed(2)).replace(".",",")} ${a?.inputSource?.currency??""}.`:"",gt=a=>a?.inputSource?.billingType!=="None"?`Billing type is ${a?.inputSource?.billingType}.`:"",ft=a=>{let n="^";for(let $=0;$<Z.length;$++)Z[$]==="*"?n=`${n}([0-9*]{1})`:n=`${n}([${Z[$]}]{1})`;n=`${n}$`;const f=new RegExp(n),{value:M}=a.target;f.test(M)?j(M):(j(Z),r(`Invalid subnumber pattern. Must be ${Z.length} characters long. Pattern is ${Z}`))},St=a=>{if(j(null),a!==""){const n=O.find(f=>f?.id===a);if(n?.maxPrice!==null&&n?.inputSource?.billingType!=="None"?d(!0):d(!1),n?.subNumberPattern){const f=n?.subNumberPattern.substring(n?.inputSource?.address.length);lt(f),j(f)}else j(null);Oe(Et(n)),$e(gt(n)),l(T(!0)),_(a)}Y(0),W("none")},Le=({target:{value:a}})=>{ne(a?.toUpperCase?.()??a),l(T(!0))},yt=a=>{Y(a.target.value),a.target.value==="0"&&W("none"),l(T(!0))},Ct=a=>{W(a.target.value),l(T(!0))},bt=a=>{ye(a.target.value),_(""),Oe(""),$e("")},vt=e.useMemo(()=>{let a=de;return V==="nonbillable"?a=de.filter(n=>(n?.maxPrice===null||n?.maxPrice===0)&&n?.inputSource?.billingType==="None"):V==="billable"&&(a=de.filter(n=>n?.maxPrice!==null&&n?.maxPrice!==0&&n?.inputSource?.billingType!=="None")),c==="RCS"?a.map(n=>({label:`${n?.inputSource?.metadata?.find?.(f=>f.key===Qe)?.value}`,value:n?.id})):a.map(n=>({label:`${n?.subNumberPattern?n.subNumberPattern:n?.inputSource?.address} ${n?.keywordPrefix?`- ${n?.keywordPrefix}`:""}`,value:n?.id}))},[de,V]),ht=a=>{j(a.target.value)};return st?e.createElement(q,null):e.createElement(Je,{className:t.container},e.createElement(Xe,null,e.createElement("colgroup",null,e.createElement("col",{width:"40%"}),e.createElement("col",{width:"60%"})),e.createElement(et,null,e.createElement(S,null,e.createElement(b,{align:"left"},"Type"),e.createElement(b,{align:"left"},e.createElement("div",{style:{display:"flex"}},c==="Whatsapp"&&e.createElement(U,null,e.createElement(ea,null)),c==="Messenger"&&e.createElement(U,null,e.createElement(Te,null)),c==="Instagram"&&e.createElement(U,null,e.createElement(Pe,null)),c==="WeChat"&&e.createElement(U,null,e.createElement(Ne,null)),c==="SMS"&&e.createElement(U,null,e.createElement(Xt,null)),c==="MMS"&&e.createElement(U,null,e.createElement(Jt,null)),c))),g&&e.createElement(S,null,e.createElement(b,{align:"left"},"Enabled"),e.createElement(b,{align:"left"},e.createElement(R,{className:t.formControl},e.createElement(K,{disabled:s||!B,checked:D,onChange:pt,name:"Enabled",color:"primary",inputProps:{"aria-label":"primary checkbox"}})))),!g&&e.createElement(S,null,e.createElement(b,{align:"left"},"Billable"),e.createElement(b,{align:"left"},e.createElement(R,{className:t.formControl},e.createElement(oe,{placeholder:"Billable",labelId:"billableSelect-label",id:"billableSelect",value:V,onChange:bt},e.createElement(k,{value:"all"},"All"),e.createElement(k,{value:"nonbillable"},"Non billable"),e.createElement(k,{value:"billable"},"Billable"))))),o&&e.createElement(S,null,e.createElement(b,{align:"left"},"Keyword"),e.createElement(b,{align:"left"},e.createElement(R,{className:t.formControl},e.createElement(X,{disabled:!0,onChange:Le,value:o?.text??""})))),!o&&e.createElement(e.Fragment,null,e.createElement(S,null,e.createElement(b,{align:"left"},"Inputsource"),e.createElement(b,{align:"left"},e.createElement(R,{className:t.formControl},e.createElement(zt,{options:vt,onChange:St,value:le}),e.createElement(Ie,null,`${N} ${nt}`)))),C?.subNumberPattern&&e.createElement(S,null,e.createElement(b,{align:"left"},"Inputsource suffix"),e.createElement(b,{align:"left"},e.createElement(R,{className:t.formControl},e.createElement(X,{onChange:ht,onBlur:ft,value:Ce??""})))),C&&e.createElement(S,null,e.createElement(b,{align:"left"},"Keyword"),e.createElement(b,{align:"left"},e.createElement(R,{className:t.formControl},e.createElement(X,{disabled:g,onChange:Le,value:ae,InputProps:{startAdornment:e.createElement("div",{style:{padding:"6px 0 7px",textWrap:"nowrap"}},!g&&C?.keywordPrefix?`${C.keywordPrefix}`:"")}}))))),(c==="SMS"||c==="MMS")&&se&&m>0&&E&&e.createElement(e.Fragment,null,e.createElement(S,null,e.createElement(b,{align:"left"},"Price"),e.createElement(b,{align:"left"},e.createElement(x.Suspense,{fallback:e.createElement(q,null)},e.createElement(R,{className:t.formControl},e.createElement(oe,{placeholder:"Select price",labelId:"priceSelect-label",id:"priceSelect",value:z,onChange:yt},e.createElement(k,{value:"0"},"None"),v?.[0]?.items?.filter(a=>a?.price<=C?.maxPrice)?.sort((a,n)=>parseFloat(a.price)-parseFloat(n.price)).map(a=>e.createElement(k,{key:a?.id,value:a?.price},`${String(parseFloat(a?.price).toFixed(2)).replace(".",",")} ${v[0].currency}`))))))),e.createElement(S,null,e.createElement(b,{align:"left"},"Vat"),e.createElement(b,{align:"left"},e.createElement(R,{className:t.formControl},e.createElement(oe,{placeholder:"Select vat",labelId:"vatSelect-label",id:"vatSelect",value:re,onChange:Ct},e.createElement(k,{value:"none"},"None"),rt.map(a=>e.createElement(k,{key:a,value:a},xt(a,!0)))))))),e.createElement(S,null,e.createElement(b,{align:"left"}),e.createElement(b,{align:"right"},e.createElement(A,{container:!0,direction:"row",justifyContent:"flex-end",alignItems:"center",className:t.toolbar},e.createElement(A,{item:!0,className:t.gridItem},g&&B&&e.createElement(ee,{"aria-label":"delete",onClick:mt},e.createElement(H,{title:"Delete"},e.createElement(At,null))),e.createElement(ee,{"aria-label":"cancel",onClick:dt},e.createElement(H,{title:"Cancel"},e.createElement(Rt,null))),e.createElement(Yt,{resourceId:w,productType:ge,actionAvailable:e.createElement(ee,{"aria-label":"save",onClick:ut},e.createElement(H,{title:"Save changes"},e.createElement(Ut,null)))}))))))))},ma=()=>{const{addSourceClicked:t,editedInputSource:r}=ie();return t||r?e.createElement(da,null):null},pa=L(t=>({root:{flexGrow:1},paper:{padding:t.spacing(2),height:"100%"},infoButton:{float:"right"},selector:{marginBottom:t.spacing(2)},list:{},editor:{}})),Ea=()=>{const t=pa(),{showInfo:r}=Ue(),{serviceId:i}=te(),{refreshInputSources:c}=ie(),y=Se(),{payload:o,loading:s}=fe({method:"GET",endpoint:"/messaging/services/twoway/inputsources"});e.useEffect(()=>o&&y({type:h.SET_INPUTSOURCE_MAPPINGS,data:o}),[y,o]);const{payload:I,loading:u,query:l}=fe({method:"GET",endpoint:`/messaging/services/twoway/inputsources/servicekeywords/${i}`},!1),w=e.useCallback(l,[]);return e.useEffect(()=>{w()},[w,c]),e.useEffect(()=>I&&y({type:h.SET_KEYWORDS,data:{unavailableKeywords:I?.unavailableKeywords??[],availableKeywords:I?.availableKeywords??[]}}),[y,I]),s||u?e.createElement(q,null):e.createElement("div",{className:t.root},e.createElement(_e,null),e.createElement(ee,{"aria-label":"info",onClick:r,className:t.infoButton},e.createElement(H,{title:"Info"},e.createElement(De,null))),e.createElement(A,{container:!0,spacing:2},e.createElement(A,{item:!0,xs:12,md:6},e.createElement(we,{className:t.paper}
1,e.createElement("div",{className:t.selector},e.createElement(ra,null)),e.createElement("div",{className:t.list},e.createElement(ia,null)))),e.createElement(A,{item:!0,xs:12,md:6},e.createElement(we,{className:t.paper},e.createElement("div",{className:t.editor},e.createElement(ma,null))))))},ga=L(t=>({root:{flexGrow:1},paper:{padding:t.spacing(2),height:"100%"},selector:{marginBottom:t.spacing(2)},infoButton:{float:"right"}})),fa=()=>{const t=ga(),{showInfo:r}=Ue(),{actionId:i}=te(),c=e.useRef(),{loading:y,mainKeywordNotFound:o}=Dt({serviceType:"twoway"}),s=()=>{c?.current?.scrollIntoView&&c.current.scrollIntoView({behavior:"smooth"})};return e.useEffect(()=>{i!==void 0&&s()},[i]),y?e.createElement(q,null):e.createElement(Fe,{path:"/:customerId/services/twowaymessaging/edit/:serviceId/actions/:actionId?",exact:!0},e.createElement("div",{className:t.root},e.createElement(_e,null),e.createElement(ee,{"aria-label":"info",onClick:r,className:t.infoButton},e.createElement(H,{title:"Info"},e.createElement(De,null))),e.createElement(A,{container:!0,spacing:2},e.createElement(A,{item:!0,xs:12,md:6},e.createElement(we,{className:t.paper},e.createElement(Vt,{addDisabled:o,onScrollToEditor:s}))),e.createElement(A,{item:!0,xs:12,md:6,ref:c},e.createElement(Fe,{path:"/:customerId/services/twowaymessaging/edit/:serviceId/actions/:actionId",exact:!0},e.createElement(jt,{key:i}))))))},p=tt({root:{borderBottom:"none"}})(at),Sa=L(t=>({lastTableRow:{border:"0"},select:{minWidth:"40%"},root:{width:"100%"},button:{marginRight:t.spacing(1)},completed:{display:"inline-block"},instructions:{marginTop:t.spacing(1),marginBottom:t.spacing(1)},required:{fontWeight:"bold"}})),ya=()=>{const{serviceId:t}=te(),{error:r}=Ae(),{showInfo:i}=Ue(),{messagingAccounts:c}=F(d=>d.messagingAccounts),{selectedCustomerMessageRetentionDays:y}=F(d=>d.auth),{services:o,editedTwoWayService:s,twoWayServiceLoading:I,editedTwoWayServiceInitialHiddenContent:u}=F(d=>d.twowaymessaging),{foldersByServiceId:l,foldersLoading:w}=F(d=>d.folders),m=Sa(),E=Re(),P=!!t,g=e.useMemo(()=>o?.find(d=>d?.id===t)??null,[o,t]),B=e.useMemo(()=>Array.isArray(l?.[t])?l[t]:[],[l,t]),v=ke(t,ge),G=_t(Ot);e.useEffect(()=>{g&&(E(He(g?.hiddenContent??!1)),E(Q(g)),E($t(g)))},[g,E]);const{query:V,payload:ye,loading:ae}=fe({endpoint:`/messaging/accounts/${s?.messagingAccountId}`,method:"GET"}),ne=e.useCallback(V,[]);e.useEffect(()=>{s.messagingAccountId&&s.messagingAccountId!==""&&ne(s.messagingAccountId)},[ne,s.messagingAccountId]);const D=d=>{const N={...s,[d.target.name]:d.target.value};E(Q(N)),E(T(!0))},ue=d=>{const N={...s,startDate:d._d};E(Q(N)),E(T(!0))},le=d=>{const N={...s,endDate:d};E(Q(N)),E(T(!0))},_=d=>{const N={...s,serviceConfiguration:{...s.serviceConfiguration,[d.target.name]:d.target.checked}};E(Q(N)),E(T(!0))},z=(d,N)=>{!N&&d.length<3&&r("Default sender value must be at least 3 characters."),E(Q({defaultSender:d})),E(T(!0))},{loading:Y,CodeServiceSelect:re}=Qt(),W=I||ae||Y||(s?.serviceConfiguration?.allowFolders?w:!1);let se=!1;return(P===!1||P&&s.id!==void 0)&&(se=!0),e.createElement("div",{className:m.container},W?e.createElement(q,null):e.createElement(x.Suspense,{fallback:e.createElement(q,null)},e.createElement(A,{container:!0,direction:"row",justifyContent:"flex-end",alignItems:"center",className:m.toolbar},e.createElement(A,{item:!0,className:m.gridItem},e.createElement(_e,null)),e.createElement(A,{item:!0,className:m.gridItem},e.createElement(ee,{"aria-label":"info",onClick:i},e.createElement(H,{title:"Info"},e.createElement(De,null))))),e.createElement(Lt,null),se?e.createElement(Je,null,e.createElement(Xe,{xs:6,sm:3},e.createElement("colgroup",null,e.createElement("col",{width:"20%"}),e.createElement("col",{width:"80%"})),e.createElement(et,null,e.createElement(S,{key:"name"},e.createElement(p,{align:"left",className:m.required},"Service name (*)"),e.createElement(p,{align:"left"},e.createElement(X,{disabled:!v,name:"name",onChange:D,value:s?.name,className:m.select}))),e.createElement(S,{key:"servicestate"},e.createElement(p,{align:"left"},"Service state"),e.createElement(p,{align:"left"},e.createElement(R,{className:m.formControl},e.createElement(oe,{id:"state-select",value:s?.serviceState,onChange:D,name:"serviceState",disabled:!v},e.createElement(k,{value:"Active"},"Active"),e.createElement(k,{value:"Passive"},"Passive"))))),e.createElement(S,{key:"messagingaccount"},e.createElement(p,{align:"left"},"Messaging account"),e.createElement(p,{align:"left"},e.createElement(R,{className:m.formControl},e.createElement(oe,{id:"messaging-account-select",onChange:D,name:"messagingAccountId",value:s?.messagingAccountId,disabled:!v},c?.map(d=>e.createElement(k,{key:d.id,value:d.id},d.name)))))),e.createElement(S,{key:"dialogService"},e.createElement(p,{align:"left"},"Dialog service"),e.createElement(p,{align:"left"},e.createElement(J,{control:e.createElement(K,{checked:s?.serviceConfiguration?.dialogService,onChange:_,name:"dialogService",color:"primary",disabled:!v})}))),e.createElement(re,{displayOnly:!P,name:"rCodeServiceId",value:s?.rCodeServiceId||"",onChange:D}),e.createElement(S,{key:"defaultsender"},e.createElement(p,{align:"left"},"Default sender"),e.createElement(p,{align:"left"},e.createElement(Zt,{fullWidth:!1,className:m.select,value:s?.defaultSender,messagingAccount:ye,onChange:z,disabled:!v}))),e.createElement(S,{key:"startdate"},e.createElement(p,{align:"left",className:m.required},"Start date (*)"),e.createElement(p,{align:"left"},e.createElement(qe,{autoOk:!0,hideTabs:!0,ampm:!1,value:s?.startDate,onChange:ue,name:"startDate",format:"D.M.YYYY HH.mm",disabled:!v}))),e.createElement(S,{key:"enddate"},e.createElement(p,{align:"left"},"End date"),e.createElement(p,{align:"left"},e.createElement(qe,{autoOk:!0,hideTabs:!0,clearable:!0,ampm:!1,value:s?.endDate,onChange:le,name:"endDate",format:"D.M.YYYY HH.mm",disabled:!v}))),e.createElement(S,{key:"dlrurl"},e.createElement(p,{align:"left"},"Dlr url"),e.createElement(p,{align:"left"}
1,e.createElement(X,{disabled:!v,name:"dlrUrl",onChange:D,value:s?.dlrUrl,className:m.select}))),e.createElement(S,{key:"messageretentiondays"},e.createElement(p,{align:"left"},"Message retention days"),e.createElement(p,{align:"left"},e.createElement(X,{name:"messageRetentionDays",onChange:D,value:s?.messageRetentionDays||"",className:m.select,placeholder:`${y||"365"}`,helperText:`Must be greater than or equal to 90 days. If not set, default value is ${y||"365"} days.`,disabled:!v}))),e.createElement(S,{key:"hiddenContent"},e.createElement(p,{align:"left"},"Hidden content"),e.createElement(p,{align:"left"},e.createElement(J,{control:e.createElement(K,{checked:u,disabled:s?.hiddenContent||!v,onChange:()=>E(He(!u)),name:"hiddenContent",color:"primary"})}))),e.createElement(S,{key:"pollService"},e.createElement(p,{align:"left"},"Poll service"),e.createElement(p,{align:"left"},e.createElement(J,{control:e.createElement(K,{checked:!!s?.serviceConfiguration?.pollService,onChange:_,name:"pollService",color:"primary",disabled:!v})}))),e.createElement(S,null,e.createElement(p,{align:"left"},"Enable folders"),e.createElement(p,{align:"left"},e.createElement(J,{control:e.createElement(e.Fragment,null,e.createElement(K,{checked:!!s?.serviceConfiguration?.allowFolders,onChange:_,name:"allowFolders",color:"primary",disabled:!v||B?.length>0}),B?.length>0&&e.createElement(Ie,{className:m.priorityExists},"If you want to disable folders you need to delete existing folders before."))}))),e.createElement(S,{key:"allowWebhooks"},e.createElement(p,{align:"left"},"Allow webhooks"),e.createElement(p,{align:"left"},e.createElement(J,{control:e.createElement(K,{checked:!!s?.serviceConfiguration?.allowWebhooks,onChange:_,name:"allowWebhooks",color:"primary",disabled:!v})}))),e.createElement(S,{key:"allowFeeds"},e.createElement(p,{align:"left"},"Allow feeds"),e.createElement(p,{align:"left"},e.createElement(J,{control:e.createElement(e.Fragment,null,e.createElement(K,{checked:!!s?.serviceConfiguration?.allowFeeds,onChange:_,name:"allowFeeds",color:"primary",disabled:!v||!G}),!G&&e.createElement(Ie,null,"Requires access to Management"," > ","Personal Access Tokens."))})))))):null))},Ca=L(t=>({lastTableRow:{border:"0"},card:{width:"100%",marginBottom:0},select:{minWidth:"40%"},root:{width:"100%",height:"100%"},button:{marginRight:t.spacing(1)},completed:{display:"inline-block"},instructions:{marginTop:t.spacing(1),marginBottom:t.spacing(1)},stepperContainer:{padding:t.spacing(2)},stepperControllersContainer:{paddingTop:t.spacing(4)}})),ba=()=>{const t=Ca(),r=Bt(),i=Re(),{customerId:c,serviceId:y}=te(),{success:o,error:s}=Ae(),{pageHasChanges:I}=F(g=>g.session),{editedTwoWayService:u,editedTwoWayServiceInitialHiddenContent:l,twoWayServiceLoading:w}=F(g=>g.twowaymessaging),{mutate:m}=Ee(g=>({method:"PUT",endpoint:"/messaging/services/twoway",body:g,headers:{serviceId:g.id}})),E=async()=>{i(ve(!0));const g={...u,hiddenContent:l},{error:B,errorMessages:v,status:G}=await m(g);B?s(G===403?"You don´t have access to create/update this service":v):(o("2-Way service updated successfully"),i(Wt(g)),i(ve(!1)),await i(T(!1)),r.push(`/${c}/services/twowaymessaging/edit/${y}/sourcesprices`)),i(ve(!1))},P=()=>{r.push(`/${c}/services/twowaymessaging/info/${y}/info`)};return e.createElement("div",{className:t.root},e.createElement(x.Suspense,{fallback:e.createElement(q,null)},e.createElement(Ze,{className:t.card},e.createElement(Ft,{showNavButtons:!0,completeButton:e.createElement(pe,{onClick:P,color:"primary",variant:"contained"},"Done"),steps:[{id:"serviceInfo",title:"Service Info",path:"/serviceinfo",component:ya,overrides:{...I&&!w?{nextButton:e.createElement(pe,{variant:"contained",color:"primary",onClick:E},"Save and Continue")}:{}}},{id:"sourcesPrices",title:"Sources & Prices",path:"/sourcesprices",component:Ea,reducer:na,defaultState:aa,overrides:{button:e.createElement(pe,{onClick:P,color:"button.lightGrey",variant:"contained",style:{marginLeft:"auto",marginRight:"15px"}},"Done")}},{id:"actions",title:"Actions",path:"/actions/:actionId?",component:fa}]}))))};L(t=>({contentContainer:{width:"100%",padding:t.spacing(2)},gridItem:{margin:t.spacing(1)},toggleContainer:{margin:t.spacing(2,0)},formControl:{margin:t.spacing(1),minWidth:120},appBar:{backgroundColor:"#fff"},panelContainer:{flexGrow:1,width:"100%",padding:t.spacing(0),paddingTop:t.spacing(3)},panel:{width:"100%",margin:t.spacing(0),padding:t.spacing(0)}}));he.node,he.any.isRequired,he.any.isRequired;const $a=()=>e.createElement(Kt,{title:"2-way messaging service edit"},e.createElement(ba,null));export{$a 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.