"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[7564],{688094:(e,t,a)=>{a.d(t,{t2:()=>E,Kg:()=>l,hJ:()=>m,ut:()=>d,g0:()=>_,gh:()=>o,fH:()=>c});var s=a(294201),n=a(691189);const r="/api/s/{site}/cmd/lte",i=e=>e&&e.data&&e.data[0],o=e=>e&&e.apiMsg,l=({mac:e,username:t,password:a,token:o})=>l=>l((0,n.Xj)(s.A.AUTH_DEVICE,r,{mac:e,ubic_username:t,x_ubic_password:a,ubic_2fa_token:o||void 0})).then(i),E=e=>t=>t((0,n.Xj)(s.A.ACTIVATE_TRIAL,r,e)),c=e=>t=>t((0,n.Xj)(s.A.UPDATE_DEVICE,r,e)),_=e=>t=>t((0,n.Xj)(s.A.CHECK_PAYMENT_PAST_DUE,r,e)).then(i),d=e=>t=>t((0,n.Xj)(s.A.PAYMENT_METHODS,r,e)).then(i),m=({macOrMacs:e,username:t,password:a,token:o})=>l=>l((0,n.Xj)(s.A.CHECK_SUBSCRIPTION,r,{macs:"string"==typeof e?[e]:e,ubic_username:t,x_ubic_password:a,ubic_2fa_token:o})).then(i)},685375:(e,t,a)=>{var s;a.d(t,{f:()=>s}),function(e){e.API_ERROR_LTE_DEVICE_UNAUTHORIZED="API_ERROR_LTE_DEVICE_UNAUTHORIZED",e.API_ERROR_INCORRECT_CREDENTIALS="API_ERROR_INCORRECT_CREDENTIALS",e.API_ERROR_TOKEN_2FA_REQUIRED="API_ERROR_TOKEN_2FA_REQUIRED",e.API_ERROR_INVALID_2FA_TOKEN="API_ERROR_INVALID_2FA_TOKEN"}(s||(s={}))},560485:(e,t,a)=>{a.d(t,{j:()=>n});var s=a(691189);const n=(e,t)=>(0,s.Kd)("uiData","/api/ui-data","uiData",{queryParams:{invalidate:!!e||void 0}},{crudCacheStrategy:t,idField:"_id"})},156229:(e,t,a)=>{a.d(t,{Ds:()=>E,M$:()=>c,X:()=>_,eT:()=>m});var s=a(801081),n=a(87485),r=a(25553),i=a(560485);const o=(0,r.uh)((0,i.j)()),l=(0,s.Mz)(o,n.i6),E=(0,s.Mz)(l,e=>e?.error||!1),c=((0,s.Mz)(l,({mapbox:e})=>e),(0,s.Mz)(l,({unsplash:e})=>e||null)),_=(0,s.Mz)(l,({stripe:e})=>e),d=(0,s.Mz)(l,({lte:e})=>e||{}),m=(0,s.Mz)(d,({pricing:e})=>e)},748598:(e,t,a)=>{a.d(t,{A:()=>D});var s=a(296540),n=a(438628),r=a(927099),i=a(71479),o=a(132196),l=a(822336),E=a(998837),c=a(868238),_=a(388151),d=a(459449),m=a(923831),u=a(294303),A=a(574137),p=a(566723),T=a(372382);const C=o.AH`
  height: 100%;
`,h=(0,i.A)("div")`
  margin-top: ${p.Ln};
  text-align: left;
  line-height: 18px;
  font-size: ${({theme:{fontSizes:e}})=>e[0]}px;
`,S=(0,i.A)("div")`
  margin-top: ${p.ew};
  display: flex;
  justify-content: center;
`,O=(0,i.A)("div")`
  width: 34px;
  height: 47px;
  text-align: center;
  line-height: 45px;
  border: ${({theme:{themeName:e}})=>l.Ay[`desktop-border-divider-${e}`]};
  font-size: 30px;
  font-weight: ${l.Ay["desktop-font-weight-semibold"]};
  margin: 0 ${({theme:{space:e}})=>e[3]}px;
  cursor: text;
`,I=(0,i.A)(_.A)`
  position: absolute;
  width: 284px;
  height: 47px;
  left: calc(50% - 142px);
  opacity: 0;

  input {
    width: 100% !important;
    height: 100% !important;
    border: none;
  }
`,R=(0,i.A)(u.A)`
  margin-top: ${p.S2};
  margin-bottom: ${p.xO};
  text-align: left;
`,N=(0,i.A)(r.A)`
  flex: 1;
  margin-left: ${p.xO};
`,g=(0,i.A)("input")`
  display: none;
`,D=(0,c.Zz)(d.j4,E.b)(({values:{sso2FA:e,ssoToken:t="",ssoUsername:a,ssoPassword:r,tos:i},hideOwnerDetailsText:l=!1,setFieldValue:c,handleSubmit:p,isSubmitting:D,isValid:U,dirty:L,showTOS:b,errors:M})=>{const{colors:{text:P}}=(0,E.u)(),{formatMessage:v}=(0,d.tz)(),f=D||(e?6!==t.length:!(U&&L&&(!b||i))),[x,y]=(0,s.useState)(!1),w=(0,s.useCallback)(()=>{y(!0)},[]),k=(0,s.useCallback)(()=>{y(!1)},[]),V=(0,s.useCallback)(e=>{e?.preventDefault?.(),e?.stopPropagation?.(),f||p()},[f,p]);(0,s.useEffect)(()=>{D||6!==t.length||V()},[t]);const $=[...Array(6)].map((e,a)=>{const n=t[a]||"",r=x&&t.length===a;return s.createElement(O,{key:`sso-token-char-${a.toString()}`,className:r?(i=P,o.AH`
  border-color: ${A.hu};
  position: relative;

  &:after {
    position: absolute;
    display: block;
    content: '';
    width: 1px;
    height: 36px;
    top: 5px;
    left: 4px;
    background: ${i};

    animation: ${o.i7`
            0% {
                opacity: 1;
            }
            69% {
                opacity: 1;
            }
            70% {
                opacity: 0;
            }
            100% {
                opacity: 0;
            }
        `} 1.2s ease 0s infinite;
  }
