"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[38817],{338817:(e,t,i)=>{i.r(t),i.d(t,{default:()=>u});var a=i(469733),n=i(296540),r=i(951272),l=i(870443),c=i(691189),s=i(887831);const E=(e,t,i="default")=>`${((e="default")=>`/v2/api/site/${e}`)(i)}/${(e=>{switch(e){case"ap":return"device";case"unifiClient":case"client":return"station";default:throw new Error("Invalid item type")}})(t)}/${e}/wifi_experience/incorrect`;var o=i(857301);var m=i(602021),_=i(561173);const u=({hideModal:e,item:t,experienceGraphType:i})=>{const u=(0,a.useDispatch)(),d={siteName:(0,a.useSelector)(m.LF),mac:"mac"in t?t.mac:void 0,experienceGraphType:i},O=l.A.object().shape({reason:l.A.string().label("COMMON_REPORT_WIFI_EXPERIENCE_MODAL_PROBLEM_LABEL").required(),comment:l.A.string().label("COMMON_REPORT_WIFI_EXPERIENCE_MODAL_COMMENT_FORMIK_LABEL")}),A=(0,n.useCallback)(async({mac:e,experienceGraphType:t,siteName:i,...a},n)=>{n.setStatus({isSuccess:void 0,isError:void 0}),n.setErrors(void 0);try{await u(((e,t,i,a,n,r)=>(0,c.vL)(o.$,null,E(e,t,i),a,n,{...r,method:s.A.POST}))(e,t,i,a)),n.setStatus({isSuccess:!0})}catch(e){n.setStatus({isError:!0})}},[]);return n.createElement(r.l1,{enableReinitialize:!0,onSubmit:A,initialValues:d,validationSchema:O},n.createElement(_.A,{hideModal:e,item:t,experienceGraphType:i}))}},561173:(e,t,i)=>{i.d(t,{v:()=>z,A:()=>j});var a=i(469733),n=i(296540),r=i(951272),l=i(325898),c=i(23835),s=i(927099),E=i(888170),o=i(617147),m=i(618983),_=i(71479),u=i(852866),d=i(628291),O=i(38937),A=i(6510),C=i(362412),I=i(825032),p=i(566723),M=i(801081),R=i(962315),N=i(429252),h=i.n(N),T=i(189601),f=i(532419);const L=["satisfaction"],P=(e,t)=>(0,T.WY)((e,t)=>h()((0,R.A)(e,L),(0,R.A)(t,L)))((0,M.Mz)((0,f.bw)(e,["port_table"]),e=>e?.port_table?.[t]||{}),e=>e);var g=i(294303),v=i(6176),b=i(703447),y=i(699784),S=i(857301),w=i(951106),x=i(765562);const D=(0,_.A)(s.A)`
  margin-top: ${p.Ln};
  line-height: 20px;
`,F=(0,_.A)(g.A)`
  background: ${({theme:e})=>E.Ay[e.themeName===I.S.DARK?"grey-1":"white-10"]};
  border-radius: 8px;
  padding: ${p.kc};
`,k=(0,_.A)(s.A)`
  margin-left: ${p.YC};
`,W=(0,_.A)(b.A)`
  vertical-align: middle;
  width: 40px;
  height: 40px;
`,U=(0,_.A)(v.A)`
  vertical-align: middle;
`,B=(0,_.A)(g.A)`
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding-bottom: ${({theme:{spacing:e}})=>e["spacing-s"]};
`,X=(0,_.A)(C.A)`
  margin-top: ${p.Ln};
`,$=(0,_.A)(c.A)`
  margin-top: ${p.Ln};
