"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[86300],{870643(e,t,s){s.d(t,{b:()=>r});var i=s(29472);const a=`${s(290454).J}/stat/ccode`,r=(e={},t={})=>(0,i.t9)("country",a,e,{idField:"key",...t})},683528(e,t,s){s.d(t,{r:()=>E});var i=s(222102),a=s(656466),r=s(401042),o=s(870643);const n=(0,a.uh)((0,o.b)()),E=(0,i.Mz)(n,e=>(0,r.kh)(e).filter(({key:e})=>"AN"!==e))},706840(e,t,s){s.d(t,{t2:()=>d,Kg:()=>E,hJ:()=>c,ut:()=>A,g0:()=>_,gh:()=>n,fH:()=>l});var i=s(29472),a=s(193730);const r=`${s(290454).J}/cmd/lte`,o=e=>e&&e.data&&e.data[0],n=e=>e&&e.apiMsg,E=({mac:e,username:t,password:s,token:n})=>E=>E((0,i.Xj)(a.A.AUTH_DEVICE,r,{mac:e,ubic_username:t,x_ubic_password:s,ubic_2fa_token:n||void 0})).then(o),d=e=>t=>t((0,i.Xj)(a.A.ACTIVATE_TRIAL,r,e)),l=e=>t=>t((0,i.Xj)(a.A.UPDATE_DEVICE,r,e)),_=e=>t=>t((0,i.Xj)(a.A.CHECK_PAYMENT_PAST_DUE,r,e)).then(o),A=e=>t=>t((0,i.Xj)(a.A.PAYMENT_METHODS,r,e)).then(o),c=({macOrMacs:e,username:t,password:s,token:n})=>E=>E((0,i.Xj)(a.A.CHECK_SUBSCRIPTION,r,{macs:"string"==typeof e?[e]:e,ubic_username:t,x_ubic_password:s,ubic_2fa_token:n})).then(o)},69834(e,t,s){var i;s.d(t,{f:()=>i}),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"}(i||(i={}))},19445(e,t,s){s.d(t,{A:()=>g});var i=s(274934),a=s(602086),r=s(418398),o=s(938984),n=s(814557),E=s(843615),d=s(247816),l=s(263705),_=s(409844),A=s(443502),c=s(309130),T=s(652347),u=s(120197),C=s(100978),h=s(470070),p=s(171056);const m=_.AH`
  height: 100%;
`,S=(0,d.A)("div")`
  margin-top: ${c.Ln};
  text-align: left;
  line-height: 18px;
  font-size: ${({theme:{fontSizes:e}})=>e[0]}px;
`,x=(0,d.A)("div")`
  margin-top: ${c.ew};
  display: flex;
  justify-content: center;
`,O=(0,d.A)("div")`
  width: 34px;
  height: 47px;
  text-align: center;
  line-height: 45px;
  border: ${({theme:{themeName:e}})=>n.Ay[`desktop-border-divider-${e}`]};
  font-size: 30px;
  font-weight: ${n.Ay["desktop-font-weight-semibold"]};
  margin: 0 ${({theme:{space:e}})=>e[3]}px;
  cursor: text;
`,N=(0,d.A)(u.A)`
  position: absolute;
  width: 284px;
  height: 47px;
  left: calc(50% - 142px);
  opacity: 0;

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

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

    animation: ${_.i7`
            0% {
                opacity: 1;
            }
            69% {
                opacity: 1;
            }
            70% {
                opacity: 0;
            }
            100% {
                opacity: 0;
            }
        `} 1.2s ease 0s infinite;
  }
`):void 0,children:t[s]||""},`sso-token-char-${s.toString()}`);var a});return(0,i.jsxs)("form",{onSubmit:k,autoComplete:"off",children:[(0,i.jsxs)(i.Fragment,e?{children:[(0,i.jsxs)(x,{children:[V,(0,i.jsx)(N,{name:"ssoToken",maxLength:"6",onFocus:y,onBlur:w,containerWrapperClassName:m,inputContentClassName:m})]}),(0,i.jsx)(T.A,{fieldName:"ssoToken"})]}:{children:[(0,i.jsxs)(C.A,{flexDirection:"column",alignItems:"flex-start",children:[(0,i.jsx)(E.A,{label:P({id:"LTE_SSO_LOGIN_LABEL_EMAIL_OR_USERNAME"}),name:"ssoUsername",value:s,onChange:e=>d("ssoUsername",e.target.value||""),full:!0}),(0,i.jsx)(T.A,{fieldName:"ssoUsername"})]}),(0,i.jsxs)(C.A,{flexDirection:"column",alignItems:"flex-start",children:[(0,i.jsx)(E.A,{label:P({id:"COMMON_PASSWORD"}),name:"ssoPassword",value:r,type:"password",onChange:e=>d("ssoPassword",e.target.value||""),full:!0}),(0,i.jsx)(T.A,{fieldName:"ssoPassword"})]}),n?null:(0,i.jsx)(S,{children:(0,i.jsx)(h.sA,{id:"DEVICE_ULTE_SETUP_ACCOUNT_DETAILS"})}),M?(0,i.jsxs)(I,{justifyContent:"space-between",alignItems:"center",children:[(0,i.jsx)(u.A,{label:"DEVICE_ULTE_SETUP_LABEL_ACCEPT_TOS",name:"tos",type:"checkbox"}),(0,i.jsx)(R,{children:(0,i.jsx)(h.sA,{id:"DEVICE_ULTE_SETUP_LABEL_ACCEPT_TOS",values:{link:(0,i.jsx)("a",{href:p.Ay.LEGAL_USE_TOS,target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(h.sA,{id:"COMMON_TOS"})})}})})]}):null]}),(0,i.jsx)(D,{type:"submit"})]})})},93298(e,t,s){s.d(t,{A:()=>m});var i=s(274934),a=s(814557),r=s(847399),o=s(856639),n=s(247816),E=s(309130),d=s(384783),l=s(291508);const _=(0,n.A)(d.A,(0,l.A)("originalSize"))`
  ${({originalSize:e})=>e?"":"width: 500px;"}
  padding: 24px;
`,A=(0,n.A)("header",(0,l.A)("onRequestClose"))`
  position: relative;
  text-align: center;
`,c=(0,n.A)("div")`
  font-size: ${({theme:{fontSizes:e}})=>e[3]}px;
  font-weight: ${a.Ay["desktop-font-weight-semibold"]};
  margin-bottom: ${({theme:{space:e}})=>e[4]}px;
`,T=(0,n.A)("div")`
  width: 345px;
  line-height: 18px;
  margin: 0 auto ${({theme:{space:e}})=>e[5]}px;
`,u=(0,n.A)(o.A)`
  position: absolute;
  top: 0;
  left: 0;
  cursor: pointer;
  color: ${({theme:{colors:{subtleText:e}}})=>e};
  width: 16px;
  height: 16px;
`,C=(0,n.A)(r.A)`
  position: absolute;
  top: 0;
  right: 0;
  cursor: pointer;
  color: ${({theme:{colors:{subtleText:e}}})=>e};
`,h=(0,n.A)("div")`
  max-height: 340px;
  overflow: auto;
`,p=(0,n.A)("div")`
  text-align: center;
  width: 100%;
  min-height: ${E.ZH};
  line-height: 18px;
  margin: 0 auto 8px;
`,m=({headerBackButtonAction:e,headerTitle:t,headerSubTitle:s,onClose:a,actions:r,children:o,originalSize:n=!1,...E})=>{const d=(0,i.jsxs)(A,{children:[e?(0,i.jsx)(u,{actionable:!0,onClick:e}):null,(0,i.jsx)(c,{children:t}),(0,i.jsx)(C,{actionable:!0,onClick:a}),s?(0,i.jsx)(T,{children:s}):null]});return(0,i.jsx)(_,{onRequestClose:a,originalSize:n,size:"small",header:d,actions:r,...E,children:(0,i.jsx)(h,{children:(0,i.jsx)(p,{children:o})})})}},786300(e,t,s){s.r(t),s.d(t,{default:()=>et});var i=s(274934),a=s(602086),r=s(977872),o=s(743178),n=s(213920),E=s(159469),d=s(401004),l=s(700444),_=s(869332),A=s(521708),c=s(892095),T=s(976458),u=s(594633),C=s(670780),h=s(197571),p=s(553732),m=s(706840),S=s(956978),x=s(754924),O=s(171056),N=s(352210),I=s(600191),R=s(247816),D=s(443502),g=s(541819),U=s(974390),L=s(470070),M=s(93298);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 j=s(291935),v=s(570801);const f=(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 w=s(613842),k=s(807811);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=s(418398),B=s(281370),G=s(369936),z=s(263705),W=s(795206),K=s(843871),X=s(938984),Z=s(814557),q=s(698782),Q=s(198273),J=s(409844),ee=s(244081),te=s(237887),se=s(950804),ie=s(859513),ae=s(120197),re=s(793442),oe=s(86635),ne=s(683528),Ee=s(870643),de=s(726831);const le=(0,R.A)("div")`
  margin-top: ${({theme:e})=>e.space[4]}px;
  text-align: left;
`,_e=(0,R.A)("div")`
  margin-top: ${({theme:e})=>e.space[3]}px;
  color: ${({theme:e})=>e.colors.subtleText};
  font-weight: ${Z.Ay["desktop-font-weight-semibold"]};
`,Ae=(0,R.A)("div")`
  margin-top: ${({theme:e})=>e.space[4]}px;
`,ce=()=>{const{standard:{costPerGb:{first:e,additional:t}}}=(0,r.d4)(A.eT)||{standard:{costPerGb:{first:"",additional:""}}};return(0,i.jsxs)(le,{children:[(0,i.jsx)(_e,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_SUBSCRIPTION_HEADER"})}),(0,i.jsxs)(Ae,{children:[(0,i.jsxs)("b",{children:[(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_COST_TITLE"}),": "]}),(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_COST_DETAILS",values:{first:e,additional:t}})]}),(0,i.jsx)(Ae,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_FREE_TRIAL"})}),(0,i.jsxs)(Ae,{children:[(0,i.jsxs)("b",{children:[(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_BILLING_TITLE"}),": "]}),(0,i.jsx)(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;
`,ue=(0,R.A)("div")`
  margin-top: ${({theme:e})=>e.space[3]}px;
  color: ${({theme:e})=>e.colors.subtleText};
  font-weight: ${Z.Ay["desktop-font-weight-semibold"]};
`,Ce=(0,R.A)("div")`
  margin-top: ${({theme:e})=>e.space[4]}px;
`,he=()=>(0,i.jsxs)(Te,{children:[(0,i.jsx)(ue,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_DISCLAIMER_HEADER"})}),(0,i.jsx)(Ce,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_DISCLAIMER_OVERAGES",values:{initialDataLimit:O.Ay.HARD_LIMIT_DEFAULT_GB}})}),(0,i.jsx)(Ce,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_DISCLAIMER_NETWORK"})})]}),pe=[2001,2003,2005,2006],me=(0,R.A)("div")`
  margin-bottom: ${({theme:e})=>e.space[4]}px;
  font-size: 13px;
`,Se=(0,R.A)(ae.A)`
  & > div > div > div > div > div > input:first-child {
    margin-top: 3px !important;
  }
`,xe=(0,R.A)(oe.A)`
  border-radius: 50%;
  object-fit: cover;
`,Oe=(0,R.A)("div")`
  text-align: left;
`,Ne=(0,R.A)(te.A.Sorted)`
  width: 100% !important;
  margin-bottom: ${({theme:e})=>e.space[4]}px;
`,Ie=J.AH`
  position: absolute;
  left: 24px;
  border-radius: 0;
`,Re=(0,R.A)("div")`
  padding-bottom: 6px;
  border-bottom: ${({theme:{themeName:e}})=>Z.Ay[`desktop-border-divider-${e}`]};
`,De=(0,R.A)(X.A)`
  margin-bottom: ${({theme:e})=>e.space[2]}px;
`,ge=(0,R.A)(q.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 Le extends a.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:s},fontSize:i}}=this.props;return{style:{base:{fontSize:`${i["font-size-body"]}px`,color:t,"::placeholder":{color:s}},invalid:{color:Z.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:s,elements:i}=this.props,{paymentMethod:a}=this.state,r={address:{...e}};if(this.setSubmitting(!0),a)return void this.submitForm(a,t);const{error:o,source:n}=await s.createSource(i.getElement("card"),{type:"card",owner:r});if(o)return this.setError(o.message),void this.setSubmitting(!1);this.submitForm("",t,n)};submitForm=async(e,t,s)=>{const{createToast:a,mac:r,setStep:o}=this.props;try{return await this.deleteWan2Network(),await this.registerDevice(e,s),await this.adoptLTE(),o(O.di.COMPLETE)}catch(e){return"API_ERROR_PAYMENT_WRONG_ADDRESS"===e.message?(this.setSubmitting(!1),a({icon:E.C.danger,title:t.formatMessage({id:"API_ERROR_PAYMENT_WRONG_ADDRESS_TITLE"},{b:L.b}),details:(0,i.jsx)("span",{children:t.formatMessage({id:"API_ERROR_PAYMENT_WRONG_ADDRESS"},{link:(0,i.jsx)(re.A.Simplified,{href:de.A.accountUiPayments,message:t.formatMessage({id:"COMMON_PAYMENT_METHODS"})})})})})):(a({icon:E.C.danger,message:e.message,values:{deviceName:r}}),this.setSubmitting(!1))}};async deleteWan2Network(){const{deleteNetwork:e,wan2Network:t,wan2DeleteOk:s,gateway:i}=this.props;if(!(0,S.D6h)(i)&&!(0,S.Cyy)(i)&&t){if(s){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:s,lte_radio:i,data:a={},activateLteTrial:r,updateLteDevice:o}=this.props,{lte_sso_user_uuid:n}=a,E="denied"===i?r:o;try{await E({mac:s,lte_sso_user_uuid:n,payment_source_id:e||t&&t.id})}catch(e){if(pe.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(pe.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:s,data:a={},intl:r,countryCodeData:o}=this.props,{paymentMethod:n,isSubmitting:E,paymentError:d}=this.state,l=a?.sources||void 0,_=o?.map(({key:e,name:t})=>({image:(0,i.jsx)(xe,{countryCode:e,width:18,height:18}),label:t,value:e,key:e})),A=l&&[{value:"",label:r.formatMessage({id:"DEVICE_ULTE_SETUP_PAYMENT_VALUE_NEW_PAYMENT_METHOD"})},...l.map(e=>({value:e.id,label:`**** **** **** ${e.last4}`}))],c={initialValues:{line1:"",city:"",state:"",country:"",postal_code:""},validationSchema:se.A.object().shape(n?{}:{country:se.A.string().required().label("COMMON_COUNTRY"),line1:se.A.string().max(64).required().label("COMMON_STREET_ADDRESS"),city:se.A.string().max(32).required().label("COMMON_CITY"),state:se.A.string().required().label("COMMON_STATE_PROVINCE"),postal_code:se.A.string().max(9).required().label("COMMON_POSTAL_CODE")}),onSubmit:e=>this.handleFormSubmit(e,r)},T=E,u=()=>e(O.di.ACCOUNT_CREDENTIALS);return(0,i.jsx)(K.l1,{...c,children:({handleSubmit:e})=>(0,i.jsxs)(M.A,{onClose:s,headerTitle:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_HEADER"}),headerBackButtonAction:u,actions:[{text:(0,i.jsx)(L.sA,{id:"COMMON_STEP_OF",values:{step:2,totalSteps:t}}),disabled:!0,wrapClassName:Ie},{text:(0,i.jsx)(L.sA,{id:"COMMON_ACTION_NEXT"}),onClick:()=>e(),variant:"primary",disabled:T,loader:E?"spinner":void 0,type:"submit"}],children:[(0,i.jsx)(me,{children:(0,i.jsx)(L.sA,{id:A?"DEVICE_ULTE_SETUP_PAYMENT_DETAILS_OPTIONS":"DEVICE_ULTE_SETUP_PAYMENT_DETAILS"})}),(0,i.jsxs)("form",{style:{textAlign:"left"},onSubmit:e,autoComplete:"off",children:[(0,i.jsx)(ge,{title:(0,i.jsx)(L.sA,{id:"COMMON_PAYMENTS_METHOD"})}),(0,i.jsxs)(Oe,{children:[A?(0,i.jsx)(Ne,{id:"paymentMethod",value:n,options:A,onChange:this.handlePaymentMethodChange,inputProps:{full:!0}}):null,n&&A?null:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(Re,{children:[(0,i.jsx)(De,{color:"text-2",children:(0,i.jsx)(L.sA,{id:"STRIPE_LABEL_CREDIT_CARD"})}),(0,i.jsx)(G.CardElement,{options:this.getCardInputStyles(),onFocus:()=>this.setError()})]}),d?(0,i.jsx)(ie.A,{visible:!0,children:(0,i.jsx)("div",{children:d})}):null]})]}),n?null:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ge,{title:(0,i.jsx)(L.sA,{id:"COMMON_PAYMENTS_BILLING_ADDRESS"})}),(0,i.jsx)(Q.A,{column:!0,children:(0,i.jsx)(Se,{name:"country",id:"country",type:"dropdown",searchable:!0,sortedOptions:!0,options:_,label:"COMMON_COUNTRY",translateLabel:!0,variant:"secondary",validated:!0,full:!0})}),(0,i.jsx)(Q.A,{children:(0,i.jsx)(ae.A,{name:"line1",variant:"secondary",label:"COMMON_STREET_ADDRESS",fast:!0,full:!0})}),(0,i.jsx)(Q.A,{children:(0,i.jsx)(ae.A,{name:"city",variant:"secondary",label:"COMMON_CITY",fast:!0,full:!0})}),(0,i.jsx)(Q.A,{children:(0,i.jsx)(ae.A,{name:"state",variant:"secondary",label:"COMMON_STATE_PROVINCE",fast:!0,full:!0})}),(0,i.jsx)(Q.A,{children:(0,i.jsx)(ae.A,{name:"postal_code",variant:"secondary",label:"COMMON_POSTAL_CODE",fast:!0,full:!0})})]}),(0,i.jsx)(ce,{}),(0,i.jsx)(he,{}),(0,i.jsx)(Ue,{type:"submit"})]})]})})}}const Me=(0,Y.Zz)((0,r.Ng)(e=>({countryCodeData:(0,ne.r)(e)}),e=>{e((0,Ee.b)(void 0,{crudCacheStrategy:{type:ee.e.CACHE}}))}))(e=>(0,i.jsx)(G.ElementsConsumer,{children:({stripe:t,elements:s})=>(0,i.jsx)(Le,{stripe:t,elements:s,...e})})),be="stripe-api-v3",Pe=(0,Y.Zz)(L.j4,(0,r.Ng)(e=>({stripeApiKey:(0,A.X)(e),wan2Network:(0,h.Hd)(e),gateway:(0,x.U$)(e)}),{hideModal:_.AS,createToast:l.ox,deleteNetwork:p.wR,activateLteTrial:m.t2,updateLteDevice:m.fH,adoptDevice:W.Hk}),z.b)(class extends a.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 s=document.createElement("script");s.async=!0,s.id=be,s.src="https://js.stripe.com/v3/",s.onload=this.initStripeProvider,document.body.appendChild(s)}initStripeProvider=()=>{const{stripeApiKey:e}=this.props;this.setState({stripeApiLoaded:!0,stripe:(0,B.c)(e)})};render(){const{state:{stripeApiLoaded:e,stripe:t}}=this;return e?(0,i.jsx)(G.Elements,{stripe:t,children:(0,i.jsx)(Me,{...this.props})}):null}}),je=(0,R.A)(U.A)`
  margin-top: ${({theme:{space:e}})=>e[3]}px;
  height: 290px;
`,ve=J.AH`
  border-radius: 0;
  color: ${D.Op};
`,fe=(0,R.A)("div")`
  margin-top: ${({theme:e})=>e.space[4]}px;
`;var ye=s(402868),we=s.n(ye),ke=s(80442),Ve=s(309130),$e=s(434521),Fe=s(45978);const He=J.AH`
  position: absolute;
  left: 24px;
`,Ye=J.AH`
  border-radius: 0;
`,Be=(0,R.A)("div")`
  margin-bottom: 24px;
  line-height: 1.5em;
`,Ge=(0,R.A)("div")`
  margin-bottom: ${Ve.kc};
`;var ze=s(69834),We=s(158402),Ke=s(528744),Xe=s(19445);const Ze=J.AH`
  position: absolute;
  left: 24px;
  border-radius: 0;
`,qe=(0,K.bk)({enableReinitialize:!0,isInitialValid:!0,mapPropsToValues:({ssoUsername:e=""})=>({ssoUsername:e,ssoPassword:"",ssoToken:"",tos:!1,sso2FA:!1,openRemoteController:!1}),validationSchema:se.A.object().shape({ssoUsername:se.A.string().label("LTE_SSO_LOGIN_LABEL_EMAIL_OR_USERNAME").required(),ssoPassword:se.A.string().label("COMMON_PASSWORD").required(),tos:se.A.boolean(),ssoToken:se.A.string(),sso2FA:se.A.boolean(),openRemoteController:se.A.boolean()}),handleSubmit:({ssoUsername:e,ssoPassword:t,ssoToken:s},{props:{mac:i,authLteDevice:a,setStep:r,setPayment:o,createToast:n,intl:{formatMessage:d},registerCloudAccess:l,registerControllerCloudAccess:_,enableUserCloudAccess:A,isRegisteringOwner:c},setFieldValue:T,setErrors:u,setSubmitting:C})=>{C(!0);const h={username:e||void 0,password:t||void 0,token:s||void 0},p=c?_:A;((e=!l)=>{const t=e?a:p;e&&(h.mac=i),t(h).then(t=>{e?t&&t.lte_sso_user_uuid?o(t):(u({ssoToken:d({id:"DEVICE_SSO_ACTIONS_AUTH_UUID_ERROR"})}),C(!1)):T("openRemoteController",!0)}).catch(({apiMsg:e})=>{switch(N.API_STRING_TRANSLATION[e]){case ze.f.API_ERROR_INCORRECT_CREDENTIALS:u({ssoUsername:d({id:"DEVICE_SSO_ACTIONS_AUTH_INVALID_ERROR"}),ssoPassword:d({id:"DEVICE_SSO_ACTIONS_AUTH_INVALID_ERROR"})});break;case ze.f.API_ERROR_INVALID_2FA_TOKEN:u({ssoToken:d({id:"DEVICE_SSO_ACTIONS_AUTH_INVALID_ERROR"})}),T("ssoToken","");break;case ze.f.API_ERROR_TOKEN_2FA_REQUIRED:T("sso2FA",!0);break;case ze.f.API_ERROR_LTE_DEVICE_UNAUTHORIZED:r(O.di.DEVICE_UNAUTHORIZED);break;default:n({icon:E.C.danger,message:"DEVICE_SSO_ACTIONS_AUTH_ERROR"})}C(!1)})})()}}),Qe=(0,Y.Zz)(L.j4,(0,r.Ng)((e,{mac:t})=>{const s=(0,v.Pk)(e),i=(0,v.fR)(e),a=(0,v.rU)(e)||s,r=!(0,u.V0)(e),o=((0,j.ef)(e)?.ubic_uuid||null)===s,n=(0,u.J5)(e),E=!!a,d=n&&E,l=n||i&&(r||o);return{env:(0,u.S$)(e),ssoUsername:a,ssoUuid:s,remoteControllerLTELink:(0,x.ev)(e),isRemoteAccessEnabledForUser:E,isRemoteAccessEnabledForSite:n,isRegisteringOwner:r&&i,registerCloudAccess:(0,T.W1)(e)&&!d&&l,deviceOwnerSsoId:(0,x.ZL)(t)(e)}},{hideModal:_.AS,authLteDevice:m.Kg,createToast:l.ox,registerControllerCloudAccess:Ke.PA,enableUserCloudAccess:We.m}),qe)(class extends a.Component{componentDidMount(){this.checkIfUserIsLoggedIn()}componentDidUpdate(){const{remoteControllerLTELink:e,values:{openRemoteController:t},isSubmitting:s}=this.props;t&&e?setTimeout(()=>{window.location.href=e},600):!s&&this.checkIfUserIsLoggedIn()}checkIfUserIsLoggedIn(){const{isRemoteAccessEnabledForUser:e,isRemoteAccessEnabledForSite:t,ssoUuid:s,deviceOwnerSsoId:i,setPayment:a}=this.props;e&&t&&i&&i===s&&a({lte_sso_user_uuid:i})}handleFormSubmit=e=>{e.preventDefault(),e.stopPropagation();const{isValid:t,dirty:s,isSubmitting:i,registerCloudAccess:a,values:{sso2FA:r,ssoToken:o="",tos:n}}=this.props,E=i||(r?6!==o.length:!(t&&s&&(a||n))),{handleSubmit:d}=this.props;E||d()};handleRegisterLink=()=>{const{env:e}=this.props,t=(0,o.Qh)(e);w.A.open(`${k.DU}${t}/register`)};render(){const{setStep:e,totalSteps:t=3,isValid:s,dirty:a,isSubmitting:r,setFieldValue:o,hideModal:n,values:{sso2FA:E,ssoToken:d="",tos:l},values:_,handleSubmit:A,errors:c,registerCloudAccess:T}=this.props,u=r||(E?6!==d.length:!(s&&a&&(T||l))),C=[{text:(0,i.jsx)(L.sA,{id:"COMMON_ACTION_NEXT"}),onClick:this.handleFormSubmit,variant:"primary",disabled:u,loader:r?"spinner":void 0,type:"submit"}];return C.unshift(T?{text:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_ACCOUNT_CREATE_NOTE"}),wrapClassName:Ze,variant:"link",onClick:this.handleRegisterLink}:{text:(0,i.jsx)(L.sA,{id:"COMMON_STEP_OF",values:{step:1,totalSteps:t}}),disabled:!0,wrapClassName:Ze}),(0,i.jsx)(M.A,{onClose:n,headerTitle:(0,i.jsx)(L.sA,{id:E?"DEVICE_ULTE_SETUP_ACCOUNT_HEADER_2FA":"DEVICE_ULTE_SETUP_ACCOUNT_HEADER"}),headerSubTitle:(0,i.jsx)(L.sA,{id:E?"DEVICE_ULTE_SETUP_ACCOUNT_SUB_HEADER_2FA":"DEVICE_ULTE_SETUP_ACCOUNT_SUB_HEADER"}),headerBackButtonAction:()=>E?o("sso2FA",!1):e(O.di.DETECTED),actions:C,children:(0,i.jsx)(Xe.A,{showTOS:!T,handleSubmit:A,setFieldValue:o,values:_,errors:c,isSubmitting:r,isValid:s,dirty:a})})}}),Je={[O.di.ACCOUNT_CREDENTIALS]:Qe,[O.di.COMPLETE]:({device:e})=>{const t=(0,r.wA)(),[s,n]=(0,a.useState)(!1),[E,{start:d}]=(0,ke.A)(1e3*O.Ay.REBOOT_TIME_IN_SECONDS,1e3);(0,a.useEffect)(d,[d]);const l=(0,r.d4)(u.S$),A=(0,o.Qh)(l),c=(0,$e.S9)(e),T=(0,a.useCallback)(()=>{t((0,_.AS)())},[t]);(0,a.useEffect)(()=>{E||n(!0),c===Fe.g.CONNECTED&&(n(!0),T())},[E,c,T]);const C=[{text:(0,i.jsx)(L.sA,{id:s?"COMMON_COMPLETE":"DEVICE_ULTE_SETUP_COMPLETE_REMAINING",values:{remaining:we()(E,"mm:ss")}}),disabled:!0,wrapClassName:He,className:Ye},{text:(0,i.jsx)(L.sA,{id:"COMMON_ACTION_DONE"}),onClick:T,variant:"primary",loader:s?E?void 0:"success":"spinner"}];return(0,i.jsxs)(M.A,{onClose:T,actions:C,headerTitle:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_COMPLETE_HEADER"}),headerSubTitle:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_COMPLETE_SUB_HEADER"}),children:[(0,i.jsx)(Be,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_COMPLETE_DETAILS",values:{minutes:O.Ay.REBOOT_TIME_IN_MINUTES}})}),(0,i.jsx)(Ge,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_COMPLETE_NOTE_CLOSE"})}),(0,i.jsx)(Ge,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_COMPLETE_NOTE_MANAGE",values:{accountUrl:(0,i.jsx)("a",{href:`${k.DU}${A}`,target:"_blank",rel:"noopener noreferrer",children:A})}})})]})},[O.di.CONFIRM_PAYMENT]:({setStep:e,mac:t,device:s,wan2DeleteOk:n,data:d={}})=>{const{lte_sso_user_uuid:A}=d,[c,T]=(0,a.useState)(!1),C=(0,r.d4)(u.S$),N=(0,r.d4)(h.Hd),I=(0,r.d4)(x.U$),R=!(0,S.D6h)(I)&&!(0,S.Cyy)(I)&&!!N,D=(0,o.Qh)(C),g=`${k.DU}${D}`,U=(0,r.wA)(),b=(0,a.useCallback)(()=>{U((0,_.AS)())},[U]),P=(0,a.useCallback)(()=>e(O.di.ACCOUNT_CREDENTIALS),[]),j=(0,a.useCallback)(async()=>{if(R){if(n){try{await U((0,p.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,n,R,U]),v=(0,a.useCallback)(async()=>{try{await U((0,m.fH)({mac:t,lte_sso_user_uuid:A}))}catch{throw new Error("DEVICE_ULTE_SETUP_ACTIONS_REGISTER_ERROR")}},[A,t,U]),f=(0,a.useCallback)(async()=>{try{await U((0,W.Hk)(s))}catch{throw new Error("DEVICE_ULTE_SETUP_MISSING_ADOPT_CALLBACK")}},[s,U]),y=(0,a.useCallback)(async()=>{T(!0);try{await j(),await v(),await f(),e(O.di.COMPLETE)}catch(e){U((0,l.ox)({icon:E.C.danger,message:e,values:{deviceName:t}})),T(!1)}},[]);return(0,i.jsxs)(M.A,{onClose:b,headerTitle:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_CONFIRM_PAYMENT_HEADER"}),headerBackButtonAction:P,actions:[{text:(0,i.jsx)(L.sA,{id:"COMMON_ACTION_CLOSE"}),onClick:b},{text:(0,i.jsx)(L.sA,{id:"DEVICE_ACTIONS_ADOPT"}),variant:"primary",onClick:y,loader:c?"spinner":void 0}],children:[(0,i.jsx)(fe,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_CONFIRM_PAYMENT_DETAILS"})}),(0,i.jsx)(fe,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_CONFIRM_PAYMENT_DETAILS_NOTE"})}),(0,i.jsx)(fe,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_CONFIRM_PAYMENT_MANAGE_ACCOUNT",values:{link:(0,i.jsx)("a",{href:g,target:"_blank",rel:"noopener noreferrer",children:D})}})})]})},[O.di.DETECTED]:({device:{model:e},setStep:t})=>{const s=(0,r.wA)(),o=(0,a.useCallback)(()=>{s((0,_.AS)())},[s]),n=(0,a.useCallback)(()=>{t(O.di.ACCOUNT_CREDENTIALS)},[t]);return(0,i.jsx)(M.A,{onClose:o,headerTitle:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_DETECTED_HEADER"}),actions:[{text:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_ACTIONS_LATER"}),onClick:o,className:ve},{text:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_ACTIONS_SETUP"}),onClick:n,variant:"primary"}],children:(0,i.jsx)(je,{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:s,needs_subscription:n}={}})=>{const[d,A]=(0,a.useState)(0),c=(0,r.d4)(u.S$),T=(0,o.Qh)(c),C=`${k.DU}${T}/subscriptions`,h=(0,r.wA)(),p=(0,a.useCallback)(()=>{clearTimeout(H),h((0,_.AS)())},[h]),S=(0,a.useCallback)(()=>t(O.di.ACCOUNT_CREDENTIALS),[t]),x=(0,a.useCallback)(()=>{w.A.open(C),A(1)},[C]);return(0,a.useEffect)(()=>(d&&(H=setTimeout(()=>{h((0,m.g0)({lte_sso_user_uuid:s})).then(e=>{if(e&&!e.payment_past_due)return clearTimeout(H),n?void h((0,m.ut)({lte_sso_user_uuid:s})).then(e=>{t(O.di.PAYMENT,{lte_sso_user_uuid:s,needs_subscription:n,...e})}).catch(()=>{h((0,l.ox)({icon:E.C.danger,message:"DEVICE_ULTE_PAYMENT_METHOD_FETCH_ERROR"}))}):void t(O.di.CONFIRM_PAYMENT,{lte_sso_user_uuid:s,needs_subscription:n});A(d+1)})},2e3)),()=>clearTimeout(H)),[d]),(0,i.jsxs)(M.A,{onClose:p,headerTitle:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(V,{size:"navigation"}),(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_OVERDUE_HEADER"})]}),headerBackButtonAction:S,actions:[{text:(0,i.jsx)(L.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:p},{text:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_OVERDUE_LINK"}),variant:"primary",onClick:x,disabled:d>0,loader:d>0?"spinner":void 0}],children:[(0,i.jsx)($,{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_PAYMENT_OVERDUE_DETAILS"})}),(0,i.jsx)(F,{model:e,size:g.Xh.LARGE})]})},[O.di.REMOTE_ACCESS]:({device:{model:e},setStep:t})=>{const s=(0,r.wA)(),n=(0,r.d4)(v.Pk),E=(0,r.d4)(v.fR),d=!(0,r.d4)(u.V0),l=((0,r.d4)(j.ef)?.ubic_uuid||null)===n,A=(0,r.d4)(u.J5),c=A&&!!n,T=A||E&&(d||l),C=(0,r.d4)(u.S$),h=(0,o.w_)(C),p=(0,r.d4)(x.ev),m=(0,a.useCallback)(()=>{s((0,_.AS)())},[s]),S=[];return(c||T)&&S.push({text:(0,i.jsx)(L.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:m}),c||T||S.push({text:(0,i.jsx)(L.sA,{id:"COMMON_ACTION_CLOSE"}),onClick:m,variant:"primary"}),c&&S.push({text:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_ACTIONS_OPEN_REMOTE",values:{remoteUrl:h}}),onClick:()=>{window.location.href=p},variant:"primary"}),!c&&T&&S.push({text:(0,i.jsx)(L.sA,{id:"COMMON_ACTIONS_REMOTE_ACCESS"}),onClick:()=>{t(O.di.ACCOUNT_CREDENTIALS)},variant:"primary"}),(0,i.jsxs)(M.A,{onClose:m,actions:S,headerTitle:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(f,{size:"navigation"}),(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_ADOPTION_UNAVAILABLE_HEADER"})]}),children:[(0,i.jsx)("div",{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_ADOPTION_UNAVAILABLE_REMOTE_ACCESS",values:{remoteUrl:h}})}),(0,i.jsx)("div",{children:c?null:(0,i.jsx)(L.sA,{id:T?"DEVICE_ULTE_SETUP_ADOPTION_UNAVAILABLE_REMOTE_ACCESS_ENABLE":"DEVICE_ULTE_SETUP_ADOPTION_UNAVAILABLE_REMOTE_ACCESS_ENABLE_DENIED"})}),(0,i.jsx)(y,{model:e,size:g.Xh.MEDIUM})]})},[O.di.WAN2WARNING]:({device:{model:e},handleWan2Delete:t})=>{const s=(0,r.wA)(),o=(0,a.useCallback)(()=>{s((0,_.AS)())},[s]),n=(0,a.useMemo)(()=>[{text:(0,i.jsx)(L.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:o},{text:(0,i.jsx)(L.sA,{id:"COMMON_ACTION_PROCEED"}),onClick:t,variant:"primary"}],[o,t]);return(0,i.jsxs)(M.A,{onClose:o,actions:n,headerTitle:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(b,{size:"navigation"}),(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_WAN2_WARNING_HEADER"})]}),children:[(0,i.jsx)("div",{children:(0,i.jsx)(L.sA,{id:"DEVICE_ULTE_SETUP_WAN2_WARNING_DETAILS"})}),(0,i.jsx)(P,{model:e,size:g.Xh.MEDIUM})]})}},et=({mac:e,lte_radio:t})=>{const[s,I]=(0,a.useState)(null),[R,D]=(0,a.useState)(null),[g,U]=(0,a.useState)(!0),[L,M]=(0,a.useState)(!1),b=(0,r.wA)(),P=(0,r.d4)(x.U$),j=(0,r.d4)((0,a.useMemo)(()=>(0,x.tG)(e),[e])),v=(0,r.d4)(h.Hd),f=!(0,S.D6h)(P)&&!(0,S.Cyy)(P)&&v&&!L,y=(0,r.d4)(A.X),w=(0,r.d4)(A.eT),k=(0,r.d4)(u.S$),V=(0,r.d4)(T.W1),$=(0,a.useMemo)(()=>!V||(0,o.Qe)(k)===window.location.hostname,[k,V]),F=(0,a.useCallback)(()=>{M(!0),I(O.di.ACCOUNT_CREDENTIALS)},[]),H=(0,a.useCallback)(e=>{const{lte_sso_user_uuid:t,needs_subscription:s}=e;b((0,m.g0)({lte_sso_user_uuid:t})).then(e=>{if(e&&e.payment_past_due)return D({lte_sso_user_uuid:t,needs_subscription:s}),void I(O.di.PAYMENT_OVERDUE);s?b((0,m.ut)({lte_sso_user_uuid:t})).then(e=>{D({lte_sso_user_uuid:t,needs_subscription:s,...e}),I(O.di.PAYMENT)}).catch(()=>{b((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))})},[b]);if((0,a.useEffect)(()=>{if(!g){if(w&&y)return $?f?void I(O.di.WAN2WARNING):void I(O.di.DETECTED):void I(O.di.REMOTE_ACCESS);b((0,l.ox)({icon:E.C.danger,message:"DEVICE_ULTE_SETUP_PRICING_ERROR"}))}},[g]),(0,a.useEffect)(()=>{b((0,d.Zi)(n.B.SETTINGS)),Promise.all([b((0,c.j)(!0)).catch(e=>{let t="COMMON_NOTICE_LOAD_ERROR_MESSAGE";switch((0,m.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,l.ox)({icon:E.C.danger,message:t})}),b((0,C.G)()).catch(()=>{b((0,l.ox)({icon:E.C.danger,message:"COMMON_NOTICE_LOAD_ERROR_MESSAGE"}))}),b((0,p.Sk)({},{failureToast:{icon:E.C.danger,message:"DEVICE_ULTE_SETUP_NETWORKS_FETCH_ERROR"}}))]).then(()=>{U(!1)}).catch(e=>{})},[b]),!s||g)return null;const Y=Je[s];return"string"==typeof Y?(b((0,_.AS)()),null):(0,i.jsx)(Y,{device:j,mac:e,data:R||{},wan2DeleteOk:L,lte_radio:t,setStep:(e,t=null)=>{D(t),I(e)},setPayment:H,handleWan2Delete:F})}}}]);