`):void 0},n);var i});return s.createElement("form",{onSubmit:V,autoComplete:"off"},e?s.createElement(s.Fragment,null,s.createElement(S,null,$,s.createElement(I,{name:"ssoToken",maxLength:"6",onFocus:w,onBlur:k,containerWrapperClassName:C,inputContentClassName:C})),s.createElement(T.A,{fieldName:"ssoToken"})):s.createElement(s.Fragment,null,s.createElement(u.A,{flexDirection:"column",alignItems:"flex-start"},s.createElement(n.A,{label:v({id:"LTE_SSO_LOGIN_LABEL_EMAIL_OR_USERNAME"}),name:"ssoUsername",value:a,onChange:e=>c("ssoUsername",e.target.value||""),full:!0}),s.createElement(T.A,{fieldName:"ssoUsername"})),s.createElement(u.A,{flexDirection:"column",alignItems:"flex-start"},s.createElement(n.A,{label:v({id:"COMMON_PASSWORD"}),name:"ssoPassword",value:r,type:"password",onChange:e=>c("ssoPassword",e.target.value||""),full:!0}),s.createElement(T.A,{fieldName:"ssoPassword"})),l?null:s.createElement(h,null,s.createElement(d.sA,{id:"DEVICE_ULTE_SETUP_ACCOUNT_DETAILS"})),b?s.createElement(R,{justifyContent:"space-between",alignItems:"center"},s.createElement(_.A,{label:"DEVICE_ULTE_SETUP_LABEL_ACCEPT_TOS",name:"tos",type:"checkbox"}),s.createElement(N,null,s.createElement(d.sA,{id:"DEVICE_ULTE_SETUP_LABEL_ACCEPT_TOS",values:{link:s.createElement("a",{href:m.Ay.LEGAL_USE_TOS,target:"_blank",rel:"noopener noreferrer"},s.createElement(d.sA,{id:"COMMON_TOS"}))}}))):null),s.createElement(g,{type:"submit"}))})},431253:(e,t,a)=>{a.d(t,{A:()=>C});var s=a(350312),n=a(793336),r=a(296540),i=a(71479),o=a(822336),l=a(566723),E=a(705426);const c=(0,i.A)(E.A,{shouldForwardProp:e=>"originalSize"!==e})`
  ${({originalSize:e})=>e?"":"width: 500px;"}
  padding: 24px;
`,_=(0,i.A)("header",{shouldForwardProp:e=>"onRequestClose"!==e})`
  position: relative;
  text-align: center;
`,d=(0,i.A)("div")`
  font-size: ${({theme:{fontSizes:e}})=>e[3]}px;
  font-weight: ${o.Ay["desktop-font-weight-semibold"]};
  margin-bottom: ${({theme:{space:e}})=>e[4]}px;
`,m=(0,i.A)("div")`
  width: 345px;
  line-height: 18px;
  margin: 0 auto ${({theme:{space:e}})=>e[5]}px;
`,u=(0,i.A)(s.A)`
  position: absolute;
  top: 0;
  left: 0;
  cursor: pointer;
  color: ${({theme:{colors:{subtleText:e}}})=>e};
  width: 16px;
  height: 16px;
`,A=(0,i.A)(n.A)`
  position: absolute;
  top: 0;
  right: 0;
  cursor: pointer;
  color: ${({theme:{colors:{subtleText:e}}})=>e};
`,p=(0,i.A)("div")`
  max-height: 340px;
  overflow: auto;
`,T=(0,i.A)("div")`
  text-align: center;
  width: 100%;
  min-height: ${l.ZH};
  line-height: 18px;
  margin: 0 auto 8px;
`,C=({headerBackButtonAction:e,headerTitle:t,headerSubTitle:a,onClose:s,actions:n,children:i,originalSize:o=!1,...l})=>{const E=r.createElement(_,null,!!e&&r.createElement(u,{actionable:!0,onClick:e}),r.createElement(d,null,t),r.createElement(A,{actionable:!0,onClick:s}),!!a&&r.createElement(m,null,a));return r.createElement(c,{onRequestClose:s,originalSize:o,size:"small",header:E,actions:n,...l},r.createElement(p,null,r.createElement(T,null,i)))}},935183:(e,t,a)=>{a.r(t),a.d(t,{default:()=>ct});var s=a(296540),n=a(469733),r=a(532419),i=a(780811),o=a(923831),l=a(634229),E=a(366188),c=a(688094),_=a(417378),d=a(519692),m=a(560485),u=a(156229),A=a(126457),p=a(675359),T=a(742920),C=a(536280),h=a(778851),S=a(953141),O=a(187483),I=a(413357),R=a(834959),N=a(71479),g=a(132196),D=a(459449),U=a(6176),L=a(574137),b=a(876250),M=a(431253);const P=(0,N.A)(U.A)`
  margin-top: ${({theme:{space:e}})=>e[3]}px;
  height: 290px;
`,v=g.AH`
  border-radius: 0;
  color: ${L.Op};
