"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[17904],{563092(e,t,E){E.d(t,{Mw:()=>l,bx:()=>c,Vp:()=>A,v8:()=>_,$w:()=>I});var n=E(691189),a=E(294201);const i=`${E(771805).J}/cmd/mbb`,I=(e,t={})=>(0,n.Xj)(a.A.VERIFY_PIN,i,{cmd:a.A.VERIFY_PIN,...e},t),l=(e,t={})=>(0,n.Xj)(a.A.ESIM_ADD,i,{cmd:a.A.ESIM_ADD,...e},t),c=(e,t={})=>(0,n.Xj)(a.A.ESIM_DELETE,i,{cmd:a.A.ESIM_DELETE,...e},t),A=(e,t={})=>(0,n.Xj)(a.A.READ_INACTIVE_SLOT_SIM_CARD,i,{cmd:a.A.READ_INACTIVE_SLOT_SIM_CARD,...e},t),_=(e,t={})=>(0,n.Xj)(a.A.RESET_USAGE,i,{cmd:a.A.RESET_USAGE,...e},t)},617904(e,t,E){E.r(t),E.d(t,{default:()=>F});var n=E(822336),a=E(296540),i=E(469733),I=E(951272),l=E(217439),c=E(74750),A=E(352190),_=E(709690),o=E(618983),r=E(71479),s=E(382389),C=E(968906),m=E(311785),d=E(180524),S=E(870443),T=E(874807),O=E(398300),V=E(566723),D=E(845030),R=E(126457),u=E(916537),N=E(563092),M=E(569299),p=E(532419),f=E(455643),g=E(855019),v=E(143811),b=E(294303),L=E(705426);const h={1:"DEVICE_ESIM_ACTIVATION_ERROR_1",2:"DEVICE_ESIM_ACTIVATION_ERROR_2",4:"DEVICE_ESIM_ACTIVATION_ERROR_4",104:"DEVICE_ESIM_ACTIVATION_ERROR_104",106:"DEVICE_ESIM_ACTIVATION_ERROR_106",109:"DEVICE_ESIM_ACTIVATION_ERROR_109",113:"DEVICE_ESIM_ACTIVATION_ERROR_113",124:"DEVICE_ESIM_ACTIVATION_ERROR_124",126:"DEVICE_ESIM_ACTIVATION_ERROR_126",209:"DEVICE_ESIM_ACTIVATION_ERROR_209",214:"DEVICE_ESIM_ACTIVATION_ERROR_214",300:"DEVICE_ESIM_ACTIVATION_ERROR_300",301:"DEVICE_ESIM_ACTIVATION_ERROR_300",601:"DEVICE_ESIM_ACTIVATION_ERROR_601"},k="DEVICE_ESIM_PROFILE_UNAVAILABLE";var x;!function(e){e[e.ACTIVATION=0]="ACTIVATION",e[e.SUCCESS=1]="SUCCESS"}(x||(x={}));const U=(0,r.A)(L.A,(0,m.A)("step"))`
  height: ${({step:e})=>e===x.SUCCESS?"unset":"320px"};
