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