PageSourceSearch

https://synerise.com/assets/feedback-dialog-DvVWFLm3.js

js synerise.com collected 2026-09-25 19:05:25 UTC 6,952 bytes, 1 lines download raw bytes

1import{r as c,j as e}from"./vendor-react-Cmi0Jrom.js";import{u as C,t as I}from"./vendor-forms-CygwS15i.js";import{z as f}from"./vendor-validation-DQXLBOVS.js";import{d as U}from"./vendor-query-HImUUcVP.js";import{u as R,a as T,B as d,t as H}from"./index-CIJgM20k.js";import{T as L}from"./textarea-DmntvPXa.js";import{I as M}from"./input-cGgwSUY9.js";import{D as P,a as E,b as O,c as z,d as B,e as W}from"./dialog-D0NhVmD7.js";import{F as A,a as j,b as k,c as w,d as y,e as F}from"./form-C5FAT4b_.js";import{e as V,f as X,X as $,L as Y}from"./vendor-icons-RDdiQ4sc.js";import"./vendor-router-xf9UbNSr.js";import"./vendor-radix-toast-LTka-d4j.js";import"./vendor-radix-primitive-BvNKvj7K.js";import"./vendor-radix-slot-f_qNkOMa.js";import"./vendor-radix-compose-refs-0p3tndNK.js";import"./vendor-radix-collection-C2ADOcGb.js";import"./vendor-radix-context-CZA76pzV.js";import"./vendor-radix-dismissable-layer-DVO7zjMy.js";import"./vendor-radix-use-callback-ref-DNSMTU4D.js";import"./vendor-radix-use-escape-keydown-CIZfUBKX.js";import"./vendor-radix-portal-lgfuWWlX.js";import"./vendor-radix-use-layout-effect-BVlAuFcq.js";import"./vendor-radix-presence-CVpwEzH2.js";import"./vendor-radix-use-controllable-state-DQPsvzY-.js";import"./vendor-radix-visually-hidden-BUU9ShfC.js";import"./vendor-radix-tooltip-DC8ZRS9i.js";import"./vendor-radix-popper-DhClme89.js";import"./vendor-radix-arrow-DCOqILDI.js";import"./vendor-radix-use-size-BbzWdhnQ.js";import"./vendor-motion-OaAG8utH.js";import"./vendor-radix-dialog-CTz_bExu.js";import"./vendor-radix-id-BVqGRCp1.js";import"./vendor-radix-focus-scope-02PDy0-H.js";import"./vendor-radix-focus-guards-C-SwFSqC.js";import"./vendor-radix-label-ttWFfKbM.js";const q=f.object({description:f.string().min(5,"Description must be at least 5 characters"),pageUrl:f.string().url()});function Re(){const[v,b]=c.useState(!1),[r,m]=c.useState([]),l=c.useRef(null),{toast:p}=R(),{t:s}=T(),[u,_]=c.useState(""),n=C({resolver:I(q),defaultValues:{description:"",pageUrl:window.location.href}}),h=U({mutationFn:async t=>{const a=new FormData;a.append("description",t.description),a.append("pageUrl",t.pageUrl),u&&a.append("website",u),r.forEach(i=>a.append("files",i));const o=await fetch("/api/feedback",{method:"POST",body:a});if(!o.ok){const i=await o.text();throw new Error(i||"Failed to submit feedback")}return o.json()},onSuccess:()=>{p({title:s("feedback.toast_success_title","Feedback submitted"),description:s("feedback.toast_success_desc","Thank you for your report. We will review it shortly.")}),n.reset({description:"",pageUrl:window.location.href}),m([]),b(!1)},onError:t=>{p({title:s("feedback.toast_error_title","Submission failed"),description:t.message,variant:"destructive"})}}),g=t=>{t&&n.setValue("pageUrl",window.location.href),b(t)},N=t=>{const a=Array.from(t.target.files||[]);if(r.length+a.length>5){p({title:s("feedback.toast_files_title","Too many files"),description:s("feedback.toast_files_desc","You can attach up to 5 files."),variant:"destructive"});return}m(i=>[...i,...a]),l.current&&(l.current.value="")},S=t=>{m(a=>a.filter((o,i)=>i!==t))},D=t=>{H("feedback",{pageUrl:t.pageUrl,description:t.description}),h.mutate(t)};return e.jsxs(e.Fragment,{children:[e.jsx(d,{"data-testid":"button-feedback-fab",onClick:()=>g(!0),className:"fixed bottom-4 left-4 z-[9999] rounded-full shadow-lg h-12 w-12 p-0 !bg-black !text-white !border-black hover:!bg-neutral-800 no-default-hover-elevate no-default-active-elevate",size:"icon","aria-label":s("feedback.aria_report","Report an issue"),children:e.jsx(V,{className:"h-6 w-6"})}),e.jsx(P,{open:v,onOpenChange:g,children:e.jsxs(E,{className:"sm:max-w-2xl","data-testid":"dialog-feedback",children:[e.jsxs(O,{children:[e.jsx(z,{children:s("feedback.dialog_title","Report an Issue")}),e.jsx(B,{children:s("feedback.dialog_desc","Describe the problem you encountered. We'll look into it.")})]}),e.jsx(A,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(D),className:"space-y-4",children:[e.jsxs("div",{style:{position:"absolute",left:"-9999px",top:"-9999px",opacity:0,height:0,overflow:"hidden"}
1,"aria-hidden":"true",tabIndex:-1,children:[e.jsx("label",{htmlFor:"feedback-website",children:"Website"}),e.jsx("input",{type:"text",id:"feedback-website",name:"website",value:u,onChange:t=>_(t.target.value),autoComplete:"off",tabIndex:-1})]}),e.jsx(j,{control:n.control,name:"pageUrl",render:({field:t})=>e.jsxs(k,{children:[e.jsx(w,{children:s("feedback.page_url","Page URL")}),e.jsx(y,{children:e.jsx(M,{...t,readOnly:!0,className:"bg-muted text-muted-foreground","data-testid":"input-feedback-url"})}),e.jsx(F,{})]})}),e.jsx(j,{control:n.control,name:"description",render:({field:t})=>{const a=o=>{t.onChange(o);const i=o.target;i.style.height="auto";const x=(parseFloat(getComputedStyle(i).lineHeight)||24)*14;i.style.height=Math.min(i.scrollHeight,x)+"px",i.style.overflowY=i.scrollHeight>x?"auto":"hidden"};return e.jsxs(k,{children:[e.jsx(w,{children:s("feedback.description","Description")}),e.jsx(y,{children:e.jsx(L,{...t,onChange:a,placeholder:s("feedback.description_placeholder","Describe the issue you found..."),rows:4,className:"resize-none overflow-hidden","data-testid":"input-feedback-description"})}),e.jsx(F,{})]})}}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:s("feedback.attachments","Attachments")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(d,{type:"button",variant:"outline",size:"sm",onClick:()=>l.current?.click(),disabled:r.length>=5,"data-testid":"button-feedback-attach",children:[e.jsx(X,{className:"h-4 w-4 mr-1"}),s("feedback.attach_files","Attach files")]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s("feedback.file_hint","Images & PDF, 10MB each / 20MB total")," (",r.length,"/5)"]})]}),e.jsx("input",{ref:l,type:"file",className:"hidden",multiple:!0,accept:"image/jpeg,image/png,image/gif,image/webp,application/pdf",onChange:N,"data-testid":"input-feedback-files"}),r.length>0&&e.jsx("div",{className:"space-y-1",children:r.map((t,a)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm bg-muted rounded px-2 py-1","data-testid":`file-attachment-${a}`,children:[t.type.startsWith("image/")?e.jsx("img",{src:URL.createObjectURL(t),alt:t.name,className:"h-8 w-8 object-cover rounded"}):e.jsx("div",{className:"h-8 w-8 flex items-center justify-center bg-background rounded text-xs font-medium",children:"PDF"}),e.jsx("span",{className:"flex-1 truncate",children:t.name}),e.jsx(d,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>S(a),"data-testid":`button-remove-file-${a}`,children:e.jsx($,{className:"h-3 w-3"})})]},a))})]}),e.jsx(W,{children:e.jsxs(d,{type:"submit",disabled:h.isPending,"data-testid":"button-feedback-submit",children:[h.isPending&&e.jsx(Y,{className:"h-4 w-4 mr-2 animate-spin"}),s("feedback.submit","Submit Report")]})})]})})]})})]})}export{Re as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.