`,f=({device:{model:e},setStep:t})=>{const a=(0,n.useDispatch)(),r=(0,s.useCallback)(()=>{a((0,A.AS)())},[a]),i=(0,s.useCallback)(()=>{t(o.di.account_credentials)},[t]);return s.createElement(M.A,{onClose:r,headerTitle:s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_DETECTED_HEADER"}),actions:[{text:s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_ACTIONS_LATER"}),onClick:r,className:v},{text:s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_ACTIONS_SETUP"}),onClick:i,variant:"primary"}]},s.createElement(P,{model:e,size:b.Xh.MEDIUM}))};var x=a(823858),y=a(302167),w=a(198494);const k=(0,N.A)(x.A)`
  color: ${L.PA.warning};
  margin-right: ${({theme:{space:e}})=>e[2]}px;
  margin-bottom: ${({theme:{space:e}})=>e[2]}px;
`,V=(0,N.A)(U.A)`
  margin-top: ${({theme:{space:e}})=>e[4]}px;
  height: 250px;
`,$=({device:{model:e},setStep:t})=>{const a=(0,n.useDispatch)(),i=(0,n.useSelector)(w.Pk),l=(0,n.useSelector)(w.fR),E=!(0,n.useSelector)(_.V0),c=((0,n.useSelector)(y.ef)?.ubic_uuid||null)===i,d=(0,n.useSelector)(_.J5),m=d&&!!i,u=d||l&&(E||c),p=(0,n.useSelector)(_.S$),T=(0,h.w_)(p),C=(0,n.useSelector)(r.ev),S=(0,s.useCallback)(()=>{a((0,A.AS)())},[a]),O=()=>{window.location.href=C},I=()=>{t(o.di.account_credentials)},R=[];return(m||u)&&R.push({text:s.createElement(D.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:S}),m||u||R.push({text:s.createElement(D.sA,{id:"COMMON_ACTION_CLOSE"}),onClick:S,variant:"primary"}),m&&R.push({text:s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_ACTIONS_OPEN_REMOTE",values:{remoteUrl:T}}),onClick:O,variant:"primary"}),!m&&u&&R.push({text:s.createElement(D.sA,{id:"COMMON_ACTIONS_REMOTE_ACCESS"}),onClick:I,variant:"primary"}),s.createElement(M.A,{onClose:S,actions:R,headerTitle:s.createElement(s.Fragment,null,s.createElement(k,{size:"navigation"}),s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_ADOPTION_UNAVAILABLE_HEADER"}))},s.createElement("div",null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_ADOPTION_UNAVAILABLE_REMOTE_ACCESS",values:{remoteUrl:T}})),s.createElement("div",null,m?null:s.createElement(D.sA,{id:u?"DEVICE_ULTE_SETUP_ADOPTION_UNAVAILABLE_REMOTE_ACCESS_ENABLE":"DEVICE_ULTE_SETUP_ADOPTION_UNAVAILABLE_REMOTE_ACCESS_ENABLE_DENIED"})),s.createElement(V,{model:e,size:b.Xh.MEDIUM}))};var F=a(868238),H=a(951272),z=a(870443),B=a(608169),Y=a(685375),G=a(775699),W=a(727270),K=a(46119),j=a(748598);const X=g.AH`
  position: absolute;
  left: 24px;
  border-radius: 0;
