1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[57512],{57512:function(e,r,n){Promise.resolve().then(n.bind(n,91710))},3539:function(e,r,n){"use strict";n.d(r,{$s:function(){return l},Ah:function(){return d},Lo:function(){return o},Lq:function(){return c},Yv:function(){return s}});var i=n(63861),t=n(2265),a=n(55447);function l(e){let r=e?a.endpoints.organization.members(e):null,{data:n,isLoading:l,error:o,isValidating:s,mutate:d}=(0,i.ZP)(r,a._);return(0,t.useMemo)(()=>({members:(null==n?void 0:n.payload)||[],membersLoading:l,membersError:o,membersValidating:s,membersEmpty:!l&&!(null==n?void 0:n.payload.length),membersMutate:d}),[null==n?void 0:n.payload,o,l,s,d])}function o(e){let r=e?a.endpoints.organization.getDepartments:null,{data:n,isLoading:l,error:o,isValidating:s,mutate:d}=(0,i.ZP)(r,a._);return(0,t.useMemo)(()=>({departments:(null==n?void 0:n.payload)||[],departmentsLoading:l,departmentsError:o,departmentsValidating:s,departmentsEmpty:!l&&!(null==n?void 0:n.payload.length),departmentsMutate:d}),[null==n?void 0:n.payload,o,l,s,d])}let s=async(e,r,n,i,t)=>{try{let l=a.endpoints.organization.memberDetails(e,r);return(await a.default.patch(l,{role:n,departments:i,is_licensed:t})).data}catch(e){throw console.error("Error updating member role:",e),e}},d=async(e,r)=>{try{let n=a.endpoints.organization.memberDetails(e,r);return(await a.default.delete(n)).data}catch(e){throw console.error("Error removing member:",e),e}},c=async(e,r)=>{try{let n=a.endpoints.organization.members(e);return(await a.default.post(n,r)).data}catch(e){throw console.error("Error inviting member:",e),e}}},91710:function(e,r,n){"use strict";n.d(r,{CreateOrganization:function(){return ea}});var i=n(57437),t=n(2265),a=n(63832),l=n(89689),o=n(85299),s=n(55693),d=n(99376),c=n(20337),u=n(35453),m=n(99795),p=n(73913),h=n(46387),g=n(37685),x=n(77584),f=n(67051),b=n(39155),v=n(98489),_=n(51689),j=n(19606),y=n(5898);function Z(e){let r,{handleNext:n,user:a,loading:l,checkUserSession:o,activeStep:s,organizationData:d}=e,{t:u}=(0,c.qM)("components"),[m,p]=(0,t.useState)({usage_option_id:null,how_did_you_hear_option_id:null,resources_to_try_option_id:null,company_size_option_id:null,developer_count_option_id:null,profile_option_id:null,industry_segment_option_id:null,management_area_option_id:null}),{responseData:Z,responseLoading:T,responseeError:k}=(0,_.Hw)();if(T)return(0,i.jsx)(h.Z,{children:u("freeTrial.questions.loading")});if(k)return(0,i.jsxs)(h.Z,{color:"error",children:[u("freeTrial.questions.loadError")," ",k.message]});if(!Z)return(0,i.jsx)(h.Z,{color:"error",children:u("freeTrial.questions.noData")});let{usageOptions:z,companySizeOptions:C,developmentCountOptions:S,howDidYouHearOptions:w,industrySegmentOptions:q,managementAreaOptions:L,profileOptions:M,resourcesToTryOptions:A}=Z,E=async e=>{let r={...m,user_id:null==a?void 0:a.id,organization_id:null==a?void 0:a.pending_organization_id,usage_option_id:m.usage_option_id,how_did_you_hear_option_id:m.how_did_you_hear_option_id,resources_to_try_option_id:m.resources_to_try_option_id,company_size_option_id:m.company_size_option_id,developer_count_option_id:m.developer_count_option_id,profile_option_id:m.profile_option_id,industry_segment_option_id:m.industry_segment_option_id,management_area_option_id:m.management_area_option_id};e.preventDefault(),console.log(r),await (0,j.RW)(r),null==o||o(),n()};return(null==a?void 0:a.is_questionnaire_answered)?(r=(0,i.jsx)(y.S,{}),n()):r=(0,i.jsxs)("form",{id:"questionnaire-form",onSubmit:E,children:[(0,i.jsx)(g.Z,{options:z,getOptionLabel:e=>e.option_text,value:z.find(e=>e.id===m.usage_option_id)||null,onChange:(e,r)=>{p(e=>({...e,usage_option_id:r?r.id:null}))},renderInput:e=>(0,i.jsx)(x.Z,{...e,label:u("freeTrial.questions.usageLabel"),fullWidth:!0,margin:"normal"}),renderOption:(e,r)=>(0,t.createElement)("li",{...e,key:r.id},(0,i.jsx)(f.Z,{primary:r.option_text,secondary:r.option_description}))}),(0,i.jsx)(g.Z,{options:w,getOptionLabel:e=>e.option_text,value:w.find(e=>e.id===m.how_did_you_hear_option_id)||null,onChange:(e,r)=>{p(e=>({...e,how_did_you_hear_option_id:r?r.id:null}))},renderInput:e=>(0,i.jsx)(x.Z,{...e,label:u("freeTrial.questions.hearLabel"),fullWidth:!0,margin:"normal"}),renderOption:(e,r)=>(0,t.createElement)("li",{...e,key:r.id},(0,i.jsx)(f.Z,{primary:r.option_text,secondary:r.option_description}))}),(0,i.jsx)(g.Z,{options:A,getOptionLabel:e=>e.option_text,value:A.find(e=>e.id===m.resources_to_try_option_id)||null,onChange:(e,r)=>{p(e=>({...e,resources_to_try_option_id:r?r.id:null}))},renderInput:e=>(0,i.jsx)(x.Z,{...e,label:u("freeTrial.questions.resourceLabel"),fullWidth:!0,margin:"normal"}),renderOption:(e,r)=>(0,t.createElement)("li",{...e,key:r.id},(0,i.jsx)(f.Z,{primary:r.option_text,secondary:r.option_description}))}),(0,i.jsx)(g.Z,{options:C,getOptionLabel:e=>e.option_text,value:C.find(e=>
1e.id===m.company_size_option_id)||null,onChange:(e,r)=>{p(e=>({...e,company_size_option_id:r?r.id:null}))},renderInput:e=>(0,i.jsx)(x.Z,{...e,label:u("freeTrial.questions.companySizeLabel"),fullWidth:!0,margin:"normal"}),renderOption:(e,r)=>(0,t.createElement)("li",{...e,key:r.id},(0,i.jsx)(f.Z,{primary:r.option_text,secondary:r.option_description}))}),(0,i.jsx)(g.Z,{options:M,getOptionLabel:e=>e.option_text,value:M.find(e=>e.id===m.profile_option_id)||null,onChange:(e,r)=>{p(e=>({...e,profile_option_id:r?r.id:null}))},renderInput:e=>(0,i.jsx)(x.Z,{...e,label:u("freeTrial.questions.roleLabel"),fullWidth:!0,margin:"normal"}),renderOption:(e,r)=>(0,t.createElement)("li",{...e,key:r.id},(0,i.jsx)(f.Z,{primary:r.option_text,secondary:r.option_description}))}),(0,i.jsx)(g.Z,{options:q,getOptionLabel:e=>e.option_text,value:q.find(e=>e.id===m.industry_segment_option_id)||null,onChange:(e,r)=>{p(e=>({...e,industry_segment_option_id:r?r.id:null}))},renderInput:e=>(0,i.jsx)(x.Z,{...e,label:u("freeTrial.questions.segmentLabel"),fullWidth:!0,margin:"normal"}),renderOption:(e,r)=>(0,t.createElement)("li",{...e,key:r.id},(0,i.jsx)(f.Z,{primary:r.option_text,secondary:r.option_description}))}),(0,i.jsx)(g.Z,{options:L,getOptionLabel:e=>e.option_text,value:L.find(e=>e.id===m.management_area_option_id)||null,onChange:(e,r)=>{p(e=>({...e,management_area_option_id:r?r.id:null}))},renderInput:e=>(0,i.jsx)(x.Z,{...e,label:u("freeTrial.questions.managementAreaLabel"),fullWidth:!0,margin:"normal"}),renderOption:(e,r)=>(0,t.createElement)("li",{...e,key:r.id},(0,i.jsx)(f.Z,{primary:r.option_text,secondary:r.option_description}))}),(0,i.jsx)(g.Z,{options:S,getOptionLabel:e=>e.option_text,value:S.find(e=>e.id===m.developer_count_option_id)||null,onChange:(e,r)=>{p(e=>({...e,developer_count_option_id:r?r.id:null}))},renderInput:e=>(0,i.jsx)(x.Z,{...e,label:u("freeTrial.questions.devCountLabel"),fullWidth:!0,margin:"normal"}),renderOption:(e,r)=>(0,t.createElement)("li",{...e,key:r.id},(0,i.jsx)(f.Z,{primary:r.option_text,secondary:r.option_description}))}),(0,i.jsx)(b.Z,{type:"submit",variant:"contained",color:"inherit",disabled:l,sx:{padding:"10px 20px",marginTop:4,backgroundColor:0===s?"#ccc":void 0},children:u("freeTrial.questions.submitButton")})]}),(0,i.jsxs)(v.Z,{maxWidth:"md",sx:{pt:3,pb:10,borderRadius:"8px",px:{xs:2,sm:3}},children:[(0,i.jsx)(h.Z,{variant:"h4",gutterBottom:!0,children:u("freeTrial.questions.title")}),r]})}var T=n(31229),k=n(93837),z=n(13590),C=n(29501),S=n(41554),w=n(89938),q=n(99115),L=n(22095),M=n(19902),A=n(70208),E=n(32281),I=n(28314),P=n(52988),N=n(59469),W=n(72608),D=n(63172),R=n(95576),B=n(35791),V=n(79507),O=n(77468),F=n(85147),Q=n(73126),U=n(22643),G=n(55447),H=n(3539),$=n(65055),Y=n(63226);let J=e=>{let r=e.replace(/\D/g,"");if(11!==r.length||/^(\d)\1+$/.test(r))return!1;let n=e=>r.slice(0,e-1).split("").reduce((r,n,i)=>r+parseInt(n,10)*(e-i),0),i=10*n(10)%11%10,t=10*n(11)%11%10;return i===parseInt(r[9],10)&&t===parseInt(r[10],10)},K=T.z.object({id:T.z.string(),name:T.z.string().min(1,"O nome \xe9 obrigat\xf3rio."),email:T.z.string().email({message:"Formato de e-mail inv\xe1lido."}).optional().or(T.z.literal("")),document:T.z.string().optional(),phone:T.z.string().optional().nullable(),is_self:T.z.boolean(),qual:T.z.string().optional().nullable(),is_from_qsa:T.z.boolean(),role:T.z.enum(["member","sponsor","admin","superuser","owner",""]),departments:T.z.array(T.z.string()),is_licensed:T.z.boolean()}).superRefine((e,r)=>{var n,i,t;if(e.is_from_qsa||e.email||r.addIssue({code:T.z.ZodIssueCode.custom,path:["email"],message:"O e-mail \xe9 obrigat\xf3rio para membros adicionados manualmente."}),"owner"===e.role){let n=null===(t=e.document)||void 0===t?void 0:t.replace(/\D/g,"");n?J(n)||r.addIssue({code:T.z.ZodIssueCode.custom,path:["document"],message:"CPF inv\xe1lido."}):r.addIssue({code:T.z.ZodIssueCode.custom,path:["document"],message:"CPF \xe9 obrigat\xf3rio para Dono/S\xf3cio."})}let a=!!((null===(n=e.email)||void 0===n?void 0:n.trim())||(null===(i=e.phone)||void 0===i?void 0:i.trim())||e.is_self);e.is_from_qsa&&!a||e.departments&&0!==e.departments.length||r.addIssue({code:T.z.ZodIssueCode.custom,path:["departments"],message:"Selecione pelo menos um departamento."})}),X=T.z.object({members:T.z.array(K)}),ee=e=>{var r,n,l,o,s,d;let{handleNext:m,handleBack:p,user:f,activeStep:v,loading:_,organizationData:Z,setOrganizationData:T}=e,{t:J}=(0,c.qM)("components"),[,K]=t.useState(!1),[,ee]=t.useState(null),[er,en]=t.useState(0),[ei,et]=t.useState(null),[ea,el]=t.useState(!1),{checkUserSession:eo}=(0,u.E)(),es=(null==Z?void 0:Z.nickname)||"",{departments:ed,departmentsLoading:ec}=(0,H.Lo)(es),eu=(0,C.cI)({resolver:(0,z.F)(X),defaultValues:{members:(null==Z?void 0:null===(n=Z.json_data_query)||void 0===n?void 0:null===(r=n.qsa)||void 0===r?void 0:r.map(e=>({id:(0,k.Z)(),name:e.nome,email:"",document:"",phone:"",qual:e.qual,is_self:!1,is_from_qsa:!0,role:"member",departments:[],is_licensed:!0})))||[]}}),{reset:em}=eu;(0,t.useEffect)(()=>{(async()=>
1{if(!(null==Z?void 0:Z.id)){null==K||K(!0);try{var e,r,n,i;let t=G.endpoints.organizations.getOrganizationById(null==f?void 0:f.pending_organization_id),a=await (0,G._)(t),l=(null==a?void 0:a.payload)||null;en((null==l?void 0:null===(r=l.json_data_query)||void 0===r?void 0:null===(e=r.qsa)||void 0===e?void 0:e.length)||0),null==T||T(l),em({members:(null==l?void 0:null===(i=l.json_data_query)||void 0===i?void 0:null===(n=i.qsa)||void 0===n?void 0:n.map(e=>({id:(0,k.Z)(),name:e.nome,email:"",phone:"",qual:e.qual,is_self:!1,is_from_qsa:!0,role:"member",departments:[],is_licensed:!0})))||[]})}catch(e){console.error("Erro ao buscar organiza\xe7\xe3o:",e),null==ee||ee(e)}finally{K(!1)}}})()},[Z,null==f?void 0:f.pending_organization_id,T,K,ee,em]);let{control:ep,handleSubmit:eh,watch:eg,setValue:ex,trigger:ef}=eu,eb=eg("members"),ev=e=>{ex("members",eb.filter(r=>r.id!==e))},e_=async()=>{if(null===ei)return;let e=["members.".concat(ei,".name"),"members.".concat(ei,".email"),"members.".concat(ei,".departments")];"owner"===eb[ei].role&&e.push("members.".concat(ei,".document")),await ef(e)&&et(null)},ej=()=>{ea&&ex("members",eb.slice(0,-1)),et(null)},ey=async e=>{if(!e.members.some(e=>{var r;return e.is_from_qsa&&(e.is_self||""!==e.email.trim()||(null===(r=e.phone)||void 0===r?void 0:r.trim())!=="")})){$.Am.error(J("freeTrial.inviteMembers.qsaContactRequired"));return}let r={organization_id:Z.id,user_id:null==f?void 0:f.id,members:e.members};try{await (0,j.TP)(r),null==eo||eo(),m()}catch(e){console.error("Erro ao convidar membros:",e)}},eZ=null;return(null==f?void 0:f.members_invited)?(eZ=(0,i.jsx)(y.S,{}),m()):eZ=(0,i.jsx)(C.RV,{...eu,children:(0,i.jsxs)("form",{id:"invite-member-form",onSubmit:eh(ey,e=>{let r=(Array.isArray(null==e?void 0:e.members)?e.members:[]).map((e,r)=>{var n,i;return e?(null==eb?void 0:null===(i=eb[r])||void 0===i?void 0:null===(n=i.name)||void 0===n?void 0:n.trim())||J("freeTrial.inviteMembers.memberFallbackName",{index:r+1}):null}).filter(Boolean);if(r.length>0){$.Am.error(J("freeTrial.inviteMembers.requiredFieldsIn",{members:r.join(", ")}));return}$.Am.error(J("freeTrial.inviteMembers.requiredFieldsGeneric"))}),children:[(0,i.jsx)(h.Z,{sx:{fontWeight:"bold",mb:2},variant:"subtitle1",children:J("freeTrial.inviteMembers.membersTitle")}),(0,i.jsx)(L.Z,{component:M.Z,sx:{mb:2},children:(0,i.jsxs)(A.Z,{children:[(0,i.jsx)(E.Z,{children:(0,i.jsxs)(I.Z,{children:[(0,i.jsx)(P.Z,{children:J("freeTrial.inviteMembers.memberHeader")}),(0,i.jsx)(P.Z,{children:J("freeTrial.inviteMembers.isYouHeader")}),(0,i.jsx)(P.Z,{align:"right",children:J("freeTrial.inviteMembers.actionsHeader")})]})}),(0,i.jsx)(N.Z,{children:eb.map((e,r)=>(0,i.jsxs)(I.Z,{children:[(0,i.jsxs)(P.Z,{children:[(0,i.jsx)(h.Z,{variant:"subtitle1",children:e.name||J("freeTrial.inviteMembers.newMember")}),(0,i.jsx)(h.Z,{variant:"body2",color:"text.secondary",children:e.email})]}),(0,i.jsx)(P.Z,{children:e.is_from_qsa&&(0,i.jsx)(W.Z,{control:(0,i.jsx)(C.Qr,{name:"members.".concat(r,".is_self"),control:ep,render:e=>{let{field:n}=e;return(0,i.jsx)(D.Z,{...n,checked:!!n.value,onChange:e=>{ex("members",eb.map((n,i)=>({...n,is_self:i===r&&e.target.checked})))}})}}),label:J("freeTrial.inviteMembers.isMe")})}),(0,i.jsxs)(P.Z,{align:"right",children:[(0,i.jsx)(R.Z,{onClick:()=>{el(!1),et(r)},children:(0,i.jsx)(w.Z,{})}),(0,i.jsx)(R.Z,{onClick:()=>ev(e.id),children:(0,i.jsx)(q.Z,{})})]})]},e.id))})]})}),null!==ei&&(0,i.jsxs)(B.Z,{open:null!==ei,onClose:ej,maxWidth:"md",fullWidth:!0,children:[(0,i.jsx)(V.Z,{children:ea?J("freeTrial.inviteMembers.addMemberTitle"):J("freeTrial.inviteMembers.editMemberTitle",{name:null===(l=eb[ei])||void 0===l?void 0:l.name})}),(0,i.jsxs)(O.Z,{children:[!(null===(o=eb[ei])||void 0===o?void 0:o.is_self)&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(a.Z,{sx:{display:"flex",alignItems:"center",gap:1,mb:2,mt:1},children:[(0,i.jsx)(Y.gN.Text,{sx:{mr:1},name:"members.".concat(ei,".name"),label:J("freeTrial.inviteMembers.nameLabel"),fullWidth:!0,disabled:!ea||(null===(s=eb[ei])||void 0===s?void 0:s.is_from_qsa)&&er>0,required:!0}),(0,i.jsx)(Y.gN.Text,{sx:{mr:1},name:"members.".concat(ei,".email"),label:"E-mail",fullWidth:!0,disabled:!ea,required:!(null===(d=eb[ei])||void 0===d?void 0:d.is_from_qsa)})]}),(0,i.jsx)(a.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2,mt:1},children:(0,i.jsx)(Y.gN.Phone,{name:"members.".concat(ei,".phone"),label:J("freeTrial.inviteMembers.phoneLabel"),country:"BR",sx:{flex:1}})})]}),(0,i.jsx)(a.Z,{sx:{display:"flex",alignItems:"center",gap:2,mb:2,mt:1},children:(0,i.jsx)(W.Z,{control:(0,i.jsx)(C.Qr,{name:"members.".concat(ei,".is_licensed"),control:ep,render:e=>{let{field:r}=e;return(0,i.jsx)(F.Z,{...r,checked:!!r.value})}}),label:J("freeTrial.inviteMembers.enableLicense")})}),(0,i.jsx)(h.Z,{variant:"subtitle2",sx:{mb:1},children:J("freeTrial.inviteMembers.rolesTitle")}),(0,i.jsx)(Q.Z,{severity:"info",sx:{mb:2},children:J("freeTrial.inviteMembers.rolesInfo")}),(0,i.jsx)(a.Z,{children:(0,i.jsx)(C.Qr,{name:"members.".concat(ei,".departments"),control:ep,render:e=>{let{field:r,fieldState:n}=e;return(0,i.jsx)(g.Z,{multiple:!0,options:ed||[],loading:ec,value:(ed||[]).filter(e=>(r.value||[]).includes(e.id)),onChange:(e,n)=>{r.onChange(n.map(e=>e.id))},getOptionLabel:e=>e.title||"",isOptionEqualToValue:(e,r)=>e.id===r.id,renderInput:e=>{var r;return(0,i.jsx)(x.Z,{...e,label:J("freeTrial.inviteMembers.departmentsLabel"),placeholder:J("freeTrial.inviteMembers.departmentsPlaceholder"),required:!0,error:!!n.error,helperText:null===(r=n.error)||void 0===r?void 0:r.message})}})}})})]}),(0,i.jsxs)(U.Z,{children:[(0,i.jsx)(b.Z,{onClick:ej,children:J("freeTrial.inviteMembers.c
1ancelButton")}),(0,i.jsx)(b.Z,{variant:"contained",color:"primary",onClick:e_,children:ea?J("freeTrial.inviteMembers.addButton"):J("freeTrial.inviteMembers.saveButton")})]})]}),(0,i.jsx)(b.Z,{startIcon:(0,i.jsx)(S.Z,{}),onClick:()=>{let e=!1;0===er&&(e=!0),ex("members",[...eb,{id:(0,k.Z)(),name:"",email:"",document:"",phone:"",qual:"",is_self:!1,is_from_qsa:e,role:"member",departments:[],is_licensed:!0}]),el(!0),et(eb.length)},sx:{mb:2},children:J("freeTrial.inviteMembers.addMemberButton")}),(0,i.jsx)(a.Z,{sx:{width:"100%",margin:"0 auto",textAlign:"center"},children:eb.length>0&&(0,i.jsx)(b.Z,{type:"submit",variant:"contained",color:"primary",disabled:_,sx:{padding:"10px 20px",marginTop:4,backgroundColor:0===v?"#ccc":void 0},children:J("freeTrial.inviteMembers.inviteAndContinue")})})]})}),(0,i.jsx)(a.Z,{sx:{width:"100%",maxWidth:"800px",margin:"0 auto"},children:eZ})};var er=n(46659),en=n(27648),ei=n(12527);let et=e=>{let{message:r}=e,{t:n}=(0,c.qM)("components"),t=n("freeTrial.registrationCompleted.defaultMessage"),l=(r||t).split("\n");return(0,i.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"calc(100vh - 200px)",textAlign:"center",p:2},children:(0,i.jsxs)(M.Z,{elevation:4,sx:{padding:4,textAlign:"center",borderRadius:3,backgroundColor:"#e8f5e9",boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.1)",maxWidth:"500px",width:"100%",margin:"0 auto"},children:[(0,i.jsx)(ei.Z,{sx:{fontSize:60,color:"#4caf50",marginBottom:2}}),(0,i.jsx)(h.Z,{variant:"h4",sx:{fontWeight:"bold",marginBottom:2},children:n("freeTrial.registrationCompleted.title")}),(0,i.jsxs)(a.Z,{textAlign:"center",children:[l.map((e,r)=>(0,i.jsx)(h.Z,{variant:"body1",children:e},r)),(0,i.jsxs)(h.Z,{variant:"body1",children:[n("freeTrial.registrationCompleted.accessPrefix")," ",(0,i.jsx)(en.default,{href:"/workspace",children:n("freeTrial.registrationCompleted.appLinkLabel")})," ",n("freeTrial.registrationCompleted.accessSuffix")]})]})]})})};function ea(){let{t:e}=(0,c.qM)("components"),{user:r,loading:n,checkUserSession:h}=(0,u.E)(),g=(0,t.useMemo)(()=>[e("freeTrial.steps.accountInfo"),e("freeTrial.steps.organizationData"),e("freeTrial.steps.profileQuestionnaire"),e("freeTrial.steps.inviteTeam"),e("freeTrial.steps.choosePlan")],[e]),[x,f]=(0,t.useState)(0),[b,v]=(0,t.useState)(!1),[_,j]=(0,t.useState)({}),y=(0,d.useRouter)();(0,t.useEffect)(()=>{if(5===x){let e=setTimeout(()=>{y.push("/workspace/")},2e3);return()=>clearTimeout(e)}},[x,y]);let[T,k]=(0,t.useState)({doc_type:"cnpj",nickname:"",document:"",trading_name:"",business_name:"",picture:"",profile_cover:"",website:"",address:"",address_number:"",complement:"",city:"",neighborhood:"",state:"",zip_code:"",email:"",phone:"",is_provider:!1,is_recipient:!1,is_freelancer:!1}),z=()=>{n||(null==h||h(),f(x+1))},C=()=>{n||f(e=>e-1)};return(0,i.jsxs)(a.Z,{sx:{width:"100%",borderRadius:"8px",px:{xs:1,sm:3},py:2,margin:"0 auto",display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center"},children:[(0,i.jsx)(l.Z,{activeStep:x,sx:{width:"100%",maxWidth:850},alternativeLabel:!0,children:g.map((e,r)=>(0,i.jsx)(o.Z,{children:(0,i.jsx)(s.Z,{sx:{cursor:"pointer"},children:e})},r))}),(0,i.jsx)(a.Z,{sx:{mt:2,width:"100%"},children:n?e("freeTrial.loading"):(e=>{switch(e){case 0:return(0,i.jsx)(m.$,{handleNext:z,isLogin:b,setIsLogin:v});case 1:return(0,i.jsx)(a.Z,{sx:{width:"100%",margin:"0 auto",textAlign:"center"},children:(0,i.jsx)(er.c,{handleNext:z,handleBack:C,formState:T,steps:g,activeStep:x,loading:n,setFormState:k,setOrganizationData:j})});case 2:return(0,i.jsx)(a.Z,{sx:{width:"100%",margin:"0 auto",textAlign:"center"},children:(0,i.jsx)(Z,{handleNext:z,handleBack:C,user:r,loading:n,checkUserSession:h,steps:g,activeStep:x,organizationData:_})});case 3:return(0,i.jsx)(ee,{handleNext:z,handleBack:C,steps:g,checkUserSession:h,user:r,activeStep:x,loading:n,organizationData:_,setOrganizationData:j});case 4:return(0,i.jsx)(p.h,{chargeType:"choose",isDisabledSubscription:!1,handleNext:z,organizationData:_});default:return(0,i.jsx)(et,{})}})(x)})]})}},73913:function(e,r,n){"use strict";n.d(r,{h:function(){return P}});var i=n(57437),t=n(99376),a=n(2265),l=n(6809),o=n(22796),s=n(46387),d=n(63832),c=n(19902),u=n(73126),m=n(22095),p=n(70208),h=n(32281),g=n(28314),x=n(52988),f=n(85147),b=n(39155),v=n(59469),_=n(95576),j=n(35791),y=n(79507),Z=n(77468),T=n(22643),k=n(12258),z=n(98489),C=n(20337),S=n(72539),w=n(24366),q=n(51689),L=n(65738),M=n(65055),A=n(35453),E=n(89667),I=n(19606);function P(e){let r,{handleNext:n,organizationData:P,currentPlanId:N,currentBilling
1Cycle:W,currentPaymentMethod:D,currentPaymentMethodId:R,currentLicensedMembersCount:B,isDisabledSubscription:V,chargeType:O,subscriptionExpired:F,currentPlanMutate:Q}=e,{t:U}=(0,C.qM)("components"),[G,H]=(0,a.useState)(null),[$,Y]=(0,a.useState)("card"),[J,K]=(0,a.useState)(null),[X,ee]=(0,a.useState)(!1),[er,en]=(0,a.useState)("monthly"),[ei,et]=(0,a.useState)(!1),[ea,el]=(0,a.useState)(!1),[eo,es]=(0,a.useState)(""),[ed,ec]=(0,a.useState)(B||0),[eu,em]=(0,a.useState)(null),[ep,eh]=(0,a.useState)(0),[eg,ex]=(0,a.useState)(null),[ef,eb]=(0,a.useState)(0),[ev,e_]=(0,a.useState)(0),[ej,ey]=(0,a.useState)(!1),[eZ,eT]=(0,a.useState)(!1),[ek,ez]=(0,a.useState)(0),[eC,eS]=(0,a.useState)(0),{nickname:ew}=(0,t.useParams)();(0,a.useEffect)(()=>{ec(B||0)},[B]);let{user:eq,checkUserSession:eL}=(0,A.E)(),eM=()=>{et(!0)};(0,a.useEffect)(()=>{let e=document.createElement("script");return e.src="https://assets.pagar.me/checkout/1.1.0/checkout.js",e.async=!0,document.body.appendChild(e),()=>{document.body.removeChild(e)}},[]);let{resourcePlans:eA,resourcePlansEmpty:eE,resourcePlansError:eI,resourcePlansLoading:eP,resourcePlansMutate:eN}=(0,q.NY)(),{billingData:eW,billingMutate:eD}=(0,q.ns)(ew),{subscription:eR}=eW;if((0,a.useEffect)(()=>{var e,r,n,i,t,a,l,o;let s=null==eA?void 0:null===(e=eA.plans)||void 0===e?void 0:e.find(e=>{var r;return e.id===(null===(r=eW.plan)||void 0===r?void 0:r.id)});s&&(null===(r=eW.subscription)||void 0===r?void 0:r.billing_cycle)?(H(s||null),en((null===(i=eW.subscription)||void 0===i?void 0:i.billing_cycle)||"monthly"),ec(null!==(o=null===(t=eW.subscription)||void 0===t?void 0:t.licensed_members_count)&&void 0!==o?o:0),Y("default"),ex((null===(a=eW.subscription)||void 0===a?void 0:a.total_amount)||null),eS((null===(l=eW.subscription)||void 0===l?void 0:l.remaining_percentage)||0)):(null===(n=eW.subscription)||void 0===n?void 0:n.is_active)===!1&&(H(null),en("monthly"),ec(0),Y(null),ex(null),eS(0))},[eW,eA]),(0,a.useEffect)(()=>{if(G){let e=(0,w.e)(G,er,null!=ed?ed:0,O,eu||void 0,eg||0,ek);eb(e),e_(e)}},[G,er,ed,ep,eg,eu,ek,O,ev]),(0,a.useEffect)(()=>{eA&&eA.payment_methods&&1===eA.payment_methods.length&&Y(eA.payment_methods[0].id)},[eA]),eP)return(0,i.jsx)(s.Z,{children:U("freeTrial.checkout.loadingPlans")});if(eI)return(0,i.jsx)(s.Z,{color:"error",children:U("freeTrial.checkout.loadPlansError")});if(eE||!eA)return(0,i.jsx)(s.Z,{children:U("freeTrial.checkout.noPlansFound")});null==eA||eA.payment_methods;let eB=(null==eA?void 0:eA.plans)||[],eV=eB.filter(e=>!0===e.is_subscription),eO=eB.find(e=>e.id===N)||null,eF=eO&&G?eO.ordination<G.ordination?"Upgrade":eO.ordination>G.ordination?"Downgrade":"Plano Atual":"Plano Atual",eQ=()=>{eT(!1)},eU=async()=>{ey(!0);try{if(!(null==eR?void 0:eR.id)){M.Am.error(U("freeTrial.checkout.noSubscriptionFound"));return}await (0,I.uE)(null==eR?void 0:eR.id,"dwongrade_prepaid",{plan_id:null==G?void 0:G.id}),M.Am.success(U("freeTrial.checkout.downgradeScheduled")),eD()}catch(e){console.error(e),M.Am.error(U("freeTrial.checkout.downgradeFailed"))}finally{ey(!1),eQ()}},eG=async()=>{await eD()},eH=e=>{if("5999157d-9978-4cec-974c-1b169eb448ff"===e.id?en("prepaid"):"prepaid"===er&&"5999157d-9978-4cec-974c-1b169eb448ff"!==e.id&&en("monthly"),null===$){el(!0),es(U("freeTrial.checkout.selectPaymentMethod"));return}el(!1),es(""),H(e),eM()},e$=e=>{K(e),ee(!0)},eY=()=>{ee(!1),K(null)};if((null==eq?void 0:eq.is_plan_selected)&&!N&&!V&&n)r=(0,i.jsx)(s.Z,{variant:"h5",align:"center",children:U("freeTrial.checkout.planAlreadySelected")}),null==n||n();else{var eJ;r=(0,i.jsxs)(d.Z,{children:[eO&&W&&(0,i.jsxs)(c.Z,{elevation:2,sx:{p:2,mb:4,display:"flex",justifyContent:"space-around",alignItems:"center",flexWrap:"wrap",gap:2},children:[(0,i.jsxs)(s.Z,{variant:"subtitle1",children:[(0,i.jsx)("strong",{children:U("freeTrial.checkout.currentPlanLabel")})," ",eO.name]}),(0,i.jsxs)(s.Z,{variant:"body1",children:[(0,i.jsx)("strong",{children:U("freeTrial.checkout.licensesLabel")})," ",(B||0)+((null==eR?void 0:eR.licences)||0)]}),(0,i.jsxs)(s.Z,{variant:"body1",children:[(0,i.jsx)("strong",{children:U("freeTrial.checkout.statusLabel")})," ",(null==eR?void 0:eR.status)||U("freeTrial.checkout.statusNotFound")]}),(0,i.jsxs)(s.Z,{variant:"body1",sx:{textTransform:"capitalize"},children:[(0,i.jsx)("strong",{children:U("freeTrial.checkout.cycleLabel")})," ","monthly"===W?U("freeTrial.checkout.monthly"):"annual"===W?U("freeTrial.checkout.annual"):W.replace(/_/g," ")
1]}),(0,i.jsxs)(s.Z,{variant:"subtitle1",children:[(0,i.jsx)("strong",{children:U("freeTrial.checkout.costLabel")})," ",(0,S.e_)(((null==eR?void 0:eR.total_amount)||0)/100),"monthly"===W?U("freeTrial.checkout.perMonth"):"annual"===W?U("freeTrial.checkout.perYear"):""]}),(0,i.jsxs)(s.Z,{variant:"subtitle1",sx:{display:"flex",alignItems:"center",gap:1},children:[(0,i.jsxs)("strong",{children:["prepaid"===W?U("freeTrial.checkout.autoRecharge"):U("freeTrial.checkout.autoRenewal"),":"]}),"prepaid"===W?(0,i.jsx)(L.__,{color:(null==eR?void 0:eR.auto_reload_credits)?"success":"error",children:(null==eR?void 0:eR.auto_reload_credits)?U("freeTrial.checkout.enabled"):U("freeTrial.checkout.disabled")}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(L.__,{color:(null==eR?void 0:eR.cancel_at_period_end)?"success":"warning",children:(null==eR?void 0:eR.cancel_at_period_end)?U("freeTrial.checkout.enabled"):U("freeTrial.checkout.disabled")}),(null==eR?void 0:eR.end_date)&&(null==eR?void 0:eR.cancel_at_period_end)&&(0,i.jsxs)(s.Z,{variant:"body2",children:[(0,i.jsx)("strong",{children:U("freeTrial.checkout.expiresAt")})," ",new Date(eR.end_date).toLocaleDateString()]})]})]})]}),eO&&(0,i.jsx)(s.Z,{variant:"h4",align:"center",sx:{mb:3},children:U("freeTrial.checkout.changePlanTitle")}),F&&(0,i.jsx)(u.Z,{severity:"warning",sx:{mb:3,fontWeight:"bold"},children:U("freeTrial.checkout.subscriptionExpiredAlert")}),(0,i.jsx)(m.Z,{component:c.Z,sx:{mb:4,border:"1px solid #ccc",borderRadius:"8px"},children:(0,i.jsxs)(p.Z,{children:[(0,i.jsxs)(h.Z,{children:[(0,i.jsxs)(g.Z,{children:[(0,i.jsxs)(x.Z,{children:[(0,i.jsx)(d.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:1},children:(0,i.jsx)(s.Z,{children:U("freeTrial.checkout.plansHeader")})}),(0,i.jsxs)(d.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:1},children:[(0,i.jsx)(s.Z,{children:U("freeTrial.checkout.monthly")}),(0,i.jsx)(f.Z,{checked:"annual"===er,onChange:e=>en(e.target.checked?"annual":"monthly")}),(0,i.jsx)(s.Z,{children:U("freeTrial.checkout.annual")})]})]}),eV.map(e=>(0,i.jsxs)(x.Z,{align:"center",children:[(0,i.jsx)(d.Z,{component:"img",src:"/assets/images/plans/".concat(e.id,".webp"),alt:e.id,sx:{width:"80px",height:"80px",objectFit:"contain",margin:"0 auto"}}),(0,i.jsx)(s.Z,{sx:{fontSize:"1.1rem",fontWeight:"bold",alignItems:"center",justifyContent:"center",display:"flex"},variant:"body1",children:e.name}),(0,i.jsx)(s.Z,{variant:"body2",color:"text.secondary",sx:{fontSize:"0.8rem",alignItems:"center",display:"flex",justifyContent:"center"},children:e.model}),(0,i.jsx)(b.Z,{variant:"contained",color:N===e.id&&F?"warning":"info",sx:{mt:1},onClick:()=>{H(e),eH(e)},disabled:N===e.id&&!F,children:eO?eO.ordination<e.ordination?"Upgrade":eO.ordination>e.ordination?"Downgrade":F?U("freeTrial.checkout.renewButton"):U("freeTrial.checkout.currentPlanButton"):e.monthly_price?U("freeTrial.checkout.subscribeButton"):U("freeTrial.checkout.acquireButton")})]},e.id))]}),(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(x.Z,{align:"center",children:U("freeTrial.checkout.monthlySubscription")}),eV.map(e=>(0,i.jsx)(x.Z,{align:"center",sx:{backgroundColor:"monthly"===er?"#e0e0e0":"inherit"},children:e.monthly_price?"R$ ".concat(((e.monthly_price||0)/100).toFixed(2)):U("freeTrial.checkout.notApplicable")},e.id))]}),(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(x.Z,{align:"center",children:U("freeTrial.checkout.annualSubscription")}),eV.map(e=>(0,i.jsx)(x.Z,{align:"center",sx:{backgroundColor:"annual"===er?"#e0e0e0":"inherit"},children:e.annual_price?"R$ ".concat(((e.annual_price||0)/100).toFixed(2)):U("freeTrial.checkout.notApplicable")},e.id))]})]}),(0,i.jsx)(v.Z,{children:((null===(eJ=eV[0])||void 0===eJ?void 0:eJ.resources)||[]).map((e,r)=>(0,i.jsxs)(g.Z,{children:[(0,i.jsx)(x.Z,{children:(0,i.jsxs)(d.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[e.short_name,(0,i.jsx)(_.Z,{onClick:()=>e$(e),children:(0,i.jsx)(o.Z,{})})]})}),eV.map(e=>{var n,t,a,l;return(0,i.jsx)(x.Z,{align:"center",sx:{backgroundColor:(null===(n=e.resources[r])||void 0===n?void 0:n.is_price_percentage)||"prepaid"!==er||(null===(t=e.resources[r])||void 0===t?void 0:t.is_subscription)?"white":"#e0e0e0"},children:null!==(l=null===(a=e.resources[r])||void 0===a?void 0:a.total_string)&&void 0!==l?l:"-"},e.id)})]},e.id))})]})}),(0,i.jsxs)(j.Z,{open:X,onClose:eY,children:[(0,i.jsx)(y.Z,{children:null==J?void 0:J.name}),(0,i.jsxs)(Z.Z,{children:[(0,i.jsx)(s.Z,{variant:"subtitle1",sx:{mb:1},children:null==J?void 0:J.title}),(0,i.jsxs)(s.Z,{variant:"body2",children:[null==J?void 0:J.headline," ",null==J?void 0:J.description]})]}),(0,i.jsx)(T.Z,{children:(0,i.jsx)(b.Z,{onClick:eY,color:"primary",children:U("freeTrial.checkout.closeButton")})})]}),(0,i.jsxs)(j.Z,{open:eZ,onClose:eQ,children:[(0,i.jsx)(y.Z,{children:U("freeTrial.checkout.confirmDowngradeTitle")}),(0,i.jsx)(Z.Z,{children:(0,i.jsx)(k.Z,{children:U("freeTrial.checkout.confirmDowngradeText")})}),(0,i.jsxs)(T.Z,{children:[(0,i.jsx)(b.Z,{onClick:eQ,children:U("freeTrial.checkout.keepCurrentPlan")}),(0,i.jsx)(l.Z,{onClick:eU,color:"warning",variant:"contained",loading:ej,children:U("freeTrial.checkout.confirmDowngradeButton")})]})]}),(0,i.jsx)(E.Z,{currentPaymentMethodId:R,checkUserSession:eL||(()=>{}),resourcePlans:eA,open:ei,user:eq,organizationData:P,plan:G,billingCycle:er,setOpenExperimentModal:et,licensedMembersCount:ed,setLicensedMembersCount:ec,currentCost:ef,selectedPaymentMethod:$,currentAutoReloadCredits:null==eR?void 0:eR.auto_reload_credits,currentAutoReloadValue:(null==eR?void 0:eR.auto_reload_credit_value)?eR.auto_reload_credit_value/100:void 0,currentMinCreditThreshold:(null==eR?void 0:eR.min_credit_threshold)?eR.min_credit_threshold/100:void 0,currentTotalAmount:eg||void 0,apliedData:eu,creditValue:ep,setCreditValue:eh,setApliedData:em,calculatedPrice:ev,setCalculatedPrice:e_,chargeType:O,creditAmount:ek,setCreditAmount:ez,billingMutate:eG,remainingPercentage:eC,subscriptionExpired:F,planChangeType:eF,currentPlanMutate:Q})]})}return(0,i.jsxs)(z.Z,{sx:{pt:3,pb:10,borderRadius:"8px",mx:"auto"},children:[!N&&(0,i.jsx)(s.Z,{variant:"h3",align:"center",sx:{mb:2},children:U("freeTrial.checkout.choosePlanTitle")}),!N&&(0,i.jsx)(u.Z,{severity:"info",sx:{mb:3,fontSize:"1rem",fontWeight:"bold",textAlign:"center"},children:U("freeTrial.checkout.freeTrialAlert")}),ea&&(0,i.jsx)(u.Z,{severity:"warning",onClose:()=>el(!1),sx:{mb:2},children:eo}),r]})}},46659:function(e,r,n){"use strict";n.d(r,{c:function(){return M}});var i=n(57437),t=n(31229),a=n(16682),l=n.n(a),o=n(29501),s=n(13590),d=n(2265),c=n(77584),u=n(50290),m=n(41327),p=n(46387),h=n(89126),g=n(72608),x=n(85147),f=n(56326),b=n(37685),v=n(63832),_=n(39155),j=n(98489),y=n(20337),Z=n(65055),T=n(63226),k=n(1400),z=n(87970),C=n(19606),S=n(35453),w=n(5898);let q=t.z.object({doc_type:t.z.enum(["cnpj","cpf","ssn"],{required_error:"Selecione um tipo de documento"}),nickname:t.z.string().min(1,{message:"Nickname \xe9 obrigat\xf3rio!"}),document:t.z.string().min(1,{message:"Documento \xe9 obrigat\xf3rio!"}).max(20,{message:"Documento deve ter no m\xe1ximo 20 caracteres!"}),is_provider:t.z.boolean().default(!1),is_recipient:t.z.boolean().default(!1),is_freelancer:t.z.boolean().default(!1),trading_name:t.z.string().min(1,{message:"Trading name is required!"}),business_name:t.z.string().min(1,{message:"Business name is required!"}),website:t.z.string().optional(),picture:t.z.string().min(1,{message:"Logo/Simbol is required!"}),profile_cover:t.z.string().optional(),address:t.z.string().min(1,{message:"Address is required!"}),address_number:t.z.string().optional(),complement:t.z.string().optional(),city:t.z.string().min(1,{message:"City is required!"}),neighborhood:t.z.string().min(1,{message:"Neighborhood is required!"}),state:t.z.string().min(2,{message:"State is required!"}).max(2,{message:"State must be 2 characters!"}),zip_code:t.z.string().min(8,{message:"Zip Code is required!"}).max(11,{message:"Zip Code must be 11 characters!"}),email:t.z.string().min(1,{message:"Email is required!"}).email({message:"Email must be a valid email address!"}),phone:t.z.string().min(1,{message:"Phone is required!"})}).superRefine((e,r)=>{e.is_provider&&"cnpj"!==e.doc_type&&r.addIssue({code:t.z.ZodIssueCode.custom,message:"Para ser provider o documento deve ser CNPJ.",path:["doc_type"]})}),L=[{value:"AC",label:"Acre"},{value:"AL",label:"Alagoas"},{value:"AP",label:"Amap\xe1"},{value:"AM",label:"Amazonas"},{value:"BA",label:"Bahia"},{value:"CE",label:"Cear\xe1"},{value:"DF",label:"Distrito Federal"},{value:"ES",label:"Esp\xedrito Santo"},{value:"GO",label:"Goi\xe1s"},{value:"MA",label:"Maranh\xe3o"},{value:"MT",label:"Mato Grosso"},{value:"MS",label:"Mato Grosso do Sul"},{value:"MG",label:"Minas Gerais"},{value:"PA",label:"Par\xe1"},{value:"PB",label:"Para\xedba"},{value:"PR",label:"Paran\xe1"},{value:"PE",label:"Pernambuco"},{value:"PI",label:"Piau\xed"},{value:"RJ",label:"Rio de Janeiro"},{value:"RN",label:"Rio Grande do Norte"},{value:"RS",label:"Rio Grande do Sul"},{value:"RO",label:"Rond\xf4nia"},{value:"RR",label:"Roraima"},{value:"SC",label:"Santa Catarina"},{value:"SP",label:"S\xe3o Paulo"},{value:"SE",label:"Sergipe"},{value:"TO",label:"Tocantins"}];function M(e){let r,{activeStep:n,loading:t,handleNext:a,setFormState:M,formState:A,setOrganizationData:E,isModalMode:I=!1}=e,{t:P}=(0,y.qM)("components"),[N,W]=(0,d.useState)(null),[D,R]=(0,d.useState)(!1),[B,V]=(0,d.useState)(null),[O,F]=(0,d.useState)(!1),{user:Q,checkUserSession:U}=(0,S.E)(),G=(0,o.cI)({resolver:(0,s.F)(q),defaultValues:A}),{control:H,handleSubmit:$,setValue:Y,getValues:J,watch:K,setError:X,clearErrors:ee,reset:er,formState:{errors:en}}=G;(0,d.useEffect)(()=>{er(A)},[A,er]);let ei=(0,d.useCallback)(async e=>{let r=e[0];if(r){let e=new FileReader;
1e.readAsDataURL(r),e.onloadend=()=>{Y("picture",e.result,{shouldValidate:!0})}}},[Y]),et=(0,d.useCallback)(async e=>{let r=e[0];if(r){let e=new FileReader;e.readAsDataURL(r),e.onloadend=()=>{Y("profile_cover",e.result,{shouldValidate:!0})}}},[Y]);(0,d.useMemo)(()=>L.find(e=>e.value===A.state)||null,[A.state]);let ea=K("doc_type"),el=K("is_provider"),eo="cpf"===ea?"999.999.999-99":"ssn"===ea?"999-99-9999":"**.***.***/****-**";(0,d.useEffect)(()=>{el&&"cnpj"!==ea&&Y("doc_type","cnpj",{shouldValidate:!0})},[ea,el,Y]);let es=(0,d.useCallback)(async e=>{var r,n,i,t,a,l;let o=J("doc_type"),s=(null===(r=J("nickname"))||void 0===r?void 0:r.trim())||"",d=null===(n=J("document"))||void 0===n?void 0:n.replace(/[^A-Za-z0-9]/g,"").toUpperCase();if(o&&d)try{let r=await (0,C.Qb)({doc_type:o,nickname:s,document:d,field:e});null===(i=null==r?void 0:r.is_unique)||void 0===i||i?(ee(e),"document"===e&&(null==r?void 0:r.payload)&&Object.keys(r.payload).length>0&&W(r.payload)):X(e,{type:"manual",message:"nickname"===e?P("freeTrial.organization.nicknameInUse"):P("freeTrial.organization.documentInUse")})}catch(i){let r=null==i?void 0:null===(t=i.response)||void 0===t?void 0:t.status,n=null==i?void 0:null===(l=i.response)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:a.detail;(404===r||409===r||400===r)&&n?X(e,{type:"manual",message:n}):(console.error("Erro ao verificar unicidade:",i),Z.Am.error(P("freeTrial.organization.validationFailed")))}},[ee,J,X,P]),ed=async e=>{J("doc_type");let{value:r}=e.target;if(r.replace(/[^A-Za-z0-9]/g,"").toUpperCase()){R(!0);try{let e=await es("document");console.log(e)}catch(e){console.error("Erro ao buscar organiza\xe7\xe3o:",e),V(e),W(null)}finally{R(!1)}}},ec=async e=>{if(e.target.value.trim()){R(!0);try{await es("nickname")}finally{R(!1)}}},eu=$(async e=>{try{let r=await (0,C.xb)({doc_type:e.doc_type,nickname:e.nickname,document:e.document.replace(/\D/g,""),is_provider:e.is_provider,is_recipient:e.is_recipient,is_freelancer:e.is_freelancer,trading_name:e.trading_name,business_name:e.business_name,website:e.website,picture:e.picture,profile_cover:e.profile_cover,address:e.address,address_number:(null==e?void 0:e.address_number)||"",complement:(null==e?void 0:e.complement)||"",city:e.city,neighborhood:e.neighborhood,state:e.state,zip_code:e.zip_code.replace(/\D/g,""),email:e.email,phone:e.phone.replace(/\D/g,""),user_id:null==Q?void 0:Q.id});E(r.payload),null==U||U()}catch(e){console.error("Error creating organization:",e)}});return(0,d.useEffect)(()=>{var e,r,n,i,t;if(N){Y("doc_type",(null==N?void 0:N.doc_type)||"cnpj",{shouldValidate:!0}),Y("nickname",N.nickname||"",{shouldValidate:!0}),Y("document",(null==N?void 0:N.document)||N.document||"",{shouldValidate:!0}),Y("is_provider",null!==(e=null==N?void 0:N.is_provider)&&void 0!==e&&e,{shouldValidate:!0}),Y("is_recipient",null!==(r=null==N?void 0:N.is_recipient)&&void 0!==r&&r,{shouldValidate:!0}),Y("is_freelancer",null!==(n=null==N?void 0:N.is_freelancer)&&void 0!==n&&n,{shouldValidate:!0}),Y("trading_name",N.trading_name||"",{shouldValidate:!0}),Y("business_name",N.business_name||"",{shouldValidate:!0}),Y("website",N.website||"",{shouldValidate:!0}),Y("address",N.address||"",{shouldValidate:!0}),Y("address_number",N.address_number||"",{shouldValidate:!0}),Y("complement",N.complement||"",{shouldValidate:!0}),Y("city",N.city||"",{shouldValidate:!0}),Y("neighborhood",N.neighborhood||"",{shouldValidate:!0}),Y("state",N.state||"",{shouldValidate:!0}),Y("zip_code",N.zip_code||"",{shouldValidate:!0}),Y("email",N.email||"",{shouldValidate:!0});let i=N.phone||"";if(i){if(i.startsWith("+"))Y("phone",i,{shouldValidate:!0});else{let e=i.replace(/\D/g,"");Y("phone","+55".concat(e),{shouldValidate:!0})}}else Y("phone","",{shouldValidate:!0})}if(B){let e=(null==B?void 0:null===(t=B.response)||void 0===t?void 0:null===(i=t.data)||void 0===i?void 0:i.detail)||P("freeTrial.organization.documentNotFound");Z.Am.error(e)}},[N,B,Y,P]),(0,d.useEffect)(()=>{F((null==Q?void 0:Q.is_email_confirmed)&&(null==Q?void 0:Q.is_company_registered)),!I&&O&&a()},[I,O,a,Q,F]),r=!I&&O?(0,i.jsx)(w.S,{}):(0,i.jsxs)(T.l0,{methods:G,onSubmit:eu,children:[(0,i.jsx)(o.Qr,{name:"doc_type",control:H,render:e=>{var r;let{field:n}=e;return(0,i.jsxs)(c.Z,{...n,select:!0,label:P("freeTrial.organization.docTypeLabel"),fullWidth:!0,margin:"normal",required:!0,error:!!en.doc_type,helperText:null===(r=en.doc_type)||void 0===r?void 0:r.message,children:[(0,i.jsx)(u.Z,{value:"cnpj",children:P("freeTrial.organization.docTypeCnpj")}),(0,i.jsx)(u.Z,{value:"cpf",children:P("freeTrial.organization.docTypeCpf")}
1),(0,i.jsx)(u.Z,{value:"ssn",children:P("freeTrial.organization.docTypeSsn")})]})}}),(0,i.jsxs)(m.Z,{margin:"normal",component:"fieldset",error:!!en.doc_type,children:[(0,i.jsx)(p.Z,{variant:"subtitle1",sx:{mb:1},children:P("freeTrial.organization.platformUsageQuestion")}),(0,i.jsxs)(h.Z,{row:!0,children:[(0,i.jsx)(o.Qr,{name:"is_provider",control:H,render:e=>{let{field:r}=e;return(0,i.jsx)(g.Z,{control:(0,i.jsx)(x.Z,{...r,checked:r.value,color:"primary"}),label:P("freeTrial.organization.asAgency")})}}),(0,i.jsx)(o.Qr,{name:"is_recipient",control:H,render:e=>{let{field:r}=e;return(0,i.jsx)(g.Z,{control:(0,i.jsx)(x.Z,{...r,checked:r.value,color:"primary"}),label:P("freeTrial.organization.asClient")})}}),(0,i.jsx)(o.Qr,{name:"is_freelancer",control:H,render:e=>{let{field:r}=e;return(0,i.jsx)(g.Z,{control:(0,i.jsx)(x.Z,{...r,checked:r.value,color:"primary"}),label:P("freeTrial.organization.asFreelancer")})}})]}),en.doc_type&&(0,i.jsx)(f.Z,{error:!0,children:en.doc_type.message})]}),(0,i.jsx)(o.Qr,{name:"document",control:H,render:e=>{let{field:r}=e;return(0,i.jsx)(l(),{mask:eo,value:r.value,onChange:e=>{let n=e.target.value.toUpperCase();r.onChange({...e,target:{...e.target,value:n}})},onBlur:e=>{r.onBlur(),ed(e)},children:e=>{var r;return(0,i.jsx)(c.Z,{...e,label:P("freeTrial.organization.documentLabel"),fullWidth:!0,margin:"normal",required:!0,error:!!en.document,helperText:null===(r=en.document)||void 0===r?void 0:r.message,inputProps:{...e.inputProps,style:{textTransform:"uppercase"}}})}})}}),(0,i.jsx)(o.Qr,{name:"nickname",control:H,render:e=>{var r;let{field:n}=e;return(0,i.jsx)(c.Z,{...n,label:"Nickname",fullWidth:!0,margin:"normal",required:!0,onBlur:e=>{n.onBlur(),ec(e)},error:!!en.nickname,helperText:null===(r=en.nickname)||void 0===r?void 0:r.message})}}),(0,i.jsx)(T.gN.Text,{label:P("freeTrial.organization.tradingNameLabel"),name:"trading_name",fullWidth:!0,margin:"normal",required:!0}),(0,i.jsx)(T.gN.Text,{label:P("freeTrial.organization.businessNameLabel"),name:"business_name",fullWidth:!0,margin:"normal",required:!0}),(0,i.jsx)(T.gN.Text,{label:"Website",name:"website",fullWidth:!0,margin:"normal",required:!0}),(0,i.jsx)(T.gN.Text,{label:P("freeTrial.organization.addressLabel"),name:"address",fullWidth:!0,margin:"normal",required:!0}),(0,i.jsx)(T.gN.Text,{label:P("freeTrial.organization.numberLabel"),name:"address_number",fullWidth:!0,margin:"normal"}),(0,i.jsx)(T.gN.Text,{label:P("freeTrial.organization.complementLabel"),name:"complement",fullWidth:!0,margin:"normal"}),(0,i.jsx)(T.gN.Text,{label:P("freeTrial.organization.cityLabel"),name:"city",fullWidth:!0,margin:"normal",required:!0}),(0,i.jsx)(T.gN.Text,{label:P("freeTrial.organization.neighborhoodLabel"),name:"neighborhood",fullWidth:!0,margin:"normal",required:!0}),(0,i.jsx)(m.Z,{fullWidth:!0,margin:"normal",required:!0,error:!!en.state,children:(0,i.jsx)(o.Qr,{name:"state",control:H,render:e=>{let{field:r}=e;return(0,i.jsx)(b.Z,{...r,options:L,getOptionLabel:e=>e.label,value:L.find(e=>e.value===r.value)||null,onChange:(e,n)=>r.onChange(n?n.value:""),renderInput:e=>{var r;return(0,i.jsx)(c.Z,{...e,label:P("freeTrial.organization.stateLabel"),margin:"normal",fullWidth:!0,required:!0,error:!!en.state,helperText:null===(r=en.state)||void 0===r?void 0:r.message})}})}})}),(0,i.jsx)(o.Qr,{name:"zip_code",control:H,render:e=>{let{field:r}=e;return(0,i.jsx)(l(),{mask:"99.999-999",value:r.value,onChange:r.onChange,onBlur:r.onBlur,children:e=>{var r;return(0,i.jsx)(c.Z,{...e,label:P("freeTrial.organization.zipCodeLabel"),fullWidth:!0,margin:"normal",required:!0,error:!!en.zip_code,helperText:null===(r=en.zip_code)||void 0===r?void 0:r.message})}})}}),(0,i.jsx)(T.gN.Text,{label:"E-mail",name:"email",type:"email",fullWidth:!0,margin:"normal",required:!0}),(0,i.jsx)(T.gN.Phone,{sx:{paddingTop:"15px"},name:"phone",label:P("freeTrial.organization.phoneLabel"),country:"BR",fullWidth:!0}),(0,i.jsxs)(v.Z,{sx:{display:"flex",flexDirection:"column",gap:3,mt:3,p:3,borderRadius:2,border:e=>"1px solid ".concat(e.vars.palette.divider)},children:[(0,i.jsxs)(v.Z,{display:"flex",flexDirection:"column",alignItems:"center",gap:1,children:[(0,i.jsx)(v.Z,{component:"label",sx:{textAlign:"center",fontWeight:"bold",fontSize:"0.875rem"},children:P("freeTrial.organization.logoLabel")}),(0,i.jsx)(v.Z,{component:"span",sx:{textAlign:"center",fontSize:"0.75rem",color:"text.secondary"},children:P("freeTrial.organization.logoHint")}),(0,i.jsx)(o.Qr,{name:"picture",control:H,render:e=>{let{field:r,fieldState:{error:n}}=e;return(0,i.jsx)(z.a,{value:r.value,onDrop:ei,error:!!n,helperText:null==n?void 0:n.message})}})]}),(0,i.jsxs)(v.Z,{display:"flex",flexDirection:"column",alignItems:"center",gap:1,children:[(0,i.jsx)(v.Z,{component:"label",sx:{textAlign:"center",fontWeight:"bold",fontSize:"0.875rem"},children:P("freeTrial.organization.coverLabel")}),(0,i.jsx)(v.Z,{component:"span",sx:{textAlign:"center",fontSize:"0.75rem",color:"text.secondary"},children:P("freeTrial.organization.coverHint")}),(0,i.jsx)(o.Qr,{name:"profile_cover",control:H,render:e=>{let{field:r,fieldState:{error:n}}=e;return(0,i.jsx)(k.g,{value:r.value,onDrop:et,error:!!n,helperText:null==n?void 0:n.message})}})]})]}),(0,i.jsx)(_.Z,{type:"submit",variant:"contained",color:"inherit",disabled:t||D,sx:{padding:"10px 20px",marginTop:4,backgroundColor:0===n?"#ccc":void 0},children:P("freeTrial.organization.submitButton")})]}),(0,i.jsx)(j.Z,{maxWidth:"sm",sx:{pt:3,pb:10,borderRadius:"8px",px:{xs:2,sm:3}}
1,children:(0,i.jsxs)(v.Z,{children:[(0,i.jsx)(p.Z,{variant:"h4",gutterBottom:!0,children:P("freeTrial.organization.title")}),r]})})}},39804:function(e,r,n){"use strict";n.d(r,{h:function(){return i}});let i={root:"mnl__label__root",icon:"mnl__label__icon"}},65738:function(e,r,n){"use strict";n.d(r,{__:function(){return i.Label},hR:function(){return t.h}});var i=n(4498);n(33033);var t=n(39804)},4498:function(e,r,n){"use strict";n.r(r),n.d(r,{Label:function(){return d}});var i=n(57437),t=n(2265),a=n(63832),l=n(31691),o=n(33033),s=n(39804);let d=(0,t.forwardRef)((e,r)=>{let{children:n,color:t="default",variant:d="soft",startIcon:c,endIcon:u,sx:m,className:p,...h}=e,g=(0,l.Z)(),x={width:16,height:16,"& svg, img":{width:1,height:1,objectFit:"cover"}};return(0,i.jsxs)(o.StyledLabel,{ref:r,component:"span",className:s.h.root.concat(p?" ".concat(p):""),ownerState:{color:t,variant:d},sx:{...c&&{pl:.75},...u&&{pr:.75},...m},theme:g,...h,children:[c&&(0,i.jsx)(a.Z,{component:"span",className:s.h.icon,sx:{mr:.75,...x},children:c}),"string"==typeof n?n.charAt(0).toUpperCase()+n.slice(1):n,u&&(0,i.jsx)(a.Z,{component:"span",className:s.h.icon,sx:{ml:.75,...x},children:u})]})})},33033:function(e,r,n){"use strict";n.r(r),n.d(r,{StyledLabel:function(){return l}});var i=n(63832),t=n(16210),a=n(43073);let l=(0,t.ZP)(i.Z)(e=>{let{theme:r,ownerState:{color:n,variant:i}}=e,t={..."default"===n&&{..."filled"===i&&{color:r.vars.palette.common.white,backgroundColor:r.vars.palette.text.primary,[a.s4.dark]:{color:r.vars.palette.grey[800]}},..."outlined"===i&&{backgroundColor:"transparent",color:r.vars.palette.text.primary,border:"2px solid ".concat(r.vars.palette.text.primary)},..."soft"===i&&{color:r.vars.palette.text.secondary,backgroundColor:(0,a.jr)(r.vars.palette.grey["500Channel"],.16)},..."inverted"===i&&{color:r.vars.palette.grey[800],backgroundColor:r.vars.palette.grey[300]}}},l={..."default"!==n&&{..."filled"===i&&{color:r.vars.palette[n].contrastText,backgroundColor:r.vars.palette[n].main},..."outlined"===i&&{backgroundColor:"transparent",color:r.vars.palette[n].main,border:"2px solid ".concat(r.vars.palette[n].main)},..."soft"===i&&{color:r.vars.palette[n].dark,backgroundColor:(0,a.jr)(r.vars.palette[n].mainChannel,.16),[a.s4.dark]:{color:r.vars.palette[n].light}},..."inverted"===i&&{color:r.vars.palette[n].darker,backgroundColor:r.vars.palette[n].lighter}}};return{height:24,minWidth:24,lineHeight:0,cursor:"default",alignItems:"center",whiteSpace:"nowrap",display:"inline-flex",justifyContent:"center",padding:r.spacing(0,.75),fontSize:r.typography.pxToRem(12),fontWeight:r.typography.fontWeightBold,borderRadius:.75*r.shape.borderRadius,transition:r.transitions.create("all",{duration:r.transitions.duration.shorter}),...t,...l}})},24366:function(e,r,n){"use strict";function i(e,r,n,i,t,a,l){var o,s;if(!e||!r)return 0;let d=0,c=Number((null==e?void 0:null===(s=e.resources)||void 0===s?void 0:null===(o=s[0])||void 0===o?void 0:o.quantity)||0);c*=Number((null==e?void 0:e.discount_factor)||0)/100;let u=0;u=("annual"===r?12*Number(n||0)*c:c*Number(n||0))+(l||0);let m=null==e?void 0:e.credit_price;return d=Number(u*((null==m?void 0:m.price)||0)),"prepaid"===r?d-=Number(a||0):"monthly"===r&&"new_recharge"!==i?(d+=Number(e.monthly_price||0),d-=Number(a||0)):"annual"===r&&"new_recharge"!==i&&(d+=Number(e.annual_price||0),d-=Number(a||0)),t&&(t.is_percent?d*=1-Number(t.discount)/100:d-=Number(t.amount||0)),d}n.d(r,{e:function(){return i}})}}]);
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.