1import{l as ve,r as x,n as X,s as ye,j as e,P as J,o as we,B as Se,k as Y,e as ee,X as Ce,u as se,i as ke,h as Pe}from"./index-CHpCBF1n.js";import{I as k}from"./input-Dc-zB96Q.js";import{B as P}from"./button-DS7ECXLr.js";import{B as W}from"./badge-We8OSk0f.js";import{C as _,a as D}from"./card-DNCz7nTZ.js";import{u as Ae}from"./index-BYSpb1Aj.js";import{L as M}from"./label-CHthUDqz.js";import{u as Re}from"./index.esm-yPChht3N.js";import{t as Ee,F as Be,a as R,b as E,c as B,d as F,e as L}from"./zod-DMTbV6Rz.js";import{z as A}from"./index-D4r1jjLZ.js";import{S as te,a as ae,b as re,c as ne,d as ie}from"./select-DuVsaF-i.js";import{N as oe}from"./navigation-GIbmPk7W.js";import{F as le}from"./footer-bVzY7RsT.js";import{C as $}from"./circle-check-big-B_o5hNeV.js";import{G as Fe}from"./globe-C9sH88g8.js";import{P as Le}from"./package-mthTORmc.js";import{U as Te}from"./user-CbFPKwg8.js";import{L as z}from"./loader-circle-D-c8ASRV.js";import{S as _e}from"./search-D0RkVzmS.js";import{A as K}from"./arrow-right-DTBi8Y2s.js";import{S as De}from"./shield-gtT5_AR3.js";import{H as Ie}from"./hard-drive-Bfnt_tb6.js";import{M as Me}from"./use-contact-DbQdPhhD.js";import{A as O}from"./arrow-left-D4kiF04t.js";import{M as $e}from"./map-pin-CIPsS5Pi.js";import"./index-dHZQhyj4.js";import"./Combination-BntuE0kB.js";import"./index-ZB_mvnml.js";import"./chevron-down-DrAiqOfs.js";import"./chevron-up-CnOcGy7_.js";import"./check-DR_uWjAr.js";import"./use-branding-C2aZDfSk.js";import"./shopping-cart-BDEqTiY9.js";import"./protected-image-DRkdDVLT.js";import"./message-circle-BaDqUsPT.js";import"./chevron-right-jPlhUS9s.js";import"./clock-D05xSLgh.js";import"./twitter-CrRp8A3t.js";var q="Switch",[ze,$s]=ve(q),[qe,He]=ze(q),ce=x.forwardRef((s,o)=>{const{__scopeSwitch:t,name:a,checked:n,defaultChecked:i,required:l,disabled:m,value:r="on",onCheckedChange:u,form:d,...h}=s,[b,g]=x.useState(null),c=X(o,N=>g(N)),f=x.useRef(!1),y=b?d||!!b.closest("form"):!0,[w,j]=ye({prop:n,defaultProp:i??!1,onChange:u,caller:q});return e.jsxs(qe,{scope:t,checked:w,disabled:m,children:[e.jsx(J.button,{type:"button",role:"switch","aria-checked":w,"aria-required":l,"data-state":ue(w),"data-disabled":m?"":void 0,disabled:m,value:r,...h,ref:c,onClick:we(s.onClick,N=>{j(v=>!v),y&&(f.current=N.isPropagationStopped(),f.current||N.stopPropagation())})}),y&&e.jsx(xe,{control:b,bubbles:!f.current,name:a,value:r,checked:w,required:l,disabled:m,form:d,style:{transform:"translateX(-100%)"}})]})});ce.displayName=q;var de="SwitchThumb",me=x.forwardRef((s,o)=>{const{__scopeSwitch:t,...a}=s,n=He(de,t);return e.jsx(J.span,{"data-state":ue(n.checked),"data-disabled":n.disabled?"":void 0,...a,ref:o})});me.displayName=de;var Ue="SwitchBubbleInput",xe=x.forwardRef(({__scopeSwitch:s,control:o,checked:t,bubbles:a=!0,...n},i)=>{const l=x.useRef(null),m=X(l,i),r=Ae(t),u=Se(o);return x.useEffect(()=>{const d=l.current;if(!d)return;const h=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(h,"checked").set;if(r!==t&&g){const c=new Event("click",{bubbles:a});g.call(d,t),d.dispatchEvent(c)}},[r,t,a]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...n,tabIndex:-1,ref:m,style:{...n.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});xe.displayName=Ue;function ue(s){return s?"checked":"unchecked"}var he=ce,We=me;const G=x.forwardRef(({className:s,...o},t)=>e.jsx(he,{className:Y("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...o,ref:t,children:e.jsx(We,{className:Y("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));G.displayName=he.displayName;const pe=[{flag:"ð¿ð¦",code:"+27",label:"South Africa"},{flag:"ð³ð¦",code:"+264",label:"Namibia"},{flag:"ð§ð¼",code:"+267",label:"Botswana"},{flag:"ð¿ð¼",code:"+263",label:"Zimbabwe"},{flag:"ð¿ð²",code:"+260",label:"Zambia"},{flag:"ð²ð¿",code:"+258",label:"Mozambique"},{flag:"ð¬ð§",code:"+44",label:"United Kingdom"},{flag:"ðºð¸",code:"+1",label:"United States"},{flag:"ð¦ðº",code:"+61",label:"Australia"}];function Ke(s){const o=[...pe].sort((t,a)=>a.code.length-t.code.length);for(const t of o)if(s.startsWith(t.code))return{dialCode:t.code,local:s.slice(t.code.length)};return s.startsWith("0")?{dialCode:"+27",local:s.slice(1)}:{dialCode:"+27",local:s}}
1function ge({value:s,onChange:o,placeholder:t="82 123 4567"}){const{dialCode:a,local:n}=Ke(s||"");return e.jsxs("div",{className:"flex",children:[e.jsxs(te,{value:a,onValueChange:i=>o(i+n),children:[e.jsx(ae,{className:"w-[90px] rounded-r-none border-r-0 shrink-0 px-2",children:e.jsx(re,{})}),e.jsx(ne,{children:pe.map(i=>e.jsxs(ie,{value:i.code,children:[i.flag," ",i.code]},i.code))})]}),e.jsx(k,{value:n,onChange:i=>{const l=i.target.value.replace(/[^0-9\s]/g,""),m=l.startsWith("0")?l.slice(1):l;o(a+m)},placeholder:t,className:"rounded-l-none flex-1",type:"tel",inputMode:"numeric"})]})}const Z=[{id:"domain",label:"Domain",icon:Fe},{id:"plan",label:"Plan",icon:Le},{id:"details",label:"Details",icon:Te},{id:"summary",label:"Summary",icon:$}];function Oe(){const[s,o]=x.useState(!1),{data:t}=se({queryKey:["/api/integrations/google/google-maps/api-key"],staleTime:3e5});return x.useEffect(()=>{var i,l,m;if((m=(l=(i=window.google)==null?void 0:i.maps)==null?void 0:l.places)!=null&&m.PlaceAutocompleteElement){o(!0);return}const a=t==null?void 0:t.apiKey;if(!a||document.querySelector("script[data-gm-wizard]"))return;const n=document.createElement("script");n.src=`https://maps.googleapis.com/maps/api/js?key=${a}&libraries=places&v=weekly&loading=async&callback=__gmWizardInit`,n.async=!0,n.defer=!0,n.setAttribute("data-gm-wizard","true"),window.__gmWizardInit=()=>o(!0),document.head.appendChild(n)},[t]),x.useEffect(()=>{const a=setInterval(()=>{var n,i,l;(l=(i=(n=window.google)==null?void 0:n.maps)==null?void 0:i.places)!=null&&l.PlaceAutocompleteElement&&(o(!0),clearInterval(a))},500);return()=>clearInterval(a)},[]),s}function Ge(s,o){const t=g=>{const c=s.find(f=>f.types.includes(g));return(c==null?void 0:c.longText)??(c==null?void 0:c.long_name)??""},a=g=>{const c=s.find(f=>f.types.includes(g));return(c==null?void 0:c.shortText)??(c==null?void 0:c.short_name)??""},n=t("street_number"),i=t("route"),l=[n,i].filter(Boolean).join(" "),m=t("sublocality_level_1")||t("sublocality")||t("neighborhood")||void 0,r=t("locality")||t("administrative_area_level_2"),u=t("administrative_area_level_1"),d=t("postal_code"),h=a("country")||"ZA";return{formatted:o||[l,m,r,u,d,h].filter(Boolean).join(", "),address1:l,address2:m,city:r,province:u,postalCode:d,country:h}}function Ve({onSelect:s,mapsLoaded:o}){const t=x.useRef(null),a=x.useRef(null),n=x.useCallback(s,[]);return x.useEffect(()=>{var l,m,r;if(!o||!t.current||a.current||!((r=(m=(l=window.google)==null?void 0:l.maps)==null?void 0:m.places)!=null&&r.PlaceAutocompleteElement))return;const i=new window.google.maps.places.PlaceAutocompleteElement({componentRestrictions:{country:"za"}});return a.current=i,t.current.appendChild(i),i.addEventListener("gmp-select",async u=>{try{const d=u.placePrediction.toPlace();await d.fetchFields({fields:["addressComponents","formattedAddress"]});const h=Ge(d.addressComponents??[],d.formattedAddress);n(h)}catch(d){console.error("Address select error:",d)}}),()=>{t.current&&i.parentNode===t.current&&t.current.removeChild(i),a.current=null}},[o,n]),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{ref:t,className:"w-full"}),!o&&e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(z,{className:"h-3 w-3 animate-spin"})," Loading address search..."]})]})}function fe({value:s,onSelect:o,onClear:t,mapsLoaded:a,label:n="Address"}){return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(M,{className:"text-sm font-medium",children:n}),s?e.jsxs("div",{className:"flex items-start gap-2 p-3 bg-green-500/10 border border-green-500/20 rounded-md",children:[e.jsx($e,{className:"h-4 w-4 text-green-500 flex-shrink-0 mt-0.5"}),e.jsx("span",{className:"text-sm flex-1 leading-snug",children:s.formatted}),e.jsx("button",{type:"button",onClick:t,className:"text-xs text-muted-foreground hover:text-foreground flex-shrink-0 underline",children:"Change"})]}):e.jsx(Ve,{onSelect:o,mapsLoaded:a})]})}function je({value:s,onChange:o,mapsLoaded:t}){return e.jsxs("div",{className:"space-y-3 pt-3",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(M,{className:"text-sm",children:"Full Name"}),e.jsx(k,{value:s.name,onChange:a=>o({...s,name:a.target.value}),placeholder:"Full name"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(M,{className:"text-sm",children:"Phone"}),e.jsx(ge,{value:s.phone,onChange:a=>o({...s,phone:a})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(M,{className:"text-sm",children:"Email"}),e.jsx(k,{value:s.email,onChange:a=>o({...s,email:a.target.value}),type:"email",placeholder:"[email protected]"})]}),e.jsx(fe,{value:s.address,onSelect:a=>o({...s,address:a}),onClear:()=>o({...s,address:null}),mapsLoaded:t})]})}function Q({title:s,defaultLabel:o,isSame:t,onToggle:a,contact:n,onContactChange:i,mapsLoaded:l}){return e.jsxs("div",{className:"border border-gray-700 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-800/50",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:s}),t&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:o})]}),e.jsx(G,{checked:t,onCheckedChange:a})]}),!t&&e.jsx("div",{className:"px-4 pb-4 border-t border-gray-700",children:e.jsx(je,{value:n,onChange:i,mapsLoaded:l})})]})}function Ye({data:s,onNext:o}){const[t,a]=x.useState(s.domain||""),[n,i]=x.useState(s.tld||".co.za"),[l,m]=x.useState(!1),[r,u]=x.useState(s.domainAvailable!==void 0?{available:s.domainAvailable}:null),[d,h]=x.useState(""),b=[".co.za",".com",".net",".org",".africa",".capetown",".joburg",".durban"],g=async()=>
1{if(t.trim()){m(!0),h(""),u(null);try{const c=`${t.trim().toLowerCase()}${n}`,f=await fetch(`/api/integrations/domains-co-za/domain/check?domain=${encodeURIComponent(c)}`),y=await f.json();if(!f.ok)throw new Error(y.message??"Domain check failed");u(y)}catch(c){h(c.message??"Could not check domain availability. Please try again.")}finally{m(!1)}}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Find your perfect domain"}),e.jsx("p",{className:"text-muted-foreground",children:"Enter the domain name you'd like to register."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"relative flex-1",children:e.jsx(k,{value:t,onChange:c=>{a(c.target.value.replace(/[^a-z0-9-]/gi,"").toLowerCase()),u(null)},placeholder:"yourdomain",className:"text-lg h-12 pr-4",onKeyDown:c=>c.key==="Enter"&&g()})}),e.jsxs(te,{value:n,onValueChange:c=>{i(c),u(null)},children:[e.jsx(ae,{className:"w-32 h-12 text-base font-medium",children:e.jsx(re,{})}),e.jsx(ne,{children:b.map(c=>e.jsx(ie,{value:c,children:c},c))})]}),e.jsxs(P,{onClick:g,disabled:!t.trim()||l,className:"h-12 px-6",children:[l?e.jsx(z,{className:"h-4 w-4 animate-spin"}):e.jsx(_e,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 hidden sm:inline",children:"Check"})]})]}),d&&e.jsx("p",{className:"text-destructive text-sm",children:d}),r!==null&&e.jsx(_,{className:r.available?"border-green-500":"border-destructive",children:e.jsxs(D,{className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r.available?e.jsx($,{className:"h-6 w-6 text-green-500"}):e.jsx(Ce,{className:"h-6 w-6 text-destructive"}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-semibold text-lg",children:[t.toLowerCase(),n]}),e.jsx("p",{className:`text-sm ${r.available?"text-green-500":"text-destructive"}`,children:r.available?"Available!":"Already registered â try a different name or extension"})]})]}),r.available&&r.isPremium&&e.jsx(W,{variant:"outline",className:"text-amber-500 border-amber-500",children:"Premium"})]})}),e.jsxs(P,{onClick:()=>o({domain:t.toLowerCase(),tld:n,domainAvailable:r==null?void 0:r.available}),disabled:!(r!=null&&r.available)||!t.trim(),className:"w-full h-12 text-base",children:["Continue ",e.jsx(K,{className:"ml-2 h-4 w-4"})]})]})}function Ze({data:s,onNext:o,onBack:t,preselectedPlanId:a}){const{data:n=[],isLoading:i}=se({queryKey:["/api/hosting/plans/public"],queryFn:()=>fetch("/api/hosting/plans/public").then(r=>r.json())}),[l,m]=x.useState(()=>s.selectedPlan);return x.useEffect(()=>{if(!l&&a&&n.length>0){const r=n.find(u=>String(u.id)===a);r&&m(r)}},[n,a,l]),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Choose a hosting plan"}),e.jsx("p",{className:"text-muted-foreground",children:"Select the hosting package that best suits your needs."})]}),i?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(z,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n.length===0?e.jsx(_,{children:e.jsx(D,{className:"p-8 text-center text-muted-foreground",children:"No hosting plans are currently available. Please contact us."})}):e.jsx("div",{className:"grid gap-4",children:n.map(r=>e.jsx(_,{className:`cursor-pointer transition-all ${(l==null?void 0:l.id)===r.id?"border-primary ring-2 ring-primary/20":"hover:border-primary/50"}`,onClick:()=>m(r),children:e.jsx(D,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"font-semibold text-lg",children:r.name}),e.jsx(W,{variant:"outline",className:"capitalize",children:r.category}),r.sslIncluded&&e.jsxs(W,{className:"bg-success/10 text-success border-success/20",children:[e.jsx(De,{className:"h-3 w-3 mr-1"}),"Free SSL"]})]}),r.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:r.description}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[r.diskSpaceGb&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ie,{className:"h-3 w-3"}),r.diskSpaceGb,"GB Storage"]}),r.emailAccounts&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Me,{className:"h-3 w-3"}),r.emailAccounts," Email Accounts"]}),r.databases&&e.jsxs("span",{children:["MySQL Databases: ",r.databases]}),r.subdomains&&e.jsxs("span",{children:[r.subdomains," Subdomains"]})]})]}),e.jsxs("div",{className:"text-right ml-4",children:[e.jsxs("p",{className:"text-2xl font-bold text-foreground",children:["R",Number(r.price).toFixed(2)]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["/",r.billingCycle==="monthly"?"month":"year"]})]})]})})},r.id))}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(P,{variant:"outline",onClick:t,className:"flex-1 h-12",children:[e.jsx(O,{className:"mr-2 h-4 w-4"})," Back"]}),e.jsxs(P,{onClick:()=>o({selectedPlan:l}),disabled:!l,className:"flex-1 h-12 text-base",children:["Continue ",e.jsx(K,{className:"ml-2 h-4 w-4"})]})]})]})}const Qe=A.object({firstName:A.string().min(1,"First name is required"),lastName:A.string().min(1,"Last name is required"),email:A.string().email("Valid email required"),phone:A.string().min(9,"Valid phone number required"),idNumber:A.string().optional(),company:A.string().optional()});
1function U(){return{name:"",email:"",phone:"",address:null}}function Xe({data:s,onNext:o,onBack:t}){var T,V;const a=Oe(),n=Re({resolver:Ee(Qe),defaultValues:s.customer??{firstName:"",lastName:"",email:"",phone:""}}),[i,l]=x.useState((V=(T=s.contacts)==null?void 0:T.registrant)!=null&&V.address1?{formatted:s.contacts.registrant.address1,...s.contacts.registrant}:null),[m,r]=x.useState(!0),[u,d]=x.useState(!0),[h,b]=x.useState(!0),[g,c]=x.useState(U()),[f,y]=x.useState(U()),[w,j]=x.useState(U()),[N,v]=x.useState(!1),I=n.handleSubmit(p=>{if(!i){v(!0);return}v(!1);const be={name:`${p.firstName} ${p.lastName}`.trim(),email:p.email,phone:p.phone,address1:i.address1,address2:i.address2,city:i.city,province:i.province,postalCode:i.postalCode,country:i.country||"ZA"},H=S=>S.address?{name:S.name,email:S.email,phone:S.phone,address1:S.address.address1,address2:S.address.address2,city:S.address.city,province:S.address.province,postalCode:S.address.postalCode,country:S.address.country||"ZA"}:void 0,Ne={registrant:be,admin:m?void 0:H(g),billing:u?void 0:H(f),tech:h?void 0:H(w)};o({customer:p,contacts:Ne})});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Your details"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Your details will be used to register the domain in your name."})]}),e.jsx(Be,{...n,children:e.jsxs("form",{onSubmit:I,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(R,{control:n.control,name:"firstName",render:({field:p})=>e.jsxs(E,{children:[e.jsx(B,{children:"First Name"}),e.jsx(F,{children:e.jsx(k,{...p,placeholder:"John"})}),e.jsx(L,{})]})}),e.jsx(R,{control:n.control,name:"lastName",render:({field:p})=>e.jsxs(E,{children:[e.jsx(B,{children:"Last Name"}),e.jsx(F,{children:e.jsx(k,{...p,placeholder:"Smith"})}),e.jsx(L,{})]})})]}),e.jsx(R,{control:n.control,name:"email",render:({field:p})=>e.jsxs(E,{children:[e.jsx(B,{children:"Email Address"}),e.jsx(F,{children:e.jsx(k,{...p,type:"email",placeholder:"[email protected]"})}),e.jsx(L,{})]})}),e.jsx(R,{control:n.control,name:"phone",render:({field:p})=>e.jsxs(E,{children:[e.jsx(B,{children:"Phone Number"}),e.jsx(F,{children:e.jsx(ge,{value:p.value,onChange:p.onChange})}),e.jsx(L,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(R,{control:n.control,name:"idNumber",render:({field:p})=>e.jsxs(E,{children:[e.jsxs(B,{children:["SA ID Number ",e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(F,{children:e.jsx(k,{...p,placeholder:"8501015009087"})}),e.jsx(L,{})]})}),e.jsx(R,{control:n.control,name:"company",render:({field:p})=>e.jsxs(E,{children:[e.jsxs(B,{children:["Company ",e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(F,{children:e.jsx(k,{...p,placeholder:"Acme Ltd"})}),e.jsx(L,{})]})})]}),e.jsxs("div",{children:[e.jsx(fe,{value:i,onSelect:p=>{l(p),v(!1)},onClear:()=>l(null),mapsLoaded:a,label:"Address"}),N&&e.jsx("p",{className:"text-destructive text-sm mt-1",children:"Address is required"})]}),e.jsxs("div",{className:"border-t pt-4 space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"The following contacts will also be registered with the domain. They default to your details unless you specify otherwise."}),e.jsx(Q,{title:"Admin Contact",defaultLabel:"Same as your details",isSame:m,onToggle:r,contact:g,onContactChange:c,mapsLoaded:a}),e.jsx(Q,{title:"Billing Contact",defaultLabel:"Same as your details",isSame:u,onToggle:d,contact:f,onContactChange:y,mapsLoaded:a}),e.jsxs("div",{className:"border border-gray-700 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-800/50",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Tech Contact"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:h?"Cititech (default)":"Custom tech contact"})]}),e.jsx(G,{checked:h,onCheckedChange:b})]}),!h&&e.jsx("div",{className:"px-4 pb-4 border-t border-gray-700",children:e.jsx(je,{value:w,onChange:j,mapsLoaded:a})})]})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsxs(P,{type:"button",variant:"outline",onClick:t,className:"flex-1 h-12",children:[e.jsx(O,{className:"mr-2 h-4 w-4"})," Back"]}),e.jsxs(P,{type:"submit",className:"flex-1 h-12 text-base",children:["Continue ",e.jsx(K,{className:"ml-2 h-4 w-4"})]})]})]})})]})}function C({label:s,value:o}){return e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground text-sm",children:s}),e.jsx("span",{className:"text-sm font-medium",children:o})]})}function Je({data:s,onBack:o}){var l,m,r,u,d,h,b,g,c,f,y,w;const[,t]=ee(),a=ke({mutationFn:()=>{var j,N,v,I,T;return Pe("POST","/api/hosting/applications",{domainName:s.domain,domainTld:s.tld.replace(".",""),domainAvailable:s.domainAvailable,domainRegistrationPrice:(j=s.domainPrice)==null?void 0:j.toString(),domainYears:1,hostingPlanId:(N=s.selectedPlan)==null?void 0:N.id,hostingPlanName:((v=s.selectedPlan)==null?void 0:v.name)??"",hostingPlanPrice:((T=(I=s.selectedPlan)==null?void 0:I.price)==null?void 0:T.toString())??"0",customerData:{...s.customer,contacts:s.contacts},status:"new"})},onSuccess:j=>{var v;const N=((v=j==null?void 0:j.data)==null?void 0:v.applicationNumber)??(j==null?void 0:j.applicationNumber);t(`/hosting/success?ref=${N}`)}}),n=(l=s.contacts)==null?void 0:l.registrant,i=Number(((m=s.selectedPlan)==null?void 0:m.price)??0)+Number(s.domainPrice??0)/12;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Review your order"}),e.jsx("p",{className:"text-muted-foreground",children:"Please review your details before submitting."})]}),e.jsx(_,{children:e.jsxs(D,{className:"p-4 space-y-4",children:[e.jsx(C,{label:"Domain",value:`${s.domain}${s.tld}`}),s.domainPrice&&e.jsx(C,{label:"Domain Registration",value:`R${s.domainPrice.toFixed(2)}/year`}),e.jsx(C,{label:"Hosting Plan",value:((r=s.selectedPlan)==null?void 0:r.name)??""}),e.jsx(C,{label:"Monthly Hosting",value:`R${Number(((u=s.selectedPlan)==null?void 0:u.price)??0).toFixed(2)}/month`}),e.jsxs("div",{className:"border-t pt-3 flex justify-between font-bold text-lg",children:[e.jsx("span",{children:"Total Monthly"}),e.jsxs("span",{children:["~R",i.toFixed(2),"/month"]})]})]})}),e.jsx(_,{children:e.jsxs(D,{className:"p-4 space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Your Details"}),e.jsx(C,{label:"Name",value:`${(d=s.customer)==null?void 0:d.firstName} ${(h=s.customer)==null?void 0:h.lastName}`}),e.jsx(C,{label:"Email",value:((b=s.customer)==null?void 0:b.email)??""}),e.jsx(C,{label:"Phone",value:((g=s.customer)==null?void 0:g.phone)??""}),((c=s.customer)==null?void 0:c.company)&&e.jsx(C,{label:"Company",value:s.customer.company}),n&&e.jsx(C,{label:"Address",value:[n.address1,n.city,n.province].filter(
1Boolean).join(", ")}),e.jsxs("p",{className:"text-xs text-muted-foreground pt-1",children:["Admin: ",(f=s.contacts)!=null&&f.admin?"Custom":"Same as you"," · Billing: ",(y=s.contacts)!=null&&y.billing?"Custom":"Same as you"," · Tech: ",(w=s.contacts)!=null&&w.tech?"Custom":"Cititech (default)"]})]})}),a.isError&&e.jsx("p",{className:"text-destructive text-sm",children:"Something went wrong. Please try again."}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(P,{variant:"outline",onClick:o,className:"flex-1 h-12",disabled:a.isPending,children:[e.jsx(O,{className:"mr-2 h-4 w-4"})," Back"]}),e.jsx(P,{onClick:()=>a.mutate(),className:"flex-1 h-12 text-base",disabled:a.isPending,children:a.isPending?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"h-4 w-4 animate-spin mr-2"}),"Submitting..."]}):"Confirm & Submit"})]})]})}function es({appNumber:s}){return e.jsxs("div",{className:"min-h-screen bg-gray-950",children:[e.jsx(oe,{}),e.jsx("div",{className:"min-h-[80vh] flex items-center justify-center p-4",children:e.jsxs("div",{className:"max-w-md text-center space-y-6",children:[e.jsx("div",{className:"bg-green-500/10 w-24 h-24 rounded-full flex items-center justify-center mx-auto",children:e.jsx($,{className:"h-12 w-12 text-green-400"})}),e.jsx("h1",{className:"text-3xl font-bold text-white",children:"Application Received!"}),e.jsx("p",{className:"text-gray-400",children:"Your hosting application has been submitted successfully. Our team will review it and be in touch shortly."}),s&&e.jsxs("div",{className:"bg-gray-900 border border-gray-700 rounded-xl p-6",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Reference Number"}),e.jsx("p",{className:"text-2xl font-mono font-bold text-green-400 mt-1",children:s}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"Keep this number for your records."})]}),e.jsx(P,{onClick:()=>window.location.href="/",variant:"outline",className:"w-full border-gray-700 text-gray-300 hover:text-white",children:"Back to Home"})]})}),e.jsx(le,{})]})}function zs(){const[s]=ee(),o=new URLSearchParams(s.includes("?")?s.split("?")[1]:""),t=o.get("plan")??void 0,[a,n]=x.useState(0),[i,l]=x.useState({domain:"",tld:".co.za"});if(s.includes("/hosting/success"))return e.jsx(es,{appNumber:o.get("ref")??""});const m=u=>{l(d=>({...d,...u})),n(d=>d+1)},r=()=>n(u=>Math.max(0,u-1));return e.jsxs("div",{className:"min-h-screen bg-gray-950",children:[e.jsx(oe,{}),e.jsx("div",{className:"bg-gradient-to-br from-gray-900 via-gray-950 to-black border-b border-gray-800",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-10",children:[e.jsx("h1",{className:"text-4xl font-bold text-white",children:"Domain & Hosting Sign-Up"}),e.jsx("p",{className:"text-gray-400 mt-2",children:"Register your domain and get your website online in minutes."})]})}),e.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-8",children:[e.jsx("div",{className:"flex items-center gap-2 mb-8",children:Z.map((u,d)=>{const h=u.icon;return e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsxs("div",{className:`flex items-center gap-2 ${d<=a?"text-green-400":"text-gray-600"}`,children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center border-2 transition-all ${d<a?"bg-green-500 border-green-500 text-white":d===a?"border-green-400 text-green-400":"border-gray-700 text-gray-600"}`,children:d<a?e.jsx($,{className:"h-4 w-4"}):e.jsx(h,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-sm font-medium hidden sm:inline",children:u.label})]}),d<Z.length-1&&e.jsx("div",{className:`flex-1 h-0.5 ${d<a?"bg-green-500":"bg-gray-800"}`})]},u.id)})}),e.jsxs("div",{className:"bg-gray-900 border border-gray-800 rounded-2xl p-6 sm:p-8",children:[a===0&&e.jsx(Ye,{data:i,onNext:m}),a===1&&e.jsx(Ze,{data:i,onNext:m,onBack:r,preselectedPlanId:t}),a===2&&e.jsx(Xe,{data:i,onNext:m,onBack:r}),a===3&&e.jsx(Je,{data:i,onBack:r})]})]}),e.jsx(le,{})]})}export{zs 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.