@upstep/js 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4,6 +4,7 @@
4
4
  #upstep-btn svg{width:16px;height:16px;flex-shrink:0}
5
5
  #upstep-btn:hover{transform:translateY(-1px);box-shadow:0 8px 26px rgba(26,25,21,.24)}
6
6
  #upstep-btn svg{width:16px;height:16px}
7
+ @media(max-width:639px){#upstep-btn{padding:12px}#upstep-btn span{display:none}}
7
8
  #upstep-backdrop{position:fixed;inset:0;background:${e.overlay};backdrop-filter:blur(3px);z-index:9999;display:flex;align-items:center;justify-content:center;padding:16px;animation:upstep-fade .2s ease}
8
9
  @keyframes upstep-fade{from{opacity:0}to{opacity:1}}
9
10
  @keyframes upstep-rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ function h(o, t, e) {
28
28
  #upstep-btn svg{width:16px;height:16px;flex-shrink:0}
29
29
  #upstep-btn:hover{transform:translateY(-1px);box-shadow:0 8px 26px rgba(26,25,21,.24)}
30
30
  #upstep-btn svg{width:16px;height:16px}
31
+ @media(max-width:639px){#upstep-btn{padding:12px}#upstep-btn span{display:none}}
31
32
  #upstep-backdrop{position:fixed;inset:0;background:${e.overlay};backdrop-filter:blur(3px);z-index:9999;display:flex;align-items:center;justify-content:center;padding:16px;animation:upstep-fade .2s ease}
32
33
  @keyframes upstep-fade{from{opacity:0}to{opacity:1}}
33
34
  @keyframes upstep-rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}
package/dist/react.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),T=require("./api-BvhrcMKU.js"),U="#D97757",R={bg:"#ffffff",bgSoft:"#f6f5f2",bgHover:"#efede8",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},L={bg:"#1c1b19",bgSoft:"#262522",bgHover:"#302e2a",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function D(o){const[t,n]=r.useState(()=>o==="dark"?!0:o==="light"?!1:typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1);return r.useEffect(()=>{if(o!=="auto"||typeof window>"u"||!window.matchMedia){n(o==="dark");return}const a=window.matchMedia("(prefers-color-scheme: dark)"),p=l=>n(l.matches);return n(a.matches),a.addEventListener("change",p),()=>a.removeEventListener("change",p)},[o]),t?L:R}const C=r.createContext(null);function M({children:o,...t}){const[n]=r.useState(()=>new T.UpstepApiClient(t)),[a,p]=r.useState([]),[l,i]=r.useState(!1),[s,g]=r.useState(!0);r.useEffect(()=>{n.setUserId(t.userId)},[n,t.userId]);const d=r.useCallback(async()=>{try{const f=await n.listFeedback({sort:"votes",limit:20});p(f.items),g(f.showBranding??!0)}catch{}},[n]);r.useEffect(()=>{d()},[d]);const m=r.useCallback(async(f,j,h)=>{const u={content:j};f.trim()&&(u.title=f.trim()),h!==void 0&&(u.type=h),await n.submitFeedback(u),await d()},[n,d]),c=r.useCallback(async(f,j)=>{try{await n.vote(f,j),await d()}catch{}},[n,d]),x=r.useCallback(f=>n.getItem(f),[n]),y=r.useCallback(()=>i(!0),[]),k=r.useCallback(()=>i(!1),[]),S=r.useCallback(f=>n.setUserId(f),[n]);return e.jsx(C.Provider,{value:{client:n,feedItems:a,loadFeed:d,submit:m,vote:c,getItem:x,isOpen:l,open:y,close:k,identify:S,accentColor:t.accentColor??U,theme:t.theme??"auto",showBranding:s},children:o})}function v(){const o=r.useContext(C);if(!o)throw new Error("useUpstep must be used inside <UpstepProvider>");return o}function P({position:o="bottom-right",accentColor:t,theme:n,hideLauncher:a=!1}){const p=v(),l=t??p.accentColor,i=D(n??p.theme),{isOpen:s,open:g,close:d,showBranding:m}=p,[c,x]=r.useState("list"),[y,k]=r.useState(null),[S,f]=r.useState("open"),j=o==="bottom-left"?{position:"fixed",bottom:24,left:24}:{position:"fixed",bottom:24,right:24},h='-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif';function u(){d(),setTimeout(()=>{x("list"),k(null)},300)}function I(b){k(b),x("detail")}return e.jsxs(e.Fragment,{children:[!a&&e.jsxs("button",{onClick:g,style:{...j,zIndex:9998,display:"inline-flex",alignItems:"center",gap:7,background:l,color:"#fff",border:"none",borderRadius:9999,padding:"12px 18px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:h,boxShadow:"0 6px 20px rgba(26,25,21,.18)"},children:[e.jsx(_,{size:16})," Feedback"]}),s&&e.jsx("div",{onClick:b=>b.target===b.currentTarget&&u(),style:{position:"fixed",inset:0,background:i.overlay,backdropFilter:"blur(3px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",padding:16,fontFamily:h},children:e.jsxs("div",{style:{background:i.bg,border:`1px solid ${i.border}`,borderRadius:20,width:"100%",maxWidth:440,maxHeight:"88vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 24px 64px rgba(0,0,0,.28)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:`1px solid ${i.border}`,flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c!=="list"&&e.jsx("button",{onClick:()=>x("list"),style:{background:"none",border:"none",cursor:"pointer",color:l,fontSize:13,fontWeight:600,padding:0},children:"← Back"}),c==="list"&&e.jsx("span",{style:{fontWeight:700,fontSize:16,color:i.text,letterSpacing:"-.01em"},children:"Feedback"}),c==="create"&&e.jsx("span",{style:{fontWeight:700,fontSize:16,color:i.text,letterSpacing:"-.01em"},children:"New feedback"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c==="list"&&e.jsx("button",{onClick:()=>x("create"),style:{background:l,color:"#fff",border:"none",borderRadius:20,padding:"6px 14px",fontSize:13,fontWeight:700,cursor:"pointer"},children:"+ New"}),e.jsx("button",{onClick:u,style:{background:i.bgSoft,border:"none",width:28,height:28,borderRadius:8,fontSize:14,cursor:"pointer",color:i.textSoft,display:"flex",alignItems:"center",justifyContent:"center"},children:"✕"})]})]}),c==="list"&&e.jsx("div",{style:{display:"flex",borderBottom:`1px solid ${i.border}`,flexShrink:0},children:["open","done"].map(b=>e.jsx("button",{onClick:()=>f(b),style:{flex:1,padding:"10px 0",border:"none",background:"none",cursor:"pointer",fontSize:13,fontWeight:600,color:S===b?l:i.textFaint,borderBottom:`2px solid ${S===b?l:"transparent"}`},children:b==="open"?"Open":"Completed"},b))}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px 24px"},children:[c==="list"&&e.jsx(A,{tab:S,onSelect:I,accent:l,p:i}),c==="detail"&&y&&e.jsx(N,{feedbackId:y,accent:l,p:i,font:h}),c==="create"&&e.jsx(O,{accent:l,p:i,font:h,onDone:()=>x("list")})]}),m&&e.jsxs("a",{href:"https://upstep.dev",target:"_blank",rel:"noopener noreferrer",style:{display:"block",textAlign:"center",padding:"8px 0",borderTop:`1px solid ${i.border}`,fontSize:11,color:i.textFaint,textDecoration:"none",flexShrink:0},children:["Powered by ",e.jsx("strong",{style:{fontWeight:700},children:"Upstep.dev"})]})]})})]})}function A({tab:o,onSelect:t,accent:n,p:a}){const{feedItems:p,vote:l}=v(),i=o==="done"?p.filter(s=>s.status==="DONE"):p.filter(s=>s.status!=="DONE"&&s.status!=="CLOSED");return i.length?e.jsx(e.Fragment,{children:i.map(s=>{const g=s.userVote==="UP",d=s.title??s.content;return e.jsxs("div",{onClick:()=>t(s.id),style:{display:"flex",gap:12,padding:14,border:`1px solid ${a.border}`,borderRadius:14,marginBottom:10,background:a.bg,cursor:"pointer"},children:[e.jsxs("button",{onClick:m=>{m.stopPropagation(),l(s.id,"UP")},style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minWidth:46,padding:"7px 0",borderRadius:11,cursor:"pointer",flexShrink:0,border:`1px solid ${g?n:a.border}`,background:g?`${n}1a`:a.bgSoft},children:[e.jsx(W,{color:n}),e.jsx("span",{style:{fontSize:14,fontWeight:700,color:a.text,lineHeight:1.1},children:s.upvotes})]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("p",{style:{fontSize:13.5,fontWeight:600,lineHeight:1.4,color:a.text,margin:"0 0 6px",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:d}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[e.jsx(F,{type:s.type,p:a}),s.status==="PENDING"?e.jsx(B,{}):e.jsx(z,{status:s.status,p:a}),e.jsx("span",{style:{fontSize:11,color:a.textFaint},children:E(s.createdAt)})]})]}),e.jsx("span",{style:{color:a.textFaint,fontSize:18,alignSelf:"center",flexShrink:0},children:"›"})]},s.id)})}):e.jsxs("div",{style:{textAlign:"center",padding:"40px 0"},children:[e.jsx("div",{style:{color:a.textSoft,fontSize:15,fontWeight:600,marginBottom:4},children:o==="done"?"Nothing completed yet":"No open feedback yet"}),e.jsx("div",{style:{color:a.textFaint,fontSize:14},children:o==="done"?"Shipped items will appear here.":"Be the first to share one."})]})}function N({feedbackId:o,accent:t,p:n,font:a}){const{vote:p,getItem:l}=v(),[i,s]=r.useState(null),[g,d]=r.useState(!1);r.useEffect(()=>{let x=!1;return l(o).then(y=>{x||s(y)}).catch(()=>{}),()=>{x=!0}},[o,l]);async function m(){if(!(!i||g)){d(!0);try{await p(i.id,"UP");const x=await l(o);s(x)}catch{}finally{d(!1)}}}if(!i)return e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:n.textFaint,fontSize:14},children:"Loading…"});const c=i.title;return e.jsxs("div",{children:[c&&e.jsx("div",{style:{fontSize:20,fontWeight:700,color:n.text,letterSpacing:"-.02em",marginBottom:10,lineHeight:1.3},children:c}),e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:14,flexWrap:"wrap"},children:[e.jsx(F,{type:i.type,p:n}),i.status==="PENDING"?e.jsx(B,{}):e.jsx(z,{status:i.status,p:n})]}),e.jsx("p",{style:{fontSize:15,lineHeight:1.6,color:n.textSoft,marginBottom:20},children:i.content}),e.jsxs("button",{onClick:m,disabled:g,style:{display:"inline-flex",alignItems:"center",gap:8,border:`1px solid ${i.userVote==="UP"?t:n.border}`,background:i.userVote==="UP"?`${t}15`:n.bgSoft,borderRadius:12,padding:"10px 16px",cursor:"pointer",fontFamily:a},children:[e.jsx(W,{color:t,size:13}),e.jsx("span",{style:{fontSize:18,fontWeight:700,color:n.text},children:i.upvotes}),e.jsx("span",{style:{fontSize:13,color:n.textFaint},children:i.userVote==="UP"?"Upvoted":"Upvote"})]}),i.comments.length>0&&e.jsxs("div",{style:{marginTop:28,borderTop:`1px solid ${n.border}`,paddingTop:20},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:12,textTransform:"uppercase"},children:"Developer response"}),i.comments.map(x=>e.jsx($,{comment:x,p:n,accent:t},x.id))]})]})}function $({comment:o,p:t,accent:n}){return e.jsxs("div",{style:{background:t.bgSoft,border:`1px solid ${t.border}`,borderRadius:12,padding:14,marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("span",{style:{background:`${n}20`,color:n,fontSize:11,fontWeight:700,borderRadius:20,padding:"2px 8px"},children:"Developer"}),e.jsx("span",{style:{fontSize:11,color:t.textFaint},children:E(o.createdAt)})]}),e.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:t.textSoft,margin:0},children:o.content})]})}function O({accent:o,p:t,font:n,onDone:a}){const{submit:p}=v(),[l,i]=r.useState(""),[s,g]=r.useState(""),[d,m]=r.useState("GENERAL"),[c,x]=r.useState(!1),[y,k]=r.useState(!1),[S,f]=r.useState("");async function j(){if(!(!l.trim()||c)){x(!0),f("");try{await p(l.trim(),s.trim()||l.trim(),d),k(!0),setTimeout(a,1200)}catch{f("Something went wrong. Please try again.")}finally{x(!1)}}}if(y)return e.jsxs("div",{style:{textAlign:"center",paddingTop:40},children:[e.jsx("div",{style:{fontSize:18,fontWeight:700,color:t.text,marginBottom:6},children:"Submitted"}),e.jsx("div",{style:{fontSize:14,color:t.textFaint},children:"Feedback received. Thank you."})]});const h={width:"100%",border:`1px solid ${t.border}`,borderRadius:12,padding:"10px 12px",fontSize:14,lineHeight:1.5,outline:"none",background:t.bgSoft,color:t.text,fontFamily:n,boxSizing:"border-box"};return e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:t.textFaint,marginBottom:8,textTransform:"uppercase"},children:"Type"}),e.jsx("div",{style:{display:"flex",gap:7,marginBottom:16},children:["BUG","FEATURE","GENERAL"].map(u=>e.jsxs("button",{onClick:()=>m(u),style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:"8px 10px",borderRadius:9,fontSize:12.5,fontWeight:600,cursor:"pointer",background:d===u?o:t.bg,color:d===u?"#fff":t.textSoft,border:`1px solid ${d===u?o:t.border}`,fontFamily:n},children:[w[u].icon,w[u].label]},u))}),e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:t.textFaint,marginBottom:8,textTransform:"uppercase"},children:"Title"}),e.jsx("input",{value:l,onChange:u=>i(u.target.value),placeholder:"Short summary of the issue or idea",maxLength:200,style:{...h,marginBottom:16,display:"block"}}),e.jsxs("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:t.textFaint,marginBottom:8,textTransform:"uppercase"},children:["Description ",e.jsx("span",{style:{fontWeight:400,textTransform:"none",letterSpacing:0},children:"(optional)"})]}),e.jsx("textarea",{value:s,onChange:u=>g(u.target.value),placeholder:"Steps to reproduce, expected behaviour, or more context",maxLength:2e3,rows:4,style:{...h,resize:"vertical",marginBottom:16}}),S&&e.jsx("p",{style:{fontSize:13,color:"#d6453d",marginBottom:12},children:S}),e.jsx("button",{onClick:j,disabled:c||!l.trim(),style:{width:"100%",padding:12,background:o,color:"#fff",border:"none",borderRadius:11,fontSize:14,fontWeight:600,cursor:"pointer",opacity:c||!l.trim()?.5:1,fontFamily:n},children:c?"Submitting…":"Submit feedback"})]})}const w={BUG:{label:"Bug",icon:e.jsxs("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("ellipse",{cx:"8",cy:"10",rx:"3.5",ry:"4.5"}),e.jsx("path",{d:"M8 5.5V4M5.5 6.5 3.5 5M10.5 6.5 12.5 5M4.5 10.5 2.5 10M11.5 10.5 13.5 10"})]})},FEATURE:{label:"Feature",icon:e.jsxs("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M8 2v1.5M8 12.5V14M2 8h1.5M12.5 8H14M4.1 4.1l1 1M10.9 10.9l1 1M11.9 4.1l-1 1M5.1 10.9l-1 1"}),e.jsx("circle",{cx:"8",cy:"8",r:"2.5"})]})},GENERAL:{label:"General",icon:e.jsx("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M14 9a2 2 0 0 1-2 2H5L2 14V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5z"})})}},G={BUG:"#fdecec",FEATURE:"#e9f0fd"},H={BUG:"#d6453d",FEATURE:"#3b76d6"};function F({type:o,p:t}){return e.jsx("span",{style:{padding:"2px 8px",borderRadius:9999,fontSize:10.5,fontWeight:700,letterSpacing:".02em",background:G[o]??t.bgSoft,color:H[o]??t.textSoft},children:o})}const V={OPEN:"#b45309",IN_PROGRESS:"#1d4ed8",DONE:"#15803d",CLOSED:"#6b7280"};function B(){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:"#fff7ed",border:"1px solid #fed7aa",borderRadius:6,padding:"1px 6px",fontSize:10,fontWeight:700,color:"#ea580c"},children:[e.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:"#ea580c",display:"inline-block"}}),"Pending review"]})}function z({status:o,p:t}){const n=V[o]??"#9ca3af";return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,background:t.bgSoft,border:`1px solid ${t.border}`,borderRadius:6,padding:"2px 8px",fontSize:10,fontWeight:600,color:t.textSoft},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:n,display:"inline-block",flexShrink:0}}),o.replace("_"," ")]})}function _({size:o=16,color:t="currentColor"}){return e.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function W({color:o="currentColor",size:t=11}){return e.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:o,strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M8 13V3M3 8l5-5 5 5"})})}function E(o){return new Date(o).toLocaleDateString(void 0,{month:"short",day:"numeric"})}exports.FeedbackWidget=P;exports.UpstepProvider=M;exports.useUpstep=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),L=require("./api-BvhrcMKU.js"),R="#D97757",M={bg:"#ffffff",bgSoft:"#f6f5f2",bgHover:"#efede8",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},D={bg:"#1c1b19",bgSoft:"#262522",bgHover:"#302e2a",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function P(i){const[n,t]=r.useState(()=>i==="dark"?!0:i==="light"?!1:typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1);return r.useEffect(()=>{if(i!=="auto"||typeof window>"u"||!window.matchMedia){t(i==="dark");return}const f=window.matchMedia("(prefers-color-scheme: dark)"),u=s=>t(s.matches);return t(f.matches),f.addEventListener("change",u),()=>f.removeEventListener("change",u)},[i]),n?D:M}const F=r.createContext(null);function A({children:i,...n}){const[t]=r.useState(()=>new L.UpstepApiClient(n)),[f,u]=r.useState([]),[s,o]=r.useState(!1),[p,g]=r.useState(!0);r.useEffect(()=>{t.setUserId(n.userId)},[t,n.userId]);const l=r.useCallback(async()=>{try{const x=await t.listFeedback({sort:"votes",limit:20});u(x.items),g(x.showBranding??!0)}catch{}},[t]);r.useEffect(()=>{l()},[l]);const m=r.useCallback(async(x,S,h)=>{const d={content:S};x.trim()&&(d.title=x.trim()),h!==void 0&&(d.type=h),await t.submitFeedback(d),await l()},[t,l]),c=r.useCallback(async(x,S)=>{try{await t.vote(x,S),await l()}catch{}},[t,l]),a=r.useCallback(x=>t.getItem(x),[t]),b=r.useCallback(()=>o(!0),[]),k=r.useCallback(()=>o(!1),[]),y=r.useCallback(x=>t.setUserId(x),[t]);return e.jsx(F.Provider,{value:{client:t,feedItems:f,loadFeed:l,submit:m,vote:c,getItem:a,isOpen:s,open:b,close:k,identify:y,accentColor:n.accentColor??R,theme:n.theme??"auto",showBranding:p},children:i})}function v(){const i=r.useContext(F);if(!i)throw new Error("useUpstep must be used inside <UpstepProvider>");return i}function G({position:i="bottom-right",accentColor:n,theme:t,hideLauncher:f=!1}){const u=v(),s=n??u.accentColor,o=P(t??u.theme),{isOpen:p,open:g,close:l,showBranding:m}=u,[c,a]=r.useState("list"),[b,k]=r.useState(null),[y,x]=r.useState(()=>typeof window<"u"?window.matchMedia("(max-width: 639px)").matches:!1);r.useEffect(()=>{const j=window.matchMedia("(max-width: 639px)"),w=U=>x(U.matches);return j.addEventListener("change",w),()=>j.removeEventListener("change",w)},[]);const S=i==="bottom-left"?{position:"fixed",bottom:24,left:24}:{position:"fixed",bottom:24,right:24},h='-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif';function d(){l(),setTimeout(()=>{a("list"),k(null)},300)}function T(j){k(j),a("detail")}return e.jsxs(e.Fragment,{children:[!f&&e.jsxs("button",{onClick:g,style:{...S,zIndex:9998,display:"inline-flex",alignItems:"center",gap:7,background:s,color:"#fff",border:"none",borderRadius:9999,padding:y?"12px":"12px 18px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:h,boxShadow:"0 6px 20px rgba(26,25,21,.18)"},children:[e.jsx(Y,{size:16}),!y&&"Feedback"]}),p&&e.jsx("div",{onClick:j=>j.target===j.currentTarget&&d(),style:{position:"fixed",inset:0,background:o.overlay,backdropFilter:"blur(3px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",padding:16,fontFamily:h},children:e.jsxs("div",{style:{background:o.bg,border:`1px solid ${o.border}`,borderRadius:20,width:"100%",maxWidth:440,maxHeight:"88vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 24px 64px rgba(0,0,0,.28)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:`1px solid ${o.border}`,flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c!=="list"&&e.jsx("button",{onClick:()=>a("list"),style:{background:"none",border:"none",cursor:"pointer",color:s,fontSize:13,fontWeight:600,padding:0},children:"← Back"}),c==="list"&&e.jsx("span",{style:{fontWeight:700,fontSize:16,color:o.text,letterSpacing:"-.01em"},children:"Feedback"}),c==="create"&&e.jsx("span",{style:{fontWeight:700,fontSize:16,color:o.text,letterSpacing:"-.01em"},children:"New feedback"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c==="list"&&e.jsx("button",{onClick:()=>a("create"),style:{background:s,color:"#fff",border:"none",borderRadius:20,padding:"6px 14px",fontSize:13,fontWeight:700,cursor:"pointer"},children:"+ New"}),e.jsx("button",{onClick:d,style:{background:o.bgSoft,border:"none",width:28,height:28,borderRadius:8,fontSize:14,cursor:"pointer",color:o.textSoft,display:"flex",alignItems:"center",justifyContent:"center"},children:"✕"})]})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px 24px"},children:[c==="list"&&e.jsx(H,{onSelect:T,accent:s,p:o}),c==="detail"&&b&&e.jsx(N,{feedbackId:b,accent:s,p:o,font:h}),c==="create"&&e.jsx(O,{accent:s,p:o,font:h,onDone:()=>a("list")})]}),m&&e.jsxs("a",{href:"https://upstep.dev",target:"_blank",rel:"noopener noreferrer",style:{display:"block",textAlign:"center",padding:"8px 0",borderTop:`1px solid ${o.border}`,fontSize:11,color:o.textFaint,textDecoration:"none",flexShrink:0},children:["Powered by ",e.jsx("strong",{style:{fontWeight:700},children:"Upstep.dev"})]})]})})]})}function H({onSelect:i,accent:n,p:t}){const{feedItems:f,vote:u}=v(),s=f.filter(o=>o.status!=="CLOSED");return s.length?e.jsx(e.Fragment,{children:s.map(o=>{const p=o.userVote==="UP",g=o.title??o.content;return e.jsxs("div",{onClick:()=>i(o.id),style:{display:"flex",gap:12,padding:14,border:`1px solid ${t.border}`,borderRadius:14,marginBottom:10,background:t.bg,cursor:"pointer"},children:[e.jsxs("button",{onClick:l=>{l.stopPropagation(),u(o.id,"UP")},style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minWidth:46,padding:"7px 0",borderRadius:11,cursor:"pointer",flexShrink:0,border:`1px solid ${p?n:t.border}`,background:p?`${n}1a`:t.bgSoft},children:[e.jsx(E,{color:n}),e.jsx("span",{style:{fontSize:14,fontWeight:700,color:t.text,lineHeight:1.1},children:o.upvotes})]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("p",{style:{fontSize:13.5,fontWeight:600,lineHeight:1.4,color:t.text,margin:"0 0 6px",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:g}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[e.jsx(z,{type:o.type,p:t}),o.status==="PENDING"?e.jsx(B,{}):e.jsx(W,{status:o.status,p:t}),e.jsx("span",{style:{fontSize:11,color:t.textFaint},children:I(o.createdAt)})]})]}),e.jsx("span",{style:{color:t.textFaint,fontSize:18,alignSelf:"center",flexShrink:0},children:"›"})]},o.id)})}):e.jsxs("div",{style:{textAlign:"center",padding:"40px 0"},children:[e.jsx("div",{style:{color:t.textSoft,fontSize:15,fontWeight:600,marginBottom:4},children:"No open feedback yet"}),e.jsx("div",{style:{color:t.textFaint,fontSize:14},children:"Be the first to share one."})]})}function N({feedbackId:i,accent:n,p:t,font:f}){const{vote:u,getItem:s}=v(),[o,p]=r.useState(null),[g,l]=r.useState(!1);r.useEffect(()=>{let a=!1;return s(i).then(b=>{a||p(b)}).catch(()=>{}),()=>{a=!0}},[i,s]);async function m(){if(!(!o||g)){l(!0);try{await u(o.id,"UP");const a=await s(i);p(a)}catch{}finally{l(!1)}}}if(!o)return e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:t.textFaint,fontSize:14},children:"Loading…"});const c=o.title;return e.jsxs("div",{children:[c&&e.jsx("div",{style:{fontSize:20,fontWeight:700,color:t.text,letterSpacing:"-.02em",marginBottom:10,lineHeight:1.3},children:c}),e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:14,flexWrap:"wrap"},children:[e.jsx(z,{type:o.type,p:t}),o.status==="PENDING"?e.jsx(B,{}):e.jsx(W,{status:o.status,p:t})]}),e.jsx("p",{style:{fontSize:15,lineHeight:1.6,color:t.textSoft,marginBottom:20},children:o.content}),e.jsxs("button",{onClick:m,disabled:g,style:{display:"inline-flex",alignItems:"center",gap:8,border:`1px solid ${o.userVote==="UP"?n:t.border}`,background:o.userVote==="UP"?`${n}15`:t.bgSoft,borderRadius:12,padding:"10px 16px",cursor:"pointer",fontFamily:f},children:[e.jsx(E,{color:n,size:13}),e.jsx("span",{style:{fontSize:18,fontWeight:700,color:t.text},children:o.upvotes}),e.jsx("span",{style:{fontSize:13,color:t.textFaint},children:o.userVote==="UP"?"Upvoted":"Upvote"})]}),o.comments.length>0&&e.jsxs("div",{style:{marginTop:28,borderTop:`1px solid ${t.border}`,paddingTop:20},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:t.textFaint,marginBottom:12,textTransform:"uppercase"},children:"Developer response"}),o.comments.map(a=>e.jsx($,{comment:a,p:t,accent:n},a.id))]})]})}function $({comment:i,p:n,accent:t}){return e.jsxs("div",{style:{background:n.bgSoft,border:`1px solid ${n.border}`,borderRadius:12,padding:14,marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("span",{style:{background:`${t}20`,color:t,fontSize:11,fontWeight:700,borderRadius:20,padding:"2px 8px"},children:"Developer"}),e.jsx("span",{style:{fontSize:11,color:n.textFaint},children:I(i.createdAt)})]}),e.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:n.textSoft,margin:0},children:i.content})]})}function O({accent:i,p:n,font:t,onDone:f}){const{submit:u}=v(),[s,o]=r.useState(""),[p,g]=r.useState(""),[l,m]=r.useState("GENERAL"),[c,a]=r.useState(!1),[b,k]=r.useState(!1),[y,x]=r.useState("");async function S(){if(!(!s.trim()||c)){a(!0),x("");try{await u(s.trim(),p.trim()||s.trim(),l),k(!0),setTimeout(f,1200)}catch{x("Something went wrong. Please try again.")}finally{a(!1)}}}if(b)return e.jsxs("div",{style:{textAlign:"center",paddingTop:40},children:[e.jsx("div",{style:{fontSize:18,fontWeight:700,color:n.text,marginBottom:6},children:"Submitted"}),e.jsx("div",{style:{fontSize:14,color:n.textFaint},children:"Feedback received. Thank you."})]});const h={width:"100%",border:`1px solid ${n.border}`,borderRadius:12,padding:"10px 12px",fontSize:14,lineHeight:1.5,outline:"none",background:n.bgSoft,color:n.text,fontFamily:t,boxSizing:"border-box"};return e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:"Type"}),e.jsx("div",{style:{display:"flex",gap:7,marginBottom:16},children:["BUG","FEATURE","GENERAL"].map(d=>e.jsxs("button",{onClick:()=>m(d),style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:"8px 10px",borderRadius:9,fontSize:12.5,fontWeight:600,cursor:"pointer",background:l===d?i:n.bg,color:l===d?"#fff":n.textSoft,border:`1px solid ${l===d?i:n.border}`,fontFamily:t},children:[C[d].icon,C[d].label]},d))}),e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:"Title"}),e.jsx("input",{value:s,onChange:d=>o(d.target.value),placeholder:"Short summary of the issue or idea",maxLength:200,style:{...h,marginBottom:16,display:"block"}}),e.jsxs("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:["Description ",e.jsx("span",{style:{fontWeight:400,textTransform:"none",letterSpacing:0},children:"(optional)"})]}),e.jsx("textarea",{value:p,onChange:d=>g(d.target.value),placeholder:"Steps to reproduce, expected behaviour, or more context",maxLength:2e3,rows:4,style:{...h,resize:"vertical",marginBottom:16}}),y&&e.jsx("p",{style:{fontSize:13,color:"#d6453d",marginBottom:12},children:y}),e.jsx("button",{onClick:S,disabled:c||!s.trim(),style:{width:"100%",padding:12,background:i,color:"#fff",border:"none",borderRadius:11,fontSize:14,fontWeight:600,cursor:"pointer",opacity:c||!s.trim()?.5:1,fontFamily:t},children:c?"Submitting…":"Submit feedback"})]})}const C={BUG:{label:"Bug",icon:e.jsxs("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("ellipse",{cx:"8",cy:"10",rx:"3.5",ry:"4.5"}),e.jsx("path",{d:"M8 5.5V4M5.5 6.5 3.5 5M10.5 6.5 12.5 5M4.5 10.5 2.5 10M11.5 10.5 13.5 10"})]})},FEATURE:{label:"Feature",icon:e.jsxs("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M8 2v1.5M8 12.5V14M2 8h1.5M12.5 8H14M4.1 4.1l1 1M10.9 10.9l1 1M11.9 4.1l-1 1M5.1 10.9l-1 1"}),e.jsx("circle",{cx:"8",cy:"8",r:"2.5"})]})},GENERAL:{label:"General",icon:e.jsx("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M14 9a2 2 0 0 1-2 2H5L2 14V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5z"})})}},V={BUG:"#fdecec",FEATURE:"#e9f0fd"},_={BUG:"#d6453d",FEATURE:"#3b76d6"};function z({type:i,p:n}){return e.jsx("span",{style:{padding:"2px 8px",borderRadius:9999,fontSize:10.5,fontWeight:700,letterSpacing:".02em",background:V[i]??n.bgSoft,color:_[i]??n.textSoft},children:i})}const q={OPEN:"#b45309",IN_PROGRESS:"#1d4ed8",DONE:"#15803d",CLOSED:"#6b7280"};function B(){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:"#fff7ed",border:"1px solid #fed7aa",borderRadius:6,padding:"1px 6px",fontSize:10,fontWeight:700,color:"#ea580c"},children:[e.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:"#ea580c",display:"inline-block"}}),"Pending review"]})}function W({status:i,p:n}){const t=q[i]??"#9ca3af";return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,background:n.bgSoft,border:`1px solid ${n.border}`,borderRadius:6,padding:"2px 8px",fontSize:10,fontWeight:600,color:n.textSoft},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:t,display:"inline-block",flexShrink:0}}),i.replace("_"," ")]})}function Y({size:i=16,color:n="currentColor"}){return e.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function E({color:i="currentColor",size:n=11}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"none",stroke:i,strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M8 13V3M3 8l5-5 5 5"})})}function I(i){return new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"})}exports.FeedbackWidget=G;exports.UpstepProvider=A;exports.useUpstep=v;
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAW,QAAQ,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAMxC,KAAK,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAmD3C,UAAU,kBAAkB;IAC1B,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC/D,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;CACvB;AAID,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,YAAY,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,qBA6DxC;AAED,wBAAgB,SAAS,IAAI,kBAAkB,CAI9C;AAID,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAID,wBAAgB,cAAc,CAAC,EAC7B,QAAyB,EACzB,WAAW,EACX,KAAK,EACL,YAAoB,GACrB,EAAE,mBAAmB,qBA6JrB"}
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAW,QAAQ,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAMxC,KAAK,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAmD3C,UAAU,kBAAkB;IAC1B,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC/D,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;CACvB;AAID,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,YAAY,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,qBA6DxC;AAED,wBAAgB,SAAS,IAAI,kBAAkB,CAI9C;AAID,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAID,wBAAgB,cAAc,CAAC,EAC7B,QAAyB,EACzB,WAAW,EACX,KAAK,EACL,YAAoB,GACrB,EAAE,mBAAmB,qBAkJrB"}
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
- import { jsxs as r, Fragment as W, jsx as e } from "react/jsx-runtime";
2
- import { createContext as M, useState as h, useEffect as B, useCallback as w, useContext as P } from "react";
3
- import { U as A } from "./api-B-umoNRf.mjs";
1
+ import { jsxs as r, Fragment as I, jsx as e } from "react/jsx-runtime";
2
+ import { createContext as A, useState as p, useEffect as z, useCallback as w, useContext as G } from "react";
3
+ import { U as H } from "./api-B-umoNRf.mjs";
4
4
  const N = "#D97757", $ = {
5
5
  bg: "#ffffff",
6
6
  bgSoft: "#f6f5f2",
@@ -10,7 +10,7 @@ const N = "#D97757", $ = {
10
10
  textFaint: "#9b9890",
11
11
  border: "#e8e6df",
12
12
  overlay: "rgba(26,25,21,.45)"
13
- }, G = {
13
+ }, j = {
14
14
  bg: "#1c1b19",
15
15
  bgSoft: "#262522",
16
16
  bgHover: "#302e2a",
@@ -20,92 +20,99 @@ const N = "#D97757", $ = {
20
20
  border: "#33312c",
21
21
  overlay: "rgba(0,0,0,.6)"
22
22
  };
23
- function H(n) {
24
- const [t, o] = h(() => n === "dark" ? !0 : n === "light" ? !1 : typeof window < "u" && window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)").matches : !1);
25
- return B(() => {
26
- if (n !== "auto" || typeof window > "u" || !window.matchMedia) {
27
- o(n === "dark");
23
+ function O(i) {
24
+ const [n, t] = p(() => i === "dark" ? !0 : i === "light" ? !1 : typeof window < "u" && window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)").matches : !1);
25
+ return z(() => {
26
+ if (i !== "auto" || typeof window > "u" || !window.matchMedia) {
27
+ t(i === "dark");
28
28
  return;
29
29
  }
30
- const s = window.matchMedia("(prefers-color-scheme: dark)"), u = (d) => o(d.matches);
31
- return o(s.matches), s.addEventListener("change", u), () => s.removeEventListener("change", u);
32
- }, [n]), t ? G : $;
30
+ const h = window.matchMedia("(prefers-color-scheme: dark)"), g = (l) => t(l.matches);
31
+ return t(h.matches), h.addEventListener("change", g), () => h.removeEventListener("change", g);
32
+ }, [i]), n ? j : $;
33
33
  }
34
- const I = M(null);
35
- function ee({
36
- children: n,
37
- ...t
34
+ const E = A(null);
35
+ function ne({
36
+ children: i,
37
+ ...n
38
38
  }) {
39
- const [o] = h(() => new A(t)), [s, u] = h([]), [d, i] = h(!1), [l, x] = h(!0);
40
- B(() => {
41
- o.setUserId(t.userId);
42
- }, [o, t.userId]);
43
- const a = w(async () => {
39
+ const [t] = p(() => new H(n)), [h, g] = p([]), [l, o] = p(!1), [u, x] = p(!0);
40
+ z(() => {
41
+ t.setUserId(n.userId);
42
+ }, [t, n.userId]);
43
+ const d = w(async () => {
44
44
  try {
45
- const g = await o.listFeedback({ sort: "votes", limit: 20 });
46
- u(g.items), x(g.showBranding ?? !0);
45
+ const f = await t.listFeedback({ sort: "votes", limit: 20 });
46
+ g(f.items), x(f.showBranding ?? !0);
47
47
  } catch {
48
48
  }
49
- }, [o]);
50
- B(() => {
51
- a();
52
- }, [a]);
53
- const y = w(async (g, v, b) => {
54
- const p = { content: v };
55
- g.trim() && (p.title = g.trim()), b !== void 0 && (p.type = b), await o.submitFeedback(p), await a();
56
- }, [o, a]), c = w(async (g, v) => {
49
+ }, [t]);
50
+ z(() => {
51
+ d();
52
+ }, [d]);
53
+ const y = w(async (f, v, m) => {
54
+ const s = { content: v };
55
+ f.trim() && (s.title = f.trim()), m !== void 0 && (s.type = m), await t.submitFeedback(s), await d();
56
+ }, [t, d]), c = w(async (f, v) => {
57
57
  try {
58
- await o.vote(g, v), await a();
58
+ await t.vote(f, v), await d();
59
59
  } catch {
60
60
  }
61
- }, [o, a]), f = w(
62
- (g) => o.getItem(g),
63
- [o]
64
- ), S = w(() => i(!0), []), F = w(() => i(!1), []), k = w((g) => o.setUserId(g), [o]);
61
+ }, [t, d]), a = w(
62
+ (f) => t.getItem(f),
63
+ [t]
64
+ ), b = w(() => o(!0), []), F = w(() => o(!1), []), S = w((f) => t.setUserId(f), [t]);
65
65
  return /* @__PURE__ */ e(
66
- I.Provider,
66
+ E.Provider,
67
67
  {
68
68
  value: {
69
- client: o,
70
- feedItems: s,
71
- loadFeed: a,
69
+ client: t,
70
+ feedItems: h,
71
+ loadFeed: d,
72
72
  submit: y,
73
73
  vote: c,
74
- getItem: f,
75
- isOpen: d,
76
- open: S,
74
+ getItem: a,
75
+ isOpen: l,
76
+ open: b,
77
77
  close: F,
78
- identify: k,
79
- accentColor: t.accentColor ?? N,
80
- theme: t.theme ?? "auto",
81
- showBranding: l
78
+ identify: S,
79
+ accentColor: n.accentColor ?? N,
80
+ theme: n.theme ?? "auto",
81
+ showBranding: u
82
82
  },
83
- children: n
83
+ children: i
84
84
  }
85
85
  );
86
86
  }
87
- function C() {
88
- const n = P(I);
89
- if (!n) throw new Error("useUpstep must be used inside <UpstepProvider>");
90
- return n;
87
+ function B() {
88
+ const i = G(E);
89
+ if (!i) throw new Error("useUpstep must be used inside <UpstepProvider>");
90
+ return i;
91
91
  }
92
- function te({
93
- position: n = "bottom-right",
94
- accentColor: t,
95
- theme: o,
96
- hideLauncher: s = !1
92
+ function oe({
93
+ position: i = "bottom-right",
94
+ accentColor: n,
95
+ theme: t,
96
+ hideLauncher: h = !1
97
97
  }) {
98
- const u = C(), d = t ?? u.accentColor, i = H(o ?? u.theme), { isOpen: l, open: x, close: a, showBranding: y } = u, [c, f] = h("list"), [S, F] = h(null), [k, g] = h("open"), v = n === "bottom-left" ? { position: "fixed", bottom: 24, left: 24 } : { position: "fixed", bottom: 24, right: 24 }, b = '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif';
99
- function p() {
100
- a(), setTimeout(() => {
101
- f("list"), F(null);
98
+ const g = B(), l = n ?? g.accentColor, o = O(t ?? g.theme), { isOpen: u, open: x, close: d, showBranding: y } = g, [c, a] = p("list"), [b, F] = p(null), [S, f] = p(
99
+ () => typeof window < "u" ? window.matchMedia("(max-width: 639px)").matches : !1
100
+ );
101
+ z(() => {
102
+ const k = window.matchMedia("(max-width: 639px)"), C = (P) => f(P.matches);
103
+ return k.addEventListener("change", C), () => k.removeEventListener("change", C);
104
+ }, []);
105
+ const v = i === "bottom-left" ? { position: "fixed", bottom: 24, left: 24 } : { position: "fixed", bottom: 24, right: 24 }, m = '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif';
106
+ function s() {
107
+ d(), setTimeout(() => {
108
+ a("list"), F(null);
102
109
  }, 300);
103
110
  }
104
- function D(m) {
105
- F(m), f("detail");
111
+ function D(k) {
112
+ F(k), a("detail");
106
113
  }
107
- return /* @__PURE__ */ r(W, { children: [
108
- !s && /* @__PURE__ */ r(
114
+ return /* @__PURE__ */ r(I, { children: [
115
+ !h && /* @__PURE__ */ r(
109
116
  "button",
110
117
  {
111
118
  onClick: x,
@@ -115,45 +122,45 @@ function te({
115
122
  display: "inline-flex",
116
123
  alignItems: "center",
117
124
  gap: 7,
118
- background: d,
125
+ background: l,
119
126
  color: "#fff",
120
127
  border: "none",
121
128
  borderRadius: 9999,
122
- padding: "12px 18px",
129
+ padding: S ? "12px" : "12px 18px",
123
130
  fontSize: 14,
124
131
  fontWeight: 600,
125
132
  cursor: "pointer",
126
- fontFamily: b,
133
+ fontFamily: m,
127
134
  boxShadow: "0 6px 20px rgba(26,25,21,.18)"
128
135
  },
129
136
  children: [
130
- /* @__PURE__ */ e(J, { size: 16 }),
131
- " Feedback"
137
+ /* @__PURE__ */ e(X, { size: 16 }),
138
+ !S && "Feedback"
132
139
  ]
133
140
  }
134
141
  ),
135
- l && /* @__PURE__ */ e(
142
+ u && /* @__PURE__ */ e(
136
143
  "div",
137
144
  {
138
- onClick: (m) => m.target === m.currentTarget && p(),
145
+ onClick: (k) => k.target === k.currentTarget && s(),
139
146
  style: {
140
147
  position: "fixed",
141
148
  inset: 0,
142
- background: i.overlay,
149
+ background: o.overlay,
143
150
  backdropFilter: "blur(3px)",
144
151
  zIndex: 9999,
145
152
  display: "flex",
146
153
  alignItems: "center",
147
154
  justifyContent: "center",
148
155
  padding: 16,
149
- fontFamily: b
156
+ fontFamily: m
150
157
  },
151
158
  children: /* @__PURE__ */ r(
152
159
  "div",
153
160
  {
154
161
  style: {
155
- background: i.bg,
156
- border: `1px solid ${i.border}`,
162
+ background: o.bg,
163
+ border: `1px solid ${o.border}`,
157
164
  borderRadius: 20,
158
165
  width: "100%",
159
166
  maxWidth: 440,
@@ -164,75 +171,55 @@ function te({
164
171
  boxShadow: "0 24px 64px rgba(0,0,0,.28)"
165
172
  },
166
173
  children: [
167
- /* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "16px 20px", borderBottom: `1px solid ${i.border}`, flexShrink: 0 }, children: [
174
+ /* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "16px 20px", borderBottom: `1px solid ${o.border}`, flexShrink: 0 }, children: [
168
175
  /* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
169
176
  c !== "list" && /* @__PURE__ */ e(
170
177
  "button",
171
178
  {
172
- onClick: () => f("list"),
173
- style: { background: "none", border: "none", cursor: "pointer", color: d, fontSize: 13, fontWeight: 600, padding: 0 },
179
+ onClick: () => a("list"),
180
+ style: { background: "none", border: "none", cursor: "pointer", color: l, fontSize: 13, fontWeight: 600, padding: 0 },
174
181
  children: "← Back"
175
182
  }
176
183
  ),
177
- c === "list" && /* @__PURE__ */ e("span", { style: { fontWeight: 700, fontSize: 16, color: i.text, letterSpacing: "-.01em" }, children: "Feedback" }),
178
- c === "create" && /* @__PURE__ */ e("span", { style: { fontWeight: 700, fontSize: 16, color: i.text, letterSpacing: "-.01em" }, children: "New feedback" })
184
+ c === "list" && /* @__PURE__ */ e("span", { style: { fontWeight: 700, fontSize: 16, color: o.text, letterSpacing: "-.01em" }, children: "Feedback" }),
185
+ c === "create" && /* @__PURE__ */ e("span", { style: { fontWeight: 700, fontSize: 16, color: o.text, letterSpacing: "-.01em" }, children: "New feedback" })
179
186
  ] }),
180
187
  /* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
181
188
  c === "list" && /* @__PURE__ */ e(
182
189
  "button",
183
190
  {
184
- onClick: () => f("create"),
185
- style: { background: d, color: "#fff", border: "none", borderRadius: 20, padding: "6px 14px", fontSize: 13, fontWeight: 700, cursor: "pointer" },
191
+ onClick: () => a("create"),
192
+ style: { background: l, color: "#fff", border: "none", borderRadius: 20, padding: "6px 14px", fontSize: 13, fontWeight: 700, cursor: "pointer" },
186
193
  children: "+ New"
187
194
  }
188
195
  ),
189
196
  /* @__PURE__ */ e(
190
197
  "button",
191
198
  {
192
- onClick: p,
193
- style: { background: i.bgSoft, border: "none", width: 28, height: 28, borderRadius: 8, fontSize: 14, cursor: "pointer", color: i.textSoft, display: "flex", alignItems: "center", justifyContent: "center" },
199
+ onClick: s,
200
+ style: { background: o.bgSoft, border: "none", width: 28, height: 28, borderRadius: 8, fontSize: 14, cursor: "pointer", color: o.textSoft, display: "flex", alignItems: "center", justifyContent: "center" },
194
201
  children: "✕"
195
202
  }
196
203
  )
197
204
  ] })
198
205
  ] }),
199
- c === "list" && /* @__PURE__ */ e("div", { style: { display: "flex", borderBottom: `1px solid ${i.border}`, flexShrink: 0 }, children: ["open", "done"].map((m) => /* @__PURE__ */ e(
200
- "button",
201
- {
202
- onClick: () => g(m),
203
- style: {
204
- flex: 1,
205
- padding: "10px 0",
206
- border: "none",
207
- background: "none",
208
- cursor: "pointer",
209
- fontSize: 13,
210
- fontWeight: 600,
211
- color: k === m ? d : i.textFaint,
212
- borderBottom: `2px solid ${k === m ? d : "transparent"}`
213
- },
214
- children: m === "open" ? "Open" : "Completed"
215
- },
216
- m
217
- )) }),
218
206
  /* @__PURE__ */ r("div", { style: { flex: 1, overflowY: "auto", padding: "16px 20px 24px" }, children: [
219
207
  c === "list" && /* @__PURE__ */ e(
220
- O,
208
+ V,
221
209
  {
222
- tab: k,
223
210
  onSelect: D,
224
- accent: d,
225
- p: i
211
+ accent: l,
212
+ p: o
226
213
  }
227
214
  ),
228
- c === "detail" && S && /* @__PURE__ */ e(j, { feedbackId: S, accent: d, p: i, font: b }),
215
+ c === "detail" && b && /* @__PURE__ */ e(_, { feedbackId: b, accent: l, p: o, font: m }),
229
216
  c === "create" && /* @__PURE__ */ e(
230
- _,
217
+ q,
231
218
  {
232
- accent: d,
233
- p: i,
234
- font: b,
235
- onDone: () => f("list")
219
+ accent: l,
220
+ p: o,
221
+ font: m,
222
+ onDone: () => a("list")
236
223
  }
237
224
  )
238
225
  ] }),
@@ -246,9 +233,9 @@ function te({
246
233
  display: "block",
247
234
  textAlign: "center",
248
235
  padding: "8px 0",
249
- borderTop: `1px solid ${i.border}`,
236
+ borderTop: `1px solid ${o.border}`,
250
237
  fontSize: 11,
251
- color: i.textFaint,
238
+ color: o.textFaint,
252
239
  textDecoration: "none",
253
240
  flexShrink: 0
254
241
  },
@@ -265,35 +252,34 @@ function te({
265
252
  )
266
253
  ] });
267
254
  }
268
- function O({
269
- tab: n,
270
- onSelect: t,
271
- accent: o,
272
- p: s
255
+ function V({
256
+ onSelect: i,
257
+ accent: n,
258
+ p: t
273
259
  }) {
274
- const { feedItems: u, vote: d } = C(), i = n === "done" ? u.filter((l) => l.status === "DONE") : u.filter((l) => l.status !== "DONE" && l.status !== "CLOSED");
275
- return i.length ? /* @__PURE__ */ e(W, { children: i.map((l) => {
276
- const x = l.userVote === "UP", a = l.title ?? l.content;
260
+ const { feedItems: h, vote: g } = B(), l = h.filter((o) => o.status !== "CLOSED");
261
+ return l.length ? /* @__PURE__ */ e(I, { children: l.map((o) => {
262
+ const u = o.userVote === "UP", x = o.title ?? o.content;
277
263
  return /* @__PURE__ */ r(
278
264
  "div",
279
265
  {
280
- onClick: () => t(l.id),
266
+ onClick: () => i(o.id),
281
267
  style: {
282
268
  display: "flex",
283
269
  gap: 12,
284
270
  padding: 14,
285
- border: `1px solid ${s.border}`,
271
+ border: `1px solid ${t.border}`,
286
272
  borderRadius: 14,
287
273
  marginBottom: 10,
288
- background: s.bg,
274
+ background: t.bg,
289
275
  cursor: "pointer"
290
276
  },
291
277
  children: [
292
278
  /* @__PURE__ */ r(
293
279
  "button",
294
280
  {
295
- onClick: (y) => {
296
- y.stopPropagation(), d(l.id, "UP");
281
+ onClick: (d) => {
282
+ d.stopPropagation(), g(o.id, "UP");
297
283
  },
298
284
  style: {
299
285
  display: "flex",
@@ -306,67 +292,67 @@ function O({
306
292
  borderRadius: 11,
307
293
  cursor: "pointer",
308
294
  flexShrink: 0,
309
- border: `1px solid ${x ? o : s.border}`,
310
- background: x ? `${o}1a` : s.bgSoft
295
+ border: `1px solid ${u ? n : t.border}`,
296
+ background: u ? `${n}1a` : t.bgSoft
311
297
  },
312
298
  children: [
313
- /* @__PURE__ */ e(R, { color: o }),
314
- /* @__PURE__ */ e("span", { style: { fontSize: 14, fontWeight: 700, color: s.text, lineHeight: 1.1 }, children: l.upvotes })
299
+ /* @__PURE__ */ e(R, { color: n }),
300
+ /* @__PURE__ */ e("span", { style: { fontSize: 14, fontWeight: 700, color: t.text, lineHeight: 1.1 }, children: o.upvotes })
315
301
  ]
316
302
  }
317
303
  ),
318
304
  /* @__PURE__ */ r("div", { style: { flex: 1, minWidth: 0 }, children: [
319
- /* @__PURE__ */ e("p", { style: { fontSize: 13.5, fontWeight: 600, lineHeight: 1.4, color: s.text, margin: "0 0 6px", overflow: "hidden", display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical" }, children: a }),
305
+ /* @__PURE__ */ e("p", { style: { fontSize: 13.5, fontWeight: 600, lineHeight: 1.4, color: t.text, margin: "0 0 6px", overflow: "hidden", display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical" }, children: x }),
320
306
  /* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
321
- /* @__PURE__ */ e(T, { type: l.type, p: s }),
322
- l.status === "PENDING" ? /* @__PURE__ */ e(E, {}) : /* @__PURE__ */ e(U, { status: l.status, p: s }),
323
- /* @__PURE__ */ e("span", { style: { fontSize: 11, color: s.textFaint }, children: L(l.createdAt) })
307
+ /* @__PURE__ */ e(T, { type: o.type, p: t }),
308
+ o.status === "PENDING" ? /* @__PURE__ */ e(L, {}) : /* @__PURE__ */ e(U, { status: o.status, p: t }),
309
+ /* @__PURE__ */ e("span", { style: { fontSize: 11, color: t.textFaint }, children: M(o.createdAt) })
324
310
  ] })
325
311
  ] }),
326
- /* @__PURE__ */ e("span", { style: { color: s.textFaint, fontSize: 18, alignSelf: "center", flexShrink: 0 }, children: "›" })
312
+ /* @__PURE__ */ e("span", { style: { color: t.textFaint, fontSize: 18, alignSelf: "center", flexShrink: 0 }, children: "›" })
327
313
  ]
328
314
  },
329
- l.id
315
+ o.id
330
316
  );
331
317
  }) }) : /* @__PURE__ */ r("div", { style: { textAlign: "center", padding: "40px 0" }, children: [
332
- /* @__PURE__ */ e("div", { style: { color: s.textSoft, fontSize: 15, fontWeight: 600, marginBottom: 4 }, children: n === "done" ? "Nothing completed yet" : "No open feedback yet" }),
333
- /* @__PURE__ */ e("div", { style: { color: s.textFaint, fontSize: 14 }, children: n === "done" ? "Shipped items will appear here." : "Be the first to share one." })
318
+ /* @__PURE__ */ e("div", { style: { color: t.textSoft, fontSize: 15, fontWeight: 600, marginBottom: 4 }, children: "No open feedback yet" }),
319
+ /* @__PURE__ */ e("div", { style: { color: t.textFaint, fontSize: 14 }, children: "Be the first to share one." })
334
320
  ] });
335
321
  }
336
- function j({ feedbackId: n, accent: t, p: o, font: s }) {
337
- const { vote: u, getItem: d } = C(), [i, l] = h(null), [x, a] = h(!1);
338
- B(() => {
339
- let f = !1;
340
- return d(n).then((S) => {
341
- f || l(S);
322
+ function _({ feedbackId: i, accent: n, p: t, font: h }) {
323
+ const { vote: g, getItem: l } = B(), [o, u] = p(null), [x, d] = p(!1);
324
+ z(() => {
325
+ let a = !1;
326
+ return l(i).then((b) => {
327
+ a || u(b);
342
328
  }).catch(() => {
343
329
  }), () => {
344
- f = !0;
330
+ a = !0;
345
331
  };
346
- }, [n, d]);
332
+ }, [i, l]);
347
333
  async function y() {
348
- if (!(!i || x)) {
349
- a(!0);
334
+ if (!(!o || x)) {
335
+ d(!0);
350
336
  try {
351
- await u(i.id, "UP");
352
- const f = await d(n);
353
- l(f);
337
+ await g(o.id, "UP");
338
+ const a = await l(i);
339
+ u(a);
354
340
  } catch {
355
341
  } finally {
356
- a(!1);
342
+ d(!1);
357
343
  }
358
344
  }
359
345
  }
360
- if (!i)
361
- return /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: "40px 0", color: o.textFaint, fontSize: 14 }, children: "Loading…" });
362
- const c = i.title;
346
+ if (!o)
347
+ return /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: "40px 0", color: t.textFaint, fontSize: 14 }, children: "Loading…" });
348
+ const c = o.title;
363
349
  return /* @__PURE__ */ r("div", { children: [
364
- c && /* @__PURE__ */ e("div", { style: { fontSize: 20, fontWeight: 700, color: o.text, letterSpacing: "-.02em", marginBottom: 10, lineHeight: 1.3 }, children: c }),
350
+ c && /* @__PURE__ */ e("div", { style: { fontSize: 20, fontWeight: 700, color: t.text, letterSpacing: "-.02em", marginBottom: 10, lineHeight: 1.3 }, children: c }),
365
351
  /* @__PURE__ */ r("div", { style: { display: "flex", gap: 6, marginBottom: 14, flexWrap: "wrap" }, children: [
366
- /* @__PURE__ */ e(T, { type: i.type, p: o }),
367
- i.status === "PENDING" ? /* @__PURE__ */ e(E, {}) : /* @__PURE__ */ e(U, { status: i.status, p: o })
352
+ /* @__PURE__ */ e(T, { type: o.type, p: t }),
353
+ o.status === "PENDING" ? /* @__PURE__ */ e(L, {}) : /* @__PURE__ */ e(U, { status: o.status, p: t })
368
354
  ] }),
369
- /* @__PURE__ */ e("p", { style: { fontSize: 15, lineHeight: 1.6, color: o.textSoft, marginBottom: 20 }, children: i.content }),
355
+ /* @__PURE__ */ e("p", { style: { fontSize: 15, lineHeight: 1.6, color: t.textSoft, marginBottom: 20 }, children: o.content }),
370
356
  /* @__PURE__ */ r(
371
357
  "button",
372
358
  {
@@ -376,73 +362,73 @@ function j({ feedbackId: n, accent: t, p: o, font: s }) {
376
362
  display: "inline-flex",
377
363
  alignItems: "center",
378
364
  gap: 8,
379
- border: `1px solid ${i.userVote === "UP" ? t : o.border}`,
380
- background: i.userVote === "UP" ? `${t}15` : o.bgSoft,
365
+ border: `1px solid ${o.userVote === "UP" ? n : t.border}`,
366
+ background: o.userVote === "UP" ? `${n}15` : t.bgSoft,
381
367
  borderRadius: 12,
382
368
  padding: "10px 16px",
383
369
  cursor: "pointer",
384
- fontFamily: s
370
+ fontFamily: h
385
371
  },
386
372
  children: [
387
- /* @__PURE__ */ e(R, { color: t, size: 13 }),
388
- /* @__PURE__ */ e("span", { style: { fontSize: 18, fontWeight: 700, color: o.text }, children: i.upvotes }),
389
- /* @__PURE__ */ e("span", { style: { fontSize: 13, color: o.textFaint }, children: i.userVote === "UP" ? "Upvoted" : "Upvote" })
373
+ /* @__PURE__ */ e(R, { color: n, size: 13 }),
374
+ /* @__PURE__ */ e("span", { style: { fontSize: 18, fontWeight: 700, color: t.text }, children: o.upvotes }),
375
+ /* @__PURE__ */ e("span", { style: { fontSize: 13, color: t.textFaint }, children: o.userVote === "UP" ? "Upvoted" : "Upvote" })
390
376
  ]
391
377
  }
392
378
  ),
393
- i.comments.length > 0 && /* @__PURE__ */ r("div", { style: { marginTop: 28, borderTop: `1px solid ${o.border}`, paddingTop: 20 }, children: [
394
- /* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: o.textFaint, marginBottom: 12, textTransform: "uppercase" }, children: "Developer response" }),
395
- i.comments.map((f) => /* @__PURE__ */ e(V, { comment: f, p: o, accent: t }, f.id))
379
+ o.comments.length > 0 && /* @__PURE__ */ r("div", { style: { marginTop: 28, borderTop: `1px solid ${t.border}`, paddingTop: 20 }, children: [
380
+ /* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: t.textFaint, marginBottom: 12, textTransform: "uppercase" }, children: "Developer response" }),
381
+ o.comments.map((a) => /* @__PURE__ */ e(Y, { comment: a, p: t, accent: n }, a.id))
396
382
  ] })
397
383
  ] });
398
384
  }
399
- function V({ comment: n, p: t, accent: o }) {
400
- return /* @__PURE__ */ r("div", { style: { background: t.bgSoft, border: `1px solid ${t.border}`, borderRadius: 12, padding: 14, marginBottom: 10 }, children: [
385
+ function Y({ comment: i, p: n, accent: t }) {
386
+ return /* @__PURE__ */ r("div", { style: { background: n.bgSoft, border: `1px solid ${n.border}`, borderRadius: 12, padding: 14, marginBottom: 10 }, children: [
401
387
  /* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 8 }, children: [
402
- /* @__PURE__ */ e("span", { style: { background: `${o}20`, color: o, fontSize: 11, fontWeight: 700, borderRadius: 20, padding: "2px 8px" }, children: "Developer" }),
403
- /* @__PURE__ */ e("span", { style: { fontSize: 11, color: t.textFaint }, children: L(n.createdAt) })
388
+ /* @__PURE__ */ e("span", { style: { background: `${t}20`, color: t, fontSize: 11, fontWeight: 700, borderRadius: 20, padding: "2px 8px" }, children: "Developer" }),
389
+ /* @__PURE__ */ e("span", { style: { fontSize: 11, color: n.textFaint }, children: M(i.createdAt) })
404
390
  ] }),
405
- /* @__PURE__ */ e("p", { style: { fontSize: 14, lineHeight: 1.5, color: t.textSoft, margin: 0 }, children: n.content })
391
+ /* @__PURE__ */ e("p", { style: { fontSize: 14, lineHeight: 1.5, color: n.textSoft, margin: 0 }, children: i.content })
406
392
  ] });
407
393
  }
408
- function _({ accent: n, p: t, font: o, onDone: s }) {
409
- const { submit: u } = C(), [d, i] = h(""), [l, x] = h(""), [a, y] = h("GENERAL"), [c, f] = h(!1), [S, F] = h(!1), [k, g] = h("");
394
+ function q({ accent: i, p: n, font: t, onDone: h }) {
395
+ const { submit: g } = B(), [l, o] = p(""), [u, x] = p(""), [d, y] = p("GENERAL"), [c, a] = p(!1), [b, F] = p(!1), [S, f] = p("");
410
396
  async function v() {
411
- if (!(!d.trim() || c)) {
412
- f(!0), g("");
397
+ if (!(!l.trim() || c)) {
398
+ a(!0), f("");
413
399
  try {
414
- await u(d.trim(), l.trim() || d.trim(), a), F(!0), setTimeout(s, 1200);
400
+ await g(l.trim(), u.trim() || l.trim(), d), F(!0), setTimeout(h, 1200);
415
401
  } catch {
416
- g("Something went wrong. Please try again.");
402
+ f("Something went wrong. Please try again.");
417
403
  } finally {
418
- f(!1);
404
+ a(!1);
419
405
  }
420
406
  }
421
407
  }
422
- if (S)
408
+ if (b)
423
409
  return /* @__PURE__ */ r("div", { style: { textAlign: "center", paddingTop: 40 }, children: [
424
- /* @__PURE__ */ e("div", { style: { fontSize: 18, fontWeight: 700, color: t.text, marginBottom: 6 }, children: "Submitted" }),
425
- /* @__PURE__ */ e("div", { style: { fontSize: 14, color: t.textFaint }, children: "Feedback received. Thank you." })
410
+ /* @__PURE__ */ e("div", { style: { fontSize: 18, fontWeight: 700, color: n.text, marginBottom: 6 }, children: "Submitted" }),
411
+ /* @__PURE__ */ e("div", { style: { fontSize: 14, color: n.textFaint }, children: "Feedback received. Thank you." })
426
412
  ] });
427
- const b = {
413
+ const m = {
428
414
  width: "100%",
429
- border: `1px solid ${t.border}`,
415
+ border: `1px solid ${n.border}`,
430
416
  borderRadius: 12,
431
417
  padding: "10px 12px",
432
418
  fontSize: 14,
433
419
  lineHeight: 1.5,
434
420
  outline: "none",
435
- background: t.bgSoft,
436
- color: t.text,
437
- fontFamily: o,
421
+ background: n.bgSoft,
422
+ color: n.text,
423
+ fontFamily: t,
438
424
  boxSizing: "border-box"
439
425
  };
440
426
  return /* @__PURE__ */ r("div", { children: [
441
- /* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: t.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: "Type" }),
442
- /* @__PURE__ */ e("div", { style: { display: "flex", gap: 7, marginBottom: 16 }, children: ["BUG", "FEATURE", "GENERAL"].map((p) => /* @__PURE__ */ r(
427
+ /* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: n.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: "Type" }),
428
+ /* @__PURE__ */ e("div", { style: { display: "flex", gap: 7, marginBottom: 16 }, children: ["BUG", "FEATURE", "GENERAL"].map((s) => /* @__PURE__ */ r(
443
429
  "button",
444
430
  {
445
- onClick: () => y(p),
431
+ onClick: () => y(s),
446
432
  style: {
447
433
  flex: 1,
448
434
  display: "flex",
@@ -454,69 +440,69 @@ function _({ accent: n, p: t, font: o, onDone: s }) {
454
440
  fontSize: 12.5,
455
441
  fontWeight: 600,
456
442
  cursor: "pointer",
457
- background: a === p ? n : t.bg,
458
- color: a === p ? "#fff" : t.textSoft,
459
- border: `1px solid ${a === p ? n : t.border}`,
460
- fontFamily: o
443
+ background: d === s ? i : n.bg,
444
+ color: d === s ? "#fff" : n.textSoft,
445
+ border: `1px solid ${d === s ? i : n.border}`,
446
+ fontFamily: t
461
447
  },
462
448
  children: [
463
- z[p].icon,
464
- z[p].label
449
+ W[s].icon,
450
+ W[s].label
465
451
  ]
466
452
  },
467
- p
453
+ s
468
454
  )) }),
469
- /* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: t.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: "Title" }),
455
+ /* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: n.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: "Title" }),
470
456
  /* @__PURE__ */ e(
471
457
  "input",
472
458
  {
473
- value: d,
474
- onChange: (p) => i(p.target.value),
459
+ value: l,
460
+ onChange: (s) => o(s.target.value),
475
461
  placeholder: "Short summary of the issue or idea",
476
462
  maxLength: 200,
477
- style: { ...b, marginBottom: 16, display: "block" }
463
+ style: { ...m, marginBottom: 16, display: "block" }
478
464
  }
479
465
  ),
480
- /* @__PURE__ */ r("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: t.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: [
466
+ /* @__PURE__ */ r("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: n.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: [
481
467
  "Description ",
482
468
  /* @__PURE__ */ e("span", { style: { fontWeight: 400, textTransform: "none", letterSpacing: 0 }, children: "(optional)" })
483
469
  ] }),
484
470
  /* @__PURE__ */ e(
485
471
  "textarea",
486
472
  {
487
- value: l,
488
- onChange: (p) => x(p.target.value),
473
+ value: u,
474
+ onChange: (s) => x(s.target.value),
489
475
  placeholder: "Steps to reproduce, expected behaviour, or more context",
490
476
  maxLength: 2e3,
491
477
  rows: 4,
492
- style: { ...b, resize: "vertical", marginBottom: 16 }
478
+ style: { ...m, resize: "vertical", marginBottom: 16 }
493
479
  }
494
480
  ),
495
- k && /* @__PURE__ */ e("p", { style: { fontSize: 13, color: "#d6453d", marginBottom: 12 }, children: k }),
481
+ S && /* @__PURE__ */ e("p", { style: { fontSize: 13, color: "#d6453d", marginBottom: 12 }, children: S }),
496
482
  /* @__PURE__ */ e(
497
483
  "button",
498
484
  {
499
485
  onClick: v,
500
- disabled: c || !d.trim(),
486
+ disabled: c || !l.trim(),
501
487
  style: {
502
488
  width: "100%",
503
489
  padding: 12,
504
- background: n,
490
+ background: i,
505
491
  color: "#fff",
506
492
  border: "none",
507
493
  borderRadius: 11,
508
494
  fontSize: 14,
509
495
  fontWeight: 600,
510
496
  cursor: "pointer",
511
- opacity: c || !d.trim() ? 0.5 : 1,
512
- fontFamily: o
497
+ opacity: c || !l.trim() ? 0.5 : 1,
498
+ fontFamily: t
513
499
  },
514
500
  children: c ? "Submitting…" : "Submit feedback"
515
501
  }
516
502
  )
517
503
  ] });
518
504
  }
519
- const z = {
505
+ const W = {
520
506
  BUG: {
521
507
  label: "Bug",
522
508
  icon: /* @__PURE__ */ r("svg", { width: 12, height: 12, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", children: [
@@ -535,48 +521,48 @@ const z = {
535
521
  label: "General",
536
522
  icon: /* @__PURE__ */ e("svg", { width: 12, height: 12, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M14 9a2 2 0 0 1-2 2H5L2 14V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5z" }) })
537
523
  }
538
- }, Y = { BUG: "#fdecec", FEATURE: "#e9f0fd" }, q = { BUG: "#d6453d", FEATURE: "#3b76d6" };
539
- function T({ type: n, p: t }) {
524
+ }, K = { BUG: "#fdecec", FEATURE: "#e9f0fd" }, J = { BUG: "#d6453d", FEATURE: "#3b76d6" };
525
+ function T({ type: i, p: n }) {
540
526
  return /* @__PURE__ */ e("span", { style: {
541
527
  padding: "2px 8px",
542
528
  borderRadius: 9999,
543
529
  fontSize: 10.5,
544
530
  fontWeight: 700,
545
531
  letterSpacing: ".02em",
546
- background: Y[n] ?? t.bgSoft,
547
- color: q[n] ?? t.textSoft
548
- }, children: n });
532
+ background: K[i] ?? n.bgSoft,
533
+ color: J[i] ?? n.textSoft
534
+ }, children: i });
549
535
  }
550
- const K = {
536
+ const Q = {
551
537
  OPEN: "#b45309",
552
538
  IN_PROGRESS: "#1d4ed8",
553
539
  DONE: "#15803d",
554
540
  CLOSED: "#6b7280"
555
541
  };
556
- function E() {
542
+ function L() {
557
543
  return /* @__PURE__ */ r("span", { style: { display: "inline-flex", alignItems: "center", gap: 4, background: "#fff7ed", border: "1px solid #fed7aa", borderRadius: 6, padding: "1px 6px", fontSize: 10, fontWeight: 700, color: "#ea580c" }, children: [
558
544
  /* @__PURE__ */ e("span", { style: { width: 5, height: 5, borderRadius: "50%", background: "#ea580c", display: "inline-block" } }),
559
545
  "Pending review"
560
546
  ] });
561
547
  }
562
- function U({ status: n, p: t }) {
563
- const o = K[n] ?? "#9ca3af";
564
- return /* @__PURE__ */ r("span", { style: { display: "inline-flex", alignItems: "center", gap: 5, background: t.bgSoft, border: `1px solid ${t.border}`, borderRadius: 6, padding: "2px 8px", fontSize: 10, fontWeight: 600, color: t.textSoft }, children: [
565
- /* @__PURE__ */ e("span", { style: { width: 6, height: 6, borderRadius: "50%", background: o, display: "inline-block", flexShrink: 0 } }),
566
- n.replace("_", " ")
548
+ function U({ status: i, p: n }) {
549
+ const t = Q[i] ?? "#9ca3af";
550
+ return /* @__PURE__ */ r("span", { style: { display: "inline-flex", alignItems: "center", gap: 5, background: n.bgSoft, border: `1px solid ${n.border}`, borderRadius: 6, padding: "2px 8px", fontSize: 10, fontWeight: 600, color: n.textSoft }, children: [
551
+ /* @__PURE__ */ e("span", { style: { width: 6, height: 6, borderRadius: "50%", background: t, display: "inline-block", flexShrink: 0 } }),
552
+ i.replace("_", " ")
567
553
  ] });
568
554
  }
569
- function J({ size: n = 16, color: t = "currentColor" }) {
570
- return /* @__PURE__ */ e("svg", { width: n, height: n, viewBox: "0 0 24 24", fill: "none", stroke: t, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
555
+ function X({ size: i = 16, color: n = "currentColor" }) {
556
+ return /* @__PURE__ */ e("svg", { width: i, height: i, viewBox: "0 0 24 24", fill: "none", stroke: n, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
571
557
  }
572
- function R({ color: n = "currentColor", size: t = 11 }) {
573
- return /* @__PURE__ */ e("svg", { width: t, height: t, viewBox: "0 0 16 16", fill: "none", stroke: n, strokeWidth: 2.2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M8 13V3M3 8l5-5 5 5" }) });
558
+ function R({ color: i = "currentColor", size: n = 11 }) {
559
+ return /* @__PURE__ */ e("svg", { width: n, height: n, viewBox: "0 0 16 16", fill: "none", stroke: i, strokeWidth: 2.2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M8 13V3M3 8l5-5 5 5" }) });
574
560
  }
575
- function L(n) {
576
- return new Date(n).toLocaleDateString(void 0, { month: "short", day: "numeric" });
561
+ function M(i) {
562
+ return new Date(i).toLocaleDateString(void 0, { month: "short", day: "numeric" });
577
563
  }
578
564
  export {
579
- te as FeedbackWidget,
580
- ee as UpstepProvider,
581
- C as useUpstep
565
+ oe as FeedbackWidget,
566
+ ne as UpstepProvider,
567
+ B as useUpstep
582
568
  };
@@ -1 +1 @@
1
- {"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAIxC,KAAK,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAsG3C,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,yEAAyE;IACzE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,GAAG,CAAiB;IAC5B,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,OAAO,CAAU;gBAEb,MAAM,EAAE,eAAe,EAAE,OAAO,GAAE,aAAkB;IAQhE,KAAK;IAKL,4EAA4E;IAC5E,UAAU;IAIV,iDAAiD;IACjD,WAAW;IAIX,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,UAAU;YAKJ,SAAS;IAUvB,OAAO,CAAC,WAAW;IAyCnB,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,UAAU;IAwBlB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,cAAc;IAyCtB,OAAO,CAAC,eAAe;CAaxB"}
1
+ {"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAIxC,KAAK,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAuG3C,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,yEAAyE;IACzE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,GAAG,CAAiB;IAC5B,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,OAAO,CAAU;gBAEb,MAAM,EAAE,eAAe,EAAE,OAAO,GAAE,aAAkB;IAQhE,KAAK;IAKL,4EAA4E;IAC5E,UAAU;IAIV,iDAAiD;IACjD,WAAW;IAIX,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,UAAU;YAKJ,SAAS;IAUvB,OAAO,CAAC,WAAW;IAyCnB,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,UAAU;IAwBlB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,cAAc;IAyCtB,OAAO,CAAC,eAAe;CAaxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upstep/js",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "Upstep feedback widget for web apps",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "dist"
22
22
  ],
23
23
  "dependencies": {
24
- "@upstep/types": "0.5.2"
24
+ "@upstep/types": "0.5.3"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": ">=18",