"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[16041],{891642(e,i,t){t.d(i,{$:()=>s,D:()=>n});const s="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"}]},916041(e,i,t){t.r(i),t.d(i,{default:()=>u});var s=t(274934),n=t(602086),r=t(977872),a=t(843871),l=t(950804),c=t(29472),o=t(774366);var d=t(891642),E=t(897166),_=t(620404);const u=({hideModal:e,item:i,experienceGraphType:t})=>{const u=(0,r.wA)(),A={siteName:(0,r.d4)(E.LF),mac:"mac"in i?i.mac:void 0,experienceGraphType:t},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")}),m=(0,n.useCallback)(async({mac:e,experienceGraphType:i,siteName:t,...s},n)=>{n.setStatus({isSuccess:void 0,isError:void 0}),n.setErrors(void 0);try{await u(((e,i,t,s)=>(0,c.vL)(d.$,null,((e,i,t="default")=>`${((e="default")=>`/v2/api/site/${e}`)(t)}/${(e=>{switch(e){case"ap":return"device";case"unifiClient":case"client":return"station";default:throw new Error("Invalid item type")}})(i)}/${e}/wifi_experience/incorrect`)(e,i,t),s,void 0,{method:o.A.POST}))(e,i,t,s)),n.setStatus({isSuccess:!0})}catch{n.setStatus({isError:!0})}},[u]);return(0,s.jsx)(a.l1,{enableReinitialize:!0,onSubmit:m,initialValues:A,validationSchema:O,children:(0,s.jsx)(_.A,{hideModal:e,item:i,experienceGraphType:t})})}},620404(e,i,t){t.d(i,{v:()=>z,A:()=>V});var s=t(274934),n=t(602086),r=t(977872),a=t(843871),l=t(43009),c=t(335220),o=t(938984),d=t(95032),E=t(241365),_=t(832162),u=t(343954),A=t(247816),O=t(415537),m=t(59612),C=t(331472),I=t(347625),p=t(237887),h=t(565527),M=t(309130),x=t(222102),R=t(917190),N=t(396489),T=t.n(N),f=t(430328),L=t(754924);const P=["satisfaction"];var g=t(100978),j=t(974390),v=t(650632),b=t(470070),w=t(891642),S=t(831433),y=t(726831);const D=(0,A.A)(o.A)`
  margin-top: ${M.Ln};
  line-height: 20px;
`,F=(0,A.A)(g.A)`
  background: ${({theme:e})=>E.Ay[e.themeName===h.S.DARK?"grey-1":"white-10"]};
  border-radius: 8px;
  padding: ${M.kc};
`,k=(0,A.A)(o.A)`
  margin-left: ${M.YC};
`,W=(0,A.A)(v.A)`
  vertical-align: middle;
  width: 40px;
  height: 40px;
`,U=(0,A.A)(j.A)`
  vertical-align: middle;
`,B=(0,A.A)(g.A)`
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding-bottom: ${({theme:{spacing:e}})=>e["spacing-s"]};
`,X=(0,A.A)(p.A)`
  margin-top: ${M.Ln};
`,$=(0,A.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,i)=>{switch(e){case z.CLIENT:case z.UNIFI_CLIENT:return(0,S.tn)(i);case z.AP:return(0,I.Q)(i);default:return null}},Y=(e,i)=>{switch(e){case z.CLIENT:case z.UNIFI_CLIENT:return(0,s.jsx)(W,{client:i,alt:G(e,i)});case z.AP:return(0,s.jsx)(U,{model:i.model});default:return null}},H=({isSuccess:e,isError:i})=>e?(0,s.jsxs)(g.A,{gap:M.YC,alignItems:"center",justifyContent:"center",marginBottom:M.Ln,children:[(0,s.jsx)(u.A,{size:"original",variant:"fill",color:E.Ay["color-success"]}),(0,s.jsx)(o.A,{size:"medium",children:(0,s.jsx)(b.sA,{id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_SUBMIT_SUCCESS"})})]}):i?(0,s.jsxs)(g.A,{gap:M.YC,alignItems:"center",justifyContent:"center",marginBottom:M.Ln,children:[(0,s.jsx)(u.A,{size:"original",variant:"fill",color:E.Ay["color-danger"]}),(0,s.jsx)(o.A,{size:"medium",children:(0,s.jsx)(b.sA,{id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_SUBMIT_ERROR"})})]}):null,V=({item:e,experienceGraphType:i,hideModal:t})=>{const{formatMessage:c}=(0,b.tz)(),{motif:E}=(0,l.A)(),{dirty:u,errors:A,isSubmitting:I,handleSubmit:p,setFieldValue:h,status:N={},values:j}=(0,a.j7)(),{isSuccess:v,isError:W}=N,U=w.D.map(({value:e,label:i})=>({value:e,label:c({id:i})})),z=(0,n.useCallback)((e,i)=>{h("reason",i)},[h]),V=(0,n.useCallback)((e,i)=>{h(e.target.name,i)},[h]),q=(0,n.useCallback)(e=>{p?.(e)},[p]),K="uplink_mac"in e&&e.uplink_mac,Q="sw_port"in e&&e.sw_port,J=(0,n.useMemo)(()=>{return K&&Q?(e=K,i=Q,(0,f.WY)((e,i)=>T()((0,R.A)(e,P),(0,R.A)(i,P)))((0,x.Mz)((0,L.bw)(e,["port_table"]),e=>e?.port_table?.[i]||{}),e=>e)):()=>{};var e,i},[K,Q]),Z=(0,r.d4)(J),ee=(0,n.useMemo)(()=>{const{satisfaction:i}="type"in e?(0,S.FX)(Z,e.type,"wifi_experience_score"in e?e.wifi_experience_score:void 0):e;return i},[e,Z]);return(0,s.jsxs)(_.A,{isOpen:!0,onRequestClose:t,title:(0,s.jsx)(b.sA,{id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_HEADER"}),size:"small",actions:v||W?[]:[{text:(0,s.jsx)(b.sA,{id:"COMMON_ACTION_CANCEL"}),onClick:t},{text:(0,s.jsx)(b.sA,{id:"COMMON_ACTION_SUBMIT"}),variant:"primary",onClick:q,disabled:!u||I,loader:I?"spinner":null}],...v||W?{footer:(0,s.jsx)(H,{isSuccess:v,isError:W})}:{},children:[(0,s.jsx)("iframe",{title:"unifi-experts-corner",width:"100%",height:"200",src:y.A.wifiPerformanceTipsVideo,frameBorder:"0"}),(0,s.jsx)(D,{color:"text-3",size:"medium",children:(0,s.jsx)(b.sA,{id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_SUBTITLE"})}),(0,s.jsxs)(F,{marginTop:M.Ln,gap:M.kc,children:[(0,s.jsx)(g.A,{justifyContent:"center",alignItems:"center",flexShrink:0,flexGrow:0,children:Y(i,e)}),(0,s.jsxs)(g.A,{flexDirection:"column",overflow:"hidden",children:[(0,s.jsx)(d.A,{size:"medium",isTruncated:!0,children:(0,O.c)(G(i,e),30)}),ee&&-1!==ee?(0,s.jsxs)(o.A,{size:"medium",children:[(0,s.jsx)(b.sA,{id:"COMMON_WIFI_EXP"}),":",(0,s.jsx)(k,{weight:"bold",size:"medium",style:{color:(0,m.L)(ee,E)},children:(0,s.jsx)(b.sA,{id:(0,C.gd)(ee)})})]}):null]})]}),(0,s.jsxs)(B,{children:[(0,s.jsx)(X,{width:"100%",placeholder:c({id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_PROBLEM_LABEL"}),options:U,variant:"secondary",onChange:z,value:j.reason}),(0,s.jsx)($,{variant:"secondary",name:"comment",height:80,maxHeight:200,maxWidth:"100%",minWidth:349,full:!0,value:j.comment,onChange:V,placeholder:c({id:"COMMON_REPORT_WIFI_EXPERIENCE_MODAL_COMMENT_LABEL"}),invalid:A&&A.comment})]})]})}}}]);