`;class q extends s.Component{constructor(){super(...arguments),this.handleFormSubmit=e=>{e.preventDefault(),e.stopPropagation();const{isValid:t,dirty:a,isSubmitting:s,registerCloudAccess:n,values:{sso2FA:r,ssoToken:i="",tos:o}}=this.props,l=s||(r?6!==i.length:!(t&&a&&(n||o))),{handleSubmit:E}=this.props;l||E()},this.handleRegisterLink=()=>{const{env:e}=this.props,t=(0,h.Qh)(e);K.A.open(`${W.DU}${t}/register`)}}componentDidMount(){this.checkIfUserIsLoggedIn()}componentDidUpdate(){const{remoteControllerLTELink:e,values:{openRemoteController:t},isSubmitting:a}=this.props;t&&e?setTimeout(()=>{window.location.href=e},600):!a&&this.checkIfUserIsLoggedIn()}checkIfUserIsLoggedIn(){const{isRemoteAccessEnabledForUser:e,isRemoteAccessEnabledForSite:t,ssoUuid:a,deviceOwnerSsoId:s,setPayment:n}=this.props;e&&t&&s&&s===a&&n({lte_sso_user_uuid:s})}render(){const{setStep:e,totalSteps:t=3,isValid:a,dirty:n,isSubmitting:r,setFieldValue:i,hideModal:l,values:{sso2FA:E,ssoToken:c="",tos:_},values:d,handleSubmit:m,errors:u,registerCloudAccess:A}=this.props,p=r||(E?6!==c.length:!(a&&n&&(A||_))),T=[{text:s.createElement(D.sA,{id:"COMMON_ACTION_NEXT"}),onClick:this.handleFormSubmit,variant:"primary",disabled:p,loader:r?"spinner":void 0,type:"submit"}];return A?T.unshift({text:s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_ACCOUNT_CREATE_NOTE"}),wrapClassName:X,variant:"link",onClick:this.handleRegisterLink}):T.unshift({text:s.createElement(D.sA,{id:"COMMON_STEP_OF",values:{step:1,totalSteps:t}}),disabled:!0,wrapClassName:X}),s.createElement(M.A,{onClose:l,headerTitle:s.createElement(D.sA,{id:E?"DEVICE_ULTE_SETUP_ACCOUNT_HEADER_2FA":"DEVICE_ULTE_SETUP_ACCOUNT_HEADER"}),headerSubTitle:s.createElement(D.sA,{id:E?"DEVICE_ULTE_SETUP_ACCOUNT_SUB_HEADER_2FA":"DEVICE_ULTE_SETUP_ACCOUNT_SUB_HEADER"}),headerBackButtonAction:()=>E?i("sso2FA",!1):e(o.di.detected),actions:T},s.createElement(j.A,{showTOS:!A,handleSubmit:m,setFieldValue:i,values:d,errors:u,isSubmitting:r,isValid:a,dirty:n}))}}const Z=q,Q=(0,H.bk)({enableReinitialize:!0,isInitialValid:!0,mapPropsToValues:({ssoUsername:e=""})=>({ssoUsername:e,ssoPassword:"",ssoToken:"",tos:!1,sso2FA:!1,openRemoteController:!1}),validationSchema:z.A.object().shape({ssoUsername:z.A.string().label("LTE_SSO_LOGIN_LABEL_EMAIL_OR_USERNAME").required(),ssoPassword:z.A.string().label("COMMON_PASSWORD").required(),tos:z.A.boolean(),ssoToken:z.A.string(),sso2FA:z.A.boolean(),openRemoteController:z.A.boolean()}),handleSubmit:({ssoUsername:e,ssoPassword:t,ssoToken:a},{props:{mac:s,authLteDevice:n,setStep:r,setPayment:i,createToast:l,intl:{formatMessage:E},registerCloudAccess:c,registerControllerCloudAccess:_,enableUserCloudAccess:d,isRegisteringOwner:m,allowLocalLteAdoption:u},setFieldValue:A,setErrors:p,setSubmitting:C})=>{C(!0);const h={username:e||void 0,password:t||void 0,token:a||void 0},O=m?_:d,I=u,R=(e=!c)=>{const t=e?n:O;e&&(h.mac=s),t(h).then(t=>{e||I?!I||t?t&&t.lte_sso_user_uuid?i(t):(p({ssoToken:E({id:"DEVICE_SSO_ACTIONS_AUTH_UUID_ERROR"})}),C(!1)):R(!0):A("openRemoteController",!0)}).catch(({apiMsg:e})=>{switch(S.r[e]){case Y.f.API_ERROR_INCORRECT_CREDENTIALS:p({ssoUsername:E({id:"DEVICE_SSO_ACTIONS_AUTH_INVALID_ERROR"}),ssoPassword:E({id:"DEVICE_SSO_ACTIONS_AUTH_INVALID_ERROR"})});break;case Y.f.API_ERROR_INVALID_2FA_TOKEN:p({ssoToken:E({id:"DEVICE_SSO_ACTIONS_AUTH_INVALID_ERROR"})}),A("ssoToken","");break;case Y.f.API_ERROR_TOKEN_2FA_REQUIRED:A("sso2FA",!0);break;case Y.f.API_ERROR_LTE_DEVICE_UNAUTHORIZED:r(o.di.device_unauthorized);break;default:l({icon:T.C.danger,message:"DEVICE_SSO_ACTIONS_AUTH_ERROR"})}C(!1)})};R()}}),J=(0,F.Zz)(D.j4,(0,n.connect)((e,{mac:t})=>{const a=(0,w.Pk)(e),s=(0,w.fR)(e),n=(0,w.rU)(e)||a,i=!(0,_.V0)(e),o=((0,y.ef)(e)?.ubic_uuid||null)===a,l=(0,_.J5)(e),E=!!n,c=l&&E,d=l||s&&(i||o);return{env:(0,_.S$)(e),ssoUsername:n,ssoUuid:a,remoteControllerLTELink:(0,r.ev)(e),isRemoteAccessEnabledForUser:E,isRemoteAccessEnabledForSite:l,isRegisteringOwner:i&&s,registerCloudAccess:(0,O.W1)(e)&&!c&&d,allowLocalLteAdoption:(0,C.K)(e),deviceOwnerSsoId:(0,r.ZL)(t)(e)}},{hideModal:A.AS,authLteDevice:c.Kg,createToast:p.ox,registerControllerCloudAccess:B.PA,enableUserCloudAccess:G.m}),Q)(Z);var ee=a(137427),te=a(222926),ae=a(998837),se=a(171073),ne=a(927099),re=a(822336),ie=a(594903),oe=a(81126),le=a(388151),Ee=a(854246),ce=a(362412),_e=a(349107),de=a(765562),me=a(198247),ue=a(323030),Ae=a(793155),pe=a(592510);const Te=(0,N.A)("div")`
  margin-top: ${({theme:e})=>e.space[4]}px;
  text-align: left;
`,Ce=(0,N.A)("div")`
  margin-top: ${({theme:e})=>e.space[3]}px;
  color: ${({theme:e})=>e.colors.subtleText};
  font-weight: ${re.Ay["desktop-font-weight-semibold"]};
`,he=(0,N.A)("div")`
  margin-top: ${({theme:e})=>e.space[4]}px;
`,Se=()=>{const{standard:{costPerGb:{first:e,additional:t}}}=(0,n.useSelector)(u.eT)||{standard:{costPerGb:{first:"",additional:""}}};return s.createElement(Te,null,s.createElement(Ce,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_SUBSCRIPTION_HEADER"})),s.createElement(he,null,s.createElement("b",null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_COST_TITLE"}),": "),s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_COST_DETAILS",values:{first:e,additional:t}})),s.createElement(he,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_FREE_TRIAL"})),s.createElement(he,null,s.createElement("b",null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_BILLING_TITLE"}),": "),s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_BILLING_DETAILS"})))},Oe=(0,N.A)("div")`
  margin-top: ${({theme:e})=>e.space[4]}px;
  text-align: left;
`,Ie=(0,N.A)("div")`
  margin-top: ${({theme:e})=>e.space[3]}px;
  color: ${({theme:e})=>e.colors.subtleText};
  font-weight: ${re.Ay["desktop-font-weight-semibold"]};
`,Re=(0,N.A)("div")`
  margin-top: ${({theme:e})=>e.space[4]}px;
`,Ne=()=>s.createElement(Oe,null,s.createElement(Ie,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_DISCLAIMER_HEADER"})),s.createElement(Re,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_DISCLAIMER_OVERAGES",values:{initialDataLimit:o.Ay.HARD_LIMIT_DEFAULT_GB}})),s.createElement(Re,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_DISCLAIMER_NETWORK"}))),ge=[2001,2003,2005,2006],De=(0,N.A)("div")`
  margin-bottom: ${({theme:e})=>e.space[4]}px;
  font-size: 13px;