`,y=({pending:e,onTimeout:t})=>a.createElement(b.A,{flexDirection:"column",flex:1,alignItems:"center",gap:V.Ln},a.createElement(v.A,{name:"activation_code",label:a.createElement(b.A,{alignItems:"center",gap:V.YC},a.createElement(l.A,{variant:"inherit"},a.createElement(u.sA,{id:"DEVICE_ESIM_ACTIVATION_CODE"})),a.createElement(d.A,{description:a.createElement(u.sA,{id:"DEVICE_ENTER_ACTIVATION_CODE_TOOLTIP"})},a.createElement("span",null,a.createElement(_.A,{isActive:!0,size:"original"})))),type:"input",variant:"secondary",full:!0,validateOnBlur:!0,disabled:e}),e?a.createElement(b.A,{width:"100%",flexDirection:"column",gap:V.YC,flex:1,justifyContent:"flex-end"},a.createElement(f.A,{size:8,duration:140,onComplete:t}),a.createElement(l.A,{color:"text-3",size:"small"},a.createElement(u.sA,{id:"DEVICE_DOWNLOADING_ESIM_PROFILES"}))):a.createElement(v.A,{name:"confirmation_code",label:a.createElement(b.A,{alignItems:"center",gap:V.YC},a.createElement(l.A,{variant:"inherit"},a.createElement(u.sA,{id:"DEVICE_ESIM_CONFIRMATION_CODE"})),a.createElement(d.A,{description:a.createElement(u.sA,{id:"DEVICE_ESIM_CONFIRMATION_CODE_TOOLTIP"})},a.createElement("span",null,a.createElement(_.A,{isActive:!0,size:"original"})))),type:"input",variant:"secondary",full:!0,disabled:e})),P=()=>{const{themeName:e}=(0,s.u)();return a.createElement(b.A,{flexDirection:"column",flex:1,alignItems:"center",gap:V.Ln},a.createElement(b.A,{position:"relative"},a.createElement(A.A,{transparent:!0,size:"header",color:n.Ay[`desktop-color-ublue-06-${e}`]}),a.createElement(b.A,{position:"absolute",right:0,bottom:0,alignItems:"center",justifyContent:"center"},a.createElement(o.A,{size:"original",variant:"fill",color:n.Ay[`desktop-color-green-06-${e}`]}))),a.createElement(b.A,{flexDirection:"column",gap:V.kc,alignItems:"center"},a.createElement(l.A,{color:"text-1",weight:"bold"},a.createElement(u.sA,{id:"DEVICE_ESIM_ACTIVATED"})),a.createElement(l.A,{color:"text-2"},a.createElement(u.sA,{id:"DEVICE_ESIM_ACTIVATED_DESCRIPTION"}))))},j=({onClose:e,mac:t,slot:E})=>{const n=(0,i.useDispatch)(),{formatMessage:l}=(0,u.tz)(),{values:{activation_code:A,confirmation_code:_},setFieldError:o,isValid:r}=(0,I.j7)(),{mbb:s={}}=(0,i.useSelector)((0,a.useMemo)(()=>(0,p.tG)(t),[t])),m=(0,a.useMemo)(()=>s.esim&&(0,M.n8)(s.esim),[s.esim]),d=(0,a.useMemo)(()=>s.esim&&(0,M.q5)(s.esim,s.sim?.[E]),[s.esim,s.sim,E]),[S,T]=(0,a.useState)(m),[f,v]=(0,a.useState)(x.ACTIVATION),L=(0,a.useCallback)(()=>{n((0,R.AS)()),e?.()},[e,n]),j=(0,a.useCallback)(()=>{L()},[L]),w=(0,a.useCallback)(()=>{if(!S&&!m){T(!0);try{n((0,N.Mw)({mac:t,activation_code:A,..._?{confirmation_code:_}:{}}))}catch{o("activation_code",l({id:"DEVICE_ESIM_PROFILE_UNAVAILABLE"})),T(!1)}}},[S,m,n,t,A,_,o,l]),z=(0,a.useCallback)(()=>{T(!1),o("activation_code",l({id:k}))},[l,o]);return(0,a.useEffect)(()=>{d&&v(x.SUCCESS)},[d]),(0,a.useEffect)(()=>{const e=s.esim?.last_operation?.code;switch(e){case void 0:case 0:return;default:o("activation_code",l({id:h[e]??k}))}T(!1)},[l,s.esim?.last_operation?.code,o]),a.createElement(U,{title:f!==x.SUCCESS?a.createElement(u.sA,{id:"DEVICE_ADD_ESIM"}):void 0,onRequestClose:j,size:"small",step:f,actions:f!==x.SUCCESS?[{type:"button",text:a.createElement(u.sA,{id:"COMMON_ACTION_NEXT"}),onClick:w,variant:"primary",disabled:S||!r,loader:S?"loading":void 0}]:void 0,footer:f===x.SUCCESS?a.createElement(b.A,{alignItems:"center",justifyContent:"center",padding:V.Ln,paddingTop:V.YC},a.createElement(c.A,{...C.A.addDataTestId(C.A.TestId.SIDE_PANEL_TRIGGER),onPress:()=>{n((0,D.XP)({type:O.H.DEVICE,id:t,tab:g.BC.SETTINGS,subId:E.toString()})),L()}},a.createElement(u.sA,{id:"DEVICE_MANAGE_DEVICES"}))):void 0},f===x.ACTIVATION?a.createElement(y,{pending:S,onTimeout:z}):null,f===x.SUCCESS?a.createElement(P,null):null)},w=S.A.object().shape({activation_code:S.A.string().label("DEVICE_ESIM_ACTIVATION_CODE").matches(/^((1|2)|(LPA:(1|2)))\$(.*)?\$[a-zA-Z0-9-]+$/,{message:a.createElement(u.sA,{id:"DEVICE_ESIM_INVALID_ACTIVATION_CODE"})}).required(),confirmation_code:S.A.string().label("DEVICE_ESIM_CONFIRMATION_CODE").optional()}),z={activation_code:""},F=e=>a.createElement(I.l1,{initialValues:z,onSubmit:T.P1,validationSchema:w,validateOnMount:!0},a.createElement(j,{...e}))}}]);