PageSourceSearch

https://app.smartdialog.ai/assets/GroupServiceNew-Dba1MEeF.js

js smartdialog.ai collected 2026-10-05 12:39:14 UTC 20,148 bytes, 1 lines download raw bytes

1import{b as je,q as Je,d as ze,c$ as _e,a2 as Xe,p as X,bK as j,R as e,dk as Ze,cS as Z,a4 as Q,w as re,cs as w,bP as B,r as K,y,E as H,U as V,bZ as Qe,bY as et,c6 as tt,be as nt,b4 as ee,b5 as te,b6 as ne,b7 as i,T as k,b9 as W,A as d,G as p,N as C,O as s,c9 as ae,b_ as T,dW as at,bx as ie,d5 as lt,dO as rt,cH as it,bG as u,dX as ct,dY as st,b8 as ot,P as ut,ai as Y}from"./index-CpcUj6vn.js";import{R as mt}from"./RoutedStepper-B2K1ef8A.js";import{S as gt}from"./SearchableSelect-D4PvvKzG.js";import{u as dt}from"./useCodeServiceSelect-CrjyuOPs.js";import{G as pt}from"./GuideLink-Cb5YRbze.js";import{I as Et}from"./InstructionVideoPopup-Bf6EIbNt.js";import{D as ft}from"./DefaultSenderTextField-kQ0FG8GZ.js";import"./Stepper-DOnYgvt3.js";import"./lodash-DqXObOj3.js";import"./lodash-1T78Azbp.js";const a=re({root:{borderBottom:"none"}})(ot),ht=j(r=>({lastTableRow:{border:"0"},select:{minWidth:"40%"},root:{width:"100%"},button:{marginRight:r.spacing(1)},completed:{display:"inline-block"},instructions:{marginTop:r.spacing(1),marginBottom:r.spacing(1)},helper:{color:"#546e7a",margin:"0",fontSize:"12px",marginTop:"3px",textAlign:"left",fontFamily:"Rajdhani",fontWeight:"400",lineHeight:"13px",letterSpacing:"0.33px"},paymentContainer:{border:"0",boxShadow:"none",maxWidth:"700px"},paymentContainerContent:{padding:"0 !important"},paymentInput:{minWidth:"60%",[r.breakpoints.only("sm")]:{minWidth:"80%"},[r.breakpoints.only("xs")]:{minWidth:"100%"}},fieldset:{border:"1px solid #ccc",borderRadius:"5px"},legend:{fontSize:"13px",marginLeft:"10px",padding:"5px"},formControl:{width:"90%"},required:{fontWeight:"bold"}})),le=()=>({defaultSender:"",dlrUrl:"",endDate:null,messagingAccountId:null,name:"",rCodeServiceId:null,serviceState:"Active",startDate:new Date,serviceConfiguration:{description:"",responseMessages:{},renewalMode:"ExpiresAutomatically",restriction:"None",dialogService:!1,membershipPeriod:null,gracePeriod:0,contactLimit:null,pushBilling:!1,pushBillingCharge:null,pushBillingChargeOnJoin:!1,pushBillingChargingLimit:150,pushBillingCurrency:null,pushBillingMode:"internal",pushBillingSender:null,pushBillingInputSourceId:null,pushBillingVat:null,pushBillingKeyword:null,webhookActionUrl:null},hiddenContent:!1}),vt={pushBillingCharge:null,pushBillingChargeOnJoin:!1,pushBillingChargingLimit:150,pushBillingCurrency:null,pushBillingMode:"internal",pushBillingSender:null,pushBillingInputSourceId:null,pushBillingVat:null,pushBillingKeyword:null,webhookActionUrl:null},Ct=()=>{const r=je(),M=Je(),{customerId:b,serviceId:ce}=ze(),{showInfo:se}=_e(),{error:A,success:oe}=Xe(),{messagingAccounts:I}=X(t=>t.messagingAccounts),{selectedCustomerMessageRetentionDays:J,selectedCustomerMaxPrice:O,selectedCustomerVats:x,selectedCustomerAlpha2Code:ue}=X(t=>t.auth),c=ht(),P=!!ce,[me,G]=e.useState(!1),ge=Ze(),[n,o]=e.useState({...le(),defaultSender:ge,customerId:b}),[h,de]=e.useState(null),[D,pe]=e.useState(""),[N,Ee]=e.useState(null),[S,fe]=e.useState(""),[he,z]=e.useState(0),[ve,_]=e.useState("none"),[R,Ce]=e.useState(!1),g=e.useMemo(()=>h?.find(t=>t?.id===D)??null,[h,D]),{payload:$,loading:Se}=Z({method:"GET",endpoint:"/messaging/services/group/inputsources"});e.useEffect(()=>{$&&de($?.filter(t=>t?.inputSource?.type==="SMS"))},[$,r]);const{payload:L,loading:ye}=Z({method:"GET",endpoint:"/messaging/services/group/pricingtables",params:{maxPrice:O,countryCode:ue}});e.useEffect(()=>{L&&Ee(L)},[L,r]),e.useEffect(()=>{n.messagingAccountId===null&&I?.[0]?.id&&o(t=>({...t,messagingAccountId:I?.[0]?.id}))},[I,n.messagingAccountId]);const{loading:be,mutate:we}=Q(t=>({method:"POST",endpoint:"/messaging/services/group",body:t})),{mutate:ke}=Q(t=>({method:"GET",endpoint:`/messaging/services/group/${t}`,params:{includeUncachedProperties:!0}})),Be=e.useMemo(()=>{let t=[];return Array.isArray(g?.allowedVats)?t=g.allowedVats:Array.isArray(x)&&(t=x.reduce((l,m)=>typeof m?.vat=="number"?[...l,m.vat]:l,[])),t.sort((l,m)=>parseFloat(l)-parseFloat(m))},[g,x]),Ie=async()=>{G(!0);const{error:t,errorMessages:l,status:m,payload:f}=await we({...n});if(t)m===403?(G(!1),A("You don´t have access to create/update this service")):(G(!1),A(l));else{oe("Group service created successfully");const{error:U,payload:q}=await ke(f);await r(u(!1)),!U&&q?(r(ct(q)),r(st(q)),M.push(`/${b}/services/groupmessaging/${f}/info`)):M.push(`/${b}/services/groupmessaging`)}},v=t=>{const l={...n,[t.target.name]:t.target.value};o(l),r(u(!0))},E=t=>{const l={...n,serviceConfiguration:{...n.serviceConfiguration,[t.target.name]:t.target.value}};o(l),r(u(!0))},xe=t=>{const l={...n,[t.target.name]:t.target.checked};o(l),r(u(!0))},Pe=t=>{const l={...n,serviceConfiguration:{...n.serviceConfiguration,[t.target.name]:t.target.checked}};o(l),r(u(!0))},De=t=>{const l={...n,serviceConfiguration:{...n.serviceConfiguration,...t.target.checked?{}:{...vt},[t.target.name]:t.target.checked}};o(l),r(u(!0))},Ne=t=>{const l={...n,serviceConfiguration:{...n.serviceConfiguration,[t.target.name]:t.target.checked,pushBilling:!1}};o(l),r(u(!0))},Te=t=>{const l={...n,startDate:t._d};o(l),r(u(!0))},Me=t=>{const l={...n,endDate:t};o(l),r(u(!0))},Ae=async()=>{await r(u(!1)),M.push(`/${b}/services/groupmessaging`)},Oe=t=>{t.target.value.length<3&&A("Default sender value must be at least 3 characters.")},Ge=t=>{if(t!==""){const l=h?.find(f=>f?.id===t),m={...n,serviceConfiguration:{...n.serviceConfiguration,pushBillingInputSourceId:l?.inputSource?.id,pushBillingSender:l?.inputSource?.address,pushBillingKeyword:l?.keywordPrefix}};o(m),r(u(!0)),pe(t)}z(0),_("none")},Re=t=>{const l=h?.find(U=>U?.id===D),m=l?.keywordPrefix?`${l?.keywordPrefix} ${t.target.value}
1`:t.target.value,f={...n,serviceConfiguration:{...n.serviceConfiguration,pushBillingKeyword:m}};o(f),fe(t.target.value),r(u(!0))},$e=t=>{const l=N?.[0]?.items?.filter(f=>f.id===t.target.value),m={...n,serviceConfiguration:{...n.serviceConfiguration,pushBillingCharge:l?.[0]?.price,pushBillingCurrency:N?.[0]?.currency}};o(m),z(t.target.value),r(u(!0))},Le=t=>{_(t.target.value);const l={...n,serviceConfiguration:{...n.serviceConfiguration,pushBillingVat:t.target.value!=="none"?t.target.value:null}};o(l),r(u(!0))},{loading:Fe,CodeServiceSelect:Ue}=dt(),qe=be||Fe;let F=!1;(P===!1||P&&n.id!==void 0)&&(F=!0);const He=e.useMemo(()=>h===null?[]:h.filter(l=>l?.maxPrice!==null&&l?.maxPrice!==0&&l?.inputSource?.billingType==="MT").map(l=>({label:`${l?.inputSource?.address} ${l?.keywordPrefix?`- ${l?.keywordPrefix}`:""}`,value:l?.id})),[h]),Ve=t=>{let{value:l}=t.target;Number.isNaN(l)?l="":l=Number(t.target.value);const m={...n,serviceConfiguration:{...n.serviceConfiguration,pushBillingChargingLimit:l}};o(m),r(u(!0))},We=()=>{let t=n?.serviceConfiguration?.pushBillingChargingLimit;t>150&&(t=150);const l={...n,serviceConfiguration:{...n.serviceConfiguration,pushBillingChargingLimit:t}};o(l),r(u(!0))},Ye=t=>{Ce(t.target.checked),t.target.checked||o({...le(),customerId:b,name:n.name,defaultSender:n.defaultSender,startDate:n.startDate})},Ke=re(t=>({switchBase:{color:t.palette.secondary.dark}}))(w);return ye||Se?e.createElement(B,null):e.createElement("div",{className:c.container},qe?e.createElement(B,null):e.createElement(K.Suspense,{fallback:e.createElement(B,null)},e.createElement(y,{container:!0,direction:"row",justifyContent:"flex-end",alignItems:"center",className:c.toolbar},e.createElement(y,{item:!0,className:c.gridItem},e.createElement(pt,null),e.createElement(Et,{useButton:!0,videoId:"groupservice"}),e.createElement(H,{"aria-label":"info",onClick:se},e.createElement(V,{title:"Info"},e.createElement(Qe,null))),e.createElement(H,{"aria-label":"cancel",onClick:Ae},e.createElement(V,{title:"Cancel"},e.createElement(et,null))),e.createElement(H,{"aria-label":"save",onClick:Ie,disabled:me},e.createElement(V,{title:"Save changes"},e.createElement(tt,null))))),e.createElement(nt,null),F&&e.createElement(ee,null,e.createElement(te,{xs:6,sm:3},e.createElement("colgroup",null,e.createElement("col",{width:"20%"}),e.createElement("col",{width:"80%"})),e.createElement(ne,null,e.createElement(i,null,e.createElement(a,{align:"left"},"Select mode"),e.createElement(a,null,e.createElement(k,{component:"div"},e.createElement(y,{component:"label",container:!0,alignItems:"center",spacing:1},e.createElement(y,{item:!0},"Basic"),e.createElement(y,{item:!0},e.createElement(Ke,{checked:R,onChange:Ye})),e.createElement(y,{item:!0},"Full")),e.createElement(W,null,"Use Basic mode to create a list of recipients to send messages to or choose Full mode to create a Group service for instance joining and leaving via sms.")))),e.createElement(i,{key:"name"},e.createElement(a,{align:"left",className:c.required},"Service name (*)"),e.createElement(a,{align:"left"},e.createElement(d,{name:"name",onChange:v,value:n?.name,className:c.select}))),e.createElement(i,{key:"description"},e.createElement(a,{align:"left"},"Description"),e.createElement(a,{align:"left"},e.createElement(d,{name:"description",onChange:E,value:n?.serviceConfiguration?.description,className:c.select}))),R&&e.createElement(e.Fragment,null,e.createElement(i,{key:"servicestate"},e.createElement(a,{align:"left"},"Service state"),e.createElement(a,{align:"left"},e.createElement(p,null,e.createElement(C,{id:"state-select",value:n?.serviceState,onChange:v,name:"serviceState"},e.createElement(s,{value:"Active"},"Active"),e.createElement(s,{value:"Passive"},"Passive"))))),e.createElement(i,{key:"messagingaccount"},e.createElement(a,{align:"left"},"Messaging account"),e.createElement(a,{align:"left"},e.createElement(p,null,e.createElement(C,{id:"messaging-account-select",onChange:v,name:"messagingAccountId",value:n?.messagingAccountId??""},I?.map(t=>e.createElement(s,{key:t.id,value:t.id},t.name))))))),e.createElement(i,{key:"defaultsender"},e.createElement(a,{align:"left",className:c.required},"Default sender (*)"),e.createElement(a,{align:"left"},e.createElement(ft,{name:"defaultSender",onChange:v,value:n?.defaultSender,className:c.select,helperText:"Long- or shortcode or Alphanumeric string (3-11 chars, no special characters)",onBlur:t=>Oe(t)}))),e.createElement(i,{key:"startdate"},e.createElement(a,{align:"left",className:c.required},"Start date (*)"),e.createElement(a,{align:"left"},e.createElement(ae,{autoOk:!0,hideTabs:!0,ampm:!1,value:n?.startDate,onChange:Te,name:"startDate",format:"D.M.YYYY HH.mm"}))),R&&e.createElement(e.Fragment,null,e.createElement(i,{key:"enddate"},e.createElement(a,{align:"left"},"End date"),e.createElement(a,{align:"left"},e.createElement(ae,{autoOk:!0,hideTabs:!0,clearable:!0,ampm:!1,value:n?.endDate,onChange:Me,name:"endDate",format:"D.M.YYYY HH.mm"}))),e.createElement(i,{key:"dlrurl"},e.createElement(a,{align:"left"},"Dlr url"),e.createElement(a,{align:"left"}
1,e.createElement(d,{name:"dlrUrl",onChange:v,value:n?.dlrUrl,className:c.select}))),e.createElement(i,{key:"dialogService"},e.createElement(a,{align:"left"},"Dialog service"),e.createElement(a,{align:"left"},e.createElement(T,{control:e.createElement(w,{checked:n?.serviceConfiguration?.dialogService,onChange:Ne,name:"dialogService",color:"primary"})}))),e.createElement(Ue,{name:"rCodeServiceId",value:n?.rCodeServiceId||"",onChange:v}),e.createElement(i,{key:"graceperiod"},e.createElement(a,{align:"left"},"Grace period"),e.createElement(a,{align:"left"},e.createElement(d,{name:"gracePeriod",onChange:E,value:n?.serviceConfiguration?.gracePeriod||"",className:c.select,helperText:"The number of days, in which the recipient does not receive Group messages, after joining."}))),e.createElement(i,{key:"restriction"},e.createElement(a,{align:"left"},"Messaging limitations"),e.createElement(a,{align:"left"},e.createElement(p,null,e.createElement(C,{id:"restriction",value:n?.serviceConfiguration?.restriction,onChange:E,name:"restriction"},e.createElement(s,{value:"None"},"None"),e.createElement(s,{value:"OnceADay"},"Once a day"),e.createElement(s,{value:"OnceAWeek"},"Once a week"),e.createElement(s,{value:"OnceAMonth"},"Once a month"),e.createElement(s,{value:"OnceAYear"},"Once a year"),e.createElement(s,{value:"OnceInServiceLifetime"},"Once in service lifetime"))),e.createElement(k,{className:c.helper},"Limits how often a message can be sent to the group."))),e.createElement(i,{key:"membershipperiod"},e.createElement(a,{align:"left"},"Membership period"),e.createElement(a,{align:"left"},e.createElement(d,{name:"membershipPeriod",onChange:E,value:n?.serviceConfiguration?.membershipPeriod||"",className:c.select,helperText:"Defines how long the membership lasts. Can be empty."}))),e.createElement(i,{key:"renewalmode"},e.createElement(a,{align:"left"},"Renewal mode"),e.createElement(a,{align:"left"},e.createElement(p,null,e.createElement(C,{id:"renewalmode",value:n?.serviceConfiguration?.renewalMode,onChange:E,name:"renewalmode",displayEmpty:!0},e.createElement(s,{value:"ExpiresAutomatically"},"Expires automatically"),e.createElement(s,{value:"RequiresRenewal"},"Requires renewal"),e.createElement(s,{value:"AutomaticRenewal"},"Automatic renewal"),e.createElement(s,{value:"RenewalReminder"},"Renewal reminder"))),e.createElement(k,{className:c.helper},"Defines what happens when the membership period has ended."))),e.createElement(i,{key:"contactlimit"},e.createElement(a,{align:"left"},"Contact amount limit"),e.createElement(a,{align:"left"},e.createElement(d,{name:"contactLimit",onChange:E,value:n?.serviceConfiguration?.contactLimit||"",className:c.select}))),e.createElement(i,{key:"messageretentiondays"},e.createElement(a,{align:"left"},"Message retention days"),e.createElement(a,{align:"left"},e.createElement(d,{name:"messageRetentionDays",onChange:v,value:n?.messageRetentionDays||"",className:c.select,placeholder:`${J||"365"}`,helperText:`Must be greater than or equal to 90 days. If not set, default value is ${J||"365"} days.`}))),e.createElement(i,{key:"hiddenContent"},e.createElement(a,{align:"left"},"Hidden content"),e.createElement(a,{align:"left"},e.createElement(T,{control:e.createElement(w,{checked:n?.hiddenContent,onChange:xe,name:"hiddenContent",color:"primary"})}))),O>0&&x&&e.createElement(i,{key:"pushBilling"},e.createElement(a,{align:"left"},"Push billing"),e.createElement(a,{align:"left"},e.createElement(T,{control:e.createElement(w,{checked:n?.serviceConfiguration?.pushBilling,onChange:De,name:"pushBilling",color:"primary",disabled:n?.serviceConfiguration?.dialogService})}),n?.serviceConfiguration?.dialogService&&e.createElement(W,null,"A Group service can not be markad as a Dialog service and use Push billing at the same time.")))),e.createElement(at,{in:n?.serviceConfiguration?.pushBilling,unmountOnExit:!0},e.createElement(i,{key:"shortnumber"},e.createElement(a,null),e.createElement(a,{align:"left"},e.createElement(ie,{className:c.paymentContainer},e.createElement(lt,{className:c.paymentContainerContent},e.createElement("fieldset",{className:c.fieldset},e.createElement("legend",{className:c.legend},"Push payment information"),e.createElement(ee,null,e.createElement(te,{xs:6,sm:3},e.createElement("colgroup",null,e.createElement("col",{width:"40%"}),e.createElement("col",{width:"60%"})),e.createElement(ne,null,e.createElement(i,{key:"text"},e.createElement(a,{colSpan:"2"},e.createElement(k,{variant:"body2"},"Our customer support will finalize the setup and send a notification when the service is up and running. Until that the service will be in passive state and uneditable."),(g?.keywordPrefix||S)&&e.createElement(e.Fragment,null,e.createElement("br",null),e.createElement(k,{variant:"body2"},"The following keywords will be added to the service:",e.createElement("br",null),e.createElement("b",null,`${g.keywordPrefix} ${S.toUpperCase()}`,e.createElement("br",null),`${g.keywordPrefix} ${S.toUpperCase()} CLOSE`,e.createElement("br",null),`${g.keywordPrefix} ${S.toUpperCase()} SULJE`,e.createElement("br",null),`${g.keywordPrefix} ${S.toUpperCase()} STOPPA`))))),e.createElement(i,null,e.createElement(a,{align:"left"},"Inputsource"),e.createElement(a,{align:"left"},e.createElement(p,{className:c.formControl},e.createElement(gt,{options:He,onChange:Ge,value:D})))),g&&e.createElement(i,null,e.createElement(a,{align:"left"},"Keyword"),e.createElement(a,{align:"left"},e.createElement(p,{className:c.formControl},e.createElement(d,{disabled:P,onChange:Re,value:S,InputProps:{startAdornment:e.createElement("div",{style:{padding:"6px 0 7px",textWrap:"nowrap"}},!P&&g?.keywordPrefix?e.createElement(e.Fragment,null,`${g.keywordPrefix}`," "):"")}})))),e.createElement(i,null,e.createElement(a,{align:"left"},"Price"),e.createElement(a,{align:"left"},e.createElement(K.Suspense,{fallback:e.createElement(B,null)},e.createElement(p,{className:c.formControl},e.createElement(C,{placeholder:"Select price",labelId:"priceSelect-label",id:"priceSelect",value:he,onCh
1ange:$e},e.createElement(s,{value:"0"},"None"),N?.[0]?.items?.filter(t=>t?.price<=g?.maxPrice&&t?.price<=O)?.sort((t,l)=>parseFloat(t.price)-parseFloat(l.price)).map(t=>e.createElement(s,{key:t?.id,value:t?.id},`${String(parseFloat(t?.price).toFixed(2)).replace(".",",")} ${N[0].currency}`))))))),e.createElement(i,null,e.createElement(a,{align:"left"},"Vat"),e.createElement(a,{align:"left"},e.createElement(p,{className:c.formControl},e.createElement(C,{placeholder:"Select vat",labelId:"vatSelect-label",id:"vatSelect",value:ve,onChange:Le},e.createElement(s,{value:"none"},"None"),Be.map(t=>e.createElement(s,{key:t,value:t},rt(t,!0))))))),e.createElement(i,null,e.createElement(a,{align:"left"},"Billing mode"),e.createElement(a,{align:"left"},e.createElement(p,{className:c.formControl},e.createElement(C,{placeholder:"Select billing mode",labelId:"pushBillingModeSelect-label",id:"pushBillingMode",name:"pushBillingMode",value:n?.serviceConfiguration?.pushBillingMode,onChange:E},e.createElement(s,{value:"api"},"API"),e.createElement(s,{value:"internal"},"Internal"))))),n?.serviceConfiguration?.pushBillingMode==="api"&&e.createElement(i,null,e.createElement(a,{align:"left"},"MO-url"),e.createElement(a,{align:"left"},e.createElement(it,{value:n?.serviceConfiguration?.webhookActionUrl,margin:"dense",name:"webhookActionUrl",onChange:E,className:c.formControl}))),e.createElement(i,null,e.createElement(a,{align:"left"},"Charging limit"),e.createElement(a,{align:"left"},e.createElement(d,{value:n?.serviceConfiguration?.pushBillingChargingLimit,margin:"dense",namne:"pushBillingChargingLimit",onChange:Ve,onBlur:We,className:c.formControl,type:"number",InputProps:{inputProps:{min:0,max:150,step:.01}}}),e.createElement(W,null,"Value can be between 1 and 150 EUR"))),e.createElement(i,null,e.createElement(a,{align:"left"},"Charge on join"),e.createElement(a,{align:"left"},e.createElement(T,{control:e.createElement(w,{checked:n?.serviceConfiguration?.pushBillingChargeOnJoin,onChange:Pe,name:"pushBillingChargeOnJoin",color:"primary"})})))))))))))))))))},St=j(r=>({lastTableRow:{border:"0"},card:{width:"100%",marginBottom:r.spacing(2)},select:{minWidth:"40%"},root:{width:"100%"},button:{marginRight:r.spacing(1)},completed:{display:"inline-block"},instructions:{marginTop:r.spacing(1),marginBottom:r.spacing(1)},stepperContainer:{padding:r.spacing(2)},stepperControllersContainer:{paddingTop:r.spacing(4)}})),yt=()=>{const r=St();return e.createElement(K.Suspense,{fallback:e.createElement(B,null)},e.createElement(ie,{className:r.card},e.createElement("div",{className:r.root},e.createElement(mt,{steps:[{title:"Basic Settings",path:"/basicsettings",component:Ct},{title:"Advanced Settings",path:"/advancedsettings",disabled:!0,component:()=>e.createElement("div",null,"Advanced Setings")}]}))))};j(r=>({contentContainer:{width:"100%",padding:r.spacing(2)},gridItem:{margin:r.spacing(1)},toggleContainer:{margin:r.spacing(2,0)},formControl:{margin:r.spacing(1),minWidth:120},appBar:{backgroundColor:"#fff"},panelContainer:{flexGrow:1,width:"100%",padding:r.spacing(0),paddingTop:r.spacing(3)},panel:{width:"100%",margin:r.spacing(0),padding:r.spacing(0)}}));Y.node,Y.any.isRequired,Y.any.isRequired;const Mt=()=>e.createElement(ut,{title:"Group service new"},e.createElement("div",null,e.createElement(yt,null)));export{Mt 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.