`;var z;!function(e){e.UNIFI_CLIENT="unifiClient",e.CLIENT="client",e.AP="ap"}(z||(z={}));const G=(e,t)=>{switch(e){case z.CLIENT:case z.UNIFI_CLIENT:return(0,w.tn)(t);case z.AP:return(0,A.Q)(t);default:return null}},Y=({isSuccess:e,isError:t})=>e?n.createElement(g.A,{gap:p.YC,alignItems:"center",justifyContent:"center",marginBottom:p.Ln},n.createElement(m.A,{size:"original",variant:"fill",color:E.Ay["color-success"]}),n.createElement(s.A,{size:"body"},n.createElement(y.sA,{id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_SUBMIT_SUCCESS"}))):t?n.createElement(g.A,{gap:p.YC,alignItems:"center",justifyContent:"center",marginBottom:p.Ln},n.createElement(m.A,{size:"original",variant:"fill",color:E.Ay["color-danger"]}),n.createElement(s.A,{size:"body"},n.createElement(y.sA,{id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_SUBMIT_ERROR"}))):null,j=({item:e,experienceGraphType:t,hideModal:i})=>{const{formatMessage:c}=(0,y.tz)(),{motif:E}=(0,l.A)(),{dirty:m,errors:_,isSubmitting:A,handleSubmit:C,setFieldValue:I,status:M={},values:R}=(0,r.j7)(),{isSuccess:N,isError:h}=M,T=S.D.map(({value:e,label:t})=>({value:e,label:c({id:t})})),f=(0,n.useCallback)((e,t)=>{I("reason",t)},[I]),L=(0,n.useCallback)((e,t)=>{I(e.target.name,t)},[I]),v=(0,n.useCallback)(e=>{C?.(e)},[C]),b="uplink_mac"in e&&e.uplink_mac,j="sw_port"in e&&e.sw_port,H=(0,n.useMemo)(()=>b&&j?P(b,j):()=>{},[b,j]),V=(0,a.useSelector)(H),q=(0,n.useMemo)(()=>{const{satisfaction:t}="type"in e?(0,w.FX)(V,e.type,"wifi_experience_score"in e?e.wifi_experience_score:void 0):e;return t},[e,V]);return n.createElement(o.A,{isOpen:!0,onRequestClose:i,title:n.createElement(y.sA,{id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_HEADER"}),size:"small",actions:N||h?[]:[{text:n.createElement(y.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:i},{text:n.createElement(y.sA,{id:"COMMON_ACTION_SUBMIT"}),variant:"primary",onClick:v,disabled:!m||A,loader:A?"spinner":null}],...N||h?{footer:n.createElement(Y,{isSuccess:N,isError:h})}:{}},n.createElement("iframe",{title:"unifi-experts-corner",width:"100%",height:"200",src:x.A.wifiPerformanceTipsVideo,frameBorder:"0"}),n.createElement(D,{color:"tertiary",size:"body"},n.createElement(y.sA,{id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_SUBTITLE"})),n.createElement(F,{marginTop:p.Ln,gap:p.kc},n.createElement(g.A,{justifyContent:"center",alignItems:"center",flexShrink:0,flexGrow:0},((e,t)=>{switch(e){case z.CLIENT:case z.UNIFI_CLIENT:return n.createElement(W,{client:t,alt:G(e,t)});case z.AP:return n.createElement(U,{model:t.model});default:return null}})(t,e)),n.createElement(g.A,{flexDirection:"column",overflow:"hidden"},n.createElement(s.A,{size:"body",truncate:!0},(0,u.c)(G(t,e),30)),q&&-1!==q?n.createElement(s.A,{size:"body"},n.createElement(y.sA,{id:"COMMON_WIFI_EXP"}),":",n.createElement(k,{weight:"bold",size:"body",style:{color:(0,d.L)(q,E)}},n.createElement(y.sA,{id:(0,O.gd)(q)}))):null)),n.createElement(B,null,n.createElement(X,{width:"100%",placeholder:c({id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_PROBLEM_LABEL"}),options:T,variant:"secondary",onChange:f,value:R.reason}),n.createElement($,{variant:"secondary",name:"comment",height:80,maxHeight:200,maxWidth:"100%",minWidth:349,full:!0,value:R.comment,onChange:L,placeholder:c({id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_COMMENT_LABEL"}),invalid:_&&_.comment})))}},857301:(e,t,i)=>{i.d(t,{$:()=>a,D:()=>n});const a="reportWifiExperience",n=[{value:"DROPPED_CONNECTIVITY",label:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_REASON_DROPPED_CONNECTIVITY"},{value:"POOR_LATENCY",label:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_REASON_POOR_LATENCY"},{value:"POOR_THROUGHPUT",label:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_REASON_POOR_THROUGHPUT"}]}}]);