"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[24602],{431253:(e,t,a)=>{a.d(t,{A:()=>R});var s=a(296540),o=a(822336),n=a(793336),i=a(350312),r=a(71479),l=a(566723),c=a(705426);const E=(0,r.A)(c.A,{shouldForwardProp:e=>"originalSize"!==e})`
  ${({originalSize:e})=>e?"":"width: 500px;"}
  padding: 24px;
`,A=(0,r.A)("header",{shouldForwardProp:e=>"onRequestClose"!==e})`
  position: relative;
  text-align: center;
`,m=(0,r.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;
`,_=(0,r.A)("div")`
  width: 345px;
  line-height: 18px;
  margin: 0 auto ${({theme:{space:e}})=>e[5]}px;
`,d=(0,r.A)(i.A)`
  position: absolute;
  top: 0;
  left: 0;
  cursor: pointer;
  color: ${({theme:{colors:{subtleText:e}}})=>e};
  width: 16px;
  height: 16px;
`,u=(0,r.A)(n.A)`
  position: absolute;
  top: 0;
  right: 0;
  cursor: pointer;
  color: ${({theme:{colors:{subtleText:e}}})=>e};
`,p=(0,r.A)("div")`
  max-height: 340px;
  overflow: auto;
`,h=(0,r.A)("div")`
  text-align: center;
  width: 100%;
  min-height: ${l.ZH};
  line-height: 18px;
  margin: 0 auto 8px;
`,R=({headerBackButtonAction:e,headerTitle:t,headerSubTitle:a,onClose:o,actions:n,children:i,originalSize:r=!1,...l})=>{const c=s.createElement(A,null,!!e&&s.createElement(d,{actionable:!0,onClick:e}),s.createElement(m,null,t),s.createElement(u,{actionable:!0,onClick:o}),!!a&&s.createElement(_,null,a));return s.createElement(E,{onRequestClose:o,originalSize:r,size:"small",header:c,actions:n,...l},s.createElement(p,null,s.createElement(h,null,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={}))},688094:(e,t,a)=>{a.d(t,{t2:()=>c,Kg:()=>l,hJ:()=>_,ut:()=>m,g0:()=>A,gh:()=>r,fH:()=>E});var s=a(691189),o=a(294201);const n="/api/s/{site}/cmd/lte",i=e=>e&&e.data&&e.data[0],r=e=>e&&e.apiMsg,l=({mac:e,username:t,password:a,token:r})=>l=>l((0,s.Xj)(o.A.AUTH_DEVICE,n,{mac:e,ubic_username:t,x_ubic_password:a,ubic_2fa_token:r||void 0})).then(i),c=e=>t=>t((0,s.Xj)(o.A.ACTIVATE_TRIAL,n,e)),E=e=>t=>t((0,s.Xj)(o.A.UPDATE_DEVICE,n,e)),A=e=>t=>t((0,s.Xj)(o.A.CHECK_PAYMENT_PAST_DUE,n,e)).then(i),m=e=>t=>t((0,s.Xj)(o.A.PAYMENT_METHODS,n,e)).then(i),_=({macOrMacs:e,username:t,password:a,token:r})=>l=>l((0,s.Xj)(o.A.CHECK_SUBSCRIPTION,n,{macs:"string"==typeof e?[e]:e,ubic_username:t,x_ubic_password:a,ubic_2fa_token:r})).then(i)},724602:(e,t,a)=>{a.r(t),a.d(t,{default:()=>b});var s=a(868238),o=a(469733),n=a(951272),i=a(742920),r=a(870443),l=a(675359),c=a(126457),E=a(811569),A=a(417378),m=a(685375),_=a(688094),d=a(198494),u=a(367370),p=a(902786),h=a(532419),R=a(953141),T=a(296540),C=a(699784),I=a(431253),O=a(748598);const g=({isValid:e,dirty:t,isSubmitting:a,setFieldValue:s,hideModal:o,values:{sso2FA:n,ssoToken:i=""},values:r,handleSubmit:l,errors:c})=>{const E=a||(n?6!==i.length:!(e&&t)),A=(0,T.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),E||l()},[E]),m=(0,T.useCallback)(()=>{n&&s("sso2FA",!1)},[n,s]),_=[{text:T.createElement(C.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:o},{text:T.createElement(C.sA,{id:"COMMON_ACTION_VERIFY"}),onClick:A,variant:"primary",disabled:E,loader:a?"spinner":void 0,type:"submit"}];return T.createElement(I.A,{onClose:o,headerTitle:T.createElement(C.sA,{id:"LTE_SUBSCRIPTION_ACCOUNT_HEADER"}),headerSubTitle:T.createElement(C.sA,{id:n?"LTE_SUBSCRIPTION_ACCOUNT_SUB_HEADER_2FA":"LTE_SUBSCRIPTION_ACCOUNT_SUB_HEADER"}),headerBackButtonAction:n?m:void 0,actions:_,originalSize:!0},T.createElement(O.A,{handleSubmit:l,setFieldValue:s,values:r,errors:c,isSubmitting:a,isValid:e,dirty:t,hideOwnerDetailsText:!0}))},S=(0,n.bk)({enableReinitialize:!0,isInitialValid:!0,mapPropsToValues:({ssoUsername:e=""})=>({ssoUsername:e,ssoPassword:"",ssoToken:"",tos:!1,sso2FA:!1,openRemoteController:!1}),validationSchema:r.A.object().shape({ssoUsername:r.A.string().label("LTE_SSO_LOGIN_LABEL_EMAIL_OR_USERNAME").required(),ssoPassword:r.A.string().label("COMMON_PASSWORD").required(),tos:r.A.boolean(),ssoToken:r.A.string(),sso2FA:r.A.boolean(),openRemoteController:r.A.boolean()}),handleSubmit:({ssoUsername:e,ssoPassword:t,ssoToken:a},{props:{macs:s,devices:o,checkLteSubscription:n,createToast:r,formatMessage:l,fetchInfo:c,hideModal:E,showLteDeviceUnavailable:A},setFieldValue:_,setErrors:d,setSubmitting:u})=>{u(!0);n({username:e||void 0,password:t||void 0,token:a||void 0,macOrMacs:s}).then(async({user_uuid:e})=>{o.some(t=>!(0,p._D)(t,e))?A():(await c(),E())}).catch(({apiMsg:e})=>{switch(R.r[e]){case m.f.API_ERROR_INCORRECT_CREDENTIALS:d({ssoUsername:l({id:"DEVICE_SSO_ACTIONS_AUTH_INVALID_ERROR"}),ssoPassword:l({id:"DEVICE_SSO_ACTIONS_AUTH_INVALID_ERROR"})});break;case m.f.API_ERROR_INVALID_2FA_TOKEN:d({ssoToken:l({id:"DEVICE_SSO_ACTIONS_AUTH_INVALID_ERROR"})}),_("ssoToken","");break;case m.f.API_ERROR_TOKEN_2FA_REQUIRED:_("sso2FA",!0);break;default:r({type:i.C.danger,message:"DEVICE_SSO_ACTIONS_AUTH_ERROR"})}u(!1)})}}),b=(0,s.Zz)((0,o.connect)((e,{macs:t})=>{const a=(0,d.Pk)(e);return{env:(0,A.S$)(e),ssoUsername:(0,d.rU)(e)||a,ssoUuid:a,devices:(0,h.ID)(e).filter(({mac:e})=>t.includes(e))}},{hideModal:c.AS,createToast:l.ox,checkLteSubscription:_.hJ,fetchInfo:u.N,showLteDeviceUnavailable:E.Zo}),S)(g)},748598:(e,t,a)=>{a.d(t,{A:()=>f});var s=a(868238),o=a(296540),n=a(927099),i=a(822336),r=a(438628),l=a(71479),c=a(998837),E=a(132196),A=a(574137),m=a(566723),_=a(372382),d=a(143811),u=a(294303),p=a(699784),h=a(923831);const R=E.AH`
  height: 100%;
`,T=(0,l.A)("div")`
  margin-top: ${m.Ln};
  text-align: left;
  line-height: 18px;
  font-size: ${({theme:{fontSizes:e}})=>e[0]}px;
`,C=(0,l.A)("div")`
  margin-top: ${m.ew};
  display: flex;
  justify-content: center;
`,I=(0,l.A)("div")`
  width: 34px;
  height: 47px;
  text-align: center;
  line-height: 45px;
  border: ${({theme:{themeName:e}})=>i.Ay[`desktop-border-divider-${e}`]};
  font-size: 30px;
  font-weight: ${i.Ay["desktop-font-weight-semibold"]};
  margin: 0 ${({theme:{space:e}})=>e[3]}px;
  cursor: text;
`,O=(0,l.A)(d.A)`
  position: absolute;
  width: 284px;
  height: 47px;
  left: calc(50% - 142px);
  opacity: 0;

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

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

    animation: ${E.i7`
            0% {
                opacity: 1;
            }
            69% {
                opacity: 1;
            }
            70% {
                opacity: 0;
            }
            100% {
                opacity: 0;
            }
        `} 1.2s ease 0s infinite;
  }
`):void 0},s);var i});return o.createElement("form",{onSubmit:M,autoComplete:"off"},e?o.createElement(o.Fragment,null,o.createElement(C,null,F,o.createElement(O,{name:"ssoToken",maxLength:"6",onFocus:V,onBlur:y,containerWrapperClassName:R,inputContentClassName:R})),o.createElement(_.A,{fieldName:"ssoToken"})):o.createElement(o.Fragment,null,o.createElement(u.A,{flexDirection:"column",alignItems:"flex-start"},o.createElement(r.A,{label:D({id:"LTE_SSO_LOGIN_LABEL_EMAIL_OR_USERNAME"}),name:"ssoUsername",value:a,onChange:e=>l("ssoUsername",e.target.value||""),full:!0}),o.createElement(_.A,{fieldName:"ssoUsername"})),o.createElement(u.A,{flexDirection:"column",alignItems:"flex-start"},o.createElement(r.A,{label:D({id:"COMMON_PASSWORD"}),name:"ssoPassword",value:s,type:"password",onChange:e=>l("ssoPassword",e.target.value||""),full:!0}),o.createElement(_.A,{fieldName:"ssoPassword"})),i?null:o.createElement(T,null,o.createElement(p.sA,{id:"DEVICE_ULTE_SETUP_ACCOUNT_DETAILS"})),U?o.createElement(g,{justifyContent:"space-between",alignItems:"center"},o.createElement(d.A,{label:"DEVICE_ULTE_SETUP_LABEL_ACCEPT_TOS",name:"tos",type:"checkbox"}),o.createElement(S,null,o.createElement(p.sA,{id:"DEVICE_ULTE_SETUP_LABEL_ACCEPT_TOS",values:{link:o.createElement("a",{href:h.Ay.LEGAL_USE_TOS,target:"_blank",rel:"noopener noreferrer"},o.createElement(p.sA,{id:"COMMON_TOS"}))}}))):null),o.createElement(b,{type:"submit"}))})}}]);