(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/smb/web/setup"],{763:(e,t,n)=>{"use strict";n.r(t),n.d(t,{useAddDomainFormInDrawer:()=>q});var a=n(153),o=n.n(a),l=n(154),i=n(261),r=n.n(i),s=n(302),m=n(405),c=n(556),d=n(144),u=n(155),p=n(764),g=n(720),b=n(765),E=n(576),f=n(767),h=n(768),w=n(770);const v=s.gql`
    query GetWebspaceIpAddress($id: ID!) {
        domain: node(id: $id) {
            ... on Domain {
                ipAddresses {
                    ipAddress(publicIp: true)
                }
            }
        }
    }
`,k=d.Locale.getSection("smb.components.forms.web.add-domain"),C=d.Locale.getTranslate("smb.components.forms.web.add-domain"),S=d.Locale.getTranslate("smb.components.forms.domain-info-section"),T=d.Locale.getTranslate("components.forms.ip-addresses-selector"),y=d.Locale.getTranslate("smb.components.forms.web._shared"),N=d.Locale.getTranslate("smb.components.forms.web.seo-settings"),F=d.Locale.getTranslate("admin.components.forms.admin-panel.form.contact-info"),D=d.Locale.getTranslate("components.buttons"),I=({id:e,showDomainRegistrationPromo:t,ipAddresses:n,allowCustomerCreation:a,allowWebspaceCreation:i,subscriptionsLookUpParams:r,canManageMailSettings:s,maxSysnameSize:h,isWindows:I,techDomain:q,settingsEnabled:P,settingsCollapsed:R,applicationWizardConfig:x,embeddedForms:A,applicationWizardEmbeddedForms:L,cancelLink:H,className:B,render:O,onProcess:U,...V})=>{var z;const _=(0,m.useApolloClient)(),W=(0,c.useHistory)(),[$,j]=(0,l.useState)(V.values),[M,J]=(0,l.useState)(Boolean(V.values.hostingSettings.root)),[Y,G]=(0,l.useState)(!V.values.domainInfo),[Z,K]=(0,l.useState)(V.webspaceIpAddress);(0,l.useEffect)((()=>{if(M)return;let e=/^[a-zA-Z0-9\.\-\*]+$/.match($.domainName.name)?$.domainName.name.replace(/\*/g,"_"):"";-1!==$.hostingSettings.rootPattern.indexOf("<domain>")&&(e=$.hostingSettings.rootPattern.replace("<domain>",e)),j((0,u.setIn)($,"hostingSettings[root]",e))}),[$.domainName.name]),(0,l.useEffect)((()=>{$.domainName.webspace&&"new"!==$.domainName.webspace.id&&_.query({query:v,variables:{id:btoa(`Domain:${$.domainName.webspace.id}`)}}).then((({data:{domain:{ipAddresses:e}}})=>{K(e[0].ipAddress)}))}),[$.domainName.webspace]);const Q=(e,t)=>{switch(j((n=>{if(n=(0,u.setIn)(n,e,t),"domainName[name]"===e&&!Y){let e=/^[a-zA-Z0-9_.\-]+$/.match(t)?n.domainName.type===p.TYPE_TECH?t.split(".")[0]:t:"";e=e.toLowerCase().substr(0,h),I&&"."===e.substr(-1)&&(e=e.substr(0,e.length-1)),n=(0,u.setIn)(n,"domainInfo[userName]",e||V.values.domainInfo.userName)}return n})),["domainInfo[ipSelector][ipv4]","domainInfo[ipSelector][ipv6]","domainInfo[userName]","domainInfo[password]"].includes(e)&&d.UAT.dispatchAction("CUSTOM-VALUE",{name:e}),e){case"hostingSettings[root]":J(!0);break;case"domainInfo[userName]":G(!0)}},X="1"===$.domainName.assignToCustomer||void 0!==$.domainName.targetWebspace||void 0!==$.domainName.webspace&&(null===$.domainName.webspace||"new"===$.domainName.webspace.id),ee=X||!Z?Object.keys(n).map((e=>{const t=$.domainInfo.ipSelector[e];return"none"===t?null:n[e][t].split(" ")[0]})).filter(Boolean)[0]:Z,te=x.enabled?w.default:g.default;return(0,l.createElement)(te,{vertical:!0,id:e,className:B,render:O,values:$,onFieldChange:Q,onSubmit:e=>(e.domainName.customer&&(e=(0,u.setIn)(e,"domainName[customer]",e.domainName.customer.id)),e.domainName.webspace&&(e=(0,u.setIn)(e,"domainName[webspace]",e.domainName.webspace.id)),e),onLongTask:U,embeddedForms:A,wizardConfig:x,wizardEmbeddedForms:L,submitButton:{id:"btn-send",children:(0,l.createElement)(C,{content:"buttonAddDomain"})},applyButton:!1,cancelButton:!!H&&{id:"btn-cancel",children:(0,l.createElement)(D,{content:"cancel"}),onClick:()=>{W.push(H)}}},t?(0,l.createElement)(E.default,null,(()=>new Jsw.Panel({cls:"tools-box",items:[{componentType:"Jsw.Hint",hint:k.lmsg("formRegistrationHint",{link:`<a href="${(0,d.prepareUrl)("/mpc/register-domains")}" target="_blank">${k.lmsg("portalLink")}</a>`})}]}))):null,(0,l.createElement)(p.default,o()({isEnabled:void 0!==$.domainName.type,isDefault:$.domainName.type===p.TYPE_TECH,typeName:"domainName[type]",name:"domainName[name]",ipAddress:ee,onTypeChange:e=>Q("domainName[type]",e),onDomainNameChange:e=>Q("domainName[name]",e)},q)),void 0===$.domainName.assignToCustomer?null:(0,l.createElement)(u.Section,null,(0,l.createElement)(u.FormFieldCheckbox,{name:"domainName[assignToCustomer]",label:(0,l.createElement)(C,{content:"assignToCustomer"}),checkedValue:"1",uncheckedValue:"0"}),"1"===$.domainName.assignToCustomer?(0,l.createElement)(u.Section,{collapsible:!0},void 0===$.domainName.customer?null:(0,l.createElement)(b.default,{name:"domainName[customer]",label:(0,l.createElement)(C,{content:"customer"}),dataUrl:"/admin/customer/look-up",newItemValue:a?{id:"new",title:k.lmsg("createNewCustomer")}:null,locale:{label:k.lmsg("selectExistingCustomer")},required:!0}),void 0===$.domainName.customer||"new"===(null===(z=$.domainName.customer)||void 0===z?void 0:z.id)?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(u.FormFieldText,{name:"customerInfo[customerContactInfo][contactName]",label:(0,l.createElement)(F,{content:"contactName"}),required:!0}),(0,l.createElement)(u.FormFieldText,{name:"customerInfo[customerContactInfo][email]",label:(0,l.createElement)(F,{content:"email"}),required:!0}),(0,l.createElement)("br",null),(0,l.createElement)(u.Heading,{level:"4"},(0,l.createElement)(C,{content:"customerLoginInfoHint"})),(0,l.createElement)(f.default,{prefix:"customerInfo[customerLoginInfo]"})):null):null),void 0===$.domainName.webspace||"1"===$.domainName.assignToCustomer?null:(0,l.createElement)(u.Section,null,(0,l.createElement)(b.default,{name:"domainName[webspace]",label:(0,l.createElement)(C,{content:"target"}),dataUrl:"/smb/web/subscription-look-up",newItemValue:i?{id:"new",title:k.lmsg("createNewTarget")}:null,locale:{label:k.lmsg("selectExistingTarget")},lookUpParams:r,required:!0})),X?P?(0,l.createElement)(u.Section,{id:"domainInfo",title:(0,l.createElement)(C,{content:"webspaceLegend"}),collapsible:!0,collapsed:R},Object.keys(n).map((e=>(0,l.createElement)(u.FormFieldSelect,{key:e,name:`domainInfo[ipSelector][${e}]`,label:(0,l.createElement)(T,{content:Object.keys(n).length>1?`${e}Address`:"ipAddress"}),required:!0},Object.keys(n[e]).map((t=>(0,l.createElement)(u.SelectOption,{key:t,value:t},n[e][t])))))),(0,l.createElement)("br",null),(0,l.createElement)(u.Heading,{level:"4"},(0,l.createElement)(C,{content:"credentials"})),(0,l.createElement)(u.Text,{component:"p",intent:"muted"},(0,l.createElement)(C,{content:"credentialsHint"})),(0,l.createElement)(u.FormFieldText,{name:"domainInfo[userName]",label:(0,l.createElement)(S,{content:"userName"}),required:!0}),(0,l.createElement)(u.FormFieldPassword,{name:"domainInfo[password]",label:(0,l.createElement)(S,{content:"password"}),required:!0})):null:(0,l.createElement)(u.Section,null,(0,l.createElement)(u.FormFieldSelect,{name:"hostingType[hosting]",label:(0,l.createElement)(C,{content:"hostingManagementOptions"})},(0,l.createElement)(u.SelectOption,{value:"hosting",label:"hosting"},(0,l.createElement)(C,{content:"websiteHosting"})),(0,l.createElement)(u.SelectOption,{value:"forwarding",label:"forwarding"},(0,l.createElement)(C,{content:"websiteForwarding"})),(0,l.createElement)(u.SelectOption,{value:"none",label:"none"},(0,l.createElement)(C,{content:"websiteNoHosting"}))),void 0===$.dnsSettings?null:(0,l.createElement)(u.FormFieldCheckbox,{name:"dnsSettings[dns]",label:(0,l.createElement)(C,{content:"dns"}),description:(0,l.createElement)(C,{content:"dnsHint"}),disabled:$.domainName.type===p.TYPE_TECH,checkedValue:"master",uncheckedValue:"none"}),void 0===$.mailSettings?null:(0,l.createElement)(u.FormFieldCheckbox,{name:"mailSettings[mail]",label:(0,l.createElement)(C,{content:"mail"}),description:s?(0,l.createElement)(C,{content:"mailHint"}):(0,l.createElement)(C,{content:"mailHintNoPermission"}),disabled:$.domainName.type===p.TYPE_TECH,checkedValue:"1",uncheckedValue:"0"}),"hosting"===$.hostingType.hosting?(0,l.createElement)(u.Section,{id:"hostingSettings",title:(0,l.createElement)(C,{content:"hostingSettingsSectionLegend"}),collapsible:!0,collapsed:!0},(0,l.createElement)(u.FormField,{name:"hostingSettings[root]",label:(0,l.createElement)(y,{content:"documentRoot"}),description:(0,l.createElement)(y,{content:"documentRootHint"}),required:!0},(({getId:e,getName:t,getValue:n,setValue:a})=>(0,l.createElement)(l.Fragment,null,(0,l.createElement)(u.Icon,{name:"home"})," / ",(0,l.createElement)(u.Input,{id:e(),name:t(),value:n(),onChange:({target:e})=>a(e.value)})))),(0,l.createElement)(u.FormFieldRadioButtons,{name:"hostingSettings[seoRedirectDirection]",label:(0,l.createElement)(N,{content:"seoRedirectDirection"}),description:(0,l.createElement)(N,{content:"seoRedirectDirectionHint"}),required:!0,options:[{value:"www",label:`www.${$.domainName.name||"<your_domain>"}`},{value:"non-www",label:$.domainName.name||"<your_domain>"},{value:"none",label:(0,l.createElement)(N,{content:"seoRedirectDirectionNone"})}]})):null,"forwarding"===$.hostingType.hosting?(0,l.createElement)(u.Section,{id:"forwardingSettings",title:(0,l.createElement)(y,{content:"forwardingSettingsSectionLegend"}),collapsible:!0,collapsed:!0},(0,l.createElement)(u.FormFieldText,{name:"forwardingSettings[forwardTo]",label:(0,l.createElement)(y,{content:"forwardDestination"}),description:(0,l.createElement)(y,{content:"forwardDestinationHint"}),required:!0}),(0,l.createElement)(u.FormFieldRadioButtons,{name:"forwardingSettings[forwardingType]",label:(0,l.createElement)(y,{content:"forwardingTypeOptions"}),options:[{value:"std_fwd301",label:(0,l.createElement)(y,{content:"forwardingHttpCode301"}),description:(0,l.createElement)(y,{content:"forwardingHttpCode301Hint"})},{value:"std_fwd302",label:(0,l.createElement)(y,{content:"forwardingHttpCode302"}),description:(0,l.createElement)(y,{content:"forwardingHttpCode302Hint"})},{value:"frm_fwd",label:(0,l.createElement)(y,{content:"forwardingFrame"}),description:(0,l.createElement)(y,{content:"forwardingFrameHint"})}]})):null))};I.propTypes={id:r().string.isRequired,showDomainRegistrationPromo:r().bool,values:r().object.isRequired,ipAddresses:r().shape({ipv4:r().object,ipv6:r().object}).isRequired,allowCustomerCreation:r().bool,allowWebspaceCreation:r().bool,subscriptionsLookUpParams:r().object,webspaceIpAddress:r().string,canManageMailSettings:r().bool,maxSysnameSize:r().number.isRequired,isWindows:r().bool.isRequired,techDomain:r().object.isRequired,settingsEnabled:r().bool,settingsCollapsed:r().bool,applicationWizardConfig:r().object,cancelLink:r().string,embeddedForms:r().array,applicationWizardEmbeddedForms:r().array,className:r().string,render:r().func,onProcess:r().func},I.defaultProps={showDomainRegistrationPromo:!1,allowCustomerCreation:!1,allowWebspaceCreation:!1,subscriptionsLookUpParams:null,webspaceIpAddress:null,canManageMailSettings:!1,settingsEnabled:!1,settingsCollapsed:!1,applicationWizardConfig:{},cancelLink:null,embeddedForms:void 0,applicationWizardEmbeddedForms:void 0,className:void 0,render:void 0,onProcess:void 0};const q=(e,t)=>(0,h.default)(I,"add-domain",e,t);t.default=I},770:(e,t,n)=>{"use strict";n.r(t);var a=n(153),o=n.n(a),l=n(154),i=n(261),r=n.n(i),s=n(144),m=n(771),c=n(772);const d=s.Locale.getTranslate("components.domain-applications.applications"),u=({onFieldChange:e,formPrefix:t,wizardConfig:a,embeddedForms:i,wizardEmbeddedForms:r,values:s,children:u,...p})=>{const[g,b]=(0,l.useState)([]),E=t=>{e("applicationName",t),b([...r.filter((({ext:e,name:n})=>t===`ext-${e}-${n}`)).filter((({content:e})=>Boolean(e))).map((({ext:e,name:t,...n})=>({key:`ext-${e}-${t}`,children:"",embeddedForms:[{name:t,...n}]})))])},f=[a.blankSite&&{name:"blank-site",icon:n(773),title:(0,l.createElement)(d,{content:"blank-site.title"}),description:(0,l.createElement)(d,{content:"blank-site.description"})},a.uploadFiles&&{name:"upload-files",icon:n(774),title:(0,l.createElement)(d,{content:"upload-files.title"}),description:(0,l.createElement)(d,{content:"upload-files.description"})},...r.map((({ext:e,name:t,title:n,icon:a,description:o})=>({name:`ext-${e}-${t}`,icon:a,title:n,description:o})))].filter(Boolean),h=[f.length>1&&{key:"chooseApplicationStep",children:(0,l.createElement)(m.default,{onApplicationSelect:E,applicationsList:f}),nextButton:!1},{key:"addDomainStep",formPrefix:t,children:u,embeddedForms:i}].filter(Boolean);return(0,l.useEffect)((()=>{if(0===f.length&&E("blank-site"),1===f.length){const[{name:e}]=f;E(e)}}),[]),(0,l.createElement)(c.default,o()({},p,{values:s,onFieldChange:e,onStepChange:(t,n)=>0===n&&h.length>1?(e("applicationName",null),b([]),t):n,step:s.applicationName&&1!==h.length?1:0,steps:[...h,...g]}))};u.propTypes={values:r().object.isRequired,onFieldChange:r().func.isRequired,children:r().node,formPrefix:r().string,wizardConfig:r().shape({enabled:r().bool,blankSite:r().bool,uploadFiles:r().bool}),embeddedForms:r().array,wizardEmbeddedForms:r().array},u.defaultProps={children:null,formPrefix:"",wizardConfig:{enabled:!0,blankSite:!0,uploadFiles:!0},embeddedForms:[],wizardEmbeddedForms:[]},t.default=u},771:(e,t,n)=>{"use strict";n.r(t);var a=n(154),o=n(155),l=n(261),i=n.n(l);const r=n(144).Locale.getTranslate("components.domain-applications"),s=({onApplicationSelect:e,applicationsList:t})=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.Heading,{level:"3"},(0,a.createElement)(r,{content:"title"})),(0,a.createElement)(o.ItemList,{minColumnWidth:220,gap:"xs",selectable:!0},t.map((({name:t,icon:n,title:l,description:i})=>(0,a.createElement)(o.Item,{"data-action":t,key:t,icon:(0,a.createElement)(o.Icon,{src:n,intent:"info",size:"64"}),title:(0,a.createElement)(o.Heading,{level:"4"},l),onClick:()=>e(t)},(0,a.createElement)(o.Paragraph,null,i))))));s.propTypes={onApplicationSelect:i().func,applicationsList:i().arrayOf(i().shape({name:i().string.isRequired,icon:i().string.isRequired,title:i().node,description:i().node}))},s.defaultProps={onApplicationSelect:null,applicationsList:[]},t.default=s},769:(e,t,n)=>{"use strict";n.r(t);var a=n(153),o=n.n(a),l=n(154),i=n(155),r=n(144),s=n(261),m=n.n(s),c=n(615),d=n(635);const u="running",p=()=>(0,r.getComponent)("asyncProgressBarWrapper"),g=({children:e,dataType:t,isOpen:n,onClose:a,task:s,...m})=>{const[g,b]=(0,l.useState)([]),[E,f]=(0,l.useState)(null),[h,w]=(0,l.useState)(null),[v,k]=(0,l.useState)(null),C=s?s.id:null,{addToast:S}=(0,d.useToaster)(),T=({id:e,steps:t,status:a,errors:o,output:i,progressValue:s,progressTitle:m,progressTitleHtml:c})=>{if(!n||C!==e)return;const d=c||m,p=r.Task.STATUS_STARTED===a?u:a,g=e=>(e||[]).map((e=>(0,l.createElement)("div",{key:e},e)));k(p),t&&t.length?(f(d),b(t.map((({errors:e,...t})=>({children:g(e),...t}))))):b([{title:d,status:p,progress:Number(s),children:(0,l.createElement)(l.Fragment,null,g(o),g(i))}])};(0,l.useEffect)((()=>{const e=p();n?(null==e||e.hide(),b([]),f(null),w(null),k(null)):(async()=>{y()||await N(),null==e||e.show()})()}),[n]),(0,l.useEffect)((()=>{var e;C&&(null===(e=p())||void 0===e||e.update(),T(s))}),[C,s]),(0,c.default)("plesk:taskStepUpdate",T,r.Observer),(0,c.default)("plesk:taskComplete",(({id:e,redirect:t,status:a})=>{n&&C===e&&r.Task.STATUS_DONE===a&&w(t)}),r.Observer);const y=()=>r.Task.STATUS_NOT_STARTED===v||u===v,N=()=>{var e,t;return C&&(null===(e=p())||void 0===e||null===(t=e.getItems().find((e=>e.getId()===C)))||void 0===t?void 0:t.remove())};return(0,l.createElement)(i.Drawer,o()({"data-type":t,isOpen:n,onClose:()=>{h?(0,r.redirect)(h):a()},progress:g.length?{cancelable:!1,title:E,steps:g,onFinish:()=>{N(),S({intent:"success",message:E||g[0].title})}}:null,hideButton:y()},m),e)};g.propTypes={children:m().node,dataType:m().string.isRequired,isOpen:m().bool,onClose:m().func.isRequired,task:m().shape({id:m().string.isRequired,steps:m().array,status:m().string,progressTitle:m().string,progressTitleHtml:m().string})},g.defaultProps={children:null,isOpen:!1,task:null},t.default=g},765:(e,t,n)=>{"use strict";n.r(t);var a=n(154),o=n(261),l=n.n(o),i=n(155),r=n(766);const s=n(144).Locale.getSection("components.elements.lookup"),m=({data:e,dataUrl:t,lookUpParams:n,newItemValue:o,locale:l,placeholder:m,...c})=>(0,a.createElement)(i.FormField,c,(({getId:i,getName:c,getValue:d,setValue:u,isDisabled:p})=>(0,a.createElement)(r.default,{id:i(),name:c(),value:d(),onChange:e=>u(e),data:e,dataUrl:t,lookUpParams:n,newItemValue:o,locale:{...s.messages,...l},disabled:p(),placeholder:m})));m.propTypes={locale:l().object,data:l().array,dataUrl:l().string,lookUpParams:l().object,newItemValue:l().object,placeholder:l().string},m.defaultProps={locale:void 0,data:void 0,dataUrl:void 0,lookUpParams:void 0,newItemValue:void 0,placeholder:void 0},t.default=m},766:(e,t,n)=>{"use strict";n.r(t);var a=n(154),o=n(144),l=n(576);t.default=e=>{const[t,n]=(0,a.useState)(null);return(0,a.useEffect)((()=>{const t=new o.LookUp(e);return n(t),()=>{t.remove(),n(null)}}),[]),t?(0,a.createElement)(l.default,null,t):null}},772:(e,t,n)=>{"use strict";n.r(t);var a=n(153),o=n.n(a),l=n(155),i=n(154),r=n(720),s=n(144),m=n(261),c=n.n(m);const d=s.Locale.getTranslate("components.buttons"),u=({step:e,steps:t,onStepChange:n,onSubmit:a,submitButton:s,cancelButton:m,...c})=>{const u=(0,i.useRef)(),[p,g]=(0,i.useState)(0),b=p+e,{children:E,formPrefix:f,embeddedForms:h,backButton:w,nextButton:v}={backButton:{},nextButton:{},...t[b]},k=b===t.length-1,C=0===b,S=()=>{u.current.handleEmbeddedFormValues(),g((t=>n(t+e,t+e+1)-e))};return(0,i.createElement)(r.default,o()({},c,{ref:u,additionalButtons:[C&&m&&(0,i.createElement)(l.Button,o()({key:"cancel",children:(0,i.createElement)(d,{content:"cancel"})},m)),!C&&w&&(0,i.createElement)(l.Button,o()({key:"back",arrow:"backward",onClick:()=>{u.current.handleEmbeddedFormValues(),g((t=>n(t+e,t+e-1)-e))},children:(0,i.createElement)(d,{content:"back"})},w)),!k&&v&&(0,i.createElement)(l.Button,o()({key:"next",intent:"primary",onClick:S,arrow:"forward",children:(0,i.createElement)(d,{content:"nextWithoutArrow"})},v)),k&&s&&(0,i.createElement)(l.Button,o()({key:"submit",intent:"primary",arrow:"forward",onClick:()=>u.current.submit(),children:(0,i.createElement)(d,{content:"ok"})},s))],onSubmit:k?a:S,onError:a=>{const o=t.findIndex((({formPrefix:e})=>""===e)),l=Object.keys(a).map((e=>{const n=t.findIndex((({formPrefix:t,embeddedForms:n=[]})=>t===e||n.any((({name:t})=>t===e))));return n>=0?n:o}));g(n(b,l.length>0?Math.min(...l):e)-e)},applyButton:!1,submitButton:!1,cancelButton:!1,formPrefix:f,embeddedForms:h}),E)};u.propTypes={step:c().number,steps:c().arrayOf(c().shape({formPrefix:c().string,embeddedForms:c().array,children:c().node,nextButton:c().bool,backButton:c().bool})),onStepChange:c().func,onSubmit:c().func,submitButton:c().object,cancelButton:c().object},u.defaultProps={step:0,steps:[],onStepChange:(e,t)=>t,onSubmit:void 0,submitButton:{},cancelButton:{}},t.default=u},767:(e,t,n)=>{"use strict";n.r(t);var a=n(154),o=n(155),l=n(144),i=n(261),r=n.n(i);const s=l.Locale.getTranslate("admin.components.forms.admin-panel.form.login-info"),m=({prefix:e})=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(o.FormFieldText,{name:"".concat(e,"[userName]"),label:(0,a.createElement)(s,{content:"userName"}),required:!0,autoComplete:"off"}),(0,a.createElement)(o.FormFieldPassword,{name:"".concat(e,"[password]"),label:(0,a.createElement)(s,{content:"password"}),required:!0,autoComplete:"off"}),(0,a.createElement)(o.FormFieldCheckbox,{name:"".concat(e,"[isActivationRequired]"),label:(0,a.createElement)(s,{content:"emailActivation"}),description:(0,a.createElement)(s,{content:"emailActivationHint"}),checkedValue:"1",uncheckedValue:"0"}));m.propTypes={prefix:r().string.isRequired},t.default=m},764:(e,t,n)=>{"use strict";n.r(t),n.d(t,{TYPE_TECH:()=>c,TYPE_CUSTOM:()=>d});var a=n(153),o=n.n(a),l=n(155),i=n(154),r=n(261),s=n.n(r),m=n(144);const c="tech",d="custom",u=m.Locale.getTranslate("components.forms.domain.tech-domain-name"),p=({isEnabled:e,isDefault:t,url:n,vendor:a,typeName:o,name:r,ipAddress:s,onDomainNameChange:m,onTypeChange:p})=>{const[E,f]=(0,i.useState)(e&&t?c:d);if(!e)return(0,i.createElement)(g,{name:r,isEnabled:!1,onDomainNameChange:m});const h=[{key:d,icon:(0,i.createElement)(l.Icon,{name:"ribbon",intent:"success"})},{key:c,icon:(0,i.createElement)(l.Icon,{name:"rocket",intent:"info"})}];return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(l.Section,{title:(0,i.createElement)(u,{content:"title"}),vertical:!0},(0,i.createElement)(l.FormField,{name:o,onChange:e=>(e=>{f(e),p(e),m("")})(e)},(({getId:e,getName:t,getValue:n,setValue:a,isDisabled:o})=>(0,i.createElement)(i.Fragment,null,(0,i.createElement)(l.ItemList,{stretchable:!0,selectable:!0,minColumnWidth:270,gap:"sm",value:n(),onSelect:e=>a(e)},h.map((({key:e,icon:t})=>(0,i.createElement)(l.Item,{icon:t,key:e,value:e,"data-action":`use-${e}-domain`,title:(0,i.createElement)(l.Heading,{level:"4"},(0,i.createElement)(l.Paragraph,null,(0,i.createElement)(u,{content:`${e}DomainTitle`}))),disabled:o()},(0,i.createElement)(l.Text,{fontSize:"md"},(0,i.createElement)(u,{content:`${e}DomainText`})))))),(0,i.createElement)("input",{hidden:!0,id:e(),name:t(),value:n(),readOnly:!0}))))),E===c?(0,i.createElement)(b,{name:r,ipAddress:s,url:n,vendor:a,onDomainNameChange:m}):(0,i.createElement)(g,{name:r,isEnabled:!0,onDomainNameChange:m}))},g=({name:e,isEnabled:t,onDomainNameChange:n})=>(0,i.createElement)(l.Section,{vertical:!0},(0,i.createElement)(l.FormField,{name:e,label:t?(0,i.createElement)(u,{content:"customDomain"}):(0,i.createElement)(u,{content:"domainName"}),onChange:e=>n(e),required:!0},(({getId:e,getName:t,getValue:n,setValue:a,isDisabled:o})=>(0,i.createElement)(i.Fragment,null,(0,i.createElement)("span",{dir:"ltr"},"www. ",(0,i.createElement)(l.Input,{id:e(),name:t(),value:n(),placeholder:"domain.name",size:"lg",onChange:e=>a(e.target.value),disabled:o()}))))));g.propTypes={name:s().string.isRequired,isEnabled:s().bool.isRequired,onDomainNameChange:s().func.isRequired};const b=({name:e,onDomainNameChange:t,...n})=>(0,i.createElement)(l.Section,{vertical:!0},(0,i.createElement)(i.Fragment,null,(0,i.createElement)(l.FormField,{label:(0,i.createElement)(u,{content:"techDomain"}),name:e,onChange:e=>t(e)},(({getId:e,getName:t,...a})=>(0,i.createElement)(E,o()({id:e(),name:t()},a,n)))),(0,i.createElement)(l.Cuttable,{maxHeight:24},(0,i.createElement)(l.Paragraph,null,(0,i.createElement)(u,{content:"techDomainDesc"})),(0,i.createElement)("ul",null,(0,i.createElement)("li",null,(0,i.createElement)(u,{content:"techDomainRandom"})),(0,i.createElement)("li",null,(0,i.createElement)(u,{content:"techDomainDns"})),(0,i.createElement)("li",null,(0,i.createElement)(u,{content:"techDomainMail"}))),(0,i.createElement)(l.Paragraph,null,(0,i.createElement)(u,{content:"techDomainSwitch"})))));b.propTypes={name:s().string.isRequired,onDomainNameChange:s().func.isRequired};const E=({id:e,name:t,ipAddress:n,url:a,vendor:o,getValue:r,setValue:s})=>{const[m,c]=(0,i.useState)(!1),[d,p]=(0,i.useState)(n),[g,b]=(0,i.useState)({}),E=(0,i.useCallback)((async()=>{if(b({}),!r()||n!==d)if(n){c(!0);try{const e=await fetch(a,{method:"POST",body:JSON.stringify({ip_address:n,vendor:o})}),{subdomain:t}=await e.json();if(!t)return void b({error:(0,i.createElement)(u,{content:"error"})});s(t),p(n)}catch{b({error:(0,i.createElement)(u,{content:"error"})})}finally{c(!1)}}else b({noIpAddress:(0,i.createElement)(u,{content:"errorNoIpAddress"})})}),[r,s,n,d,a,o]);return(0,i.useEffect)((()=>{E()}),[n]),(0,i.createElement)(i.Fragment,null,m?(0,i.createElement)(l.Status,{progress:!0},(0,i.createElement)(u,{content:"generating"})):(0,i.createElement)(l.Text,{bold:!0},r()),(0,i.createElement)("input",{hidden:!0,id:e,name:t,value:r(),readOnly:!0}),Object.keys(g).map((e=>(0,i.createElement)(l.Alert,{key:e,intent:"danger"},(0,i.createElement)(l.Icon,{name:"exclamation-mark-circle-filled",intent:"danger"})," ",g[e]))))};E.propTypes={id:s().string.isRequired,name:s().string.isRequired,ipAddress:s().string,url:s().string.isRequired,vendor:s().string.isRequired,getValue:s().func.isRequired,setValue:s().func.isRequired},E.defaultProps={ipAddress:null},p.propTypes={isEnabled:s().bool.isRequired,isDefault:s().bool.isRequired,url:s().string.isRequired,vendor:s().string.isRequired,typeName:s().string.isRequired,name:s().string.isRequired,ipAddress:s().string,onDomainNameChange:s().func.isRequired,onTypeChange:s().func.isRequired},p.defaultProps={ipAddress:null},t.default=p},768:(e,t,n)=>{"use strict";n.r(t);var a=n(153),o=n.n(a),l=n(154),i=n(302),r=n(405),s=n(556),m=n(155),c=n(144),d=n(769);const u=i.gql`
    query GetAddDomainData {
        config {
            domainManagement {
                settings {
                    enabled
                    collapsed
                }
                applicationWizard {
                    enabled
                    blankSite
                    uploadFiles
                }
            }
            techDomain {
                url
                vendor
            }
        }
    }
`;t.default=(e,t,n,a)=>{const i=(0,r.useApolloClient)(),p=!!(0,s.useRouteMatch)(a),g=(0,s.useHistory)(),[b,E]=(0,l.useState)(null),[f,h]=(0,l.useState)(null);(0,l.useEffect)((()=>{p&&(E(null),h(null),Promise.all([c.api.get(a),i.query({query:u})]).then((([e,{data:{config:t}}])=>{e.redirect?(0,c.redirect)(e.redirect):E({...e,techDomain:{url:`${t.techDomain.url}/api/subdomain`,vendor:t.techDomain.vendor},settingsEnabled:t.domainManagement.settings.enabled,settingsCollapsed:t.domainManagement.settings.collapsed,applicationWizardConfig:t.domainManagement.applicationWizard})})))}),[p,a,i]);const w=()=>{g.push(n)};return[(0,l.createElement)(d.default,{dataType:t,title:b?b.pageTitle:"",size:"sm",isOpen:p,onClose:w,form:b?(0,l.createElement)(e,o()({onCancel:w,onProcess:h},b)):null,task:f},b?null:(0,l.createElement)(m.ContentLoader,null))]}},894:(e,t,n)=>{"use strict";n.r(t);var a=n(155),o=n(154),l=n(261),i=n.n(l),r=n(144),s=n(582),m=n(602),c=n(647),d=n(763);const u=r.Locale.getTranslate("smb.controllers.web.setup"),p=({addDomainUrl:e,openTutorialUrl:t,baseClassName:l})=>{const[i]=(0,d.useAddDomainFormInDrawer)("/smb/web/setup","/smb/web/add-domain/create-webspace/true");return(0,o.createElement)(o.Fragment,null,i,(0,o.createElement)(a.ListEmptyView,{className:l,title:(0,o.createElement)(u,{content:"noDomainTitle"}),description:(0,o.createElement)(o.Fragment,null,(0,o.createElement)(u,{content:"description"}),(0,o.createElement)("br",null),(0,o.createElement)(u,{content:"openTutorial",params:{link:(0,o.createElement)(s.default,{to:t,target:"_blank",id:"linkOpenTutorial"},(0,o.createElement)(u,{content:"openTutorialLink"}))}})),image:n(895),actions:(0,o.createElement)(a.Button,{component:s.default,to:e,size:"lg",icon:"plus",intent:"primary",id:"buttonAddDomain"},(0,o.createElement)(u,{content:"addDomain"}))}))};p.propTypes={addDomainUrl:i().string.isRequired,openTutorialUrl:i().string.isRequired,baseClassName:i().string},p.defaultProps={baseClassName:"web-setup-panel"},t.default=(0,m.withPageLayout)((0,c.withPageContent)(p))},893:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>a.default});var a=n(894)},895:e=>{e.exports=Jsw.skinUrl+"/images/add-domain.svg?8718d077e71615582cb1f89dad81e476"},773:e=>{e.exports=Jsw.skinUrl+"/images/code.svg?e9fb9feb605b8cf334414f688a603918"},774:e=>{e.exports=Jsw.skinUrl+"/images/upload-files.svg?e6091d3474a27a3eafe63b2d09b1b943"}}]);
//# sourceMappingURL=setup.js.map?a3e5420fc18891863970