"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[57564],{793155(e,t,a){a.d(t,{b:()=>i});var s=a(691189);const n=`${a(771805).J}/stat/ccode`,i=(e={},t={})=>(0,s.t9)("country",n,e,{idField:"key",...t})},198247(e,t,a){a.d(t,{r:()=>E});var s=a(801081),n=a(25553),i=a(87485),r=a(793155);const l=(0,n.uh)((0,r.b)()),E=(0,s.Mz)(l,e=>(0,i.kh)(e).filter(({key:e})=>"AN"!==e))},688094(e,t,a){a.d(t,{t2:()=>o,Kg:()=>E,hJ:()=>A,ut:()=>d,g0:()=>_,gh:()=>l,fH:()=>c});var s=a(691189),n=a(294201);const i=`${a(771805).J}/cmd/lte`,r=e=>e&&e.data&&e.data[0],l=e=>e&&e.apiMsg,E=({mac:e,username:t,password:a,token:l})=>E=>E((0,s.Xj)(n.A.AUTH_DEVICE,i,{mac:e,ubic_username:t,x_ubic_password:a,ubic_2fa_token:l||void 0})).then(r),o=e=>t=>t((0,s.Xj)(n.A.ACTIVATE_TRIAL,i,e)),c=e=>t=>t((0,s.Xj)(n.A.UPDATE_DEVICE,i,e)),_=e=>t=>t((0,s.Xj)(n.A.CHECK_PAYMENT_PAST_DUE,i,e)).then(r),d=e=>t=>t((0,s.Xj)(n.A.PAYMENT_METHODS,i,e)).then(r),A=({macOrMacs:e,username:t,password:a,token:l})=>E=>E((0,s.Xj)(n.A.CHECK_SUBSCRIPTION,i,{macs:"string"==typeof e?[e]:e,ubic_username:t,x_ubic_password:a,ubic_2fa_token:l})).then(r)},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:()=>o,M$:()=>c,X:()=>_,eT:()=>A});var s=a(801081),n=a(25553),i=a(87485),r=a(560485);const l=(0,n.uh)((0,r.j)()),E=(0,s.Mz)(l,i.i6),o=(0,s.Mz)(E,e=>e?.error||!1),c=((0,s.Mz)(E,({mapbox:e})=>e),(0,s.Mz)(E,({unsplash:e})=>e||null)),_=(0,s.Mz)(E,({stripe:e})=>e),d=(0,s.Mz)(E,({lte:e})=>e||{}),A=(0,s.Mz)(d,({pricing:e})=>e)},372382(e,t,a){a.d(t,{A:()=>l});var s=a(296540),n=a(951272),i=a(86838),r=a(79760);const l=({fieldName:e,validationMessageProps:t={}})=>{const{errors:a,touched:l,submitCount:E}=(0,n.j7)(),o=(0,r.t$)(e,a,l,E);return o?s.createElement(i.A,{isInvalid:!0,style:{padding:0},...t,label:o}):null}},854246(e,t,a){a.d(t,{A:()=>c});var s=a(822336),n=a(296540),i=a(71479),r=a(132196),l=a(916537),E=a(311785);const o=(0,i.A)("div",(0,E.A)("align"))`
  ${({align:e})=>e&&`text-align: ${e}`};
  color: ${({theme:{themeName:e}})=>s.Ay[`desktop-color-red-06-${e}`]};
  font-size: ${({theme:{fontSizes:e}})=>e[0]}px;
  line-height: 20px;
`,c=({align:e="left",children:t=null,className:a=null,translation:s=null,visible:i=!1})=>i?n.createElement(o,{align:e,className:(0,r.cx)(a)},s?n.createElement(l.sA,{id:s}):null,t):null},748598(e,t,a){a.d(t,{A:()=>g});var s=a(296540),n=a(82960),i=a(217439),r=a(822336),l=a(438628),E=a(71479),o=a(382389),c=a(132196),_=a(574137),d=a(566723),A=a(372382),m=a(143811),u=a(294303),T=a(916537),C=a(923831);const p=c.AH`
  height: 100%;
`,S=(0,E.A)("div")`
  margin-top: ${d.Ln};
  text-align: left;
  line-height: 18px;
  font-size: ${({theme:{fontSizes:e}})=>e[0]}px;
`,h=(0,E.A)("div")`
  margin-top: ${d.ew};
  display: flex;
  justify-content: center;
`,O=(0,E.A)("div")`
  width: 34px;
  height: 47px;
  text-align: center;
  line-height: 45px;
  border: ${({theme:{themeName:e}})=>r.Ay[`desktop-border-divider-${e}`]};
  font-size: 30px;
  font-weight: ${r.Ay["desktop-font-weight-semibold"]};
  margin: 0 ${({theme:{space:e}})=>e[3]}px;
  cursor: text;
`,N=(0,E.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,E.A)(u.A)`
  margin-top: ${d.S2};
  margin-bottom: ${d.xO};
  text-align: left;
`,R=(0,E.A)(i.A)`
  flex: 1;
  margin-left: ${d.xO};
`,D=(0,E.A)("input")`
  display: none;
`,g=(0,n.Zz)(T.j4,o.b)(({values:{sso2FA:e,ssoToken:t="",ssoUsername:a,ssoPassword:n,tos:i},hideOwnerDetailsText:r=!1,setFieldValue:E,handleSubmit:d,isSubmitting:g,isValid:U,dirty:M,showTOS:L})=>{const{colors:{text:b}}=(0,o.u)(),{formatMessage:P}=(0,T.tz)(),v=g||(e?6!==t.length:!(U&&M&&(!L||i))),[f,x]=(0,s.useState)(!1),y=(0,s.useCallback)(()=>{x(!0)},[]),k=(0,s.useCallback)(()=>{x(!1)},[]),w=(0,s.useCallback)(e=>{e?.preventDefault?.(),e?.stopPropagation?.(),v||d()},[v,d]);(0,s.useEffect)(()=>{g||6!==t.length||w()},[t]);const V=[...new Array(6)].map((e,a)=>{const n=t[a]||"",i=f&&t.length===a;return s.createElement(O,{key:`sso-token-char-${a.toString()}`,className:i?(r=b,c.AH`
  border-color: ${_.hu};
  position: relative;

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

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