@upstep/js 0.5.1 → 0.5.2
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/react.cjs +1 -1
- package/dist/react.d.ts +1 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +203 -180
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),I=require("./api-Bzvimzou.js"),T="#D97757",R={bg:"#ffffff",bgSoft:"#f6f5f2",bgHover:"#efede8",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},U={bg:"#1c1b19",bgSoft:"#262522",bgHover:"#302e2a",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function L(o){const[t,n]=s.useState(()=>o==="dark"?!0:o==="light"?!1:typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1);return s.useEffect(()=>{if(o!=="auto"||typeof window>"u"||!window.matchMedia){n(o==="dark");return}const a=window.matchMedia("(prefers-color-scheme: dark)"),x=l=>n(l.matches);return n(a.matches),a.addEventListener("change",x),()=>a.removeEventListener("change",x)},[o]),t?U:R}const C=s.createContext(null);function D({children:o,...t}){const[n]=s.useState(()=>new I.UpstepApiClient(t)),[a,x]=s.useState([]),[l,i]=s.useState(!1);s.useEffect(()=>{n.setUserId(t.userId)},[n,t.userId]);const r=s.useCallback(async()=>{const c=await n.listFeedback({sort:"votes",limit:20});x(c.items)},[n]);s.useEffect(()=>{r()},[r]);const h=s.useCallback(async(c,S,j)=>{const b={content:S};c.trim()&&(b.title=c.trim()),j!==void 0&&(b.type=j),await n.submitFeedback(b),await r()},[n,r]),p=s.useCallback(async(c,S)=>{await n.vote(c,S),await r()},[n,r]),d=s.useCallback(c=>n.getItem(c),[n]),u=s.useCallback(()=>i(!0),[]),f=s.useCallback(()=>i(!1),[]),y=s.useCallback(c=>n.setUserId(c),[n]);return e.jsx(C.Provider,{value:{client:n,feedItems:a,loadFeed:r,submit:h,vote:p,getItem:d,isOpen:l,open:u,close:f,identify:y,accentColor:t.accentColor??T,theme:t.theme??"auto"},children:o})}function k(){const o=s.useContext(C);if(!o)throw new Error("useUpstep must be used inside <UpstepProvider>");return o}function M({position:o="bottom-right",accentColor:t,theme:n,hideLauncher:a=!1}){const x=k(),l=t??x.accentColor,i=L(n??x.theme),{isOpen:r,open:h,close:p}=x,[d,u]=s.useState("list"),[f,y]=s.useState(null),[c,S]=s.useState("open"),j=o==="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';function v(){p(),setTimeout(()=>{u("list"),y(null)},300)}function g(m){y(m),u("detail")}return e.jsxs(e.Fragment,{children:[!a&&e.jsxs("button",{onClick:h,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:b,boxShadow:"0 6px 20px rgba(26,25,21,.18)"},children:[e.jsx(V,{size:16})," Feedback"]}),r&&e.jsx("div",{onClick:m=>m.target===m.currentTarget&&v(),style:{position:"fixed",inset:0,background:i.overlay,backdropFilter:"blur(3px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",padding:16,fontFamily:b},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:[d!=="list"&&e.jsx("button",{onClick:()=>u("list"),style:{background:"none",border:"none",cursor:"pointer",color:l,fontSize:13,fontWeight:600,padding:0},children:"← Back"}),d==="list"&&e.jsx("span",{style:{fontWeight:700,fontSize:16,color:i.text,letterSpacing:"-.01em"},children:"Feedback"}),d==="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:[d==="list"&&e.jsx("button",{onClick:()=>u("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:v,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:"✕"})]})]}),d==="list"&&e.jsx("div",{style:{display:"flex",borderBottom:`1px solid ${i.border}`,flexShrink:0},children:["open","done"].map(m=>e.jsx("button",{onClick:()=>S(m),style:{flex:1,padding:"10px 0",border:"none",background:"none",cursor:"pointer",fontSize:13,fontWeight:600,color:c===m?l:i.textFaint,borderBottom:`2px solid ${c===m?l:"transparent"}`},children:m==="open"?"Open":"Completed"},m))}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px 24px"},children:[d==="list"&&e.jsx(P,{tab:c,onSelect:g,accent:l,p:i}),d==="detail"&&f&&e.jsx(A,{feedbackId:f,accent:l,p:i,font:b}),d==="create"&&e.jsx(O,{accent:l,p:i,font:b,onDone:()=>u("list")})]})]})})]})}function P({tab:o,onSelect:t,accent:n,p:a}){const{feedItems:x}=k(),{vote:l}=k(),i=o==="done"?x.filter(r=>r.status==="DONE"):x.filter(r=>r.status!=="DONE"&&r.status!=="CLOSED");return i.length?e.jsx(e.Fragment,{children:i.map(r=>{const h=r.userVote==="UP",p=r.title??r.content;return e.jsxs("div",{onClick:()=>t(r.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:d=>{d.stopPropagation(),l(r.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 ${h?n:a.border}`,background:h?`${n}1a`:a.bgSoft},children:[e.jsx(B,{color:n}),e.jsx("span",{style:{fontSize:14,fontWeight:700,color:a.text,lineHeight:1.1},children:r.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:p}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[e.jsx(F,{type:r.type,p:a}),r.status==="PENDING"?e.jsx(z,{}):e.jsx(W,{status:r.status,p:a}),e.jsx("span",{style:{fontSize:11,color:a.textFaint},children:E(r.createdAt)})]})]}),e.jsx("span",{style:{color:a.textFaint,fontSize:18,alignSelf:"center",flexShrink:0},children:"›"})]},r.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 A({feedbackId:o,accent:t,p:n,font:a}){const{vote:x,getItem:l}=k(),[i,r]=s.useState(null),[h,p]=s.useState(!1);s.useEffect(()=>{let f=!1;return l(o).then(y=>{f||r(y)}).catch(()=>{}),()=>{f=!0}},[o,l]);async function d(){if(!(!i||h)){p(!0);try{await x(i.id,"UP");const f=await l(o);r(f)}finally{p(!1)}}}if(!i)return e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:n.textFaint,fontSize:14},children:"Loading…"});const u=i.title;return e.jsxs("div",{children:[u&&e.jsx("div",{style:{fontSize:20,fontWeight:700,color:n.text,letterSpacing:"-.02em",marginBottom:10,lineHeight:1.3},children:u}),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(z,{}):e.jsx(W,{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:d,disabled:h,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(B,{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(f=>e.jsx(N,{comment:f,p:n,accent:t},f.id))]})]})}function N({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:x}=k(),[l,i]=s.useState(""),[r,h]=s.useState(""),[p,d]=s.useState("GENERAL"),[u,f]=s.useState(!1),[y,c]=s.useState(!1),[S,j]=s.useState("");async function b(){if(!(!l.trim()||u)){f(!0),j("");try{await x(l.trim(),r.trim()||l.trim(),p),c(!0),setTimeout(a,1200)}catch{j("Something went wrong. Please try again.")}finally{f(!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 v={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(g=>e.jsxs("button",{onClick:()=>d(g),style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:"8px 10px",borderRadius:9,fontSize:12.5,fontWeight:600,cursor:"pointer",background:p===g?o:t.bg,color:p===g?"#fff":t.textSoft,border:`1px solid ${p===g?o:t.border}`,fontFamily:n},children:[w[g].icon,w[g].label]},g))}),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:g=>i(g.target.value),placeholder:"Short summary of the issue or idea",maxLength:200,style:{...v,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:r,onChange:g=>h(g.target.value),placeholder:"Steps to reproduce, expected behaviour, or more context",maxLength:2e3,rows:4,style:{...v,resize:"vertical",marginBottom:16}}),S&&e.jsx("p",{style:{fontSize:13,color:"#d6453d",marginBottom:12},children:S}),e.jsx("button",{onClick:b,disabled:u||!l.trim(),style:{width:"100%",padding:12,background:o,color:"#fff",border:"none",borderRadius:11,fontSize:14,fontWeight:600,cursor:"pointer",opacity:u||!l.trim()?.5:1,fontFamily:n},children:u?"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"})})}},$={BUG:"#fdecec",FEATURE:"#e9f0fd"},G={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:$[o]??t.bgSoft,color:G[o]??t.textSoft},children:o})}const H={OPEN:"#b45309",IN_PROGRESS:"#1d4ed8",DONE:"#15803d",CLOSED:"#6b7280"};function z(){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:o,p:t}){const n=H[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 V({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 B({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=M;exports.UpstepProvider=D;exports.useUpstep=k;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),T=require("./api-Bzvimzou.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()=>{const f=await n.listFeedback({sort:"votes",limit:20});p(f.items),g(f.showBranding??!0)},[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)=>{await n.vote(f,j),await d()},[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}=v(),{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)}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;
|
package/dist/react.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ interface UpstepContextValue {
|
|
|
15
15
|
identify: (userId: string | undefined) => void;
|
|
16
16
|
accentColor: string;
|
|
17
17
|
theme: ThemeMode;
|
|
18
|
+
showBranding: boolean;
|
|
18
19
|
}
|
|
19
20
|
export declare function UpstepProvider({ children, ...config }: UpstepConfig & {
|
|
20
21
|
children: ReactNode;
|
package/dist/react.d.ts.map
CHANGED
|
@@ -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;
|
|
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,qBAqDxC;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"}
|
package/dist/react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { U as
|
|
4
|
-
const
|
|
1
|
+
import { jsxs as r, Fragment as W, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as M, useState as u, useEffect as C, useCallback as w, useContext as P } from "react";
|
|
3
|
+
import { U as A } from "./api-CMuwaAet.mjs";
|
|
4
|
+
const N = "#D97757", $ = {
|
|
5
5
|
bg: "#ffffff",
|
|
6
6
|
bgSoft: "#f6f5f2",
|
|
7
7
|
bgHover: "#efede8",
|
|
@@ -10,7 +10,7 @@ const A = "#D97757", N = {
|
|
|
10
10
|
textFaint: "#9b9890",
|
|
11
11
|
border: "#e8e6df",
|
|
12
12
|
overlay: "rgba(26,25,21,.45)"
|
|
13
|
-
},
|
|
13
|
+
}, G = {
|
|
14
14
|
bg: "#1c1b19",
|
|
15
15
|
bgSoft: "#262522",
|
|
16
16
|
bgHover: "#302e2a",
|
|
@@ -20,90 +20,91 @@ const A = "#D97757", N = {
|
|
|
20
20
|
border: "#33312c",
|
|
21
21
|
overlay: "rgba(0,0,0,.6)"
|
|
22
22
|
};
|
|
23
|
-
function
|
|
23
|
+
function H(n) {
|
|
24
24
|
const [t, o] = u(() => n === "dark" ? !0 : n === "light" ? !1 : typeof window < "u" && window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)").matches : !1);
|
|
25
|
-
return
|
|
25
|
+
return C(() => {
|
|
26
26
|
if (n !== "auto" || typeof window > "u" || !window.matchMedia) {
|
|
27
27
|
o(n === "dark");
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const s = window.matchMedia("(prefers-color-scheme: dark)"),
|
|
31
|
-
return o(s.matches), s.addEventListener("change",
|
|
32
|
-
}, [n]), t ?
|
|
30
|
+
const s = window.matchMedia("(prefers-color-scheme: dark)"), h = (d) => o(d.matches);
|
|
31
|
+
return o(s.matches), s.addEventListener("change", h), () => s.removeEventListener("change", h);
|
|
32
|
+
}, [n]), t ? G : $;
|
|
33
33
|
}
|
|
34
|
-
const I =
|
|
35
|
-
function
|
|
34
|
+
const I = M(null);
|
|
35
|
+
function ee({
|
|
36
36
|
children: n,
|
|
37
37
|
...t
|
|
38
38
|
}) {
|
|
39
|
-
const [o] = u(() => new
|
|
40
|
-
|
|
39
|
+
const [o] = u(() => new A(t)), [s, h] = u([]), [d, i] = u(!1), [l, x] = u(!0);
|
|
40
|
+
C(() => {
|
|
41
41
|
o.setUserId(t.userId);
|
|
42
42
|
}, [o, t.userId]);
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
43
|
+
const a = w(async () => {
|
|
44
|
+
const g = await o.listFeedback({ sort: "votes", limit: 20 });
|
|
45
|
+
h(g.items), x(g.showBranding ?? !0);
|
|
46
46
|
}, [o]);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}, [
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
}, [o,
|
|
54
|
-
await o.vote(
|
|
55
|
-
}, [o,
|
|
56
|
-
(
|
|
47
|
+
C(() => {
|
|
48
|
+
a();
|
|
49
|
+
}, [a]);
|
|
50
|
+
const y = w(async (g, v, b) => {
|
|
51
|
+
const p = { content: v };
|
|
52
|
+
g.trim() && (p.title = g.trim()), b !== void 0 && (p.type = b), await o.submitFeedback(p), await a();
|
|
53
|
+
}, [o, a]), c = w(async (g, v) => {
|
|
54
|
+
await o.vote(g, v), await a();
|
|
55
|
+
}, [o, a]), f = w(
|
|
56
|
+
(g) => o.getItem(g),
|
|
57
57
|
[o]
|
|
58
|
-
),
|
|
58
|
+
), S = w(() => i(!0), []), F = w(() => i(!1), []), k = w((g) => o.setUserId(g), [o]);
|
|
59
59
|
return /* @__PURE__ */ e(
|
|
60
60
|
I.Provider,
|
|
61
61
|
{
|
|
62
62
|
value: {
|
|
63
63
|
client: o,
|
|
64
64
|
feedItems: s,
|
|
65
|
-
loadFeed:
|
|
66
|
-
submit:
|
|
67
|
-
vote:
|
|
68
|
-
getItem:
|
|
65
|
+
loadFeed: a,
|
|
66
|
+
submit: y,
|
|
67
|
+
vote: c,
|
|
68
|
+
getItem: f,
|
|
69
69
|
isOpen: d,
|
|
70
|
-
open:
|
|
71
|
-
close:
|
|
72
|
-
identify:
|
|
73
|
-
accentColor: t.accentColor ??
|
|
74
|
-
theme: t.theme ?? "auto"
|
|
70
|
+
open: S,
|
|
71
|
+
close: F,
|
|
72
|
+
identify: k,
|
|
73
|
+
accentColor: t.accentColor ?? N,
|
|
74
|
+
theme: t.theme ?? "auto",
|
|
75
|
+
showBranding: l
|
|
75
76
|
},
|
|
76
77
|
children: n
|
|
77
78
|
}
|
|
78
79
|
);
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
-
const n =
|
|
81
|
+
function B() {
|
|
82
|
+
const n = P(I);
|
|
82
83
|
if (!n) throw new Error("useUpstep must be used inside <UpstepProvider>");
|
|
83
84
|
return n;
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
+
function te({
|
|
86
87
|
position: n = "bottom-right",
|
|
87
88
|
accentColor: t,
|
|
88
89
|
theme: o,
|
|
89
90
|
hideLauncher: s = !1
|
|
90
91
|
}) {
|
|
91
|
-
const
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
const h = B(), d = t ?? h.accentColor, i = H(o ?? h.theme), { isOpen: l, open: x, close: a, showBranding: y } = h, [c, f] = u("list"), [S, F] = u(null), [k, g] = u("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';
|
|
93
|
+
function p() {
|
|
94
|
+
a(), setTimeout(() => {
|
|
95
|
+
f("list"), F(null);
|
|
95
96
|
}, 300);
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
98
|
+
function D(m) {
|
|
99
|
+
F(m), f("detail");
|
|
99
100
|
}
|
|
100
|
-
return /* @__PURE__ */
|
|
101
|
-
!s && /* @__PURE__ */
|
|
101
|
+
return /* @__PURE__ */ r(W, { children: [
|
|
102
|
+
!s && /* @__PURE__ */ r(
|
|
102
103
|
"button",
|
|
103
104
|
{
|
|
104
|
-
onClick:
|
|
105
|
+
onClick: x,
|
|
105
106
|
style: {
|
|
106
|
-
...
|
|
107
|
+
...v,
|
|
107
108
|
zIndex: 9998,
|
|
108
109
|
display: "inline-flex",
|
|
109
110
|
alignItems: "center",
|
|
@@ -116,19 +117,19 @@ function ee({
|
|
|
116
117
|
fontSize: 14,
|
|
117
118
|
fontWeight: 600,
|
|
118
119
|
cursor: "pointer",
|
|
119
|
-
fontFamily:
|
|
120
|
+
fontFamily: b,
|
|
120
121
|
boxShadow: "0 6px 20px rgba(26,25,21,.18)"
|
|
121
122
|
},
|
|
122
123
|
children: [
|
|
123
|
-
/* @__PURE__ */ e(
|
|
124
|
+
/* @__PURE__ */ e(J, { size: 16 }),
|
|
124
125
|
" Feedback"
|
|
125
126
|
]
|
|
126
127
|
}
|
|
127
128
|
),
|
|
128
|
-
|
|
129
|
+
l && /* @__PURE__ */ e(
|
|
129
130
|
"div",
|
|
130
131
|
{
|
|
131
|
-
onClick: (
|
|
132
|
+
onClick: (m) => m.target === m.currentTarget && p(),
|
|
132
133
|
style: {
|
|
133
134
|
position: "fixed",
|
|
134
135
|
inset: 0,
|
|
@@ -139,9 +140,9 @@ function ee({
|
|
|
139
140
|
alignItems: "center",
|
|
140
141
|
justifyContent: "center",
|
|
141
142
|
padding: 16,
|
|
142
|
-
fontFamily:
|
|
143
|
+
fontFamily: b
|
|
143
144
|
},
|
|
144
|
-
children: /* @__PURE__ */
|
|
145
|
+
children: /* @__PURE__ */ r(
|
|
145
146
|
"div",
|
|
146
147
|
{
|
|
147
148
|
style: {
|
|
@@ -157,24 +158,24 @@ function ee({
|
|
|
157
158
|
boxShadow: "0 24px 64px rgba(0,0,0,.28)"
|
|
158
159
|
},
|
|
159
160
|
children: [
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
|
|
161
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "16px 20px", borderBottom: `1px solid ${i.border}`, flexShrink: 0 }, children: [
|
|
162
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
163
|
+
c !== "list" && /* @__PURE__ */ e(
|
|
163
164
|
"button",
|
|
164
165
|
{
|
|
165
|
-
onClick: () =>
|
|
166
|
+
onClick: () => f("list"),
|
|
166
167
|
style: { background: "none", border: "none", cursor: "pointer", color: d, fontSize: 13, fontWeight: 600, padding: 0 },
|
|
167
168
|
children: "← Back"
|
|
168
169
|
}
|
|
169
170
|
),
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
c === "list" && /* @__PURE__ */ e("span", { style: { fontWeight: 700, fontSize: 16, color: i.text, letterSpacing: "-.01em" }, children: "Feedback" }),
|
|
172
|
+
c === "create" && /* @__PURE__ */ e("span", { style: { fontWeight: 700, fontSize: 16, color: i.text, letterSpacing: "-.01em" }, children: "New feedback" })
|
|
172
173
|
] }),
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
|
|
174
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
175
|
+
c === "list" && /* @__PURE__ */ e(
|
|
175
176
|
"button",
|
|
176
177
|
{
|
|
177
|
-
onClick: () =>
|
|
178
|
+
onClick: () => f("create"),
|
|
178
179
|
style: { background: d, color: "#fff", border: "none", borderRadius: 20, padding: "6px 14px", fontSize: 13, fontWeight: 700, cursor: "pointer" },
|
|
179
180
|
children: "+ New"
|
|
180
181
|
}
|
|
@@ -182,17 +183,17 @@ function ee({
|
|
|
182
183
|
/* @__PURE__ */ e(
|
|
183
184
|
"button",
|
|
184
185
|
{
|
|
185
|
-
onClick:
|
|
186
|
+
onClick: p,
|
|
186
187
|
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" },
|
|
187
188
|
children: "✕"
|
|
188
189
|
}
|
|
189
190
|
)
|
|
190
191
|
] })
|
|
191
192
|
] }),
|
|
192
|
-
|
|
193
|
+
c === "list" && /* @__PURE__ */ e("div", { style: { display: "flex", borderBottom: `1px solid ${i.border}`, flexShrink: 0 }, children: ["open", "done"].map((m) => /* @__PURE__ */ e(
|
|
193
194
|
"button",
|
|
194
195
|
{
|
|
195
|
-
onClick: () =>
|
|
196
|
+
onClick: () => g(m),
|
|
196
197
|
style: {
|
|
197
198
|
flex: 1,
|
|
198
199
|
padding: "10px 0",
|
|
@@ -201,34 +202,56 @@ function ee({
|
|
|
201
202
|
cursor: "pointer",
|
|
202
203
|
fontSize: 13,
|
|
203
204
|
fontWeight: 600,
|
|
204
|
-
color:
|
|
205
|
-
borderBottom: `2px solid ${
|
|
205
|
+
color: k === m ? d : i.textFaint,
|
|
206
|
+
borderBottom: `2px solid ${k === m ? d : "transparent"}`
|
|
206
207
|
},
|
|
207
|
-
children:
|
|
208
|
+
children: m === "open" ? "Open" : "Completed"
|
|
208
209
|
},
|
|
209
|
-
|
|
210
|
+
m
|
|
210
211
|
)) }),
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
/* @__PURE__ */ r("div", { style: { flex: 1, overflowY: "auto", padding: "16px 20px 24px" }, children: [
|
|
213
|
+
c === "list" && /* @__PURE__ */ e(
|
|
214
|
+
O,
|
|
214
215
|
{
|
|
215
|
-
tab:
|
|
216
|
-
onSelect:
|
|
216
|
+
tab: k,
|
|
217
|
+
onSelect: D,
|
|
217
218
|
accent: d,
|
|
218
219
|
p: i
|
|
219
220
|
}
|
|
220
221
|
),
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
c === "detail" && S && /* @__PURE__ */ e(j, { feedbackId: S, accent: d, p: i, font: b }),
|
|
223
|
+
c === "create" && /* @__PURE__ */ e(
|
|
224
|
+
_,
|
|
224
225
|
{
|
|
225
226
|
accent: d,
|
|
226
227
|
p: i,
|
|
227
|
-
font:
|
|
228
|
-
onDone: () =>
|
|
228
|
+
font: b,
|
|
229
|
+
onDone: () => f("list")
|
|
229
230
|
}
|
|
230
231
|
)
|
|
231
|
-
] })
|
|
232
|
+
] }),
|
|
233
|
+
y && /* @__PURE__ */ r(
|
|
234
|
+
"a",
|
|
235
|
+
{
|
|
236
|
+
href: "https://upstep.dev",
|
|
237
|
+
target: "_blank",
|
|
238
|
+
rel: "noopener noreferrer",
|
|
239
|
+
style: {
|
|
240
|
+
display: "block",
|
|
241
|
+
textAlign: "center",
|
|
242
|
+
padding: "8px 0",
|
|
243
|
+
borderTop: `1px solid ${i.border}`,
|
|
244
|
+
fontSize: 11,
|
|
245
|
+
color: i.textFaint,
|
|
246
|
+
textDecoration: "none",
|
|
247
|
+
flexShrink: 0
|
|
248
|
+
},
|
|
249
|
+
children: [
|
|
250
|
+
"Powered by ",
|
|
251
|
+
/* @__PURE__ */ e("strong", { style: { fontWeight: 700 }, children: "Upstep.dev" })
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
)
|
|
232
255
|
]
|
|
233
256
|
}
|
|
234
257
|
)
|
|
@@ -236,19 +259,19 @@ function ee({
|
|
|
236
259
|
)
|
|
237
260
|
] });
|
|
238
261
|
}
|
|
239
|
-
function
|
|
262
|
+
function O({
|
|
240
263
|
tab: n,
|
|
241
264
|
onSelect: t,
|
|
242
265
|
accent: o,
|
|
243
266
|
p: s
|
|
244
267
|
}) {
|
|
245
|
-
const { feedItems:
|
|
246
|
-
return i.length ? /* @__PURE__ */ e(W, { children: i.map((
|
|
247
|
-
const
|
|
248
|
-
return /* @__PURE__ */
|
|
268
|
+
const { feedItems: h } = B(), { vote: d } = B(), i = n === "done" ? h.filter((l) => l.status === "DONE") : h.filter((l) => l.status !== "DONE" && l.status !== "CLOSED");
|
|
269
|
+
return i.length ? /* @__PURE__ */ e(W, { children: i.map((l) => {
|
|
270
|
+
const x = l.userVote === "UP", a = l.title ?? l.content;
|
|
271
|
+
return /* @__PURE__ */ r(
|
|
249
272
|
"div",
|
|
250
273
|
{
|
|
251
|
-
onClick: () => t(
|
|
274
|
+
onClick: () => t(l.id),
|
|
252
275
|
style: {
|
|
253
276
|
display: "flex",
|
|
254
277
|
gap: 12,
|
|
@@ -260,11 +283,11 @@ function H({
|
|
|
260
283
|
cursor: "pointer"
|
|
261
284
|
},
|
|
262
285
|
children: [
|
|
263
|
-
/* @__PURE__ */
|
|
286
|
+
/* @__PURE__ */ r(
|
|
264
287
|
"button",
|
|
265
288
|
{
|
|
266
|
-
onClick: (
|
|
267
|
-
|
|
289
|
+
onClick: (y) => {
|
|
290
|
+
y.stopPropagation(), d(l.id, "UP");
|
|
268
291
|
},
|
|
269
292
|
style: {
|
|
270
293
|
display: "flex",
|
|
@@ -277,71 +300,71 @@ function H({
|
|
|
277
300
|
borderRadius: 11,
|
|
278
301
|
cursor: "pointer",
|
|
279
302
|
flexShrink: 0,
|
|
280
|
-
border: `1px solid ${
|
|
281
|
-
background:
|
|
303
|
+
border: `1px solid ${x ? o : s.border}`,
|
|
304
|
+
background: x ? `${o}1a` : s.bgSoft
|
|
282
305
|
},
|
|
283
306
|
children: [
|
|
284
|
-
/* @__PURE__ */ e(
|
|
285
|
-
/* @__PURE__ */ e("span", { style: { fontSize: 14, fontWeight: 700, color: s.text, lineHeight: 1.1 }, children:
|
|
307
|
+
/* @__PURE__ */ e(R, { color: o }),
|
|
308
|
+
/* @__PURE__ */ e("span", { style: { fontSize: 14, fontWeight: 700, color: s.text, lineHeight: 1.1 }, children: l.upvotes })
|
|
286
309
|
]
|
|
287
310
|
}
|
|
288
311
|
),
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
/* @__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:
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */ e(
|
|
293
|
-
|
|
294
|
-
/* @__PURE__ */ e("span", { style: { fontSize: 11, color: s.textFaint }, children: L(
|
|
312
|
+
/* @__PURE__ */ r("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
313
|
+
/* @__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 }),
|
|
314
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
|
|
315
|
+
/* @__PURE__ */ e(T, { type: l.type, p: s }),
|
|
316
|
+
l.status === "PENDING" ? /* @__PURE__ */ e(E, {}) : /* @__PURE__ */ e(U, { status: l.status, p: s }),
|
|
317
|
+
/* @__PURE__ */ e("span", { style: { fontSize: 11, color: s.textFaint }, children: L(l.createdAt) })
|
|
295
318
|
] })
|
|
296
319
|
] }),
|
|
297
320
|
/* @__PURE__ */ e("span", { style: { color: s.textFaint, fontSize: 18, alignSelf: "center", flexShrink: 0 }, children: "›" })
|
|
298
321
|
]
|
|
299
322
|
},
|
|
300
|
-
|
|
323
|
+
l.id
|
|
301
324
|
);
|
|
302
|
-
}) }) : /* @__PURE__ */
|
|
325
|
+
}) }) : /* @__PURE__ */ r("div", { style: { textAlign: "center", padding: "40px 0" }, children: [
|
|
303
326
|
/* @__PURE__ */ e("div", { style: { color: s.textSoft, fontSize: 15, fontWeight: 600, marginBottom: 4 }, children: n === "done" ? "Nothing completed yet" : "No open feedback yet" }),
|
|
304
327
|
/* @__PURE__ */ e("div", { style: { color: s.textFaint, fontSize: 14 }, children: n === "done" ? "Shipped items will appear here." : "Be the first to share one." })
|
|
305
328
|
] });
|
|
306
329
|
}
|
|
307
|
-
function
|
|
308
|
-
const { vote:
|
|
309
|
-
|
|
310
|
-
let
|
|
330
|
+
function j({ feedbackId: n, accent: t, p: o, font: s }) {
|
|
331
|
+
const { vote: h, getItem: d } = B(), [i, l] = u(null), [x, a] = u(!1);
|
|
332
|
+
C(() => {
|
|
333
|
+
let f = !1;
|
|
311
334
|
return d(n).then((S) => {
|
|
312
|
-
|
|
335
|
+
f || l(S);
|
|
313
336
|
}).catch(() => {
|
|
314
337
|
}), () => {
|
|
315
|
-
|
|
338
|
+
f = !0;
|
|
316
339
|
};
|
|
317
340
|
}, [n, d]);
|
|
318
|
-
async function
|
|
319
|
-
if (!(!i ||
|
|
320
|
-
|
|
341
|
+
async function y() {
|
|
342
|
+
if (!(!i || x)) {
|
|
343
|
+
a(!0);
|
|
321
344
|
try {
|
|
322
|
-
await
|
|
323
|
-
const
|
|
324
|
-
|
|
345
|
+
await h(i.id, "UP");
|
|
346
|
+
const f = await d(n);
|
|
347
|
+
l(f);
|
|
325
348
|
} finally {
|
|
326
|
-
|
|
349
|
+
a(!1);
|
|
327
350
|
}
|
|
328
351
|
}
|
|
329
352
|
}
|
|
330
353
|
if (!i)
|
|
331
354
|
return /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: "40px 0", color: o.textFaint, fontSize: 14 }, children: "Loading…" });
|
|
332
|
-
const
|
|
333
|
-
return /* @__PURE__ */
|
|
334
|
-
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */ e(
|
|
337
|
-
i.status === "PENDING" ? /* @__PURE__ */ e(
|
|
355
|
+
const c = i.title;
|
|
356
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
357
|
+
c && /* @__PURE__ */ e("div", { style: { fontSize: 20, fontWeight: 700, color: o.text, letterSpacing: "-.02em", marginBottom: 10, lineHeight: 1.3 }, children: c }),
|
|
358
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", gap: 6, marginBottom: 14, flexWrap: "wrap" }, children: [
|
|
359
|
+
/* @__PURE__ */ e(T, { type: i.type, p: o }),
|
|
360
|
+
i.status === "PENDING" ? /* @__PURE__ */ e(E, {}) : /* @__PURE__ */ e(U, { status: i.status, p: o })
|
|
338
361
|
] }),
|
|
339
362
|
/* @__PURE__ */ e("p", { style: { fontSize: 15, lineHeight: 1.6, color: o.textSoft, marginBottom: 20 }, children: i.content }),
|
|
340
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ r(
|
|
341
364
|
"button",
|
|
342
365
|
{
|
|
343
|
-
onClick:
|
|
344
|
-
disabled:
|
|
366
|
+
onClick: y,
|
|
367
|
+
disabled: x,
|
|
345
368
|
style: {
|
|
346
369
|
display: "inline-flex",
|
|
347
370
|
alignItems: "center",
|
|
@@ -354,47 +377,47 @@ function O({ feedbackId: n, accent: t, p: o, font: s }) {
|
|
|
354
377
|
fontFamily: s
|
|
355
378
|
},
|
|
356
379
|
children: [
|
|
357
|
-
/* @__PURE__ */ e(
|
|
380
|
+
/* @__PURE__ */ e(R, { color: t, size: 13 }),
|
|
358
381
|
/* @__PURE__ */ e("span", { style: { fontSize: 18, fontWeight: 700, color: o.text }, children: i.upvotes }),
|
|
359
382
|
/* @__PURE__ */ e("span", { style: { fontSize: 13, color: o.textFaint }, children: i.userVote === "UP" ? "Upvoted" : "Upvote" })
|
|
360
383
|
]
|
|
361
384
|
}
|
|
362
385
|
),
|
|
363
|
-
i.comments.length > 0 && /* @__PURE__ */
|
|
386
|
+
i.comments.length > 0 && /* @__PURE__ */ r("div", { style: { marginTop: 28, borderTop: `1px solid ${o.border}`, paddingTop: 20 }, children: [
|
|
364
387
|
/* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: o.textFaint, marginBottom: 12, textTransform: "uppercase" }, children: "Developer response" }),
|
|
365
|
-
i.comments.map((
|
|
388
|
+
i.comments.map((f) => /* @__PURE__ */ e(V, { comment: f, p: o, accent: t }, f.id))
|
|
366
389
|
] })
|
|
367
390
|
] });
|
|
368
391
|
}
|
|
369
|
-
function
|
|
370
|
-
return /* @__PURE__ */
|
|
371
|
-
/* @__PURE__ */
|
|
392
|
+
function V({ comment: n, p: t, accent: o }) {
|
|
393
|
+
return /* @__PURE__ */ r("div", { style: { background: t.bgSoft, border: `1px solid ${t.border}`, borderRadius: 12, padding: 14, marginBottom: 10 }, children: [
|
|
394
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 8 }, children: [
|
|
372
395
|
/* @__PURE__ */ e("span", { style: { background: `${o}20`, color: o, fontSize: 11, fontWeight: 700, borderRadius: 20, padding: "2px 8px" }, children: "Developer" }),
|
|
373
396
|
/* @__PURE__ */ e("span", { style: { fontSize: 11, color: t.textFaint }, children: L(n.createdAt) })
|
|
374
397
|
] }),
|
|
375
398
|
/* @__PURE__ */ e("p", { style: { fontSize: 14, lineHeight: 1.5, color: t.textSoft, margin: 0 }, children: n.content })
|
|
376
399
|
] });
|
|
377
400
|
}
|
|
378
|
-
function
|
|
379
|
-
const { submit:
|
|
380
|
-
async function
|
|
381
|
-
if (!(!d.trim() ||
|
|
382
|
-
|
|
401
|
+
function _({ accent: n, p: t, font: o, onDone: s }) {
|
|
402
|
+
const { submit: h } = B(), [d, i] = u(""), [l, x] = u(""), [a, y] = u("GENERAL"), [c, f] = u(!1), [S, F] = u(!1), [k, g] = u("");
|
|
403
|
+
async function v() {
|
|
404
|
+
if (!(!d.trim() || c)) {
|
|
405
|
+
f(!0), g("");
|
|
383
406
|
try {
|
|
384
|
-
await
|
|
407
|
+
await h(d.trim(), l.trim() || d.trim(), a), F(!0), setTimeout(s, 1200);
|
|
385
408
|
} catch {
|
|
386
|
-
|
|
409
|
+
g("Something went wrong. Please try again.");
|
|
387
410
|
} finally {
|
|
388
|
-
|
|
411
|
+
f(!1);
|
|
389
412
|
}
|
|
390
413
|
}
|
|
391
414
|
}
|
|
392
415
|
if (S)
|
|
393
|
-
return /* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ r("div", { style: { textAlign: "center", paddingTop: 40 }, children: [
|
|
394
417
|
/* @__PURE__ */ e("div", { style: { fontSize: 18, fontWeight: 700, color: t.text, marginBottom: 6 }, children: "Submitted" }),
|
|
395
418
|
/* @__PURE__ */ e("div", { style: { fontSize: 14, color: t.textFaint }, children: "Feedback received. Thank you." })
|
|
396
419
|
] });
|
|
397
|
-
const
|
|
420
|
+
const b = {
|
|
398
421
|
width: "100%",
|
|
399
422
|
border: `1px solid ${t.border}`,
|
|
400
423
|
borderRadius: 12,
|
|
@@ -407,12 +430,12 @@ function V({ accent: n, p: t, font: o, onDone: s }) {
|
|
|
407
430
|
fontFamily: o,
|
|
408
431
|
boxSizing: "border-box"
|
|
409
432
|
};
|
|
410
|
-
return /* @__PURE__ */
|
|
433
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
411
434
|
/* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: t.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: "Type" }),
|
|
412
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", gap: 7, marginBottom: 16 }, children: ["BUG", "FEATURE", "GENERAL"].map((
|
|
435
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", gap: 7, marginBottom: 16 }, children: ["BUG", "FEATURE", "GENERAL"].map((p) => /* @__PURE__ */ r(
|
|
413
436
|
"button",
|
|
414
437
|
{
|
|
415
|
-
onClick: () =>
|
|
438
|
+
onClick: () => y(p),
|
|
416
439
|
style: {
|
|
417
440
|
flex: 1,
|
|
418
441
|
display: "flex",
|
|
@@ -424,50 +447,50 @@ function V({ accent: n, p: t, font: o, onDone: s }) {
|
|
|
424
447
|
fontSize: 12.5,
|
|
425
448
|
fontWeight: 600,
|
|
426
449
|
cursor: "pointer",
|
|
427
|
-
background:
|
|
428
|
-
color:
|
|
429
|
-
border: `1px solid ${
|
|
450
|
+
background: a === p ? n : t.bg,
|
|
451
|
+
color: a === p ? "#fff" : t.textSoft,
|
|
452
|
+
border: `1px solid ${a === p ? n : t.border}`,
|
|
430
453
|
fontFamily: o
|
|
431
454
|
},
|
|
432
455
|
children: [
|
|
433
|
-
|
|
434
|
-
|
|
456
|
+
z[p].icon,
|
|
457
|
+
z[p].label
|
|
435
458
|
]
|
|
436
459
|
},
|
|
437
|
-
|
|
460
|
+
p
|
|
438
461
|
)) }),
|
|
439
462
|
/* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: t.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: "Title" }),
|
|
440
463
|
/* @__PURE__ */ e(
|
|
441
464
|
"input",
|
|
442
465
|
{
|
|
443
466
|
value: d,
|
|
444
|
-
onChange: (
|
|
467
|
+
onChange: (p) => i(p.target.value),
|
|
445
468
|
placeholder: "Short summary of the issue or idea",
|
|
446
469
|
maxLength: 200,
|
|
447
|
-
style: { ...
|
|
470
|
+
style: { ...b, marginBottom: 16, display: "block" }
|
|
448
471
|
}
|
|
449
472
|
),
|
|
450
|
-
/* @__PURE__ */
|
|
473
|
+
/* @__PURE__ */ r("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: t.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: [
|
|
451
474
|
"Description ",
|
|
452
475
|
/* @__PURE__ */ e("span", { style: { fontWeight: 400, textTransform: "none", letterSpacing: 0 }, children: "(optional)" })
|
|
453
476
|
] }),
|
|
454
477
|
/* @__PURE__ */ e(
|
|
455
478
|
"textarea",
|
|
456
479
|
{
|
|
457
|
-
value:
|
|
458
|
-
onChange: (
|
|
480
|
+
value: l,
|
|
481
|
+
onChange: (p) => x(p.target.value),
|
|
459
482
|
placeholder: "Steps to reproduce, expected behaviour, or more context",
|
|
460
483
|
maxLength: 2e3,
|
|
461
484
|
rows: 4,
|
|
462
|
-
style: { ...
|
|
485
|
+
style: { ...b, resize: "vertical", marginBottom: 16 }
|
|
463
486
|
}
|
|
464
487
|
),
|
|
465
|
-
|
|
488
|
+
k && /* @__PURE__ */ e("p", { style: { fontSize: 13, color: "#d6453d", marginBottom: 12 }, children: k }),
|
|
466
489
|
/* @__PURE__ */ e(
|
|
467
490
|
"button",
|
|
468
491
|
{
|
|
469
|
-
onClick:
|
|
470
|
-
disabled:
|
|
492
|
+
onClick: v,
|
|
493
|
+
disabled: c || !d.trim(),
|
|
471
494
|
style: {
|
|
472
495
|
width: "100%",
|
|
473
496
|
padding: 12,
|
|
@@ -478,25 +501,25 @@ function V({ accent: n, p: t, font: o, onDone: s }) {
|
|
|
478
501
|
fontSize: 14,
|
|
479
502
|
fontWeight: 600,
|
|
480
503
|
cursor: "pointer",
|
|
481
|
-
opacity:
|
|
504
|
+
opacity: c || !d.trim() ? 0.5 : 1,
|
|
482
505
|
fontFamily: o
|
|
483
506
|
},
|
|
484
|
-
children:
|
|
507
|
+
children: c ? "Submitting…" : "Submit feedback"
|
|
485
508
|
}
|
|
486
509
|
)
|
|
487
510
|
] });
|
|
488
511
|
}
|
|
489
|
-
const
|
|
512
|
+
const z = {
|
|
490
513
|
BUG: {
|
|
491
514
|
label: "Bug",
|
|
492
|
-
icon: /* @__PURE__ */
|
|
515
|
+
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: [
|
|
493
516
|
/* @__PURE__ */ e("ellipse", { cx: "8", cy: "10", rx: "3.5", ry: "4.5" }),
|
|
494
517
|
/* @__PURE__ */ e("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" })
|
|
495
518
|
] })
|
|
496
519
|
},
|
|
497
520
|
FEATURE: {
|
|
498
521
|
label: "Feature",
|
|
499
|
-
icon: /* @__PURE__ */
|
|
522
|
+
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: [
|
|
500
523
|
/* @__PURE__ */ e("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" }),
|
|
501
524
|
/* @__PURE__ */ e("circle", { cx: "8", cy: "8", r: "2.5" })
|
|
502
525
|
] })
|
|
@@ -505,48 +528,48 @@ const B = {
|
|
|
505
528
|
label: "General",
|
|
506
529
|
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" }) })
|
|
507
530
|
}
|
|
508
|
-
},
|
|
509
|
-
function
|
|
531
|
+
}, Y = { BUG: "#fdecec", FEATURE: "#e9f0fd" }, q = { BUG: "#d6453d", FEATURE: "#3b76d6" };
|
|
532
|
+
function T({ type: n, p: t }) {
|
|
510
533
|
return /* @__PURE__ */ e("span", { style: {
|
|
511
534
|
padding: "2px 8px",
|
|
512
535
|
borderRadius: 9999,
|
|
513
536
|
fontSize: 10.5,
|
|
514
537
|
fontWeight: 700,
|
|
515
538
|
letterSpacing: ".02em",
|
|
516
|
-
background:
|
|
517
|
-
color:
|
|
539
|
+
background: Y[n] ?? t.bgSoft,
|
|
540
|
+
color: q[n] ?? t.textSoft
|
|
518
541
|
}, children: n });
|
|
519
542
|
}
|
|
520
|
-
const
|
|
543
|
+
const K = {
|
|
521
544
|
OPEN: "#b45309",
|
|
522
545
|
IN_PROGRESS: "#1d4ed8",
|
|
523
546
|
DONE: "#15803d",
|
|
524
547
|
CLOSED: "#6b7280"
|
|
525
548
|
};
|
|
526
|
-
function
|
|
527
|
-
return /* @__PURE__ */
|
|
549
|
+
function E() {
|
|
550
|
+
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: [
|
|
528
551
|
/* @__PURE__ */ e("span", { style: { width: 5, height: 5, borderRadius: "50%", background: "#ea580c", display: "inline-block" } }),
|
|
529
552
|
"Pending review"
|
|
530
553
|
] });
|
|
531
554
|
}
|
|
532
|
-
function
|
|
533
|
-
const o =
|
|
534
|
-
return /* @__PURE__ */
|
|
555
|
+
function U({ status: n, p: t }) {
|
|
556
|
+
const o = K[n] ?? "#9ca3af";
|
|
557
|
+
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: [
|
|
535
558
|
/* @__PURE__ */ e("span", { style: { width: 6, height: 6, borderRadius: "50%", background: o, display: "inline-block", flexShrink: 0 } }),
|
|
536
559
|
n.replace("_", " ")
|
|
537
560
|
] });
|
|
538
561
|
}
|
|
539
|
-
function
|
|
562
|
+
function J({ size: n = 16, color: t = "currentColor" }) {
|
|
540
563
|
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" }) });
|
|
541
564
|
}
|
|
542
|
-
function
|
|
565
|
+
function R({ color: n = "currentColor", size: t = 11 }) {
|
|
543
566
|
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" }) });
|
|
544
567
|
}
|
|
545
568
|
function L(n) {
|
|
546
569
|
return new Date(n).toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
547
570
|
}
|
|
548
571
|
export {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
572
|
+
te as FeedbackWidget,
|
|
573
|
+
ee as UpstepProvider,
|
|
574
|
+
B as useUpstep
|
|
552
575
|
};
|