`,Ue=(0,N.A)(le.A)`
  & > div > div > div > div > div > input:first-child {
    margin-top: 3px !important;
  }
`,Le=(0,N.A)(ue.A)`
  border-radius: 50%;
  object-fit: cover;
`,be=(0,N.A)("div")`
  text-align: left;
`,Me=(0,N.A)(ce.A.Sorted)`
  width: 100% !important;
  margin-bottom: ${({theme:e})=>e.space[4]}px;
`,Pe=g.AH`
  position: absolute;
  left: 24px;
  border-radius: 0;
`,ve=(0,N.A)("div")`
  padding-bottom: 6px;
  border-bottom: ${({theme:{themeName:e}})=>re.Ay[`desktop-border-divider-${e}`]};
`,fe=(0,N.A)(ne.A)`
  margin-bottom: ${({theme:e})=>e.space[2]}px;
`,xe=(0,N.A)(ie.A)`
  width: 250px;
  font-size: 14px;
  text-align: left;
  margin-bottom: 0px;
  & > div {
    margin: 0;
  }
  & > div > span {
    font-size: 14px;
  }
`,ye=(0,N.A)("input")`
  display: none;
`;class we extends s.PureComponent{constructor(){super(...arguments),this.state={paymentMethod:"",isSubmitting:!1,paymentError:""},this.getCardInputStyles=()=>{const{theme:{motifPalette:{text01:e,text04:t,red06:a},fontSize:s}}=this.props;return{style:{base:{fontSize:`${s["font-size-body"]}px`,color:e,"::placeholder":{color:t}},invalid:{color:a}}}},this.setSubmitting=e=>{this.setState({isSubmitting:e})},this.setError=(e="")=>{const{paymentError:t}=this.state;t!==e&&this.setState({isSubmitting:!1,paymentError:e})},this.handlePaymentMethodChange=(e,t)=>{this.setState({paymentMethod:t||""})},this.handleFormSubmit=async(e,t)=>{const{stripe:a,elements:s}=this.props,{paymentMethod:n}=this.state,r={address:{...e}};if(this.setSubmitting(!0),n)return void this.submitForm(n,t);const{error:i,source:o}=await a.createSource(s.getElement("card"),{type:"card",owner:r});if(i)return this.setError(i.message),void this.setSubmitting(!1);this.submitForm("",t,o)},this.submitForm=async(e,t,a)=>{const{createToast:n,mac:r,setStep:i}=this.props;try{return await this.deleteWan2Network(),await this.registerDevice(e,a),await this.adoptLTE(),i(o.di.complete)}catch(e){return"API_ERROR_PAYMENT_WRONG_ADDRESS"===e.message?(this.setSubmitting(!1),n({icon:T.C.danger,title:t.formatMessage({id:"API_ERROR_PAYMENT_WRONG_ADDRESS_TITLE"},{b:D.b}),details:s.createElement("span",null,t.formatMessage({id:"API_ERROR_PAYMENT_WRONG_ADDRESS"},{link:s.createElement(_e.A.Simplified,{href:de.A.accountUiPayments,message:t.formatMessage({id:"COMMON_PAYMENT_METHODS"})})}))})):(n({icon:T.C.danger,message:e.message,values:{deviceName:r}}),this.setSubmitting(!1))}}}componentDidMount(){const{data:e={}}=this.props,t=e?.default||"";t&&this.setState({paymentMethod:t})}async deleteWan2Network(){const{deleteNetwork:e,wan2Network:t,wan2DeleteOk:a,gateway:s}=this.props;if(!(0,i.D6)(s)&&!(0,i.Cy)(s)&&!!t){if(a){try{await e(t._id)}catch(e){throw new Error("DEVICE_ULTE_SETUP_ACTIONS_WAN2_DELETE_ERROR")}return}throw new Error("DEVICE_ULTE_SETUP_ACTIONS_WAN2_AGREEMENT_ERROR")}}async registerDevice(e,t){const{mac:a,lte_radio:s,data:n={},activateLteTrial:r,updateLteDevice:i}=this.props,{lte_sso_user_uuid:o}=n,l="denied"===s?r:i;try{await l({mac:a,lte_sso_user_uuid:o,payment_source_id:e||t&&t.id})}catch(e){if(ge.includes(e.lte_billing_error_code))throw new Error("API_ERROR_PAYMENT_WRONG_ADDRESS");throw new Error("DEVICE_ULTE_SETUP_ACTIONS_REGISTER_ERROR")}}async adoptLTE(){const{adoptDevice:e,device:t}=this.props;try{await e(t)}catch(e){if(ge.includes(e.lte_billing_error_code))throw new Error("API_ERROR_PAYMENT_WRONG_ADDRESS");throw new Error("DEVICE_ULTE_SETUP_MISSING_ADOPT_CALLBACK")}}render(){const{setStep:e,totalSteps:t=3,hideModal:a,data:n={},intl:r,countryCodeData:i}=this.props,{paymentMethod:l,isSubmitting:E,paymentError:c}=this.state,_=n?.sources||void 0,d=i?.map(({key:e,name:t})=>({image:s.createElement(Le,{countryCode:e,width:18,height:18}),label:t,value:e,key:e})),m=_&&[{value:"",label:r.formatMessage({id:"DEVICE_ULTE_SETUP_PAYMENT_VALUE_NEW_PAYMENT_METHOD"})},..._.map(e=>({value:e.id,label:`**** **** **** ${e.last4}`}))],u={initialValues:{line1:"",city:"",state:"",country:"",postal_code:""},validationSchema:z.A.object().shape(l?{}:{country:z.A.string().required().label("COMMON_COUNTRY"),line1:z.A.string().max(64).required().label("COMMON_STREET_ADDRESS"),city:z.A.string().max(32).required().label("COMMON_CITY"),state:z.A.string().required().label("COMMON_STATE_PROVINCE"),postal_code:z.A.string().max(9).required().label("COMMON_POSTAL_CODE")}),onSubmit:e=>this.handleFormSubmit(e,r)},A=E,p=()=>e(o.di.account_credentials);return s.createElement(H.l1,{...u},({handleSubmit:e})=>s.createElement(M.A,{onClose:a,headerTitle:s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_HEADER"}),headerBackButtonAction:p,actions:[{text:s.createElement(D.sA,{id:"COMMON_STEP_OF",values:{step:2,totalSteps:t}}),disabled:!0,wrapClassName:Pe},{text:s.createElement(D.sA,{id:"COMMON_ACTION_NEXT"}),onClick:()=>e(),variant:"primary",disabled:A,loader:E?"spinner":void 0,type:"submit"}]},s.createElement(De,null,s.createElement(D.sA,{id:m?"DEVICE_ULTE_SETUP_PAYMENT_DETAILS_OPTIONS":"DEVICE_ULTE_SETUP_PAYMENT_DETAILS"})),s.createElement("form",{style:{textAlign:"left"},onSubmit:e,autoComplete:"off"},s.createElement(xe,{title:s.createElement(D.sA,{id:"COMMON_PAYMENTS_METHOD"})}),s.createElement(be,null,m&&s.createElement(Me,{id:"paymentMethod",value:l,options:m,onChange:this.handlePaymentMethodChange,inputProps:{full:!0}}),(!l||!m)&&s.createElement(s.Fragment,null,s.createElement(ve,null,s.createElement(fe,{color:"secondary"},s.createElement(D.sA,{id:"STRIPE_LABEL_CREDIT_CARD"})),s.createElement(te.CardElement,{options:this.getCardInputStyles(),onFocus:()=>this.setError()})),!!c&&s.createElement(Ee.A,{visible:!0},s.createElement("div",null,c)))),!l&&s.createElement(s.Fragment,null,s.createElement(xe,{title:s.createElement(D.sA,{id:"COMMON_PAYMENTS_BILLING_ADDRESS"})}),s.createElement(oe.A,{column:!0},s.createElement(Ue,{name:"country",id:"country",type:"dropdown",searchable:!0,sortedOptions:!0,options:d,label:"COMMON_COUNTRY",translateLabel:!0,variant:"secondary",validated:!0,full:!0})),s.createElement(oe.A,null,s.createElement(le.A,{name:"line1",variant:"secondary",label:"COMMON_STREET_ADDRESS",fast:!0,full:!0})),s.createElement(oe.A,null,s.createElement(le.A,{name:"city",variant:"secondary",label:"COMMON_CITY",fast:!0,full:!0})),s.createElement(oe.A,null,s.createElement(le.A,{name:"state",variant:"secondary",label:"COMMON_STATE_PROVINCE",fast:!0,full:!0})),s.createElement(oe.A,null,s.createElement(le.A,{name:"postal_code",variant:"secondary",label:"COMMON_POSTAL_CODE",fast:!0,full:!0}))),s.createElement(Se,null),s.createElement(Ne,null),s.createElement(ye,{type:"submit"}))))}}const ke=(0,F.Zz)((0,n.connect)(e=>({countryCodeData:(0,me.r)(e)}),e=>{e((0,Ae.b)(void 0,{crudCacheStrategy:{type:pe.e.CACHE}}))}))(e=>s.createElement(te.ElementsConsumer,null,({stripe:t,elements:a})=>(console.log({props:e,stripe:t}),s.createElement(we,{stripe:t,elements:a,...e})))),Ve="stripe-api-v3";class $e extends s.PureComponent{constructor(e){super(e),this.initStripeProvider=()=>{const{stripeApiKey:e}=this.props;this.setState({stripeApiLoaded:!0,stripe:(0,ee.c)(e)})},this.state={stripeApiLoaded:!1};const{stripeApiKey:t}=e;if(!t)return;if(document.getElementById(Ve))return void this.initStripeProvider();const a=document.createElement("script");a.async=!0,a.id=Ve,a.src="https://js.stripe.com/v3/",a.onload=this.initStripeProvider,document.body.appendChild(a)}render(){const{state:{stripeApiLoaded:e,stripe:t}}=this;return e?s.createElement(te.Elements,{stripe:t},s.createElement(ke,{...this.props})):null}}const Fe=(0,F.Zz)(D.j4,(0,n.connect)(e=>({stripeApiKey:(0,u.X)(e),wan2Network:(0,E.Hd)(e),gateway:(0,r.U$)(e)}),{hideModal:A.AS,createToast:p.ox,deleteNetwork:l.wR,activateLteTrial:c.t2,updateLteDevice:c.fH,adoptDevice:se.Hk}),ae.b)($e),He=(0,N.A)(x.A)`
  color: ${L.PA.warning};
  margin-right: ${({theme:{space:e}})=>e[3]}px;
  margin-bottom: ${({theme:{space:e}})=>e[2]}px;
