"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[57564],{431253:(e,t,a)=>{a.d(t,{A:()=>p});var s=a(296540),n=a(822336),r=a(793336),i=a(350312),E=a(71479),o=a(566723),l=a(705426);const c=(0,E.A)(l.A,{shouldForwardProp:e=>"originalSize"!==e})`
  ${({originalSize:e})=>e?"":"width: 500px;"}
  padding: 24px;
`,_=(0,E.A)("header",{shouldForwardProp:e=>"onRequestClose"!==e})`
  position: relative;
  text-align: center;
`,d=(0,E.A)("div")`
  font-size: ${({theme:{fontSizes:e}})=>e[3]}px;
  font-weight: ${n.Ay["desktop-font-weight-semibold"]};
  margin-bottom: ${({theme:{space:e}})=>e[4]}px;
`,A=(0,E.A)("div")`
  width: 345px;
  line-height: 18px;
  margin: 0 auto ${({theme:{space:e}})=>e[5]}px;
`,m=(0,E.A)(i.A)`
  position: absolute;
  top: 0;
  left: 0;
  cursor: pointer;
  color: ${({theme:{colors:{subtleText:e}}})=>e};
  width: 16px;
  height: 16px;
`,u=(0,E.A)(r.A)`
  position: absolute;
  top: 0;
  right: 0;
  cursor: pointer;
  color: ${({theme:{colors:{subtleText:e}}})=>e};
`,T=(0,E.A)("div")`
  max-height: 340px;
  overflow: auto;
`,C=(0,E.A)("div")`
  text-align: center;
  width: 100%;
  min-height: ${o.ZH};
  line-height: 18px;
  margin: 0 auto 8px;
`,p=({headerBackButtonAction:e,headerTitle:t,headerSubTitle:a,onClose:n,actions:r,children:i,originalSize:E=!1,...o})=>{const l=s.createElement(_,null,!!e&&s.createElement(m,{actionable:!0,onClick:e}),s.createElement(d,null,t),s.createElement(u,{actionable:!0,onClick:n}),!!a&&s.createElement(A,null,a));return s.createElement(c,{onRequestClose:n,originalSize:E,size:"small",header:l,actions:r,...o},s.createElement(T,null,s.createElement(C,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:()=>l,Kg:()=>o,hJ:()=>A,ut:()=>d,g0:()=>_,gh:()=>E,fH:()=>c});var s=a(691189),n=a(294201);const r="/api/s/{site}/cmd/lte",i=e=>e&&e.data&&e.data[0],E=e=>e&&e.apiMsg,o=({mac:e,username:t,password:a,token:E})=>o=>o((0,s.Xj)(n.A.AUTH_DEVICE,r,{mac:e,ubic_username:t,x_ubic_password:a,ubic_2fa_token:E||void 0})).then(i),l=e=>t=>t((0,s.Xj)(n.A.ACTIVATE_TRIAL,r,e)),c=e=>t=>t((0,s.Xj)(n.A.UPDATE_DEVICE,r,e)),_=e=>t=>t((0,s.Xj)(n.A.CHECK_PAYMENT_PAST_DUE,r,e)).then(i),d=e=>t=>t((0,s.Xj)(n.A.PAYMENT_METHODS,r,e)).then(i),A=({macOrMacs:e,username:t,password:a,token:E})=>o=>o((0,s.Xj)(n.A.CHECK_SUBSCRIPTION,r,{macs:"string"==typeof e?[e]:e,ubic_username:t,x_ubic_password:a,ubic_2fa_token:E})).then(i)},748598:(e,t,a)=>{a.d(t,{A:()=>g});var s=a(868238),n=a(296540),r=a(927099),i=a(822336),E=a(438628),o=a(71479),l=a(998837),c=a(132196),_=a(574137),d=a(566723),A=a(372382),m=a(143811),u=a(294303),T=a(699784),C=a(923831);const p=c.AH`
  height: 100%;
`,S=(0,o.A)("div")`
  margin-top: ${d.Ln};
  text-align: left;
  line-height: 18px;
  font-size: ${({theme:{fontSizes:e}})=>e[0]}px;
`,h=(0,o.A)("div")`
  margin-top: ${d.ew};
  display: flex;
  justify-content: center;
`,O=(0,o.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;
`,N=(0,o.A)(m.A)`
  position: absolute;
  width: 284px;
  height: 47px;
  left: calc(50% - 142px);
  opacity: 0;

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

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

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