@upstep/js 0.5.11 → 0.5.12
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/README.md +17 -2
- package/dist/index.cjs +6 -5
- package/dist/index.js +24 -20
- package/dist/react.cjs +1 -1
- package/dist/react.js +34 -30
- package/dist/widget.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @upstep/js
|
|
2
2
|
|
|
3
|
-
A feedback widget for web apps: a floating button, a voting board, and a submit form, backed by your [Upstep](https://upstep.dev) project. Drops into
|
|
3
|
+
A feedback widget for web apps: a floating button, a voting board, and a submit form, backed by your [Upstep](https://upstep.dev) project. Drops into React, Next.js, Vue, Nuxt, SvelteKit, vanilla JS, or a plain HTML page with no build step, in two lines of code.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -36,6 +36,19 @@ import Upstep from "@upstep/js";
|
|
|
36
36
|
Upstep.init({ apiKey: "upstep_xxx" });
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
### Vue / Nuxt / SvelteKit
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import Upstep from "@upstep/js";
|
|
43
|
+
|
|
44
|
+
Upstep.init({ apiKey: "upstep_xxx" });
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Mount that once from the client-side root for your framework:
|
|
48
|
+
- Vue: `onMounted()` in `App.vue`
|
|
49
|
+
- Nuxt: `plugins/upstep.client.ts`
|
|
50
|
+
- SvelteKit: `onMount()` in `src/routes/+layout.svelte`
|
|
51
|
+
|
|
39
52
|
### No build step (WordPress, Webflow, Shopify, static HTML)
|
|
40
53
|
|
|
41
54
|
```html
|
|
@@ -46,7 +59,7 @@ Upstep.init({ apiKey: "upstep_xxx" });
|
|
|
46
59
|
></script>
|
|
47
60
|
```
|
|
48
61
|
|
|
49
|
-
All
|
|
62
|
+
All of these report to the same project, so feedback from your React app, your Nuxt marketing site, a script tag on a static page, and (if you add [`@upstep/react-native`](https://www.npmjs.com/package/@upstep/react-native) or [`upstep_flutter`](https://pub.dev/packages/upstep_flutter)) your mobile app all land on one board, sorted by votes.
|
|
50
63
|
|
|
51
64
|
## Configuration
|
|
52
65
|
|
|
@@ -80,5 +93,7 @@ Every entry point (`Upstep.init`, `<UpstepProvider>`, and the script tag's `data
|
|
|
80
93
|
## Links
|
|
81
94
|
|
|
82
95
|
- [Full documentation](https://upstep.dev/#integrate)
|
|
96
|
+
- [Platform integration guides](https://upstep.dev/integrations)
|
|
83
97
|
- [Dashboard / sign up](https://upstep.dev/login)
|
|
84
98
|
- [@upstep/react-native](https://www.npmjs.com/package/@upstep/react-native) for React Native apps
|
|
99
|
+
- [upstep_flutter](https://pub.dev/packages/upstep_flutter) for Flutter apps
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("./api-DLrEC5_l.js"),L="#D97757",x={bg:"#ffffff",bgSoft:"#f6f5f2",bgHover:"#efede8",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},m={bg:"#1c1b19",bgSoft:"#262522",bgHover:"#302e2a",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function y(o){if(o==="light"||o==="dark")return o;if(typeof document<"u"){const e=document.documentElement;return e.classList.contains("dark")||e.getAttribute("data-theme")==="dark"?"dark":"light"}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function S(o,e,t){return`
|
|
2
2
|
#upstep-root *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
|
|
3
3
|
#upstep-btn{position:fixed;bottom:24px;${e==="left"?"left:24px":"right:24px"};z-index:9998;display:inline-flex;align-items:center;gap:7px;background:${o};color:#fff;border:none;border-radius:9999px;padding:12px 18px;font-size:14px;font-weight:600;cursor:grab;touch-action:none;box-shadow:0 6px 20px rgba(26,25,21,.18);transition:transform .15s,box-shadow .15s}
|
|
4
4
|
#upstep-btn svg{width:16px;height:16px;flex-shrink:0}
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
.upstep-feedback-date{font-size:11px;color:${t.textFaint}}
|
|
48
48
|
.upstep-empty{text-align:center;color:${t.textFaint};font-size:14px;padding:40px 0}
|
|
49
49
|
.upstep-empty strong{display:block;color:${t.textSoft};font-size:15px;margin-bottom:4px}
|
|
50
|
-
`}const
|
|
50
|
+
`}const C='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>';class F{constructor(e,t={}){this.isOpen=!1,this.tab="submit",this.feedItems=[],this.selectedType="GENERAL",this.loading=!1,this.dragMoved=!1,this.client=e,this.accent=t.accentColor??L,this.position=t.position??"right",this.showLauncher=t.launcher!==!1,this.themeMode=t.theme??"auto",this.palette=y(this.themeMode)==="dark"?m:x}mount(){this.injectStyles(),this.showLauncher&&this.renderButton()}openWidget(){this.openModal()}closeWidget(){this.closeModal()}injectStyles(){var t;(t=document.getElementById("upstep-styles"))==null||t.remove();const e=document.createElement("style");e.id="upstep-styles",e.textContent=S(this.accent,this.position,this.palette),document.head.appendChild(e)}renderButton(){const e=document.createElement("button");e.id="upstep-btn",e.innerHTML=`${C}<span>Feedback</span>`,e.addEventListener("click",()=>{this.dragMoved||this.openModal()}),document.body.appendChild(e),this.makeDraggable(e)}makeDraggable(e){const s="upstep-btn-pos";try{const i=localStorage.getItem(s);if(i){const{side:a,bottom:u}=JSON.parse(i);e.style.left=a==="left"?"24px":"auto",e.style.right=a==="right"?"24px":"auto",e.style.top="auto",e.style.bottom=`${u}px`}}catch{}let r=0,c=0,d=0,h=0,b=!1;const $=()=>{const i=e.getBoundingClientRect(),a=i.left+i.width/2<window.innerWidth/2?"left":"right",u=Math.max(24,Math.min(window.innerHeight-i.height-24,i.top)),g=window.innerHeight-u-i.height;e.style.transition="left .25s cubic-bezier(.16,1,.3,1),right .25s cubic-bezier(.16,1,.3,1),top .25s cubic-bezier(.16,1,.3,1),bottom .25s cubic-bezier(.16,1,.3,1),transform .15s,box-shadow .15s",e.style.left=a==="left"?"24px":"auto",e.style.right=a==="right"?"24px":"auto",e.style.top="auto",e.style.bottom=`${g}px`;try{localStorage.setItem(s,JSON.stringify({side:a,bottom:g}))}catch{}},M=i=>{if(i.pointerType==="mouse"&&i.button!==0)return;this.dragMoved=!1,b=!0;const a=e.getBoundingClientRect();r=i.clientX,c=i.clientY,d=a.left,h=a.top,e.setPointerCapture(i.pointerId),e.style.transition="none"},E=i=>{if(!b)return;const a=i.clientX-r,u=i.clientY-c;!this.dragMoved&&Math.hypot(a,u)<6||(this.dragMoved||e.classList.add("upstep-dragging"),this.dragMoved=!0,e.style.left=`${d+a}px`,e.style.right="auto",e.style.top=`${h+u}px`,e.style.bottom="auto")},f=()=>{b&&(b=!1,e.classList.remove("upstep-dragging"),this.dragMoved&&$())};e.addEventListener("pointerdown",M),e.addEventListener("pointermove",E),e.addEventListener("pointerup",f),e.addEventListener("pointercancel",f)}openModal(){this.isOpen=!0,this.palette=y(this.themeMode)==="dark"?m:x,this.injectStyles(),this.fetchFeed(),this.renderModal()}closeModal(){var e;this.isOpen=!1,(e=document.getElementById("upstep-backdrop"))==null||e.remove()}async fetchFeed(){try{const e=await this.client.listFeedback({sort:"votes",limit:20});this.feedItems=e.items,this.renderFeedList()}catch{}}renderModal(){var t,n;const e=document.createElement("div");e.id="upstep-backdrop",e.addEventListener("click",s=>{s.target===e&&this.closeModal()}),e.innerHTML=`
|
|
51
51
|
<div id="upstep-modal">
|
|
52
52
|
<div id="upstep-header">
|
|
53
53
|
<div>
|
|
@@ -73,17 +73,18 @@
|
|
|
73
73
|
<button class="upstep-submit" id="upstep-submit-btn">Send feedback</button>
|
|
74
74
|
<div id="upstep-form-msg"></div>
|
|
75
75
|
</div>
|
|
76
|
-
`}renderFeed(){return this.feedItems.length?this.feedItems.map(e
|
|
76
|
+
`}renderFeed(){return this.feedItems.length?this.feedItems.map(e=>{var t;return`
|
|
77
77
|
<div class="upstep-feedback-item" data-id="${e.id}">
|
|
78
78
|
<button class="upstep-vote${e.userVote==="UP"?" voted":""}" data-vote="UP" data-feedback="${e.id}">
|
|
79
79
|
<span class="upstep-vote-arrow">▲</span>
|
|
80
80
|
<span class="upstep-vote-count">${e.upvotes}</span>
|
|
81
81
|
</button>
|
|
82
82
|
<div class="upstep-feedback-main">
|
|
83
|
-
<p class="upstep-feedback-content">${
|
|
83
|
+
<p class="upstep-feedback-content">${v(e.content)}</p>
|
|
84
84
|
<div class="upstep-feedback-meta">
|
|
85
85
|
<span class="upstep-badge upstep-badge-${e.type.toLowerCase()}">${e.type}</span>
|
|
86
|
+
<span class="upstep-badge upstep-badge-general">${v(((t=e.boardStatus)==null?void 0:t.name)??e.status.replace("_"," "))}</span>
|
|
86
87
|
<span class="upstep-feedback-date">${new Date(e.createdAt).toLocaleDateString()}</span>
|
|
87
88
|
</div>
|
|
88
89
|
</div>
|
|
89
|
-
</div>`).join(""):'<div class="upstep-empty"><strong>No ideas yet</strong>Be the first to share one.</div>'}renderFeedList(){const e=document.getElementById("upstep-body");!e||this.tab!=="feed"||(e.innerHTML=this.renderFeed(),this.bindVoteButtons())}bindSubmitForm(){var e;document.querySelectorAll(".upstep-type-btn").forEach(t=>{t.addEventListener("click",()=>{this.selectedType=t.dataset.type,document.querySelectorAll(".upstep-type-btn").forEach(n=>n.classList.remove("selected")),t.classList.add("selected")})}),(e=document.getElementById("upstep-submit-btn"))==null||e.addEventListener("click",async()=>{const t=document.getElementById("upstep-textarea"),n=document.getElementById("upstep-form-msg"),s=document.getElementById("upstep-submit-btn");if(!t||this.loading)return;const r=t.value.trim();if(r){this.loading=!0,s&&(s.disabled=!0,s.textContent="Sending…");try{await this.client.submitFeedback({content:r,type:this.selectedType}),t.value="",n&&(n.textContent="Feedback received. Thank you."),await this.fetchFeed()}catch{n&&(n.textContent="Something went wrong. Please try again.")}finally{this.loading=!1,s&&(s.disabled=!1,s.textContent="Send feedback")}}})}bindVoteButtons(){document.querySelectorAll(".upstep-vote").forEach(e=>{e.addEventListener("click",async()=>{const t=e.dataset.feedback;try{await this.client.vote(t,"UP"),await this.fetchFeed()}catch{}})})}}function
|
|
90
|
+
</div>`}).join(""):'<div class="upstep-empty"><strong>No ideas yet</strong>Be the first to share one.</div>'}renderFeedList(){const e=document.getElementById("upstep-body");!e||this.tab!=="feed"||(e.innerHTML=this.renderFeed(),this.bindVoteButtons())}bindSubmitForm(){var e;document.querySelectorAll(".upstep-type-btn").forEach(t=>{t.addEventListener("click",()=>{this.selectedType=t.dataset.type,document.querySelectorAll(".upstep-type-btn").forEach(n=>n.classList.remove("selected")),t.classList.add("selected")})}),(e=document.getElementById("upstep-submit-btn"))==null||e.addEventListener("click",async()=>{const t=document.getElementById("upstep-textarea"),n=document.getElementById("upstep-form-msg"),s=document.getElementById("upstep-submit-btn");if(!t||this.loading)return;const r=t.value.trim();if(r){this.loading=!0,s&&(s.disabled=!0,s.textContent="Sending…");try{await this.client.submitFeedback({content:r,type:this.selectedType}),t.value="",n&&(n.textContent="Feedback received. Thank you."),await this.fetchFeed()}catch{n&&(n.textContent="Something went wrong. Please try again.")}finally{this.loading=!1,s&&(s.disabled=!1,s.textContent="Send feedback")}}})}bindVoteButtons(){document.querySelectorAll(".upstep-vote").forEach(e=>{e.addEventListener("click",async()=>{const t=e.dataset.feedback;try{await this.client.vote(t,"UP"),await this.fetchFeed()}catch{}})})}}function v(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let p=null,l=null;const w={init(o){if(p=new k.UpstepApiClient(o),typeof window<"u"){const e={};o.accentColor!==void 0&&(e.accentColor=o.accentColor),o.position!==void 0&&(e.position=o.position),o.theme!==void 0&&(e.theme=o.theme),o.launcher!==void 0&&(e.launcher=o.launcher);const t=()=>{l=new F(p,e),l.mount()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}return p},open(){l==null||l.openWidget()},close(){l==null||l.closeWidget()},identify(o){p==null||p.setUserId(o)},get client(){if(!p)throw new Error("Upstep.init() must be called first");return p}};if(typeof document<"u"){const o=document.currentScript,e=o==null?void 0:o.dataset.apiKey,t=o==null?void 0:o.dataset.userId,n=o==null?void 0:o.dataset.baseUrl,s=o==null?void 0:o.dataset.accentColor,r=o==null?void 0:o.dataset.position,c=o==null?void 0:o.dataset.theme;if(e){const d={apiKey:e};t&&(d.userId=t),n&&(d.baseUrl=n),s&&(d.accentColor=s),(r==="left"||r==="right")&&(d.position=r),(c==="light"||c==="dark"||c==="auto")&&(d.theme=c),w.init(d)}}exports.UpstepApiClient=k.UpstepApiClient;exports.default=w;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as
|
|
2
|
-
const
|
|
1
|
+
import { U as M } from "./api-DIQt-yuC.mjs";
|
|
2
|
+
const E = "#D97757", x = {
|
|
3
3
|
bg: "#ffffff",
|
|
4
4
|
bgSoft: "#f6f5f2",
|
|
5
5
|
bgHover: "#efede8",
|
|
@@ -26,7 +26,7 @@ function y(o) {
|
|
|
26
26
|
}
|
|
27
27
|
return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function L(o, e, t) {
|
|
30
30
|
return `
|
|
31
31
|
#upstep-root *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
|
|
32
32
|
#upstep-btn{position:fixed;bottom:24px;${e === "left" ? "left:24px" : "right:24px"};z-index:9998;display:inline-flex;align-items:center;gap:7px;background:${o};color:#fff;border:none;border-radius:9999px;padding:12px 18px;font-size:14px;font-weight:600;cursor:grab;touch-action:none;box-shadow:0 6px 20px rgba(26,25,21,.18);transition:transform .15s,box-shadow .15s}
|
|
@@ -78,10 +78,10 @@ function E(o, e, t) {
|
|
|
78
78
|
.upstep-empty strong{display:block;color:${t.textSoft};font-size:15px;margin-bottom:4px}
|
|
79
79
|
`;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
class
|
|
81
|
+
const S = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>';
|
|
82
|
+
class F {
|
|
83
83
|
constructor(e, t = {}) {
|
|
84
|
-
this.isOpen = !1, this.tab = "submit", this.feedItems = [], this.selectedType = "GENERAL", this.loading = !1, this.dragMoved = !1, this.client = e, this.accent = t.accentColor ??
|
|
84
|
+
this.isOpen = !1, this.tab = "submit", this.feedItems = [], this.selectedType = "GENERAL", this.loading = !1, this.dragMoved = !1, this.client = e, this.accent = t.accentColor ?? E, this.position = t.position ?? "right", this.showLauncher = t.launcher !== !1, this.themeMode = t.theme ?? "auto", this.palette = y(this.themeMode) === "dark" ? m : x;
|
|
85
85
|
}
|
|
86
86
|
mount() {
|
|
87
87
|
this.injectStyles(), this.showLauncher && this.renderButton();
|
|
@@ -98,11 +98,11 @@ class S {
|
|
|
98
98
|
var t;
|
|
99
99
|
(t = document.getElementById("upstep-styles")) == null || t.remove();
|
|
100
100
|
const e = document.createElement("style");
|
|
101
|
-
e.id = "upstep-styles", e.textContent =
|
|
101
|
+
e.id = "upstep-styles", e.textContent = L(this.accent, this.position, this.palette), document.head.appendChild(e);
|
|
102
102
|
}
|
|
103
103
|
renderButton() {
|
|
104
104
|
const e = document.createElement("button");
|
|
105
|
-
e.id = "upstep-btn", e.innerHTML = `${
|
|
105
|
+
e.id = "upstep-btn", e.innerHTML = `${S}<span>Feedback</span>`, e.addEventListener("click", () => {
|
|
106
106
|
this.dragMoved || this.openModal();
|
|
107
107
|
}), document.body.appendChild(e), this.makeDraggable(e);
|
|
108
108
|
}
|
|
@@ -117,26 +117,26 @@ class S {
|
|
|
117
117
|
} catch {
|
|
118
118
|
}
|
|
119
119
|
let r = 0, c = 0, d = 0, h = 0, b = !1;
|
|
120
|
-
const
|
|
120
|
+
const k = () => {
|
|
121
121
|
const i = e.getBoundingClientRect(), a = i.left + i.width / 2 < window.innerWidth / 2 ? "left" : "right", u = Math.max(24, Math.min(window.innerHeight - i.height - 24, i.top)), g = window.innerHeight - u - i.height;
|
|
122
122
|
e.style.transition = "left .25s cubic-bezier(.16,1,.3,1),right .25s cubic-bezier(.16,1,.3,1),top .25s cubic-bezier(.16,1,.3,1),bottom .25s cubic-bezier(.16,1,.3,1),transform .15s,box-shadow .15s", e.style.left = a === "left" ? "24px" : "auto", e.style.right = a === "right" ? "24px" : "auto", e.style.top = "auto", e.style.bottom = `${g}px`;
|
|
123
123
|
try {
|
|
124
124
|
localStorage.setItem(s, JSON.stringify({ side: a, bottom: g }));
|
|
125
125
|
} catch {
|
|
126
126
|
}
|
|
127
|
-
},
|
|
127
|
+
}, w = (i) => {
|
|
128
128
|
if (i.pointerType === "mouse" && i.button !== 0) return;
|
|
129
129
|
this.dragMoved = !1, b = !0;
|
|
130
130
|
const a = e.getBoundingClientRect();
|
|
131
131
|
r = i.clientX, c = i.clientY, d = a.left, h = a.top, e.setPointerCapture(i.pointerId), e.style.transition = "none";
|
|
132
|
-
},
|
|
132
|
+
}, $ = (i) => {
|
|
133
133
|
if (!b) return;
|
|
134
134
|
const a = i.clientX - r, u = i.clientY - c;
|
|
135
135
|
!this.dragMoved && Math.hypot(a, u) < 6 || (this.dragMoved || e.classList.add("upstep-dragging"), this.dragMoved = !0, e.style.left = `${d + a}px`, e.style.right = "auto", e.style.top = `${h + u}px`, e.style.bottom = "auto");
|
|
136
136
|
}, f = () => {
|
|
137
|
-
b && (b = !1, e.classList.remove("upstep-dragging"), this.dragMoved &&
|
|
137
|
+
b && (b = !1, e.classList.remove("upstep-dragging"), this.dragMoved && k());
|
|
138
138
|
};
|
|
139
|
-
e.addEventListener("pointerdown",
|
|
139
|
+
e.addEventListener("pointerdown", w), e.addEventListener("pointermove", $), e.addEventListener("pointerup", f), e.addEventListener("pointercancel", f);
|
|
140
140
|
}
|
|
141
141
|
openModal() {
|
|
142
142
|
this.isOpen = !0, this.palette = y(this.themeMode) === "dark" ? m : x, this.injectStyles(), this.fetchFeed(), this.renderModal();
|
|
@@ -199,20 +199,24 @@ class S {
|
|
|
199
199
|
}
|
|
200
200
|
renderFeed() {
|
|
201
201
|
return this.feedItems.length ? this.feedItems.map(
|
|
202
|
-
(e) =>
|
|
202
|
+
(e) => {
|
|
203
|
+
var t;
|
|
204
|
+
return `
|
|
203
205
|
<div class="upstep-feedback-item" data-id="${e.id}">
|
|
204
206
|
<button class="upstep-vote${e.userVote === "UP" ? " voted" : ""}" data-vote="UP" data-feedback="${e.id}">
|
|
205
207
|
<span class="upstep-vote-arrow">▲</span>
|
|
206
208
|
<span class="upstep-vote-count">${e.upvotes}</span>
|
|
207
209
|
</button>
|
|
208
210
|
<div class="upstep-feedback-main">
|
|
209
|
-
<p class="upstep-feedback-content">${
|
|
211
|
+
<p class="upstep-feedback-content">${v(e.content)}</p>
|
|
210
212
|
<div class="upstep-feedback-meta">
|
|
211
213
|
<span class="upstep-badge upstep-badge-${e.type.toLowerCase()}">${e.type}</span>
|
|
214
|
+
<span class="upstep-badge upstep-badge-general">${v(((t = e.boardStatus) == null ? void 0 : t.name) ?? e.status.replace("_", " "))}</span>
|
|
212
215
|
<span class="upstep-feedback-date">${new Date(e.createdAt).toLocaleDateString()}</span>
|
|
213
216
|
</div>
|
|
214
217
|
</div>
|
|
215
|
-
</div
|
|
218
|
+
</div>`;
|
|
219
|
+
}
|
|
216
220
|
).join("") : '<div class="upstep-empty"><strong>No ideas yet</strong>Be the first to share one.</div>';
|
|
217
221
|
}
|
|
218
222
|
renderFeedList() {
|
|
@@ -253,17 +257,17 @@ class S {
|
|
|
253
257
|
});
|
|
254
258
|
}
|
|
255
259
|
}
|
|
256
|
-
function
|
|
260
|
+
function v(o) {
|
|
257
261
|
return o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
258
262
|
}
|
|
259
263
|
let p = null, l = null;
|
|
260
264
|
const C = {
|
|
261
265
|
init(o) {
|
|
262
|
-
if (p = new
|
|
266
|
+
if (p = new M(o), typeof window < "u") {
|
|
263
267
|
const e = {};
|
|
264
268
|
o.accentColor !== void 0 && (e.accentColor = o.accentColor), o.position !== void 0 && (e.position = o.position), o.theme !== void 0 && (e.theme = o.theme), o.launcher !== void 0 && (e.launcher = o.launcher);
|
|
265
269
|
const t = () => {
|
|
266
|
-
l = new
|
|
270
|
+
l = new F(p, e), l.mount();
|
|
267
271
|
};
|
|
268
272
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t) : t();
|
|
269
273
|
}
|
|
@@ -294,6 +298,6 @@ if (typeof document < "u") {
|
|
|
294
298
|
}
|
|
295
299
|
}
|
|
296
300
|
export {
|
|
297
|
-
|
|
301
|
+
M as UpstepApiClient,
|
|
298
302
|
C as default
|
|
299
303
|
};
|
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"),L=require("./api-DLrEC5_l.js"),D="#D97757",M={bg:"#ffffff",bgSoft:"#f6f5f2",bgHover:"#efede8",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},P={bg:"#1c1b19",bgSoft:"#262522",bgHover:"#302e2a",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function C(){if(typeof document>"u")return!1;const i=document.documentElement;return i.classList.contains("dark")||i.getAttribute("data-theme")==="dark"}function A(i){const[n,t]=r.useState(()=>i==="dark");return r.useEffect(()=>{if(i!=="auto"){t(i==="dark");return}if(t(C()),typeof MutationObserver>"u")return;const x=new MutationObserver(()=>t(C()));return x.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),()=>x.disconnect()},[i]),n?P:M}const z=r.createContext(null);function H({children:i,...n}){const[t]=r.useState(()=>new L.UpstepApiClient(n)),[x,g]=r.useState([]),[s,o]=r.useState(!1),[f,p]=r.useState(!0);r.useEffect(()=>{t.setUserId(n.userId)},[t,n.userId]);const l=r.useCallback(async()=>{try{const u=await t.listFeedback({sort:"votes",limit:20});g(u.items),p(u.showBranding??!0)}catch{}},[t]);r.useEffect(()=>{l()},[l]);const y=r.useCallback(async(u,j,h)=>{const d={content:j};u.trim()&&(d.title=u.trim()),h!==void 0&&(d.type=h),await t.submitFeedback(d),await l()},[t,l]),c=r.useCallback(async(u,j)=>{try{await t.vote(u,j),await l()}catch{}},[t,l]),a=r.useCallback(u=>t.getItem(u),[t]),b=r.useCallback(()=>o(!0),[]),k=r.useCallback(()=>o(!1),[]),S=r.useCallback(u=>t.setUserId(u),[t]);return e.jsx(z.Provider,{value:{client:t,feedItems:x,loadFeed:l,submit:y,vote:c,getItem:a,isOpen:s,open:b,close:k,identify:S,accentColor:n.accentColor??D,theme:n.theme??"auto",showBranding:f},children:i})}function v(){const i=r.useContext(z);if(!i)throw new Error("useUpstep must be used inside <UpstepProvider>");return i}function G({position:i="bottom-right",accentColor:n,theme:t,hideLauncher:x=!1}){const g=v(),s=n??g.accentColor,o=A(t??g.theme),{isOpen:f,open:p,close:l,showBranding:y}=g,[c,a]=r.useState("list"),[b,k]=r.useState(null),[S,u]=r.useState(!1);r.useEffect(()=>{const m=window.matchMedia("(max-width: 639px)");u(m.matches);const w=R=>u(R.matches);return m.addEventListener("change",w),()=>m.removeEventListener("change",w)},[]);const j=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 U(m){k(m),a("detail")}return e.jsxs(e.Fragment,{children:[!x&&e.jsxs("button",{onClick:p,style:{...j,zIndex:9998,display:"inline-flex",alignItems:"center",gap:7,background:s,color:"#fff",border:"none",borderRadius:9999,padding:S?"12px":"12px 18px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:h,boxShadow:"0 6px 20px rgba(26,25,21,.18)"},children:[e.jsx(K,{size:16}),!S&&"Feedback"]}),f&&e.jsx("div",{onClick:m=>m.target===m.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(N,{onSelect:U,accent:s,p:o}),c==="detail"&&b&&e.jsx(O,{feedbackId:b,accent:s,p:o,font:h}),c==="create"&&e.jsx(V,{accent:s,p:o,font:h,onDone:()=>a("list")})]}),y&&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 N({onSelect:i,accent:n,p:t}){const{feedItems:x,vote:g}=v(),s=x.filter(o=>o.status!=="CLOSED");return s.length?e.jsx(e.Fragment,{children:s.map(o=>{const f=o.userVote==="UP",p=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(),g(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 ${f?n:t.border}`,background:f?`${n}1a`:t.bgSoft},children:[e.jsx(I,{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:p}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[e.jsx(B,{type:o.type,p:t}),o.status==="PENDING"?e.jsx(W,{}):e.jsx(E,{status:o.status,p:t}),e.jsx("span",{style:{fontSize:11,color:t.textFaint},children:T(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 O({feedbackId:i,accent:n,p:t,font:x}){const{vote:g,getItem:s}=v(),[o,f]=r.useState(null),[p,l]=r.useState(!1);r.useEffect(()=>{let a=!1;return s(i).then(b=>{a||f(b)}).catch(()=>{}),()=>{a=!0}},[i,s]);async function y(){if(!(!o||p)){l(!0);try{await g(o.id,"UP");const a=await s(i);f(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(B,{type:o.type,p:t}),o.status==="PENDING"?e.jsx(W,{}):e.jsx(E,{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:y,disabled:p,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:x},children:[e.jsx(I,{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:T(i.createdAt)})]}),e.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:n.textSoft,margin:0},children:i.content})]})}function V({accent:i,p:n,font:t,onDone:x}){const{submit:g}=v(),[s,o]=r.useState(""),[f,p]=r.useState(""),[l,y]=r.useState("GENERAL"),[c,a]=r.useState(!1),[b,k]=r.useState(!1),[S,u]=r.useState("");async function j(){if(!(!s.trim()||c)){a(!0),u("");try{await g(s.trim(),f.trim()||s.trim(),l),k(!0),setTimeout(x,1200)}catch{u("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:()=>y(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:[F[d].icon,F[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:f,onChange:d=>p(d.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||!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 F={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"},q={BUG:"#d6453d",FEATURE:"#3b76d6"};function B({type:i,p:n}){return e.jsx("span",{style:{padding:"2px 8px",borderRadius:9999,fontSize:10.5,fontWeight:700,letterSpacing:".02em",background:_[i]??n.bgSoft,color:q[i]??n.textSoft},children:i})}const Y={OPEN:"#b45309",IN_PROGRESS:"#1d4ed8",DONE:"#15803d",CLOSED:"#6b7280"};function W(){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 E({status:i,p:n}){const t=Y[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 K({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 I({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 T(i){return new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"})}exports.FeedbackWidget=G;exports.UpstepProvider=H;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-DLrEC5_l.js"),D="#D97757",M={bg:"#ffffff",bgSoft:"#f6f5f2",bgHover:"#efede8",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},P={bg:"#1c1b19",bgSoft:"#262522",bgHover:"#302e2a",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function C(){if(typeof document>"u")return!1;const i=document.documentElement;return i.classList.contains("dark")||i.getAttribute("data-theme")==="dark"}function A(i){const[n,t]=r.useState(()=>i==="dark");return r.useEffect(()=>{if(i!=="auto"){t(i==="dark");return}if(t(C()),typeof MutationObserver>"u")return;const u=new MutationObserver(()=>t(C()));return u.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),()=>u.disconnect()},[i]),n?P:M}const z=r.createContext(null);function H({children:i,...n}){const[t]=r.useState(()=>new L.UpstepApiClient(n)),[u,g]=r.useState([]),[s,o]=r.useState(!1),[f,p]=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});g(x.items),p(x.showBranding??!0)}catch{}},[t]);r.useEffect(()=>{l()},[l]);const y=r.useCallback(async(x,j,h)=>{const d={content:j};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,j)=>{try{await t.vote(x,j),await l()}catch{}},[t,l]),a=r.useCallback(x=>t.getItem(x),[t]),b=r.useCallback(()=>o(!0),[]),k=r.useCallback(()=>o(!1),[]),S=r.useCallback(x=>t.setUserId(x),[t]);return e.jsx(z.Provider,{value:{client:t,feedItems:u,loadFeed:l,submit:y,vote:c,getItem:a,isOpen:s,open:b,close:k,identify:S,accentColor:n.accentColor??D,theme:n.theme??"auto",showBranding:f},children:i})}function v(){const i=r.useContext(z);if(!i)throw new Error("useUpstep must be used inside <UpstepProvider>");return i}function G({position:i="bottom-right",accentColor:n,theme:t,hideLauncher:u=!1}){const g=v(),s=n??g.accentColor,o=A(t??g.theme),{isOpen:f,open:p,close:l,showBranding:y}=g,[c,a]=r.useState("list"),[b,k]=r.useState(null),[S,x]=r.useState(!1);r.useEffect(()=>{const m=window.matchMedia("(max-width: 639px)");x(m.matches);const w=R=>x(R.matches);return m.addEventListener("change",w),()=>m.removeEventListener("change",w)},[]);const j=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 U(m){k(m),a("detail")}return e.jsxs(e.Fragment,{children:[!u&&e.jsxs("button",{onClick:p,style:{...j,zIndex:9998,display:"inline-flex",alignItems:"center",gap:7,background:s,color:"#fff",border:"none",borderRadius:9999,padding:S?"12px":"12px 18px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:h,boxShadow:"0 6px 20px rgba(26,25,21,.18)"},children:[e.jsx(K,{size:16}),!S&&"Feedback"]}),f&&e.jsx("div",{onClick:m=>m.target===m.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(N,{onSelect:U,accent:s,p:o}),c==="detail"&&b&&e.jsx(O,{feedbackId:b,accent:s,p:o,font:h}),c==="create"&&e.jsx(V,{accent:s,p:o,font:h,onDone:()=>a("list")})]}),y&&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 N({onSelect:i,accent:n,p:t}){const{feedItems:u,vote:g}=v(),s=u.filter(o=>o.status!=="CLOSED");return s.length?e.jsx(e.Fragment,{children:s.map(o=>{const f=o.userVote==="UP",p=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(),g(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 ${f?n:t.border}`,background:f?`${n}1a`:t.bgSoft},children:[e.jsx(I,{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:p}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[e.jsx(B,{type:o.type,p:t}),o.status==="PENDING"?e.jsx(W,{}):e.jsx(E,{status:o.status,boardStatus:o.boardStatus,p:t}),e.jsx("span",{style:{fontSize:11,color:t.textFaint},children:T(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 O({feedbackId:i,accent:n,p:t,font:u}){const{vote:g,getItem:s}=v(),[o,f]=r.useState(null),[p,l]=r.useState(!1);r.useEffect(()=>{let a=!1;return s(i).then(b=>{a||f(b)}).catch(()=>{}),()=>{a=!0}},[i,s]);async function y(){if(!(!o||p)){l(!0);try{await g(o.id,"UP");const a=await s(i);f(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(B,{type:o.type,p:t}),o.status==="PENDING"?e.jsx(W,{}):e.jsx(E,{status:o.status,boardStatus:o.boardStatus,p:t})]}),e.jsx("p",{style:{fontSize:15,lineHeight:1.6,color:t.textSoft,marginBottom:20},children:o.content}),e.jsxs("button",{onClick:y,disabled:p,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:u},children:[e.jsx(I,{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:T(i.createdAt)})]}),e.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:n.textSoft,margin:0},children:i.content})]})}function V({accent:i,p:n,font:t,onDone:u}){const{submit:g}=v(),[s,o]=r.useState(""),[f,p]=r.useState(""),[l,y]=r.useState("GENERAL"),[c,a]=r.useState(!1),[b,k]=r.useState(!1),[S,x]=r.useState("");async function j(){if(!(!s.trim()||c)){a(!0),x("");try{await g(s.trim(),f.trim()||s.trim(),l),k(!0),setTimeout(u,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:()=>y(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:[F[d].icon,F[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:f,onChange:d=>p(d.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||!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 F={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"},q={BUG:"#d6453d",FEATURE:"#3b76d6"};function B({type:i,p:n}){return e.jsx("span",{style:{padding:"2px 8px",borderRadius:9999,fontSize:10.5,fontWeight:700,letterSpacing:".02em",background:_[i]??n.bgSoft,color:q[i]??n.textSoft},children:i})}const Y={OPEN:"#b45309",IN_PROGRESS:"#1d4ed8",DONE:"#15803d",CLOSED:"#6b7280"};function W(){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 E({status:i,boardStatus:n,p:t}){const u=(n==null?void 0:n.color)??Y[i]??"#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:u,display:"inline-block",flexShrink:0}}),(n==null?void 0:n.name)??i.replace("_"," ")]})}function K({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 I({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 T(i){return new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"})}exports.FeedbackWidget=G;exports.UpstepProvider=H;exports.useUpstep=v;
|
package/dist/react.js
CHANGED
|
@@ -33,11 +33,11 @@ function V(i) {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
if (t(W()), typeof MutationObserver > "u") return;
|
|
36
|
-
const
|
|
37
|
-
return
|
|
36
|
+
const g = new MutationObserver(() => t(W()));
|
|
37
|
+
return g.observe(document.documentElement, {
|
|
38
38
|
attributes: !0,
|
|
39
39
|
attributeFilter: ["class", "data-theme"]
|
|
40
|
-
}), () =>
|
|
40
|
+
}), () => g.disconnect();
|
|
41
41
|
}, [i]), n ? j : O;
|
|
42
42
|
}
|
|
43
43
|
const T = H(null);
|
|
@@ -45,7 +45,7 @@ function oe({
|
|
|
45
45
|
children: i,
|
|
46
46
|
...n
|
|
47
47
|
}) {
|
|
48
|
-
const [t] = p(() => new N(n)), [
|
|
48
|
+
const [t] = p(() => new N(n)), [g, h] = p([]), [l, o] = p(!1), [u, b] = p(!0);
|
|
49
49
|
z(() => {
|
|
50
50
|
t.setUserId(n.userId);
|
|
51
51
|
}, [t, n.userId]);
|
|
@@ -76,7 +76,7 @@ function oe({
|
|
|
76
76
|
{
|
|
77
77
|
value: {
|
|
78
78
|
client: t,
|
|
79
|
-
feedItems:
|
|
79
|
+
feedItems: g,
|
|
80
80
|
loadFeed: d,
|
|
81
81
|
submit: S,
|
|
82
82
|
vote: c,
|
|
@@ -87,7 +87,7 @@ function oe({
|
|
|
87
87
|
identify: v,
|
|
88
88
|
accentColor: n.accentColor ?? $,
|
|
89
89
|
theme: n.theme ?? "auto",
|
|
90
|
-
showBranding:
|
|
90
|
+
showBranding: u
|
|
91
91
|
},
|
|
92
92
|
children: i
|
|
93
93
|
}
|
|
@@ -102,9 +102,9 @@ function ie({
|
|
|
102
102
|
position: i = "bottom-right",
|
|
103
103
|
accentColor: n,
|
|
104
104
|
theme: t,
|
|
105
|
-
hideLauncher:
|
|
105
|
+
hideLauncher: g = !1
|
|
106
106
|
}) {
|
|
107
|
-
const h = B(), l = n ?? h.accentColor, o = V(t ?? h.theme), { isOpen:
|
|
107
|
+
const h = B(), l = n ?? h.accentColor, o = V(t ?? h.theme), { isOpen: u, open: b, close: d, showBranding: S } = h, [c, s] = p("list"), [m, F] = p(null), [v, f] = p(!1);
|
|
108
108
|
z(() => {
|
|
109
109
|
const y = window.matchMedia("(max-width: 639px)");
|
|
110
110
|
f(y.matches);
|
|
@@ -121,7 +121,7 @@ function ie({
|
|
|
121
121
|
F(y), s("detail");
|
|
122
122
|
}
|
|
123
123
|
return /* @__PURE__ */ r(E, { children: [
|
|
124
|
-
!
|
|
124
|
+
!g && /* @__PURE__ */ r(
|
|
125
125
|
"button",
|
|
126
126
|
{
|
|
127
127
|
onClick: b,
|
|
@@ -148,7 +148,7 @@ function ie({
|
|
|
148
148
|
]
|
|
149
149
|
}
|
|
150
150
|
),
|
|
151
|
-
|
|
151
|
+
u && /* @__PURE__ */ e(
|
|
152
152
|
"div",
|
|
153
153
|
{
|
|
154
154
|
onClick: (y) => y.target === y.currentTarget && a(),
|
|
@@ -266,9 +266,9 @@ function _({
|
|
|
266
266
|
accent: n,
|
|
267
267
|
p: t
|
|
268
268
|
}) {
|
|
269
|
-
const { feedItems:
|
|
269
|
+
const { feedItems: g, vote: h } = B(), l = g.filter((o) => o.status !== "CLOSED");
|
|
270
270
|
return l.length ? /* @__PURE__ */ e(E, { children: l.map((o) => {
|
|
271
|
-
const
|
|
271
|
+
const u = o.userVote === "UP", b = o.title ?? o.content;
|
|
272
272
|
return /* @__PURE__ */ r(
|
|
273
273
|
"div",
|
|
274
274
|
{
|
|
@@ -301,8 +301,8 @@ function _({
|
|
|
301
301
|
borderRadius: 11,
|
|
302
302
|
cursor: "pointer",
|
|
303
303
|
flexShrink: 0,
|
|
304
|
-
border: `1px solid ${
|
|
305
|
-
background:
|
|
304
|
+
border: `1px solid ${u ? n : t.border}`,
|
|
305
|
+
background: u ? `${n}1a` : t.bgSoft
|
|
306
306
|
},
|
|
307
307
|
children: [
|
|
308
308
|
/* @__PURE__ */ e(D, { color: n }),
|
|
@@ -314,7 +314,7 @@ function _({
|
|
|
314
314
|
/* @__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: b }),
|
|
315
315
|
/* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
|
|
316
316
|
/* @__PURE__ */ e(U, { type: o.type, p: t }),
|
|
317
|
-
o.status === "PENDING" ? /* @__PURE__ */ e(L, {}) : /* @__PURE__ */ e(R, { status: o.status, p: t }),
|
|
317
|
+
o.status === "PENDING" ? /* @__PURE__ */ e(L, {}) : /* @__PURE__ */ e(R, { status: o.status, boardStatus: o.boardStatus, p: t }),
|
|
318
318
|
/* @__PURE__ */ e("span", { style: { fontSize: 11, color: t.textFaint }, children: M(o.createdAt) })
|
|
319
319
|
] })
|
|
320
320
|
] }),
|
|
@@ -328,12 +328,12 @@ function _({
|
|
|
328
328
|
/* @__PURE__ */ e("div", { style: { color: t.textFaint, fontSize: 14 }, children: "Be the first to share one." })
|
|
329
329
|
] });
|
|
330
330
|
}
|
|
331
|
-
function Y({ feedbackId: i, accent: n, p: t, font:
|
|
332
|
-
const { vote: h, getItem: l } = B(), [o,
|
|
331
|
+
function Y({ feedbackId: i, accent: n, p: t, font: g }) {
|
|
332
|
+
const { vote: h, getItem: l } = B(), [o, u] = p(null), [b, d] = p(!1);
|
|
333
333
|
z(() => {
|
|
334
334
|
let s = !1;
|
|
335
335
|
return l(i).then((m) => {
|
|
336
|
-
s ||
|
|
336
|
+
s || u(m);
|
|
337
337
|
}).catch(() => {
|
|
338
338
|
}), () => {
|
|
339
339
|
s = !0;
|
|
@@ -345,7 +345,7 @@ function Y({ feedbackId: i, accent: n, p: t, font: u }) {
|
|
|
345
345
|
try {
|
|
346
346
|
await h(o.id, "UP");
|
|
347
347
|
const s = await l(i);
|
|
348
|
-
|
|
348
|
+
u(s);
|
|
349
349
|
} catch {
|
|
350
350
|
} finally {
|
|
351
351
|
d(!1);
|
|
@@ -359,7 +359,7 @@ function Y({ feedbackId: i, accent: n, p: t, font: u }) {
|
|
|
359
359
|
c && /* @__PURE__ */ e("div", { style: { fontSize: 20, fontWeight: 700, color: t.text, letterSpacing: "-.02em", marginBottom: 10, lineHeight: 1.3 }, children: c }),
|
|
360
360
|
/* @__PURE__ */ r("div", { style: { display: "flex", gap: 6, marginBottom: 14, flexWrap: "wrap" }, children: [
|
|
361
361
|
/* @__PURE__ */ e(U, { type: o.type, p: t }),
|
|
362
|
-
o.status === "PENDING" ? /* @__PURE__ */ e(L, {}) : /* @__PURE__ */ e(R, { status: o.status, p: t })
|
|
362
|
+
o.status === "PENDING" ? /* @__PURE__ */ e(L, {}) : /* @__PURE__ */ e(R, { status: o.status, boardStatus: o.boardStatus, p: t })
|
|
363
363
|
] }),
|
|
364
364
|
/* @__PURE__ */ e("p", { style: { fontSize: 15, lineHeight: 1.6, color: t.textSoft, marginBottom: 20 }, children: o.content }),
|
|
365
365
|
/* @__PURE__ */ r(
|
|
@@ -376,7 +376,7 @@ function Y({ feedbackId: i, accent: n, p: t, font: u }) {
|
|
|
376
376
|
borderRadius: 12,
|
|
377
377
|
padding: "10px 16px",
|
|
378
378
|
cursor: "pointer",
|
|
379
|
-
fontFamily:
|
|
379
|
+
fontFamily: g
|
|
380
380
|
},
|
|
381
381
|
children: [
|
|
382
382
|
/* @__PURE__ */ e(D, { color: n, size: 13 }),
|
|
@@ -400,13 +400,13 @@ function q({ comment: i, p: n, accent: t }) {
|
|
|
400
400
|
/* @__PURE__ */ e("p", { style: { fontSize: 14, lineHeight: 1.5, color: n.textSoft, margin: 0 }, children: i.content })
|
|
401
401
|
] });
|
|
402
402
|
}
|
|
403
|
-
function K({ accent: i, p: n, font: t, onDone:
|
|
404
|
-
const { submit: h } = B(), [l, o] = p(""), [
|
|
403
|
+
function K({ accent: i, p: n, font: t, onDone: g }) {
|
|
404
|
+
const { submit: h } = B(), [l, o] = p(""), [u, b] = p(""), [d, S] = p("GENERAL"), [c, s] = p(!1), [m, F] = p(!1), [v, f] = p("");
|
|
405
405
|
async function k() {
|
|
406
406
|
if (!(!l.trim() || c)) {
|
|
407
407
|
s(!0), f("");
|
|
408
408
|
try {
|
|
409
|
-
await h(l.trim(),
|
|
409
|
+
await h(l.trim(), u.trim() || l.trim(), d), F(!0), setTimeout(g, 1200);
|
|
410
410
|
} catch {
|
|
411
411
|
f("Something went wrong. Please try again.");
|
|
412
412
|
} finally {
|
|
@@ -479,7 +479,7 @@ function K({ accent: i, p: n, font: t, onDone: u }) {
|
|
|
479
479
|
/* @__PURE__ */ e(
|
|
480
480
|
"textarea",
|
|
481
481
|
{
|
|
482
|
-
value:
|
|
482
|
+
value: u,
|
|
483
483
|
onChange: (a) => b(a.target.value),
|
|
484
484
|
placeholder: "Steps to reproduce, expected behaviour, or more context",
|
|
485
485
|
maxLength: 2e3,
|
|
@@ -554,11 +554,15 @@ function L() {
|
|
|
554
554
|
"Pending review"
|
|
555
555
|
] });
|
|
556
556
|
}
|
|
557
|
-
function R({
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
557
|
+
function R({
|
|
558
|
+
status: i,
|
|
559
|
+
boardStatus: n,
|
|
560
|
+
p: t
|
|
561
|
+
}) {
|
|
562
|
+
const g = (n == null ? void 0 : n.color) ?? X[i] ?? "#9ca3af";
|
|
563
|
+
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: [
|
|
564
|
+
/* @__PURE__ */ e("span", { style: { width: 6, height: 6, borderRadius: "50%", background: g, display: "inline-block", flexShrink: 0 } }),
|
|
565
|
+
(n == null ? void 0 : n.name) ?? i.replace("_", " ")
|
|
562
566
|
] });
|
|
563
567
|
}
|
|
564
568
|
function Z({ size: i = 16, color: n = "currentColor" }) {
|
package/dist/widget.d.ts.map
CHANGED
|
@@ -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;AAoH3C,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,SAAS,CAAY;IAC7B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,eAAe,EAAE,OAAO,GAAE,aAAkB;IAShE,KAAK;IAKL,4EAA4E;IAC5E,UAAU;IAIV,iDAAiD;IACjD,WAAW;IAIX,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,aAAa;IA4ErB,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,UAAU;YAKJ,SAAS;IAUvB,OAAO,CAAC,WAAW;IAyCnB,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,UAAU;
|
|
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;AAoH3C,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,SAAS,CAAY;IAC7B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,eAAe,EAAE,OAAO,GAAE,aAAkB;IAShE,KAAK;IAKL,4EAA4E;IAC5E,UAAU;IAIV,iDAAiD;IACjD,WAAW;IAIX,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,aAAa;IA4ErB,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,UAAU;YAKJ,SAAS;IAUvB,OAAO,CAAC,WAAW;IAyCnB,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,UAAU;IAyBlB,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.
|
|
3
|
+
"version": "0.5.12",
|
|
4
4
|
"description": "Upstep feedback widget for web apps",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://upstep.dev",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@upstep/types": "0.5.
|
|
39
|
+
"@upstep/types": "0.5.6"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=18",
|