`,ze=(0,N.A)("div")`
  margin-bottom: ${({theme:{space:e}})=>e[4]}px;
`,Be=(0,N.A)(U.A)`
  margin-top: ${({theme:{space:e}})=>e[3]}px;
  height: 250px;
`;let Ye;const Ge=({device:{model:e},setStep:t,data:{lte_sso_user_uuid:a,needs_subscription:r}={}})=>{const[i,l]=(0,s.useState)(0),E=(0,n.useSelector)(_.S$),d=(0,h.Qh)(E),m=`${W.DU}${d}/subscriptions`,u=(0,n.useDispatch)(),C=(0,s.useCallback)(()=>{clearTimeout(Ye),u((0,A.AS)())},[u]),S=(0,s.useCallback)(()=>t(o.di.account_credentials),[t]),O=(0,s.useCallback)(()=>{K.A.open(m),l(1)},[m]);return(0,s.useEffect)(()=>(i&&(Ye=setTimeout(()=>{u((0,c.g0)({lte_sso_user_uuid:a})).then(e=>{if(e&&!e.payment_past_due)return clearTimeout(Ye),r?void u((0,c.ut)({lte_sso_user_uuid:a})).then(e=>{t(o.di.payment,{lte_sso_user_uuid:a,needs_subscription:r,...e})}).catch(()=>{u((0,p.ox)({icon:T.C.danger,message:"DEVICE_ULTE_PAYMENT_METHOD_FETCH_ERROR"}))}):void t(o.di.confirm_payment,{lte_sso_user_uuid:a,needs_subscription:r});l(i+1)})},2e3)),()=>clearTimeout(Ye)),[i]),s.createElement(M.A,{onClose:C,headerTitle:s.createElement(s.Fragment,null,s.createElement(He,{size:"navigation"}),s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_OVERDUE_HEADER"})),headerBackButtonAction:S,actions:[{text:s.createElement(D.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:C},{text:s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_OVERDUE_LINK"}),variant:"primary",onClick:O,disabled:i>0,loader:i>0?"spinner":void 0}]},s.createElement(ze,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_OVERDUE_DETAILS"})),s.createElement(Be,{model:e,size:b.Xh.LARGE}))},We=(0,N.A)("div")`
  margin-top: ${({theme:e})=>e.space[4]}px;
