1import{i as d,u as n,j as e,a6 as m,f as x,S as p,a as h}from"./index-Bxs8AVGw.js";import{r as u}from"./vendor-react-DaFXv1S7.js";import{u as v,L as f}from"./useLiveStoreEvents-QVATFUTG.js";import{I as b}from"./inbox-BD3_gLur.js";import{f as j}from"./formatDistanceToNow-BcxmQfdQ.js";import"./vendor-firebase-B0Eof2Zf.js";import"./endOfMonth-Ccp-Ol9X.js";function I(){const{store:a}=d(),t=a==null?void 0:a.publicId,{connected:s}=v(t),{data:r,isLoading:o,error:c}=n({queryKey:["feedback","me",t],queryFn:()=>h.get(`/feedback/me?storePublicId=${encodeURIComponent(t)}`),enabled:!!t}),l=u.useMemo(()=>(r==null?void 0:r.feedback)??[],[r]);return t?e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"eyebrow",children:"Private feedback"}),e.jsx(f,{connected:s})]}),e.jsx("p",{className:"text-[13px] mt-1 max-w-2xl",style:{color:"var(--text-muted)"},children:"Customers who tap 1â3 stars on the iPad or scan an employee QR with a low rating are routed here instead of Google. Their note never goes public â read it, fix the issue, save the relationship."})]}),o&&e.jsx(m,{variant:"list"}),c&&e.jsx("div",{className:"card-brand",children:e.jsxs("p",{className:"text-sm",style:{color:"var(--danger, #dc2626)"},children:["Couldn't load feedback: ",c.message]})}),!o&&!c&&l.length===0&&e.jsxs("div",{className:"card-brand text-center py-12",children:[e.jsx(b,{className:"w-9 h-9 mx-auto mb-3",strokeWidth:1.5,style:{color:"var(--text-light)"}}),e.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-primary)"},children:"No private feedback yet."}),e.jsx("p",{className:"text-[12px] mt-2 max-w-md mx-auto",style:{color:"var(--text-muted)"},children:"When a customer rates 1â3 stars on the iPad or via an employee QR, we offer them a private feedback form. Their text shows up here."})]}),!o&&!c&&l.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(g,{count:l.length}),e.jsx("div",{className:"space-y-3",children:l.map(i=>e.jsx(y,{entry:i},i.id))})]})]}):e.jsx("div",{className:"card-brand",children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"Pick a location to see private feedback."})})}function g({count:a}){return e.jsxs("div",{className:"card-brand",children:[e.jsx("p",{className:"eyebrow",children:"Summary"}),e.jsxs("p",{className:"text-[18px] font-medium mt-1",style:{color:"var(--text-primary)"},children:[a," customer",a===1?"":"s"," left private feedback at this location."]})]})}function y({entry:a}){const t=a.privateFeedbackAt?new Date(a.privateFeedbackAt):null,s=t&&!isNaN(t.getTime())?t:null;return e.jsxs("div",{className:"card-brand",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{rating:a.starRating}),(a.feedbackTags??[]).length>0&&e.jsx("span",{className:"text-[11px] mono uppercase tracking-wider",style:{color:"var(--text-light)"},children:(a.feedbackTags??[]).map(r=>r.replace(/_/g," ")).join(" · ")}),e.jsx("span",{className:"text-[10px] mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--bg-elevated, var(--bg-hover))",color:"var(--text-muted)",border:"1px solid var(--border)"},children:(a.source??"").replace(/_/g," ")})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-[12px]",style:{color:"var(--text-muted)"},children:[a.staffMember&&e.jsxs(e.Fragment,{children:["helped by ",e.jsx("strong",{style:{color:"var(--text-primary)"},children:a.staffMember.name})," · "]}),s?x(s,"MMM d, yyyy"):"â"]}),e.jsx("p",{className:"text-[11px] mt-0.5",style:{color:"var(--text-light)"},children:s?j(s,{addSuffix:!0}):""})]})]}),e.jsx("p",{className:"mt-3 text-[14px] leading-relaxed whitespace-pre-wrap",style:{color:"var(--text-primary)",borderLeft:"2px solid var(--text-primary)",paddingLeft:"14px"},children:a.privateFeedback}),a.privateFeedbackContact&&e.jsxs("div",{className:"mt-3 pt-3",style:{borderTop:"1px solid var(--border)"},children:[e.jsx("p",{className:"text-[11px] mono uppercase tracking-wider",style:{color:"var(--text-light)"},children:"Customer contact"}),e.jsx("p",{className:"text-[14px] mt-1",style:{color:"var(--text-primary)"},children:a.privateFeedbackContact})]})]})}function N({rating:a}){return e.jsx("span",{className:"inline-flex items-center gap-0.5",children:[1,2,3,4,5].map(t=>e.jsx(p,{className:"w-3.5 h-3.5",strokeWidth:1.5,style:{color:t<=a?"var(--text-primary)":"var(--text-light)"},fill:t<=a?"currentColor":"none"},t))})}
1export{I 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.