D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
psa
/
admin
/
cp
/
public
/
javascript
/
views
/
admin
/
customer
/
Filename :
list.js
back
Copy
(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/customer/list"],{1417:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>d});var s=t(286),i=t(596),o=t.n(i),r=t(89),a=t(285);const l=r.Locale.getTranslate("components.forms.ip-addresses-selector"),c=({ipAddresses:e,namePrefix:n,type:t,isOtherTypeAvailable:i,getIpAddressType:o,...r})=>{const c=(0,s.useTranslate)("components.forms.ip-addresses-selector");return!!e.length&&(0,a.jsxs)(s.FormFieldSelect,{label:(0,a.jsx)(l,{content:i?`${t}Address`:"ipAddress"}),name:`${n}[${t}]`,...r,children:[e.map((({id:e,ipAddress:n,publicIpAddress:t,type:i})=>(0,a.jsx)(s.SelectOption,{value:e,children:`${t||n}${o(i)}`},e))),i&&(0,a.jsx)(s.SelectOption,{value:"none",children:c("noIpAddressHint")})]},t)};c.propTypes={ipAddresses:o().array.isRequired,namePrefix:o().string.isRequired,type:o().string.isRequired,isOtherTypeAvailable:o().bool.isRequired,getIpAddressType:o().func.isRequired};const d=c},1416:(e,n,t)=>{"use strict";t.r(n),t.d(n,{TYPE_EXCLUSIVE:()=>m,TYPE_IPV4:()=>l,TYPE_IPV6:()=>c,TYPE_SHARED:()=>d,default:()=>p});var s=t(286),i=t(596),o=t.n(i),r=t(285),a=t(1417);const l="ipv4",c="ipv6",d="SHARED",m="EXCLUSIVE",u=({ipAddresses:e,namePrefix:n,isIPv6Supported:t=!0,...i})=>{const o=(0,s.useTranslate)("components.forms.ip-addresses-selector"),u=(0,r.useMemo)((()=>e.filter((({isIPv6:e,isBroken:n})=>!e&&!n))),[e]),p=(0,r.useMemo)((()=>e.filter((({isIPv6:e,isBroken:n})=>e&&!n))),[e]),b=(0,r.useCallback)((e=>{switch(e){case d:return` (${o("shared")})`;case m:return` (${o("exclusive")})`;default:return""}}),[o]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.default,{ipAddresses:u,namePrefix:n,type:l,isOtherTypeAvailable:t&&!!p.length,getIpAddressType:b,...i}),t&&(0,r.jsx)(a.default,{ipAddresses:p,namePrefix:n,type:c,isOtherTypeAvailable:!!u.length,getIpAddressType:b,...i})]})};u.propTypes={ipAddresses:o().array.isRequired,namePrefix:o().string.isRequired,isIPv6Supported:o().bool};const p=u},1415:(e,n,t)=>{"use strict";t.r(n),t.d(n,{TYPE_EXCLUSIVE:()=>s.TYPE_EXCLUSIVE,TYPE_SHARED:()=>s.TYPE_SHARED,default:()=>s.default,prepareBackendData:()=>i});var s=t(1416);const i=e=>{const n=[];return Object.keys(e).forEach((t=>{Object.keys(e[t]).forEach((i=>{"none"!==i&&n.push({id:i,ipAddress:e[t][i],isIPv6:t===s.TYPE_IPV6})}))})),n}},1648:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>b});var s=t(285),i=t(286),o=t(1623),r=t(89),a=t(596),l=t.n(a),c=t(1415);const d=r.Locale.getTranslate("admin.components.forms.admin-panel.form.domain-info-section"),m=r.Locale.getTranslate("admin.components.forms.admin-panel.form.subscription-info-section"),u=r.Locale.getTranslate("components.forms.admin-info"),p=({values:e,servicePlans:n,ipAddresses:t,addonPlans:r,handleFieldChange:a,techDomainUrl:l,techDomainVendor:p,maxDomainLength:b,settingsEnabled:g=!1,settingsCollapsed:h=!1,withCustomer:x=!1,isWindows:f=!1,onToggleDomainSettings:j})=>{const[S,v]=(0,s.useState)(r.filter((({selected:e})=>e)).map((({id:e})=>e))),y=(0,i.getIn)(e,"subscription[subscriptionInfo][servicePlan]"),C=()=>"0"===y,I=(0,s.useMemo)((()=>"mail-hosting"===e.applicationName),[e.applicationName]);(0,s.useEffect)((()=>{const e={};r.forEach((({id:n})=>{e[n]=S.includes(n)})),a("subscription[subscriptionInfo][addonPlanSelector]",JSON.stringify(e))}),[S]),(0,s.useEffect)((()=>{a("subscription[subscriptionInfo][customize]",C()?"1":"0")}),[y]);const T=Object.keys(t).map((n=>{const s=e.subscription.domainInfo.ipSelector[n];return"none"===s?null:t[n][s].split(" ")[0]})).filter(Boolean)[0];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.default,{isEnabled:void 0!==e.subscription.domainInfo.type,isDefault:e.subscription.domainInfo.type===o.TYPE_TECH,url:l,vendor:p,maxDomainLength:b,typeName:"subscription[domainInfo][type]",name:"subscription[domainInfo][domainName]",ipAddress:T,onTypeChange:e=>a("subscription[domainInfo][type]",e),onDomainNameChange:e=>a("subscription[domainInfo][domainName]",e)}),(0,s.jsxs)(i.FormFieldSelect,{label:(0,s.jsx)(m,{content:"servicePlan"}),name:"subscription[subscriptionInfo][servicePlan]",size:"lg",children:[Object.keys(n).filter((e=>"0"!==e)).map((e=>(0,s.jsx)(i.SelectOption,{value:e,children:n[e]},e))),(0,s.jsx)(i.SelectOption,{value:"0",children:n[0]},"0")]}),!C()&&r.length?(0,s.jsx)(i.FormField,{label:(0,s.jsx)(m,{content:"addonPlans"}),children:({isDisabled:e})=>(0,s.jsx)(i.Select,{multiple:!0,searchable:!0,size:"lg",name:"subscription[subscriptionInfo][addonPlanSelector]",id:"subscription-subscriptionInfo-addonPlanSelector",defaultValue:S,onChange:e=>v(e),disabled:e(),children:r.map((({id:e,title:n})=>(0,s.jsx)(i.SelectOption,{value:e,children:n},e)))})}):null,(0,s.jsx)(i.FormFieldCheckbox,{label:(0,s.jsx)(m,{content:x?"customizeSubscriptionForCustomer":"customizeSubscriptionOnCreateSubscription"}),name:"subscription[subscriptionInfo][customize]",description:(0,s.jsx)(m,{content:"customizeSubscriptionHint"}),checkedValue:"1",uncheckedValue:"0"}),g?(0,s.jsxs)(i.Section,{id:"subscription-additionalSettings",title:(0,s.jsx)(d,{content:"subscriptionSettings"}),collapsible:!0,collapsed:h,onToggle:j,children:[(0,s.jsx)(c.default,{ipAddresses:(0,c.prepareBackendData)(t),namePrefix:"subscription[domainInfo][ipSelector]"}),!I&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("br",{}),(0,s.jsx)(i.Heading,{level:"4",children:(0,s.jsx)(d,{content:"credentials"})}),(0,s.jsx)(i.Text,{component:"p",intent:"muted",children:(0,s.jsx)(d,{content:f?"credentialsHintWin":"credentialsHint"})}),(0,s.jsx)(i.FormFieldText,{label:(0,s.jsx)(d,{content:"userName"}),name:"subscription[domainInfo][userName]",required:!0,autoComplete:"off"}),(0,s.jsx)(i.FormFieldPassword,{label:(0,s.jsx)(d,{content:"password"}),name:"subscription[domainInfo][password]",required:!0,autoComplete:"new-password"})]}),(0,s.jsx)(i.FormFieldText,{label:(0,s.jsx)(u,{content:"description"}),multiline:!0,size:"xl",name:"subscription[adminInfo][subscriptionDescription]",description:(0,s.jsx)(u,{content:"subscriptionDescriptionHint"})})]}):null]})};p.propTypes={values:l().object.isRequired,servicePlans:l().object.isRequired,addonPlans:l().array.isRequired,ipAddresses:l().object.isRequired,handleFieldChange:l().func.isRequired,techDomainUrl:l().string.isRequired,techDomainVendor:l().string.isRequired,maxDomainLength:l().number.isRequired,settingsEnabled:l().bool,settingsCollapsed:l().bool,withCustomer:l().bool,isWindows:l().bool,onToggleDomainSettings:l().func};const b=p},1623:(e,n,t)=>{"use strict";t.r(n),t.d(n,{TYPE_CUSTOM:()=>d,TYPE_TECH:()=>c,default:()=>h});var s=t(286),i=t(285),o=t(596),r=t.n(o),a=t(89),l=t(1624);const c="tech",d="custom",m=a.Locale.getTranslate("components.forms.domain.tech-domain-name"),u=({isEnabled:e,isDefault:n,url:t,vendor:o,maxDomainLength:r,typeName:a,name:l,ipAddress:u=null,onDomainNameChange:g,onTypeChange:h})=>{const[x,f]=(0,i.useState)(e&&n?c:d);if(!e)return(0,i.jsx)(p,{name:l,isEnabled:!1,onDomainNameChange:g});const j=[{key:d,icon:(0,i.jsx)(s.Icon,{name:"ribbon",intent:"success"})},{key:c,icon:(0,i.jsx)(s.Icon,{name:"rocket",intent:"info"})}];return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.Section,{title:(0,i.jsx)(m,{content:"title"}),vertical:!0,children:(0,i.jsx)(s.FormField,{name:a,onChange:e=>(e=>{f(e),h(e),g("")})(e),children:({getId:e,getName:n,getValue:t,setValue:o,isDisabled:r})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.ItemList,{stretchable:!0,selectable:!0,minColumnWidth:270,gap:"sm",value:t(),onSelect:e=>{e!==x&&o(e)},children:j.map((({key:e,icon:n})=>(0,i.jsx)(s.Item,{icon:n,role:"button",value:e,"data-action":`use-${e}-domain`,title:(0,i.jsx)(s.Heading,{level:"4",children:(0,i.jsx)(s.Paragraph,{children:(0,i.jsx)(m,{content:`${e}DomainTitle`})})}),disabled:r(),children:(0,i.jsx)(s.Text,{fontSize:"md",children:(0,i.jsx)(m,{content:`${e}DomainText`})})},e)))}),(0,i.jsx)("input",{hidden:!0,id:e(),name:n(),value:t(),readOnly:!0})]})})}),x===c?(0,i.jsx)(b,{name:l,ipAddress:u,url:t,vendor:o,maxDomainLength:r,onDomainNameChange:g}):(0,i.jsx)(p,{name:l,isEnabled:!0,onDomainNameChange:g})]})},p=({name:e,isEnabled:n,onDomainNameChange:t})=>(0,i.jsx)(s.Section,{vertical:!0,children:(0,i.jsx)(l.default,{name:e,label:n?(0,i.jsx)(m,{content:"customDomain"}):(0,i.jsx)(m,{content:"domainName"}),onChange:t,required:!0})});p.propTypes={name:r().string.isRequired,isEnabled:r().bool.isRequired,onDomainNameChange:r().func.isRequired};const b=({name:e,onDomainNameChange:n,...t})=>(0,i.jsx)(s.Section,{vertical:!0,children:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.FormField,{label:(0,i.jsx)(m,{content:"techDomain"}),name:e,onChange:e=>n(e),children:({getId:e,getName:n,...s})=>(0,i.jsx)(g,{id:e(),name:n(),...s,...t})}),(0,i.jsxs)(s.Cuttable,{maxHeight:24,children:[(0,i.jsx)(s.Paragraph,{children:(0,i.jsx)(m,{content:"techDomainDesc"})}),(0,i.jsxs)("ul",{children:[(0,i.jsx)("li",{children:(0,i.jsx)(m,{content:"techDomainRandom"})}),(0,i.jsx)("li",{children:(0,i.jsx)(m,{content:"techDomainDns"})})]}),(0,i.jsx)(s.Paragraph,{children:(0,i.jsx)(m,{content:"techDomainSwitch"})})]})]})});b.propTypes={name:r().string.isRequired,onDomainNameChange:r().func.isRequired};const g=({id:e,name:n,ipAddress:t=null,url:o,vendor:r,getValue:a,setValue:l,maxDomainLength:c})=>{const[d,u]=(0,i.useState)(!1),[p,b]=(0,i.useState)(t),[g,h]=(0,i.useState)({}),x=(0,i.useCallback)((async()=>{if(h({}),!a()||t!==p)if(t){u(!0);try{const e=await(async({url:e,ipAddress:n,vendor:t,maxDomainLength:s})=>{const i=await fetch(e,{method:"POST",body:JSON.stringify({ip_address:n,vendor:t,max_length:s})}),{subdomain:o}=await i.json();if(!o)throw new Error("subdomain is empty");return o})({url:o,ipAddress:t,vendor:r,maxDomainLength:c});l(e),b(t)}catch{h({error:(0,i.jsx)(m,{content:"error"})})}finally{u(!1)}}else h({noIpAddress:(0,i.jsx)(m,{content:"errorNoIpAddress"})})}),[a,l,t,p,o,r,c]);return(0,i.useEffect)((()=>{x()}),[t]),(0,i.jsxs)(i.Fragment,{children:[d?(0,i.jsx)(s.Status,{progress:!0,children:(0,i.jsx)(m,{content:"generating"})}):(0,i.jsx)(s.Text,{bold:!0,children:a()}),(0,i.jsx)("input",{hidden:!0,id:e,name:n,value:a(),readOnly:!0}),Object.keys(g).map((e=>(0,i.jsxs)(s.Alert,{intent:"danger",children:[(0,i.jsx)(s.Icon,{name:"exclamation-mark-circle-filled",intent:"danger"})," ",g[e]]},e)))]})};g.propTypes={id:r().string.isRequired,name:r().string.isRequired,ipAddress:r().string,url:r().string.isRequired,vendor:r().string.isRequired,maxDomainLength:r().number.isRequired,getValue:r().func.isRequired,setValue:r().func.isRequired},u.propTypes={isEnabled:r().bool.isRequired,isDefault:r().bool.isRequired,url:r().string.isRequired,vendor:r().string.isRequired,maxDomainLength:r().number.isRequired,typeName:r().string.isRequired,name:r().string.isRequired,ipAddress:r().string,onDomainNameChange:r().func.isRequired,onTypeChange:r().func.isRequired};const h=u},1624:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>l});var s=t(286),i=t(596),o=t.n(i),r=t(285);const a=({size:e="lg",...n})=>(0,r.jsx)(s.FormField,{...n,children:({getId:n,getName:t,getValue:i,setValue:o,isDisabled:a})=>(0,r.jsxs)("div",{className:"composite-field",children:[(0,r.jsx)(s.Text,{className:"composite-field__prefix",children:"www. "}),(0,r.jsx)(s.Input,{id:n(),name:t(),value:i(),placeholder:"domain.name",size:e,onChange:e=>o(e.target.value),disabled:a()})]})});a.propTypes={size:o().string};const l=a},1647:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>v,useCreateCustomerFormInDrawer:()=>S});var s=t(285),i=t(596),o=t.n(i),r=t(286),a=t(1623),l=t(89),c=t(620),d=t(1637),m=t(1289),u=t(1648);const p=l.Locale.getTranslate("admin.components.forms.customer"),b=l.Locale.getTranslate("admin.components.forms.admin-panel.form.contact-info"),g=l.Locale.getTranslate("components.forms.admin-info"),h=l.Locale.getTranslate("admin.components.forms.admin-panel.form.domain-info-section"),x=l.Locale.getTranslate("components.buttons"),f=l.Locale.getTranslate("admin.components.forms.admin-panel.form.login-info"),j=({onCancel:e,onToggleDomainSettings:n,onProcess:t,id:i,action:o,values:c,countries:j,canCreateSubscription:S=!1,servicePlans:v,ipAddresses:y,addonPlans:C,customerSettingsEnabled:I=!1,customerSettingsCollapsed:T=!1,embeddedForms:D,maxSysnameSize:w,isWindows:R,techDomain:{url:F,vendor:P,maxDomainLength:E},settingsEnabled:N=!1,settingsCollapsed:q=!1,className:A,render:k,status:L=[]})=>{const[O,U]=(0,s.useState)(c),[H,$]=(0,s.useState)(S&&!c.subscription.domainInfo),V=()=>"1"===(0,r.getIn)(O,"subscription[domainInfo][createSubscription]"),_=(e,n)=>{U((t=>{if(t=(0,r.setIn)(t,e,n),"subscription[domainInfo][domainName]"===e&&!H){const e=(0,d.generateUserName)({domainName:n,maxUserNameSize:w,isTechDomain:t.subscription.domainInfo.type===a.TYPE_TECH,isWindows:R});t=(0,r.setIn)(t,"subscription[domainInfo][userName]",e||c.subscription.domainInfo.userName)}return t})),["subscription[domainInfo][ipSelector][ipv4]","subscription[domainInfo][ipSelector][ipv6]","subscription[domainInfo][userName]","subscription[domainInfo][password]"].includes(e)&&l.UAT.dispatchAction("CUSTOM-VALUE",{name:e}),"subscription[domainInfo][userName]"===e&&$(!0)};return(0,s.jsxs)(m.default,{id:i,className:A,render:k,action:o,applyButton:!1,values:O,vertical:!0,onLongTask:t,onFieldChange:_,formPrefix:"subscription",embeddedForms:V()?D:[],embeddedFormsRender:e=>(0,s.jsx)(r.Section,{collapsible:!0,children:e}),submitButton:{id:"btn-send",children:(0,s.jsx)(p,{content:"buttonOk"})},cancelButton:{id:"btn-cancel",children:(0,s.jsx)(x,{content:"cancel"}),onClick:e},children:[(L||[]).filter((({status:e})=>"warning"===e)).map((({content:e})=>(0,s.jsx)(r.StatusMessage,{intent:"warning",children:(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:e}})},e))),(0,s.jsx)(r.Paragraph,{children:(0,s.jsx)(p,{content:"hint"})}),(0,s.jsxs)(r.Section,{title:(0,s.jsx)(p,{content:"contactInfoSection"}),children:[(0,s.jsx)(r.FormFieldText,{label:(0,s.jsx)(b,{content:"contactName"}),name:"contactInfoSection[contactInfo][contactName]",required:!0}),(0,s.jsx)(r.FormFieldText,{label:(0,s.jsx)(b,{content:"email"}),name:"contactInfoSection[contactInfo][email]",required:!0})]}),I?(0,s.jsxs)(r.Section,{id:"customer-additionalSettings",title:(0,s.jsx)(p,{content:"additionalInfoSection"}),collapsible:!0,collapsed:T,children:[(0,s.jsx)(r.FormFieldText,{label:(0,s.jsx)(b,{content:"companyName"}),name:"contactInfoSection[contactInfo][companyName]"}),(0,s.jsx)(r.FormFieldText,{label:(0,s.jsx)(b,{content:"phone"}),name:"contactInfoSection[contactInfo][phone]"}),(0,s.jsx)(r.FormFieldText,{label:(0,s.jsx)(b,{content:"address"}),multiline:!0,size:"xl",name:"contactInfoSection[contactInfo][address]"}),(0,s.jsx)(r.FormFieldText,{label:(0,s.jsx)(b,{content:"city"}),name:"contactInfoSection[contactInfo][city]"}),(0,s.jsx)(r.FormFieldText,{label:(0,s.jsx)(b,{content:"state"}),name:"contactInfoSection[contactInfo][state]"}),(0,s.jsx)(r.FormFieldText,{label:(0,s.jsx)(b,{content:"postalCode"}),name:"contactInfoSection[contactInfo][postalCode]"}),(0,s.jsx)(r.FormFieldSelect,{label:(0,s.jsx)(b,{content:"country"}),name:"contactInfoSection[contactInfo][country]",size:"lg",children:Object.keys(j).map((e=>(0,s.jsx)(r.SelectOption,{value:e,children:j[e]},e)))}),(0,s.jsx)(r.FormFieldText,{label:(0,s.jsx)(b,{content:"additionalInfo"}),multiline:!0,size:"xl",name:"contactInfoSection[contactInfo][additionalInfo]",description:(0,s.jsx)(b,{content:"additionalInfoHint"})}),(0,s.jsx)(r.Section,{title:(0,s.jsx)(g,{content:"adminInfoSection"}),children:(0,s.jsx)(r.FormFieldText,{label:(0,s.jsx)(g,{content:"description"}),multiline:!0,size:"xl",name:"adminInfoSection[clientDescription]",description:(0,s.jsx)(g,{content:"customerDescriptionHint"})})})]}):null,(0,s.jsxs)(r.Section,{id:"customer-panelAccess",title:(0,s.jsx)(p,{content:"accessToPanelSection"}),description:(0,s.jsx)(p,{content:"accessToPanelSection"}),collapsible:!0,children:[(0,s.jsx)(r.FormFieldText,{name:"accessToPanelSection[loginInfo][userName]",label:(0,s.jsx)(f,{content:"userName"}),required:!0,autoComplete:"off"}),(0,s.jsx)(r.FormFieldPassword,{name:"accessToPanelSection[loginInfo][password]",label:(0,s.jsx)(f,{content:"password"}),required:!0,autoComplete:"new-password"}),(0,s.jsx)(r.FormFieldCheckbox,{name:"accessToPanelSection[loginInfo][isActivationRequired]",label:(0,s.jsx)(f,{content:"emailActivation"}),description:(0,s.jsx)(f,{content:"emailActivationHint"}),checkedValue:"1",uncheckedValue:"0"})]}),S?(0,s.jsxs)(r.Section,{title:(0,s.jsx)(h,{content:"domainInfoSection"}),children:[(0,s.jsx)(r.FormFieldCheckbox,{name:"subscription[domainInfo][createSubscription]",label:(0,s.jsx)(h,{content:"createSubscription"}),description:(0,s.jsx)(h,{content:"createSubscriptionHint"}),checkedValue:"1",uncheckedValue:"0"}),V()?(0,s.jsx)(r.Section,{collapsible:!0,children:(0,s.jsx)(u.default,{values:O,servicePlans:v,ipAddresses:y,addonPlans:C,handleFieldChange:_,techDomainUrl:F,techDomainVendor:P,maxDomainLength:E,settingsEnabled:N,settingsCollapsed:q,isWindows:R,onToggleDomainSettings:n,withCustomer:!0})}):null]}):null]})};j.propTypes={onCancel:o().func.isRequired,onToggleDomainSettings:o().func,onProcess:o().func,id:o().string.isRequired,action:o().string.isRequired,values:o().object.isRequired,countries:o().object.isRequired,canCreateSubscription:o().bool,servicePlans:o().object.isRequired,ipAddresses:o().object.isRequired,addonPlans:o().array.isRequired,customerSettingsEnabled:o().bool,customerSettingsCollapsed:o().bool,embeddedForms:o().array,maxSysnameSize:o().number.isRequired,isWindows:o().bool.isRequired,techDomain:o().object.isRequired,settingsEnabled:o().bool,settingsCollapsed:o().bool,className:o().string,render:o().func,status:o().array};const S=(e,n)=>(0,c.useCreateFormInDrawer)(j,"create-customer",e,n),v=j},1534:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>d});var s=t(596),i=t.n(s),o=t(89),r=t(1535);const a={id:i().string,dataUrl:i().string,operations:i().array,itemActions:i().object,columns:i().array,data:i().shape({data:i().array,state:i().object,pager:i().object,locale:i().object,additional:i().object,pathbar:i().any}),searchFilters:i().object,searchOveral:i().string,disabledSelectHint:i().string,isDisabledItem:i().func,onRedraw:i().func,emptyViewMode:i().oneOf(["all","items"]),emptyView:i().any},l={id:void 0,dataUrl:void 0,operations:void 0,itemActions:void 0,columns:void 0,data:void 0,searchFilters:void 0,searchOveral:void 0,disabledSelectHint:void 0,isDisabledItem:void 0,onRedraw:void 0,emptyViewMode:void 0,emptyView:void 0},c=(0,r.default)(o.List,{propsList:Object.keys(a),defaultProps:l});c.displayName="JswList",c.propTypes=a;const d=c},1535:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>o});var s=t(285),i=t(89);const o=(e,{propsList:n=[],setters:t={},defaultProps:o={}})=>r=>{const a=(0,s.useRef)(),l=(0,s.useRef)(),[c,d]=Object.entries({...o,...r}).reduce(((e,[t,s])=>(e[n.includes(t)?0:1][t]=s,e)),[{},{}]),m=n.map((e=>{const n=c[e];return t[e]?(l.current?.[t[e]](n),null):n}));return(0,s.useLayoutEffect)((()=>(l.current=new e(c),(0,i.render)(a.current,l.current),()=>{l.current.remove(),l.current=null})),[d.key,...m]),(0,s.jsx)("div",{ref:a,...d})}},1649:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>p});var s=t(285),i=t(596),o=t.n(i),r=t(89),a=t(646),l=t(1645),c=t(1534);const d=r.Locale.getSection("admin.components.lists.customers"),m=r.Locale.getSection("admin.components.lists.subscriptions"),u=({data:e,searchFilters:n,allowCreateCustomer:i=!1,resellersSupport:o=!1,isAdmin:u=!1,hasResellers:p=!1,hasResellerCustomers:b=!1,showOwnerName:g=!1,maxSubscriptionsDisplayed:h,dataUrl:x,createUrl:f,redirectUrl:j})=>{const S=(0,a.useNavigateCallback)(),v=(0,s.useMemo)((()=>[i?{componentType:r.SmallButton,id:"buttonAddNewCustomer",title:d.lmsg("buttonAddNewCustomer"),description:d.lmsg("hintAddNewCustomer"),addCls:"sb-add-new-customer btn-primary",href:f,handler:S}:null,i&&u&&o?{componentType:r.bar.Separator}:null,i&&u&&o?{componentType:r.SmallButton,id:"buttonConvertCustomersToReseller",title:d.lmsg("buttonConvertCustomersToReseller"),description:d.lmsg("hintConvertCustomersToReseller"),addCls:"sb-convert-to-reseller",handler:e=>{const n=(0,r.getComponent)("customers-list");n.checkNonEmptySelection()&&(Plesk.require("app/convert-customers-to-resellers",(e=>{new e({id:"convertCustomersToResellers",cls:"popup-panel",prepareUrl:(0,r.prepareUrl)("/customer/prepare-convert/"),handlerUrl:(0,r.prepareUrl)(`/customer/convert-to-reseller/?redirect=${j}`),ids:n.getSelectedItemsIds()})})),e.preventDefault(),e.stopPropagation())}}:null,i&&u&&p&&(o||b)?{componentType:r.bar.Separator}:null,i&&u&&p&&(o||b)?{componentType:r.SmallButton,id:"buttonChangeOwner",title:d.lmsg("buttonChangeOwner"),description:d.lmsg("hintChangeOwner"),addCls:"sb-move",handler:e=>{const n=(0,r.getComponent)("customers-list");n.checkNonEmptySelection()&&(Plesk.require("app/change-customers-owner",(e=>{new e({id:"changeOwner",cls:"popup-panel",prepareUrl:(0,r.prepareUrl)("/customer/prepare-change-owner/"),handlerUrl:(0,r.prepareUrl)(`/customer/change-owner/?redirect=${j}`),ids:n.getSelectedItemsIds()})})),e.preventDefault(),e.stopPropagation())}}:null,i?{componentType:r.bar.Separator}:null,{componentType:r.list.AdditionalActions,description:d.lmsg("hintChangeStatus"),title:d.lmsg("buttonChangeStatus"),operations:[{componentType:r.SmallButton,id:"buttonSuspendCustomers",title:d.lmsg("buttonSuspendCustomers"),description:d.lmsg("hintSuspendCustomers"),addCls:"sb-suspend",cls:"sb-btn",handler:()=>{(0,r.getComponent)("customers-list").execGroupOperation({url:`/customer/suspend/?redirect=${j}`,skipConfirmation:!0})}},{componentType:r.SmallButton,id:"buttonActivateCustomers",title:d.lmsg("buttonActivateCustomers"),description:d.lmsg("hintActivateCustomers"),addCls:"sb-activate",cls:"sb-btn",handler:()=>{(0,r.getComponent)("customers-list").execGroupOperation({url:`/customer/activate/?redirect=${j}`,skipConfirmation:!0})}}]},i?{componentType:r.bar.Separator}:null,i?{componentType:r.SmallButton,id:"buttonRemoveUser",title:d.lmsg("buttonRemoveCustomer"),description:d.lmsg("hintRemoveCustomer"),addCls:"sb-remove-selected",handler:e=>{const n=(0,r.getComponent)("customers-list"),t=n.getSelectedItems();n.execGroupOperation({url:`/customer/delete/?redirect=${j}`,subtype:r.messageBox.SUBTYPE_DELETE,mouseEvent:e,text:d.formatMessage("confirmOnDelete",{name:`<b>${(0,r.escapeHtml)(t[0]?.customerName)}</b>`,count:t.length}),toJsonPayload:!0,submitHandler:async(e,n)=>{const{task:t}=await r.api.post((0,r.prepareUrl)("/customer/delete-async/"),{ids:n.ids});t&&"Jsw.Task.ProgressBar.Item"===t.componentType&&(0,r.getComponent)("asyncProgressBarWrapper").progressDialog(t)}})}}:null]),[i,f,b,p,u,S,j,o]),y=(0,s.useMemo)((()=>[r.list.COLUMN_SELECTION,{header:d.lmsg("customerName"),sortable:!0,dataIndex:"customerName",renderer:({id:e,active:n,status:s,customerName:i,companyName:o,description:a})=>{let c="ok",m=t(1650),u=d.lmsg("statusOk");return n||(c="suspended",m=t(1651),u="1"===s?d.lmsg("statusInactive"):d.lmsg("statusSuspended")),(0,r.createElement)("div.b-indent",(0,r.createElement)("span.b-indent-icon",(0,r.createElement)("span.tooltipData",(0,r.escapeHtml)(u)),(0,r.createElement)("img",{src:m,alt:c,title:""}))," ",(0,r.createElement)("a",{href:`/admin/customer/overview/id/${e}`,onclick:S},(0,r.escapeHtml)(i)),o?.length?`, ${(0,r.escapeHtml)(o)}`:null,a?.length?(0,l.createDescription)(".minor",a):null)}},{header:d.lmsg("subscription"),sortable:!1,dataIndex:"subscriptions",renderer:e=>{const n=e.subscriptions.slice(0,h).map((({domainDisplayName:e,planName:n,domainId:t,subscriptionOveruse:s})=>`<div class="owned-subscription ${s?"status-overused":"status-ok"}">${(0,r.escapeHtml)(e)} (${(0,r.escapeHtml)(n)}) <span class="hint hint-info" id="hint-item-${t}"><span>${d.lmsg("hintInfo")}</span></span></div>`)).join("");return h<e.subscriptions.length?`${n}<div class="owned-subscription status-ok">...</div>`:n}},{header:d.lmsg("setupDate"),sortable:!0,dataIndex:"setupDateTimestamp",renderer:({setupDateString:e})=>(0,r.escapeHtml)(e)},g&&{header:d.lmsg("ownerName"),sortable:!0,dataIndex:"ownerName",renderer:({ownerType:e,ownerId:n,ownerName:t,ownerCompanyName:s})=>{let i=null;return"client"===e?i=`/admin/customer/overview/id/${n}`:"reseller"===e&&o&&(i=`/admin/reseller/overview/id/${n}`),[i?(0,r.createElement)("a",{href:i,onclick:S},(0,r.escapeHtml)(t)):(0,r.escapeHtml)(t),s?`, ${(0,r.escapeHtml)(s)}`:null]}},{header:"",sortable:!1,renderer:({id:e,allowLogin:n})=>n?(0,r.createElement)("a.s-btn.sb-login",{href:`/admin/customer/login/id/${e}/all/true`},(0,r.createElement)("span",d.lmsg("buttonLogin"))):""}]),[h,S,o,g]),C=(0,s.useCallback)((()=>{document.querySelectorAll("span.hint.hint-info").forEach((e=>{new r.DynamicPopupHint.Instance({title:m.lmsg("hintTitle"),waitMsg:m.lmsg("hintWaitMessage"),url:`/subscription/stats-hint/domainId/${e.id.replace("hint-item-","")}`,placement:"right",target:e.id})}))}),[]);return(0,s.jsx)(c.default,{data:e,dataUrl:x,searchFilters:n,id:"customers-list",searchOveral:"name",disabledSelectHint:d.lmsg("disabledSelectHint"),operations:v,columns:y,onRedraw:C})};u.propTypes={data:c.default.propTypes.data.isRequired,searchFilters:c.default.propTypes.searchFilters.isRequired,allowCreateCustomer:o().bool,resellersSupport:o().bool,isAdmin:o().bool,hasResellers:o().bool,hasResellerCustomers:o().bool,showOwnerName:o().bool,maxSubscriptionsDisplayed:o().number.isRequired,dataUrl:o().string.isRequired,createUrl:o().string.isRequired,redirectUrl:o().string.isRequired};const p=u},1646:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>c});var s=t(89),i=t(1647),o=t(603),r=t(1649),a=t(285);const l=s.Locale.getTranslate("components.pages.customers"),c=(0,o.withPageLayout)((e=>{const[n]=(0,i.useCreateCustomerFormInDrawer)("/admin/customer/list","/admin/customer/create");return(0,a.jsxs)(a.Fragment,{children:[n,(0,a.jsx)("p",{children:(0,a.jsx)(l,{content:"hint"})}),(0,a.jsx)(r.default,{dataUrl:"/admin/customer/list-data",createUrl:"/admin/customer/create",redirectUrl:"/admin/customer/list",...e})]})}))},1645:(e,n,t)=>{"use strict";t.r(n),t.d(n,{createDescription:()=>o,createSiteDescription:()=>r,truncate:()=>i});var s=t(89);const i=(e,n=50)=>e.length<n?e:`${e.slice(0,n-3)}...`,o=(e,n,t)=>(0,s.createElement)(e,[(t?`${t}: `:"")+(0,s.escapeHtml)(i(n,50)),(0,s.createElement)("span.tooltipData",(0,s.escapeHtml)(n))]),r=({adminDescription:e,resellerDescription:n,ownerDescription:t,hideResellerTitleDescription:s,hideOwnerTitleDescription:i},r,a="hint")=>[e?o(`.${a}`,e):"",n?o(`.${a}`,n,!s&&r.lmsg("resellerDescription")):"",t?o(`.${a}`,t,!i&&r.lmsg("ownerDescription")):""]},1637:(e,n,t)=>{"use strict";t.r(n),t.d(n,{generateUserName:()=>o,randomString:()=>s});const s=()=>Math.random().toString(36).slice(2),i=()=>`_${s()}`,o=({domainName:e,maxUserNameSize:n,isTechDomain:t,isWindows:s,postfix:o=i()})=>{let r=e;const a=!s,l=!/^[a-zA-Z0-9_.\-]+$/.test(e),c=/^[0-9]+/.test(e);if("string"!=typeof e||"string"!=typeof o)return"";if(l)return"";if(a&&c)return"";if("number"!=typeof n&&void 0!==n)return"";if(n){if(o.length>n)return"";n-=o.length}return t&&(r=r.split(".")[0]),r=r.toLowerCase().substr(0,n)+o,s&&(r=r.replace(/\.+$/,"")),r}},1650:e=>{e.exports=Jsw.skinUrl+"/icons/16/plesk/subscription-status-ok.png?6d52f91c87cbdc73b4ef0b5ded92c441"},1651:e=>{e.exports=Jsw.skinUrl+"/icons/16/plesk/subscription-status-suspended.png?7968ea094f0aa3fdced5d59b0c7f3196"}}]); //# sourceMappingURL=list.js.map?bb3fe542162da9c16d09