`,Ke=({setStep:e,mac:t,device:a,wan2DeleteOk:d,data:m={}})=>{const{lte_sso_user_uuid:u}=m,[C,S]=(0,s.useState)(!1),O=(0,n.useSelector)(_.S$),I=(0,n.useSelector)(E.Hd),R=(0,n.useSelector)(r.U$),N=!(0,i.D6)(R)&&!(0,i.Cy)(R)&&!!I,g=(0,h.Qh)(O),U=`${W.DU}${g}`,L=(0,n.useDispatch)(),b=(0,s.useCallback)(()=>{L((0,A.AS)())},[]),P=(0,s.useCallback)(()=>e(o.di.account_credentials),[]),v=(0,s.useCallback)(async()=>{if(N){if(d){try{await L((0,l.wR)(I._id))}catch(e){throw new Error("DEVICE_ULTE_SETUP_ACTIONS_WAN2_DELETE_ERROR")}return}throw new Error("DEVICE_ULTE_SETUP_ACTIONS_WAN2_AGREEMENT_ERROR")}},[I,d,N]),f=(0,s.useCallback)(async()=>{try{await L((0,c.fH)({mac:t,lte_sso_user_uuid:u}))}catch(e){throw new Error("DEVICE_ULTE_SETUP_ACTIONS_REGISTER_ERROR")}},[u,t]),x=(0,s.useCallback)(async()=>{try{await L((0,se.Hk)(a))}catch(e){throw new Error("DEVICE_ULTE_SETUP_MISSING_ADOPT_CALLBACK")}},[a,L]),y=(0,s.useCallback)(async()=>{S(!0);try{await v(),await f(),await x(),e(o.di.complete)}catch(e){L((0,p.ox)({icon:T.C.danger,message:e,values:{deviceName:t}})),S(!1)}},[]);return s.createElement(M.A,{onClose:b,headerTitle:s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_CONFIRM_PAYMENT_HEADER"}),headerBackButtonAction:P,actions:[{text:s.createElement(D.sA,{id:"COMMON_ACTION_CLOSE"}),onClick:b},{text:s.createElement(D.sA,{id:"DEVICE_ACTIONS_ADOPT"}),variant:"primary",onClick:y,loader:C?"spinner":void 0}]},s.createElement(We,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_CONFIRM_PAYMENT_DETAILS"})),s.createElement(We,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_CONFIRM_PAYMENT_DETAILS_NOTE"})),s.createElement(We,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_CONFIRM_PAYMENT_MANAGE_ACCOUNT",values:{link:s.createElement("a",{href:U,target:"_blank",rel:"noopener noreferrer"},g)}})))},je=(0,N.A)(x.A)`
  color: ${L.PA.warning};
  margin-right: ${({theme:{space:e}})=>e[2]}px;
  margin-bottom: ${({theme:{space:e}})=>e[2]}px;
`,Xe=(0,N.A)(U.A)`
  margin-top: ${({theme:{space:e}})=>e[4]}px;
  height: 250px;
`,qe=({device:{model:e},handleWan2Delete:t})=>{const a=(0,n.useDispatch)(),r=(0,s.useCallback)(()=>{a((0,A.AS)())},[a]),i=(0,s.useMemo)(()=>[{text:s.createElement(D.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:r},{text:s.createElement(D.sA,{id:"COMMON_ACTION_PROCEED"}),onClick:t,variant:"primary"}],[r,t]);return s.createElement(M.A,{onClose:r,actions:i,headerTitle:s.createElement(s.Fragment,null,s.createElement(je,{size:"navigation"}),s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_WAN2_WARNING_HEADER"}))},s.createElement("div",null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_WAN2_WARNING_DETAILS"})),s.createElement(Xe,{model:e,size:b.Xh.MEDIUM}))};var Ze=a(966353),Qe=a.n(Ze),Je=a(410110),et=a.n(Je),tt=a(566723),at=a(602197),st=a(837612);const nt=g.AH`
  position: absolute;
  left: 24px;
`,rt=g.AH`
  border-radius: 0;
`,it=(0,N.A)("div")`
  margin-bottom: 24px;
  line-height: 1.5em;
