import{useCallback as m}from"react";import{withPathPrefix as p,combineUrls as d}from"@redocly/theme/core/utils";import{ServerRoutes as b}from"../../../constants/index.js";import{usePageData as u}from"../../providers/hooks";import{usePageSharedData as f}from"../../providers/page-data/hooks";function w(){const{basePath:t}=f("openAPIDocsStore")||{},o=u()?.templateId==="openapi_docs";return{submitFeedback:m(async({type:e,values:a,path:i,location:r,lang:s})=>{const n=d(window.location.origin,o?t:"",i),c={location:r,lang:s,component:e,...a,path:n};await fetch(p(b.FEEDBACK),{method:"POST",body:JSON.stringify(c)})},[t,o])}}export{w as useSubmitFeedback};
