"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2588],{51699:function(e,r,l){var t=l(85893);l(67294);var i=l(74764),n=l(27727),a=l(96413);let o=e=>{let{disabled:r,children:l,...o}=e;return(0,t.jsx)(i.gU,{polling:{enabled:!1},render:e=>{let{online:i}=e;return(0,t.jsxs)(n.Z,{disabled:r||!i,...o,children:[!i&&(0,t.jsx)(a.Z,{sx:{marginRight:"10px"}}),l]})}})};o.propTypes={...n.Z.propTypes},r.Z=o},60794:function(e,r,l){var t=l(85893),i=l(67294),n=l(45697),a=l.n(n),o=l(50135),s=l(42579);let d=e=>{let{onBlur:r,autoComplete:l,errorMessage:n,required:a,fullWidth:d=!0,countryCode:u,variant:c="filled",placeholder:h,...m}=e,[p,y,x]=(0,i.useMemo)(()=>{let e=new Intl.DateTimeFormat(u,{year:"numeric",month:"2-digit",day:"2-digit"}),r=e.format(new Date(1990,6,14)),l=r.replace("07","MM").replace("14","dd").replace("1990","yyyy"),t=r.replace("07","__").replace("14","__").replace("1990","____");return[r,l,t]},[u]);return(0,t.jsx)(s.M,{inputFormat:y,toolbarPlaceholder:h||p,mask:x,renderInput:e=>{let{inputProps:i,...s}=e;return(0,t.jsx)(o.Z,{...s,variant:c,fullWidth:d,error:!!n,helperText:n,onBlur:r,required:a,autoComplete:l,inputProps:{...i,placeholder:h||p}})},...m})};d.propTypes={countryCode:a().string.isRequired,onBlur:a().func},r.Z=d},27727:function(e,r,l){var t=l(85893);l(67294);var i=l(45697),n=l.n(i),a=l(42992),o=l(98456),s=l(90948),d=l(24697);let u=(0,s.ZP)(o.Z,{name:"ButtonCircularProgress"})({position:"absolute",top:"50%",left:"50%",marginTop:"-12px",marginLeft:"-12px"}),c=(0,s.ZP)("div",{name:"WrapperDiv"})({position:"relative"}),h=e=>{let{loading:r,disabled:l,children:i,onClick:n,sx:o,...s}=e,h=(0,d.y1)(e=>{n&&n(e)},300,{leading:!0});return(0,t.jsxs)(c,{sx:o,children:[(0,t.jsx)(a.Z,{color:"primary",variant:"contained",size:"large",disabled:r||l,onClick:h,...s,children:i}),r&&(0,t.jsx)(u,{size:24})]})};h.propTypes={...a.Z.propTypes,loading:n().bool.isRequired,disabled:n().bool},r.Z=h},5149:function(e,r,l){var t=l(85893),i=l(67294),n=l(45697),a=l.n(n),o=l(26793),s=l(9473),d=l(33841),u=l(56815),c=l(94054),h=l(86886),m=l(18360),p=l(50135),y=l(21187),x=l(18205),C=l(94011),P=l(65550),g=l(98809),v=l(97770),j=l(15526),f=l(64069);let Z=e=>{let{state:r,dispatch:l,errors:n,disabled:a=!1,loading:Z=!1,required:R=!0,isKiosk:b}=e,E=(0,s.v9)(e=>e.clubInfo.API_KEY),I=(0,s.v9)(e=>e.clubInfo.API_PATH),T=(0,s.v9)(e=>e.address.loaded),q=(0,s.v9)(e=>e.address.loading),M=(0,s.v9)(e=>e.address.countries),F=(0,s.v9)(e=>e.address.level1),N=(0,s.I0)(),B=(0,C.ml)(),k=(0,i.useMemo)(()=>Math.random().toString(36).substring(7),[]),W=(0,i.useMemo)(()=>Math.random().toString(36).substring(7),[]),[D,A,w]=(0,o.$)(["client"]),O=(0,i.useMemo)(()=>({country:D("Country"),streetOne:D("AddressLineOne"),streetTwo:D("AddressLineTwo")}),[D,w]),S=(0,i.useMemo)(()=>{let e="dr"===A.language?"en":A.language,r=M.map(r=>({code:"AA"===r.code?Math.random().toString(36).substring(7):r.code,name:"AA"===r.code?r.name:(0,f.pD)(r.code,e)})),l=r.sort((0,f.V2)("name"));return l},[M,A,w]),_=(0,i.useMemo)(()=>Array.isArray(F[r.Country])?F[r.Country]:null,[F,r.Country]);(0,i.useEffect)(()=>{if(q||T)return;N((0,g.e)()),N((0,v.JR)());let e=async()=>{try{let e=await (0,j.ox)(I,E);N((0,v.kL)(e))}catch(e){console.debug(e),N((0,v.kL)([{Code:"US",Name:"United States",Level1:null}]))}finally{N((0,g.I)())}};e()},[q,T]);let U=(0,i.useMemo)(()=>"CR"===r.Country?D("District"):D("City"),[r.Country,w]),L=(0,i.useMemo)(()=>null!==_,[_]),V=(0,i.useMemo)(()=>null===_&&"DO"!==r.Country,[_,r.Country]),H=(0,i.useMemo)(()=>{switch(r.Country){case"MX":case"US":return D("State");case"SV":case"HN":case"NI":return D("Department");default:return D("Province")}},[r.Country,w]),G=(0,i.useMemo)(()=>"CR"!==r.Country&&"SV"!==r.Country&&"HN"!==r.Country&&"NI"!==r.Country,[r.Country]),$=(0,i.useMemo)(()=>"PA"===r.Country?D("District"):D("ZipCode"),[r.Country,w]),z=(0,P.vt)(l),K=(0,P.QJ)(l);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.ZP,{item:!0,xs:12,children:q||Z?(0,t.jsx)(y.Z,{}):(0,t.jsxs)(c.Z,{variant:"filled",error:!!n.Country,required:R,fullWidth:!0,disabled:a,children:[(0,t.jsx)(d.Z,{htmlFor:k,children:O.country}),(0,t.jsx)(m.Z,{native:!0,value:r.Country,onChange:z("Country"),onBlur:K("Country"),inputProps:{id:k,autoComplete:"country"},children:S.map(e=>(0,t.jsx)("option",{value:e.code,children:e.name},"country-".concat(e.code)))}),!!n.Country&&(0,t.jsx)(u.Z,{children:n.Country})]})}),(0,t.jsx)(h.ZP,{item:!0,xs:12,lg:6,children:Z?(0,t.jsx)(y.Z,{}):(0,t.jsx)(x.Z,{variant:"filled",label:O.streetOne,autoComplete:b?"none":"address-line1",fullWidth:!0,required:R,value:r.StreetOne,error:!!n.StreetOne,helperText:n.StreetOne,onChange:z("StreetOne"),onBlur:K("StreetOne"),disabled:a,characterLimit:B.StreetOne})}),(0,t.jsx)(h.ZP,{item:!0,xs:12,lg:6,children:Z?(0,t.jsx)(y.Z,{}):(0,t.jsx)(x.Z,{variant:"filled",label:O.streetTwo,autoComplete:b?"none":"address-line2",fullWidth:!0,value:r.StreetTwo,error:!!n.StreetTwo,helperText:n.StreetTwo,onChange:z("StreetTwo"),onBlur:K("StreetTwo"),disabled:a,characterLimit:B.StreetTwo})}),(0,t.jsx)(h.ZP,{item:!0,xs:12,lg:6,children:Z?(0,t.jsx)(y.Z,{}):(0,t.jsx)(x.Z,{variant:"filled",label:U,autoComplete:b?"none":"address-level2",fullWidth:!0,required:R,value:r.City,error:!!n.City,helperText:n.City,onChange:z("City"),onBlur:K("City"),disabled:a,characterLimit:B.City})}),L&&(0,t.jsx)(h.ZP,{item:!0,xs:12,lg:3,children:q||Z?(0,t.jsx)(y.Z,{}):(0,t.jsxs)(c.Z,{variant:"filled",error:!!n.State,required:R,fullWidth:!0,disabled:a,children:[(0,t.jsx)(d.Z,{htmlFor:W,children:H}),(0,t.jsxs)(m.Z,{native:!0,labelId:W,value:r.State,onChange:z("State"),onBlur:K("State"),inputProps:b?{id:W}:{id:W,autoComplete:"address-level1"},children:[(0,t.jsx)("option",{value:""}),_.map(e=>(0,t.jsx)("option",{value:e.Code,children:e.Name},"state-".concat(e.Code)))]}),n.State&&(0,t.jsx)(u.Z,{children:n.State})]})}),V&&(0,t.jsx)(h.ZP,{item:!0,xs:12,lg:3,children:Z?(0,t.jsx)(y.Z,{}):(0,t.jsx)(x.Z,{variant:"filled",label:H,autoComplete:b?"none":"address-level1",fullWidth:!0,required:R,value:r.State,error:!!n.State,helperText:n.State,onChange:z("State"),onBlur:K("State"),disabled:a,characterLimit:32})}),G&&(0,t.jsx)(h.ZP,{item:!0,xs:12,lg:3,children:Z?(0,t.jsx)(y.Z,{}):(0,t.jsx)(p.Z,{variant:"filled",label:$,autoComplete:b?"none":"postal-code",fullWidth:!0,required:R,value:r.ZipCode,error:!!n.ZipCode,helperText:n.ZipCode,onChange:z("ZipCode"),onBlur:K("ZipCode"),disabled:a})})]})};Z.propTypes={state:a().object.isRequired,dispatch:a().func.isRequired,errors:a().object.isRequired,required:a().bool},r.Z=Z},23647:function(e,r,l){l.d(r,{Z:function(){return H}});var t=l(85893),i=l(67294),n=l(9473),a=l(45697),o=l.n(a),s=l(26793),d=l(87431),u=l(69368),c=l(6135),h=l(94054),m=l(50480),p=l(56815),y=l(86886),x=l(33841),C=l(18972),P=l(18360),g=l(50135),v=l(23972),j=l(5149),f=l(60794),Z=l(48966),R=l(42992),b=l(18205),E=l(53756),I=l(98809),T=l(65550),q=l(55075);let M={showOverride:!1,suggestion:null,suggestionMessage:""},F=e=>{var r,l;let{client:a,clientDispatch:o,errors:d,fields:u,isKiosk:c,maxLengths:h,location:m}=e,p=(0,n.v9)(e=>e.clubInfo.API_KEY),x=(0,n.v9)(e=>e.clubInfo.API_PATH),C=(0,n.v9)(e=>e.clubs.selectedClub),P=(0,q.P)(),[v,,j]=(0,s.$)(["client","common"]),f=(0,i.useMemo)(()=>({email:v("Email"),emailIsCorrect:v("EmailIsCorrect"),no:v("common:No"),verifyEmail:v("VerifyEmail"),yes:v("common:Yes")}),[v,j]),F=(0,n.I0)(),N=(e,r)=>{switch(r.type){case"suggestion":return{...e,suggestion:r.payload,suggestionMessage:r.payload?v("EmailDidYouMean",{suggestion:r.payload}):""};case"AcceptSuggestion":return{...e,suggestion:"",showOverride:!1};default:return{...e,[r.type]:r.payload}}},[B,k]=(0,i.useReducer)(N,M),W=async e=>{let r={ClubId:C.ID,Email:e,ClientId:a.ClientId?a.ClientId:null,Location:m};F((0,I.e)());try{let e=await (0,E.oH)(x,p,r,P.current.signal);if(!e)return;o({type:"EmailValidated",payload:!0}),k({type:"suggestion",payload:e.Suggestion}),o({type:"EmailInvalid",payload:e.Invalid}),k({type:"showOverride",payload:e.Invalid&&!1===C.EmailValidationRequired})}catch(e){console.error(e)}finally{F((0,I.I)())}},D=()=>{let e=B.suggestion;o({type:"EmailInvalid",payload:!1}),o({type:"EmailValidated",payload:!1}),k({type:"AcceptSuggestion"}),o({type:"Email",payload:e}),W(e)},A=()=>{k({type:"suggestion",payload:""})},w=()=>{o({type:"EmailInvalid",payload:!1}),k({type:"showOverride",payload:!1})},O=(0,T.vt)(o),S=(0,T.QJ)(o);return(0,t.jsxs)(t.Fragment,{children:[!!u.Email&&(0,t.jsxs)(y.ZP,{item:!0,xs:12,lg:6,children:[(0,t.jsx)(b.Z,{variant:"filled",label:f.email,autoComplete:c?"none":"email",fullWidth:!0,required:u.Email.isRequired,value:a.Email,error:!!B.suggestion||!!d.Email,helperText:B.suggestionMessage||d.Email,onChange:e=>{o({type:"EmailInvalid",payload:!1}),o({type:"Email",payload:e.target.value}),o({type:"EmailValidated",payload:!1}),k({type:"showOverride",payload:!1})},onBlur:(r=a.Email,l=a.EmailValidated,e=>{k({type:"suggestion",payload:""}),C.EmailValidationEnabled&&m&&!l&&!(0,Z.isEmpty)(r)&&(0,Z.isEmail)(r)&&W(r),o({type:"blurred",payload:"Email"})}),characterLimit:h.Email}),!!B.suggestion&&(0,t.jsxs)(y.ZP,{container:!0,justifyContent:"flex-end",children:[(0,t.jsx)(R.Z,{color:"primary",onClick:A,children:f.no}),(0,t.jsx)(R.Z,{color:"primary",onClick:D,children:f.yes})]}),!B.suggestion&&B.showOverride&&(0,t.jsx)(y.ZP,{container:!0,justifyContent:"flex-end",children:(0,t.jsx)(R.Z,{color:"primary",onClick:w,children:f.emailIsCorrect})})]}),!!u.EmailVerification&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(g.Z,{variant:"filled",label:f.verifyEmail,autoComplete:c?"none":"email",fullWidth:!0,required:!0,value:a.VerifyEmail,error:!!d.VerifyEmail,helperText:d.VerifyEmail,onChange:O("VerifyEmail"),onBlur:S("VerifyEmail")})})]})};F.propTypes={client:o().object.isRequired,clientDispatch:o().func.isRequired,errors:o().object.isRequired,fields:o().object.isRequired,isKiosk:o().bool,maxLengths:o().object.isRequired,location:o().string};var N=l(96420),B=l(33454);let k=e=>{let{client:r,clientDispatch:l,errors:n,fields:a,isKiosk:o,isV6:u}=e,c=(0,T.vt)(l),h=(0,T.QJ)(l),m=e=>{let t=(0,d._)(r.HomePhone,r.Country);t&&t.isValid()&&l({type:"HomePhone",payload:t.formatNational()});let i=h(e);i(e)},p=e=>{let t=(0,d._)(r.WorkPhone,r.Country);t&&t.isValid()&&l({type:"WorkPhone",payload:t.formatNational()});let i=h(e);i(e)},x=e=>{let t=(0,d._)(r.CellPhone,r.Country);t&&t.isValid()&&l({type:"CellPhone",payload:t.formatNational()});let i=h(e);i(e)},C=(e,r)=>{l({type:"PhoneType",payload:r})},[P,j,f]=(0,s.$)(["client"]),Z=(0,i.useMemo)(()=>({homePhone:P("client:HomePhone"),cellPhone:P("client:CellPhone"),workPhone:P("client:WorkPhone"),preferredContactPhone:P("client:PreferredContactPhone")}),[P,f]);return(0,i.useEffect)(()=>{a.HomePhone||"Home"!==r.PhoneType?a.WorkPhone||"Work"!==r.PhoneType?a.AltPhone||"Cell"!==r.PhoneType||l({type:"PhoneType",payload:a.HomePhone?"Home":"Work"}):l({type:"PhoneType",payload:a.AltPhone?"Cell":"Home"}):l({type:"PhoneType",payload:a.AltPhone?"Cell":"Work"})},[r.PhoneType,a]),(0,t.jsxs)(t.Fragment,{children:[!!a.HomePhone&&(0,t.jsx)(y.ZP,{item:!0,xs:12,children:(0,t.jsx)(g.Z,{variant:"filled",label:Z.homePhone,autoComplete:o?"none":"tel",fullWidth:!0,value:r.HomePhone,error:!!n.HomePhone,helperText:n.HomePhone,onChange:c("HomePhone"),onBlur:m,required:"Home"===r.PhoneType||u&&a.HomePhone.isRequired})}),!!a.AltPhone&&(0,t.jsx)(y.ZP,{item:!0,xs:12,children:(0,t.jsx)(g.Z,{variant:"filled",label:Z.cellPhone,autoComplete:o?"none":"tel",fullWidth:!0,value:r.CellPhone,error:!!n.CellPhone,helperText:n.CellPhone,onChange:c("CellPhone"),onBlur:x,required:"Cell"===r.PhoneType||u&&a.AltPhone.isRequired})}),!!a.WorkPhone&&(0,t.jsx)(y.ZP,{item:!0,xs:12,children:(0,t.jsx)(g.Z,{variant:"filled",label:Z.workPhone,autoComplete:o?"none":"tel",fullWidth:!0,value:r.WorkPhone,error:!!n.WorkPhone,helperText:n.WorkPhone,onChange:c("WorkPhone"),onBlur:p,required:"Work"===r.PhoneType||u&&a.WorkPhone.isRequired})}),!!a.PhoneType&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.ZP,{item:!0,xs:12,children:(0,t.jsx)(v.Z,{variant:"body2",children:Z.preferredContactPhone})}),(0,t.jsx)(y.ZP,{item:!0,xs:12,children:(0,t.jsxs)(B.Z,{id:"phone-type-select",size:"small",value:r.PhoneType,exclusive:!0,onChange:C,children:[!!a.HomePhone&&(0,t.jsx)(N.Z,{value:"Home",children:Z.homePhone},"phone-type-home"),!!a.AltPhone&&(0,t.jsx)(N.Z,{value:"Cell",children:Z.cellPhone},"phone-type-cell"),!!a.WorkPhone&&(0,t.jsx)(N.Z,{value:"Work",children:Z.workPhone},"phone-type-work")]})})]})]})};k.propTypes={client:o().object.isRequired,clientDispatch:o().func.isRequired,errors:o().object.isRequired,fields:o().object.isRequired};var W=l(94011),D=l(64069);let A=e=>{let{required:r,field:l,state:n,dispatch:a,errors:o,handleBlur:d}=e,[u,m,C]=(0,s.$)(["client","common"]),v=(0,i.useMemo)(()=>({cedula:u("client:Cedula"),required:u("common:required")}),[u,C]),[j,f]=(0,i.useState)(1),Z=(0,i.useMemo)(()=>"PA"===l.clubCountry?6:4,[l]),R=(0,i.useMemo)(()=>"PA"===l.clubCountry?5:4,[l]),b=(0,i.useRef)(null),E=(0,i.useRef)(null),I=e=>{e.target.value&&(a({type:"CedulaPartOne",payload:e.target.value}),f(2))},T=e=>{if(e.target.value.length>Z){a({type:"CedulaPartTwo",payload:e.target.value.substring(0,Z)});var r=e.target.value.substring(Z)+n.CedulaPartThree;a({type:"CedulaPartThree",payload:r.length>R?r.substring(0,R):r}),f(3)}else a({type:"CedulaPartTwo",payload:e.target.value})},q=e=>{e.target.value.length<=R&&a({type:"CedulaPartThree",payload:e.target.value})};return(0,i.useEffect)(()=>{2===j&&b.current?b.current.focus():3===j&&E.current&&E.current.focus()},[j]),(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(y.ZP,{container:!0,spacing:0,children:[(0,t.jsx)(y.ZP,{item:!0,xs:4,children:(0,t.jsxs)(h.Z,{variant:"filled",required:!0,fullWidth:!0,error:!!o.CedulaPartOne,children:[(0,t.jsx)(x.Z,{htmlFor:"part-one-select",children:v.cedula}),(0,t.jsxs)(P.Z,{native:!0,value:n.CedulaPartOne,input:(0,t.jsx)(c.Z,{}),onChange:I,children:[(0,t.jsx)("option",{value:null,children:"--"},"startValue-unselected"),l.startValues.map(e=>(0,t.jsx)("option",{value:e,children:e},"startValue-".concat(e)))]}),o.CedulaPartOne&&(0,t.jsx)(p.Z,{children:v.required})]})}),(0,t.jsx)(y.ZP,{item:!0,xs:4,children:(0,t.jsx)(g.Z,{variant:"filled",type:"number",fullWidth:!0,required:r,value:n.CedulaPartTwo,error:!!o.CedulaPartTwo,helperText:o.CedulaPartTwo?v.required:"",onChange:T,onBlur:d("CedulaPartTwo"),inputRef:b})}),(0,t.jsx)(y.ZP,{item:!0,xs:4,children:(0,t.jsx)(g.Z,{variant:"filled",type:"number",fullWidth:!0,required:r,value:n.CedulaPartThree,error:!!o.CedulaPartThree,helperText:o.CedulaPartThree?v.required:"",onChange:q,inputRef:E,onBlur:d("CedulaPartThree")})})]})})};A.propTypes={required:o().bool.isRequired,field:o().object.isRequired,state:o().object.isRequired,dispatch:o().func.isRequired,errors:o().object.isRequired,handleBlur:o().func.isRequired};var w=l(30120);let O=e=>{let{fields:r,client:l,errors:n,handleBlur:a,handleTextChange:o,dispatch:d}=e,[u,c,h]=(0,s.$)(["client","common"]),m=(0,i.useMemo)(()=>!l.CURP_Override&&!!n.CURP&&(!r.CURP.isRequired||!!l.CURP)||!l.RFC_Override&&!!n.RFC&&(!r.RFC.isRequired||!!l.RFC)||!l.INE_Override&&!!n.INE&&(!r.INE.isRequired||!!l.INE),[r,n,l]),p=(0,i.useMemo)(()=>{let e=[];n.INE&&(!r.INE.isRequired||l.INE)&&e.push("INE"),n.CURP&&(!r.CURP.isRequired||l.CURP)&&e.push("CURP"),n.RFC&&(!r.RFC.isRequired||l.RFC)&&e.push("RFC");let t=e[0];for(let r=1;r<e.length;r++)t+=r===e.length-1?", "+u("common:And")+" "+e[r]:", "+e[r];return t},[r,n,l,h]),x=(0,i.useMemo)(()=>{let e=[];l.INE_Override&&e.push("INE"),l.CURP_Override&&e.push("CURP"),l.RFC_Override&&e.push("RFC");let r=e[0];for(let l=1;l<e.length;l++)r+=l===e.length-1?", "+u("common:And")+" "+e[l]:", "+e[l];return r},[r,n,l,h]),C=(0,i.useMemo)(()=>({ignoreIDErrors:u("IgnoreIDErrors",{idNames:p}),idErrorsIgnored:u("IDErrorsIgnored",{idNames:x})}),[u,h,p,x]),P=(0,i.useCallback)(()=>{n.CURP&&(!r.CURP.isRequired||l.CURP)&&d({type:"CURP_Override",payload:!0}),n.RFC&&(!r.RFC.isRequired||l.RFC)&&d({type:"RFC_Override",payload:!0}),n.INE&&(!r.INE.isRequired||l.INE)&&d({type:"INE_Override",payload:!0})}),j=(0,i.useCallback)(e=>{let r=e.target.value.match(/^(([a-zA-Z]{4})(\d{6})([a-zA-Z]{6})([a-zA-Z0-9]{1})(\d))$/);r&&d({type:"Birthday",payload:w.ou.fromFormat(e.target.value.substr(4,6),"yyMMdd")});let l=a("CURP");l(e)});return(0,t.jsxs)(t.Fragment,{children:[!!r.CURP&&!l.CURP_Override&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(g.Z,{variant:"filled",label:"CURP",fullWidth:!0,required:r.CURP.isRequired,value:l.CURP,error:!!n.CURP,helperText:n.CURP,onChange:o("CURP"),onBlur:j})}),!!r.RFC&&!l.RFC_Override&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(g.Z,{variant:"filled",label:"RFC",fullWidth:!0,required:r.RFC.isRequired,value:l.RFC,error:!!n.RFC,helperText:n.RFC,onChange:o("RFC"),onBlur:a("RFC")})}),!!r.INE&&!l.INE_Override&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(g.Z,{variant:"filled",label:"INE",fullWidth:!0,required:r.INE.isRequired,value:l.INE,error:!!n.INE,helperText:n.INE,onChange:o("INE"),onBlur:a("INE")})}),m&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(R.Z,{color:"primary",variant:"contained",size:"large",onClick:P,children:C.ignoreIDErrors})}),(!!l.CURP_Override||!!l.RFC_Override||!!l.INE_Override)&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(v.Z,{variant:"body2",children:C.idErrorsIgnored})})]})};var S=l(4298),_=l.n(S),U=l(94964);let L=e=>{let{clientID:r,onComplete:l,onLoaded:a,onExited:o}=e,d=(0,n.v9)(e=>e.clubs.selectedClub),[u,c,h]=(0,s.$)(["client"]);(0,i.useEffect)(()=>{if(d.UseMati){let e=document.getElementById("mati-button");e.addEventListener("mati:userFinishedSdk",e=>{let{detail:r}=e;l&&l(r),console.log("finishedPayload",r)}),e.addEventListener("mati:loaded",e=>{let{detail:r}=e;a&&a(r),console.log("loaded payload",r)}),e.addEventListener("mati:exitedSdk",e=>{let{detail:r}=e;console.log("exited payload",r),o&&o(r)})}},[d.clubID]);let m=(0,i.useRef)(null),p=()=>{m.current.click()};return(0,t.jsx)(t.Fragment,{children:d.UseMati?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_(),{src:"https://web-button.mati.io/button.js"}),d.MatiPrompt&&(0,t.jsx)(v.Z,{children:d.MatiPrompt}),(0,t.jsxs)(R.Z,{variant:"contained",color:"primary",onClick:p,children:[(0,t.jsx)(U.Z,{sx:{marginRight:"10px"}}),u("VerifyMe")]}),(0,t.jsx)("mati-button",{id:"mati-button",clientId:"".concat(d.MatiClientID),flowId:"".concat(d.MatiFlowID),metadata:'{ "clientID": "'.concat(r,'"}'),style:{display:"none"},ref:m})]}):null})},V=e=>{let{client:r,clientDispatch:l,errors:a,fields:o,isKiosk:Z,location:R,checkDuplicate:I}=e,q=(0,n.v9)(e=>e.clubInfo.API_KEY),M=(0,n.v9)(e=>e.clubInfo.API_PATH),N=(0,n.v9)(e=>e.clubs.selectedClub),B=(0,n.v9)(e=>e.clubInfo.SoftwareVersion),[S,_,U]=(0,s.$)(["client","common","membership"]),V=(0,D.so)(_,r.Country),H=(0,T.vt)(l),G=(0,T.MP)(l),$=(0,T.J)(l),z=(0,T.QJ)(l),K=(0,T.YT)(l),J=e=>{let t=(0,d._)(r.PrimaryPhone,r.Country);t&&t.isValid()&&l({type:"PrimaryPhone",payload:t.formatNational()});let i=z("PrimaryPhone");i(e)},Y=e=>{let t=(0,d._)(r.EmergencyPhone,r.Country);t&&t.isValid()&&l({type:"EmergencyPhone",payload:t.formatNational()});let i=z("EmergencyPhone");i(e)},Q=(0,W.ml)(),X=(0,i.useMemo)(()=>({birthDay:S("Birthday"),cellPhone:S("CellPhone"),emergencyContact:S("EmergencyContact"),emergencyContactPhone:S("EmergencyContactPhone"),employer:S("Employer"),female:S("Female"),firstName:S("FirstName"),gender:S("Gender"),homePhone:S("HomePhone"),lastName:S("LastName"),male:S("Male"),phone:S("PhoneNumber"),phoneType:S("PhoneType"),sameAddress:S("SameAddressAsPrimaryMember"),samePhone:S("SamePhoneInfoAsPrimaryMember"),unknownGender:S("UnknownGender"),workPhone:S("WorkPhone"),CedulaFisica:S("CedulaFisica"),type:S("common:type"),referredBy:S("ReferredBy"),middleInitial:S("MiddleInitialAbbreviation"),enterCodeFromEmail:S("membership:EnterCodeFromEmail")}),[S,U]),ee=e=>{l({type:"GovernmentIdType",payload:e.target.value})},er=0,el=async()=>{try{let e=await (0,E.hO)(M,q,r.tempId,N.ID);e?(e.CURP&&(!e.BirthDate||"0001-01-01T00:00:00"===e.BirthDate)&&(e.BirthDate=w.ou.fromFormat(e.CURP.substr(4,6),"yyMMdd")),l({type:"MatiVerificationResult",payload:e})):null==e&&er<18&&setTimeout(()=>{er++;try{el()}catch(e){el(),console.log("Webhook hasn't returned yet")}},1e4)}catch(e){e instanceof DOMException&&e.code===DOMException.ABORT_ERR?console.debug(e):console.error(e)}},et=e=>{er=0,el()},ei=(0,i.useMemo)(()=>o.MiddleInitial?4:6,[o]),en=(0,i.useMemo)(()=>!I||!!r.DupeCheckComplete,[I,r]),ea=(0,i.useMemo)(()=>r&&r.DuplicateFound?r.DidDuplicateEmail?S("membership:duplicateCheckEmail",{email:r.Email}):S("membership:duplicateCheckNoEmail"):"",[r,U]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.ZP,{item:!0,xs:12,children:(0,t.jsx)(L,{clientID:r.tempId,onComplete:et})}),!!o.FirstName&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:ei,children:(0,t.jsx)(b.Z,{variant:"filled",label:X.firstName,autoComplete:Z?"none":"given-name",fullWidth:!0,required:o.FirstName.isRequired,value:r.FirstName,error:!!a.FirstName,helperText:a.FirstName,onChange:H("FirstName"),onBlur:K("FirstName",r.FirstName),characterLimit:Q.FirstName})}),!!o.MiddleInitial&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:2,children:(0,t.jsx)(b.Z,{variant:"filled",label:X.middleInitial,autoComplete:Z?"none":"additional-name",fullWidth:!0,required:o.MiddleInitial.isRequired,value:r.MiddleInitial,error:!!a.MiddleInitial,helperText:a.MiddleInitial,onChange:H("MiddleInitial"),onBlur:K("MiddleInitial",r.MiddleInitial),characterLimit:1})}),!!o.LastName&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(b.Z,{variant:"filled",label:X.lastName,autoComplete:Z?"none":"family-name",fullWidth:!0,required:o.LastName.isRequired,value:r.LastName,error:!!a.LastName,helperText:a.LastName,onChange:H("LastName"),onBlur:K("LastName",r.LastName),characterLimit:Q.LastName})}),(0,t.jsx)(F,{client:r,clientDispatch:l,errors:a,fields:o,isKiosk:Z,maxLengths:Q,location:R}),!!o.Cedula&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsxs)(y.ZP,{container:!0,spacing:0,children:[(0,t.jsx)(y.ZP,{item:!0,xs:o.Cedula.allowDimex?10:12,children:"Cedula"===r.GovernmentIdType?(0,t.jsx)(A,{required:o.Cedula.isRequired,field:o.Cedula,state:r,dispatch:l,errors:a,handleBlur:z}):(0,t.jsx)(g.Z,{variant:"filled",type:"number",label:"DIMEX",fullWidth:!0,required:!0,value:r.GovernmentID,error:!!a.GovernmentID,helperText:a.GovernmentID,onChange:H("GovernmentID"),onBlur:z("GovernmentID")})}),o.Cedula.allowDimex&&(0,t.jsx)(y.ZP,{item:!0,xs:2,children:(0,t.jsxs)(h.Z,{variant:"filled",fullWidth:!0,children:[(0,t.jsx)(x.Z,{htmlFor:"cedula-type-select",children:X.type}),(0,t.jsxs)(P.Z,{input:(0,t.jsx)(c.Z,{}),renderValue:e=>"",value:r.GovernmentIdType,onChange:ee,children:[(0,t.jsx)(C.Z,{value:"Cedula",children:X.CedulaFisica}),(0,t.jsx)(C.Z,{value:"Dimex",children:"DIMEX"})]})]})})]})}),!!o.Birthday&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(f.Z,{label:X.birthDay,value:r.Birthday,errorMessage:a.Birthday,onChange:G("Birthday"),onBlur:z("Birthday"),autoComplete:Z?"none":"bday",fullWidth:!0,required:o.Birthday.isRequired,countryCode:V,disableFuture:!0,openTo:"year"})}),(!!o.CURP||!!o.RFC||!!o.INE)&&(0,t.jsx)(O,{fields:o,client:r,errors:a,handleBlur:z,handleTextChange:H,dispatch:l}),!!o.Gender&&en&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsxs)(h.Z,{variant:"filled",error:!!a.Gender,required:o.Gender.isRequired,fullWidth:!0,children:[(0,t.jsx)(x.Z,{htmlFor:"gender-select",children:X.gender}),(0,t.jsxs)(P.Z,{value:r.Gender,onChange:H("Gender"),onBlur:z("Gender"),input:(0,t.jsx)(c.Z,{autoComplete:Z?"none":"sex"}),children:[(0,t.jsx)(C.Z,{value:"F",children:X.female}),(0,t.jsx)(C.Z,{value:"M",children:X.male}),(0,t.jsx)(C.Z,{value:"U",children:X.unknownGender})]}),a.Gender&&(0,t.jsx)(p.Z,{children:a.Gender})]})}),!!o.PrimaryPhone&&(0,t.jsxs)(t.Fragment,{children:[r.isFamily&&(0,t.jsx)(y.ZP,{item:!0,xs:12,children:(0,t.jsx)(m.Z,{control:(0,t.jsx)(u.Z,{checked:r.useMainPhone,onChange:$("useMainPhone")}),label:X.samePhone})}),(0,t.jsx)(y.ZP,{item:!0,xs:12,children:(0,t.jsxs)(y.ZP,{container:!0,spacing:2,children:[(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(g.Z,{variant:"filled",label:X.phone,autoComplete:Z?"none":"tel",fullWidth:!0,required:o.PrimaryPhone.isRequired,value:r.PrimaryPhone,error:!!a.PrimaryPhone,helperText:a.PrimaryPhone,onChange:H("PrimaryPhone"),onBlur:J,disabled:r.useMainPhone})}),(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsxs)(h.Z,{variant:"filled",error:!!a.PhoneType,required:!0,fullWidth:!0,children:[(0,t.jsx)(x.Z,{htmlFor:"phone-type-select",children:X.phoneType}),(0,t.jsxs)(P.Z,{value:r.PhoneType,onChange:H("PhoneType"),onBlur:z("PhoneType"),input:(0,t.jsx)(c.Z,{}),disabled:r.useMainPhone,children:[(0,t.jsx)(C.Z,{value:"Cell",children:X.cellPhone}),(0,t.jsx)(C.Z,{value:"Home",children:X.homePhone}),(0,t.jsx)(C.Z,{value:"Work",children:X.workPhone})]}),a.PhoneType&&(0,t.jsx)(p.Z,{children:a.PhoneType})]})})]})})]}),(!!o.HomePhone||!!o.WorkPhone||!!o.AltPhone)&&(0,t.jsx)(k,{client:r,clientDispatch:l,errors:a,fields:o,isKiosk:Z,isV6:"Advantage"!==B}),!!o.Address&&en&&(0,t.jsxs)(t.Fragment,{children:[r.isFamily&&(0,t.jsx)(y.ZP,{item:!0,xs:12,children:(0,t.jsx)(m.Z,{control:(0,t.jsx)(u.Z,{checked:r.useMainAddress,onChange:$("useMainAddress")}),label:X.sameAddress})}),(0,t.jsx)(j.Z,{state:r,dispatch:l,errors:a,disabled:r.useMainAddress,required:o.Address.isRequired,isKiosk:Z})]}),!!o.Employer&&en&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(b.Z,{variant:"filled",label:X.employer,fullWidth:!0,value:r.Employer,error:!!a.Employer,helperText:a.Employer,onChange:H("Employer"),onBlur:z("Employer"),required:o.Employer.isRequired,characterLimit:25})}),!!o.EmergencyContact&&en&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(b.Z,{variant:"filled",label:X.emergencyContact,fullWidth:!0,value:r.EmergencyContact,error:!!a.EmergencyContact,helperText:a.EmergencyContact,onChange:H("EmergencyContact"),onBlur:z("EmergencyContact"),required:o.EmergencyContact.isRequired,characterLimit:Q.EmergencyContact})}),!!o.EmergencyPhone&&en&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(g.Z,{variant:"filled",label:X.emergencyContactPhone,fullWidth:!0,value:r.EmergencyPhone,error:!!a.EmergencyPhone,helperText:a.EmergencyPhone,onChange:H("EmergencyPhone"),onBlur:Y,required:o.EmergencyPhone.isRequired})}),r.ReferredBy&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(g.Z,{variant:"filled",label:X.referredBy,fullWidth:!0,value:r.ReferredBy.FirstName?r.ReferredBy.LastName+", "+r.ReferredBy.FirstName:r.ReferredBy.LastName,disabled:!0})}),(0,t.jsx)(y.ZP,{item:!0,xs:12,children:(0,t.jsx)(v.Z,{variant:"subtitle1",children:ea})}),r.AllowDuplicateOverride&&(0,t.jsx)(y.ZP,{item:!0,xs:12,lg:6,children:(0,t.jsx)(b.Z,{variant:"filled",label:X.enterCodeFromEmail,fullWidth:!0,value:r.DuplicateOverrideCode,error:!!a.DuplicateOverrideCode,helperText:a.DuplicateOverrideCode,onChange:H("DuplicateOverrideCode"),onBlur:z("DuplicateOverrideCode")})})]})};V.propTypes={client:o().object.isRequired,clientDispatch:o().func.isRequired,errors:o().object.isRequired,fields:o().object.isRequired,location:o().string};var H=V},55075:function(e,r,l){l.d(r,{P:function(){return i}});var t=l(67294);let i=()=>{let e=(0,t.useRef)(null);return(0,t.useEffect)(()=>(e.current=new AbortController,()=>{e.current.abort()}),[]),e}}}]);