`,ot=(0,N.A)("div")`
  margin-bottom: ${tt.kc};
`,lt=({device:e})=>{const t=(0,n.useDispatch)(),[a,r]=(0,s.useState)(!1),[i,{start:l}]=et()(1e3*o.Ay.REBOOT_TIME_IN_SECONDS,1e3);(0,s.useEffect)(l,[l]);const E=(0,n.useSelector)(_.S$),c=(0,h.Qh)(E),d=(0,st.S9)(e),m=(0,s.useCallback)(()=>{t((0,A.AS)())},[t]);(0,s.useEffect)(()=>{i||r(!0),d===at.g.CONNECTED&&(r(!0),m())},[i,d,m]);const u=[{text:s.createElement(D.sA,{id:a?"COMMON_COMPLETE":"DEVICE_ULTE_SETUP_COMPLETE_REMAINING",values:{remaining:Qe()(i,"mm:ss")}}),disabled:!0,wrapClassName:nt,className:rt},{text:s.createElement(D.sA,{id:"COMMON_ACTION_DONE"}),onClick:m,variant:"primary",loader:a?i?void 0:"success":"spinner"}];return s.createElement(M.A,{onClose:m,actions:u,headerTitle:s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_COMPLETE_HEADER"}),headerSubTitle:s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_COMPLETE_SUB_HEADER"})},s.createElement(it,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_COMPLETE_DETAILS",values:{minutes:o.Ay.REBOOT_TIME_IN_MINUTES}})),s.createElement(ot,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_COMPLETE_NOTE_CLOSE"})),s.createElement(ot,null,s.createElement(D.sA,{id:"DEVICE_ULTE_SETUP_COMPLETE_NOTE_MANAGE",values:{accountUrl:s.createElement("a",{href:`${W.DU}${c}`,target:"_blank",rel:"noopener noreferrer"},c)}})))},Et={account_credentials:J,complete:lt,confirm_payment:Ke,detected:f,device_unauthorized:"LTEDeviceUnauthorized",payment:Fe,payment_overdue:Ge,remote_access:$,wan2warning:qe},ct=({mac:e,lte_radio:t})=>{const[a,N]=(0,s.useState)(null),[g,D]=(0,s.useState)(null),[U,L]=(0,s.useState)(!0),[b,M]=(0,s.useState)(!1),P=(0,n.useDispatch)(),v=(0,n.useSelector)(r.U$),f=(0,n.useSelector)((0,s.useMemo)(()=>(0,r.tG)(e),[e])),x=(0,n.useSelector)(E.Hd),y=!(0,i.D6)(v)&&!(0,i.Cy)(v)&&(x&&!b),w=(0,n.useSelector)(u.X),k=(0,n.useSelector)(u.eT),V=(0,n.useSelector)(C.K),$=(0,n.useSelector)(_.S$),F=(0,n.useSelector)(O.W1),H=(0,s.useMemo)(()=>!F||(0,h.Qe)($)===window.location.hostname,[$,F]),z=(0,s.useCallback)(()=>{M(!0),N(o.di.account_credentials)},[]),B=(0,s.useCallback)(e=>{const{lte_sso_user_uuid:t,needs_subscription:a}=e;P((0,c.g0)({lte_sso_user_uuid:t})).then(e=>{if(e&&e.payment_past_due)return D({lte_sso_user_uuid:t,needs_subscription:a}),void N(o.di.payment_overdue);a?P((0,c.ut)({lte_sso_user_uuid:t})).then(e=>{D({lte_sso_user_uuid:t,needs_subscription:a,...e}),N(o.di.payment)}).catch(()=>{P((0,p.ox)({icon:T.C.danger,message:"DEVICE_ULTE_PAYMENT_METHOD_FETCH_ERROR"}))}):(D({lte_sso_user_uuid:t}),N(o.di.confirm_payment))})},[e,P]);if((0,s.useEffect)(()=>{if(!U){if(k&&w)return H||V?y?void N(o.di.wan2warning):void N(o.di.detected):void N(o.di.remote_access);P((0,p.ox)({icon:T.C.danger,message:"DEVICE_ULTE_SETUP_PRICING_ERROR"}))}},[U]),(0,s.useEffect)(()=>{P((0,I.Zi)(R.B.SETTINGS)),Promise.all([P((0,m.j)(!0)).catch(e=>{let t="COMMON_NOTICE_LOAD_ERROR_MESSAGE";switch((0,c.gh)(e)){case S.U.apiErrNetworkIssue:t="DEVICE_ULTE_SETUP_CONTROLLER_OFFLINE";break;case S.U.apiErrCannotFetchUiData:t="API_ERROR_CANNOT_FETCH_UI_DATA"}(0,p.ox)({icon:T.C.danger,message:t})}),P((0,d.G)()).catch(()=>{P((0,p.ox)({icon:T.C.danger,message:"COMMON_NOTICE_LOAD_ERROR_MESSAGE"}))}),P((0,l.Sk)({},{failureToast:{icon:T.C.danger,message:"DEVICE_ULTE_SETUP_NETWORKS_FETCH_ERROR"}}))]).then(()=>{L(!1)}).catch(e=>{})},[]),!a||U)return null;const Y=Et[a];return"string"==typeof Y?(P((0,A.AS)()),null):s.createElement(Y,{device:f,mac:e,data:g||{},wan2DeleteOk:b,lte_radio:t,setStep:(e,t=null)=>{D(t),N(e)},setPayment:B,handleWan2Delete:z})}},536280:(e,t,a)=>{a.d(t,{K:()=>n,a:()=>s});var s=function(e){var t;return(null==e||null===(t=e.shared)||void 0===t?void 0:t.featureFlags)||{}},n=function(e){var t;return(null===(t=s(e))||void 0===t?void 0:t.allowLocalLteAdoption)||!1}}}]);