@upstep/js 0.5.8 → 0.5.10
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/LICENSE +21 -0
- package/README.md +84 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +27 -22
- package/dist/react.cjs +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +96 -87
- package/dist/widget.d.ts +1 -0
- package/dist/widget.d.ts.map +1 -1
- package/package.json +17 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Upstep
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @upstep/js
|
|
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 a React app, a vanilla JS app, or a plain HTML page with no build step, in two lines of code.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @upstep/js
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Get an API key by creating a free project at [upstep.dev](https://upstep.dev) — no credit card required.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
### React
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { UpstepProvider, FeedbackWidget } from "@upstep/js/react";
|
|
19
|
+
|
|
20
|
+
export default function App({ children }) {
|
|
21
|
+
return (
|
|
22
|
+
<UpstepProvider apiKey="upstep_xxx">
|
|
23
|
+
{children}
|
|
24
|
+
<FeedbackWidget />
|
|
25
|
+
</UpstepProvider>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Vanilla JavaScript
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import Upstep from "@upstep/js";
|
|
34
|
+
|
|
35
|
+
// Mounts the feedback button automatically
|
|
36
|
+
Upstep.init({ apiKey: "upstep_xxx" });
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### No build step (WordPress, Webflow, Shopify, static HTML)
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<script
|
|
43
|
+
type="module"
|
|
44
|
+
src="https://unpkg.com/@upstep/js/dist/index.js"
|
|
45
|
+
data-api-key="upstep_xxx"
|
|
46
|
+
></script>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
All three report to the same project, so feedback from your React app, a script tag on your marketing site, and (if you add [`@upstep/react-native`](https://www.npmjs.com/package/@upstep/react-native)) your mobile app all land on one board, sorted by votes.
|
|
50
|
+
|
|
51
|
+
## Configuration
|
|
52
|
+
|
|
53
|
+
Every entry point (`Upstep.init`, `<UpstepProvider>`, and the script tag's `data-*` attributes) takes the same options:
|
|
54
|
+
|
|
55
|
+
| Option | Type | Default | Description |
|
|
56
|
+
| --- | --- | --- | --- |
|
|
57
|
+
| `apiKey` | `string` | — | **Required.** Your project's API key. |
|
|
58
|
+
| `userId` | `string` | — | End-user id from your app, used to deduplicate votes per user. Call `identify(userId)` if it's only known after login. |
|
|
59
|
+
| `baseUrl` | `string` | `https://upstep.dev` | Only needed for self-hosted or staging setups. |
|
|
60
|
+
| `accentColor` | `string` | `#D97757` | Any CSS color, used for the launcher button and highlights. |
|
|
61
|
+
| `theme` | `"light" \| "dark" \| "auto"` | `"auto"` | `"auto"` follows the host page's `prefers-color-scheme`. |
|
|
62
|
+
| `position` | `"left" \| "right"` | `"right"` | Which corner the launcher button docks to. |
|
|
63
|
+
| `launcher` | `boolean` | `true` | Set `false` to hide the floating button and trigger the widget yourself via `Upstep.open()`. |
|
|
64
|
+
|
|
65
|
+
## API
|
|
66
|
+
|
|
67
|
+
### Vanilla / script-tag (`Upstep` default export)
|
|
68
|
+
|
|
69
|
+
- `Upstep.init(config)` — mounts the widget, returns the underlying API client.
|
|
70
|
+
- `Upstep.open()` / `Upstep.close()` — open or close the widget from your own UI (e.g. a nav link).
|
|
71
|
+
- `Upstep.identify(userId)` — set or update the end-user id after the widget has mounted.
|
|
72
|
+
- `Upstep.client` — the raw `UpstepApiClient` instance, if you want to call the API directly.
|
|
73
|
+
|
|
74
|
+
### React (`@upstep/js/react`)
|
|
75
|
+
|
|
76
|
+
- `<UpstepProvider apiKey="..." />` — wraps your app, all `UpstepConfig` options are valid props.
|
|
77
|
+
- `<FeedbackWidget position? accentColor? theme? hideLauncher? />` — the launcher button and panel. Renders nothing until it's shown; safe to mount once near the root.
|
|
78
|
+
- `useUpstep()` — the same state and actions the widget uses (`feedItems`, `submit`, `vote`, `open`, `close`, `identify`, ...), if you want to build your own UI on top instead of the default widget.
|
|
79
|
+
|
|
80
|
+
## Links
|
|
81
|
+
|
|
82
|
+
- [Full documentation](https://upstep.dev/#integrate)
|
|
83
|
+
- [Dashboard / sign up](https://upstep.dev/login)
|
|
84
|
+
- [@upstep/react-native](https://www.npmjs.com/package/@upstep/react-native) for React Native 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 v=require("./api-BvhrcMKU.js"),E="#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 L(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 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>';class C{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??
|
|
50
|
+
`}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>';class C{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??E,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=L(this.accent,this.position,this.palette),document.head.appendChild(e)}renderButton(){const e=document.createElement("button");e.id="upstep-btn",e.innerHTML=`${S}<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 w=()=>{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{}},$=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"},M=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&&w())};e.addEventListener("pointerdown",$),e.addEventListener("pointermove",M),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>
|
|
@@ -86,4 +86,4 @@
|
|
|
86
86
|
<span class="upstep-feedback-date">${new Date(e.createdAt).toLocaleDateString()}</span>
|
|
87
87
|
</div>
|
|
88
88
|
</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 F(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let p=null,l=null;const
|
|
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 F(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let p=null,l=null;const k={init(o){if(p=new v.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 C(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),k.init(d)}}exports.UpstepApiClient=v.UpstepApiClient;exports.default=k;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as
|
|
2
|
-
const
|
|
1
|
+
import { U as $ } from "./api-B-umoNRf.mjs";
|
|
2
|
+
const M = "#D97757", x = {
|
|
3
3
|
bg: "#ffffff",
|
|
4
4
|
bgSoft: "#f6f5f2",
|
|
5
5
|
bgHover: "#efede8",
|
|
@@ -8,7 +8,7 @@ const k = "#D97757", w = {
|
|
|
8
8
|
textFaint: "#9b9890",
|
|
9
9
|
border: "#e8e6df",
|
|
10
10
|
overlay: "rgba(26,25,21,.45)"
|
|
11
|
-
},
|
|
11
|
+
}, m = {
|
|
12
12
|
bg: "#1c1b19",
|
|
13
13
|
bgSoft: "#262522",
|
|
14
14
|
bgHover: "#302e2a",
|
|
@@ -18,8 +18,13 @@ const k = "#D97757", w = {
|
|
|
18
18
|
border: "#33312c",
|
|
19
19
|
overlay: "rgba(0,0,0,.6)"
|
|
20
20
|
};
|
|
21
|
-
function
|
|
22
|
-
|
|
21
|
+
function y(o) {
|
|
22
|
+
if (o === "light" || o === "dark") return o;
|
|
23
|
+
if (typeof document < "u") {
|
|
24
|
+
const e = document.documentElement;
|
|
25
|
+
return e.classList.contains("dark") || e.getAttribute("data-theme") === "dark" ? "dark" : "light";
|
|
26
|
+
}
|
|
27
|
+
return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
23
28
|
}
|
|
24
29
|
function E(o, e, t) {
|
|
25
30
|
return `
|
|
@@ -74,9 +79,9 @@ function E(o, e, t) {
|
|
|
74
79
|
`;
|
|
75
80
|
}
|
|
76
81
|
const L = '<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>';
|
|
77
|
-
class
|
|
82
|
+
class S {
|
|
78
83
|
constructor(e, t = {}) {
|
|
79
|
-
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 ?? M, this.position = t.position ?? "right", this.showLauncher = t.launcher !== !1, this.themeMode = t.theme ?? "auto", this.palette = y(this.themeMode) === "dark" ? m : x;
|
|
80
85
|
}
|
|
81
86
|
mount() {
|
|
82
87
|
this.injectStyles(), this.showLauncher && this.renderButton();
|
|
@@ -111,30 +116,30 @@ class F {
|
|
|
111
116
|
}
|
|
112
117
|
} catch {
|
|
113
118
|
}
|
|
114
|
-
let r = 0, c = 0, d = 0,
|
|
115
|
-
const
|
|
119
|
+
let r = 0, c = 0, d = 0, h = 0, b = !1;
|
|
120
|
+
const v = () => {
|
|
116
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;
|
|
117
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`;
|
|
118
123
|
try {
|
|
119
124
|
localStorage.setItem(s, JSON.stringify({ side: a, bottom: g }));
|
|
120
125
|
} catch {
|
|
121
126
|
}
|
|
122
|
-
},
|
|
127
|
+
}, k = (i) => {
|
|
123
128
|
if (i.pointerType === "mouse" && i.button !== 0) return;
|
|
124
129
|
this.dragMoved = !1, b = !0;
|
|
125
130
|
const a = e.getBoundingClientRect();
|
|
126
|
-
r = i.clientX, c = i.clientY, d = a.left,
|
|
127
|
-
},
|
|
131
|
+
r = i.clientX, c = i.clientY, d = a.left, h = a.top, e.setPointerCapture(i.pointerId), e.style.transition = "none";
|
|
132
|
+
}, w = (i) => {
|
|
128
133
|
if (!b) return;
|
|
129
134
|
const a = i.clientX - r, u = i.clientY - c;
|
|
130
|
-
!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 = `${
|
|
131
|
-
},
|
|
132
|
-
b && (b = !1, e.classList.remove("upstep-dragging"), this.dragMoved &&
|
|
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
|
+
}, f = () => {
|
|
137
|
+
b && (b = !1, e.classList.remove("upstep-dragging"), this.dragMoved && v());
|
|
133
138
|
};
|
|
134
|
-
e.addEventListener("pointerdown",
|
|
139
|
+
e.addEventListener("pointerdown", k), e.addEventListener("pointermove", w), e.addEventListener("pointerup", f), e.addEventListener("pointercancel", f);
|
|
135
140
|
}
|
|
136
141
|
openModal() {
|
|
137
|
-
this.isOpen = !0, this.fetchFeed(), this.renderModal();
|
|
142
|
+
this.isOpen = !0, this.palette = y(this.themeMode) === "dark" ? m : x, this.injectStyles(), this.fetchFeed(), this.renderModal();
|
|
138
143
|
}
|
|
139
144
|
closeModal() {
|
|
140
145
|
var e;
|
|
@@ -201,7 +206,7 @@ class F {
|
|
|
201
206
|
<span class="upstep-vote-count">${e.upvotes}</span>
|
|
202
207
|
</button>
|
|
203
208
|
<div class="upstep-feedback-main">
|
|
204
|
-
<p class="upstep-feedback-content">${
|
|
209
|
+
<p class="upstep-feedback-content">${F(e.content)}</p>
|
|
205
210
|
<div class="upstep-feedback-meta">
|
|
206
211
|
<span class="upstep-badge upstep-badge-${e.type.toLowerCase()}">${e.type}</span>
|
|
207
212
|
<span class="upstep-feedback-date">${new Date(e.createdAt).toLocaleDateString()}</span>
|
|
@@ -248,17 +253,17 @@ class F {
|
|
|
248
253
|
});
|
|
249
254
|
}
|
|
250
255
|
}
|
|
251
|
-
function
|
|
256
|
+
function F(o) {
|
|
252
257
|
return o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
253
258
|
}
|
|
254
259
|
let p = null, l = null;
|
|
255
260
|
const C = {
|
|
256
261
|
init(o) {
|
|
257
|
-
if (p = new
|
|
262
|
+
if (p = new $(o), typeof window < "u") {
|
|
258
263
|
const e = {};
|
|
259
264
|
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);
|
|
260
265
|
const t = () => {
|
|
261
|
-
l = new
|
|
266
|
+
l = new S(p, e), l.mount();
|
|
262
267
|
};
|
|
263
268
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t) : t();
|
|
264
269
|
}
|
|
@@ -289,6 +294,6 @@ if (typeof document < "u") {
|
|
|
289
294
|
}
|
|
290
295
|
}
|
|
291
296
|
export {
|
|
292
|
-
|
|
297
|
+
$ as UpstepApiClient,
|
|
293
298
|
C as default
|
|
294
299
|
};
|
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-BvhrcMKU.js"),R="#D97757",M={bg:"#ffffff",bgSoft:"#f6f5f2",bgHover:"#efede8",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},D={bg:"#1c1b19",bgSoft:"#262522",bgHover:"#302e2a",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function P(i){const[n,t]=r.useState(()=>i==="dark");return r.useEffect(()=>{if(i!=="auto"||typeof window>"u"||!window.matchMedia){t(i==="dark");return}const f=window.matchMedia("(prefers-color-scheme: dark)"),u=s=>t(s.matches);return t(f.matches),f.addEventListener("change",u),()=>f.removeEventListener("change",u)},[i]),n?D:M}const F=r.createContext(null);function A({children:i,...n}){const[t]=r.useState(()=>new L.UpstepApiClient(n)),[f,u]=r.useState([]),[s,o]=r.useState(!1),[g,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});u(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),[]),v=r.useCallback(()=>o(!1),[]),S=r.useCallback(x=>t.setUserId(x),[t]);return e.jsx(F.Provider,{value:{client:t,feedItems:f,loadFeed:l,submit:y,vote:c,getItem:a,isOpen:s,open:b,close:v,identify:S,accentColor:n.accentColor??R,theme:n.theme??"auto",showBranding:g},children:i})}function k(){const i=r.useContext(F);if(!i)throw new Error("useUpstep must be used inside <UpstepProvider>");return i}function G({position:i="bottom-right",accentColor:n,theme:t,hideLauncher:f=!1}){const u=k(),s=n??u.accentColor,o=P(t??u.theme),{isOpen:g,open:p,close:l,showBranding:y}=u,[c,a]=r.useState("list"),[b,v]=r.useState(null),[S,x]=r.useState(!1);r.useEffect(()=>{const m=window.matchMedia("(max-width: 639px)");x(m.matches);const w=U=>x(U.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"),v(null)},300)}function T(m){v(m),a("detail")}return e.jsxs(e.Fragment,{children:[!f&&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(Y,{size:16}),!S&&"Feedback"]}),g&&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(H,{onSelect:T,accent:s,p:o}),c==="detail"&&b&&e.jsx(N,{feedbackId:b,accent:s,p:o,font:h}),c==="create"&&e.jsx(O,{accent:s,p:o,font:h,onDone:()=>a("list")})]}),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 H({onSelect:i,accent:n,p:t}){const{feedItems:f,vote:u}=k(),s=f.filter(o=>o.status!=="CLOSED");return s.length?e.jsx(e.Fragment,{children:s.map(o=>{const g=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(),u(o.id,"UP")},style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minWidth:46,padding:"7px 0",borderRadius:11,cursor:"pointer",flexShrink:0,border:`1px solid ${g?n:t.border}`,background:g?`${n}1a`:t.bgSoft},children:[e.jsx(E,{color:n}),e.jsx("span",{style:{fontSize:14,fontWeight:700,color:t.text,lineHeight:1.1},children:o.upvotes})]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("p",{style:{fontSize:13.5,fontWeight:600,lineHeight:1.4,color:t.text,margin:"0 0 6px",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:p}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[e.jsx(z,{type:o.type,p:t}),o.status==="PENDING"?e.jsx(B,{}):e.jsx(W,{status:o.status,p:t}),e.jsx("span",{style:{fontSize:11,color:t.textFaint},children:I(o.createdAt)})]})]}),e.jsx("span",{style:{color:t.textFaint,fontSize:18,alignSelf:"center",flexShrink:0},children:"›"})]},o.id)})}):e.jsxs("div",{style:{textAlign:"center",padding:"40px 0"},children:[e.jsx("div",{style:{color:t.textSoft,fontSize:15,fontWeight:600,marginBottom:4},children:"No open feedback yet"}),e.jsx("div",{style:{color:t.textFaint,fontSize:14},children:"Be the first to share one."})]})}function N({feedbackId:i,accent:n,p:t,font:f}){const{vote:u,getItem:s}=k(),[o,g]=r.useState(null),[p,l]=r.useState(!1);r.useEffect(()=>{let a=!1;return s(i).then(b=>{a||g(b)}).catch(()=>{}),()=>{a=!0}},[i,s]);async function y(){if(!(!o||p)){l(!0);try{await u(o.id,"UP");const a=await s(i);g(a)}catch{}finally{l(!1)}}}if(!o)return e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:t.textFaint,fontSize:14},children:"Loading…"});const c=o.title;return e.jsxs("div",{children:[c&&e.jsx("div",{style:{fontSize:20,fontWeight:700,color:t.text,letterSpacing:"-.02em",marginBottom:10,lineHeight:1.3},children:c}),e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:14,flexWrap:"wrap"},children:[e.jsx(z,{type:o.type,p:t}),o.status==="PENDING"?e.jsx(B,{}):e.jsx(W,{status:o.status,p:t})]}),e.jsx("p",{style:{fontSize:15,lineHeight:1.6,color:t.textSoft,marginBottom:20},children:o.content}),e.jsxs("button",{onClick: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:f},children:[e.jsx(E,{color:n,size:13}),e.jsx("span",{style:{fontSize:18,fontWeight:700,color:t.text},children:o.upvotes}),e.jsx("span",{style:{fontSize:13,color:t.textFaint},children:o.userVote==="UP"?"Upvoted":"Upvote"})]}),o.comments.length>0&&e.jsxs("div",{style:{marginTop:28,borderTop:`1px solid ${t.border}`,paddingTop:20},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:t.textFaint,marginBottom:12,textTransform:"uppercase"},children:"Developer response"}),o.comments.map(a=>e.jsx($,{comment:a,p:t,accent:n},a.id))]})]})}function $({comment:i,p:n,accent:t}){return e.jsxs("div",{style:{background:n.bgSoft,border:`1px solid ${n.border}`,borderRadius:12,padding:14,marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("span",{style:{background:`${t}20`,color:t,fontSize:11,fontWeight:700,borderRadius:20,padding:"2px 8px"},children:"Developer"}),e.jsx("span",{style:{fontSize:11,color:n.textFaint},children:I(i.createdAt)})]}),e.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:n.textSoft,margin:0},children:i.content})]})}function O({accent:i,p:n,font:t,onDone:f}){const{submit:u}=k(),[s,o]=r.useState(""),[g,p]=r.useState(""),[l,y]=r.useState("GENERAL"),[c,a]=r.useState(!1),[b,v]=r.useState(!1),[S,x]=r.useState("");async function j(){if(!(!s.trim()||c)){a(!0),x("");try{await u(s.trim(),g.trim()||s.trim(),l),v(!0),setTimeout(f,1200)}catch{x("Something went wrong. Please try again.")}finally{a(!1)}}}if(b)return e.jsxs("div",{style:{textAlign:"center",paddingTop:40},children:[e.jsx("div",{style:{fontSize:18,fontWeight:700,color:n.text,marginBottom:6},children:"Submitted"}),e.jsx("div",{style:{fontSize:14,color:n.textFaint},children:"Feedback received. Thank you."})]});const h={width:"100%",border:`1px solid ${n.border}`,borderRadius:12,padding:"10px 12px",fontSize:14,lineHeight:1.5,outline:"none",background:n.bgSoft,color:n.text,fontFamily:t,boxSizing:"border-box"};return e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:"Type"}),e.jsx("div",{style:{display:"flex",gap:7,marginBottom:16},children:["BUG","FEATURE","GENERAL"].map(d=>e.jsxs("button",{onClick:()=>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:[C[d].icon,C[d].label]},d))}),e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:"Title"}),e.jsx("input",{value:s,onChange:d=>o(d.target.value),placeholder:"Short summary of the issue or idea",maxLength:200,style:{...h,marginBottom:16,display:"block"}}),e.jsxs("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:["Description ",e.jsx("span",{style:{fontWeight:400,textTransform:"none",letterSpacing:0},children:"(optional)"})]}),e.jsx("textarea",{value:g,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 C={BUG:{label:"Bug",icon:e.jsxs("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("ellipse",{cx:"8",cy:"10",rx:"3.5",ry:"4.5"}),e.jsx("path",{d:"M8 5.5V4M5.5 6.5 3.5 5M10.5 6.5 12.5 5M4.5 10.5 2.5 10M11.5 10.5 13.5 10"})]})},FEATURE:{label:"Feature",icon:e.jsxs("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M8 2v1.5M8 12.5V14M2 8h1.5M12.5 8H14M4.1 4.1l1 1M10.9 10.9l1 1M11.9 4.1l-1 1M5.1 10.9l-1 1"}),e.jsx("circle",{cx:"8",cy:"8",r:"2.5"})]})},GENERAL:{label:"General",icon:e.jsx("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M14 9a2 2 0 0 1-2 2H5L2 14V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5z"})})}},V={BUG:"#fdecec",FEATURE:"#e9f0fd"},_={BUG:"#d6453d",FEATURE:"#3b76d6"};function z({type:i,p:n}){return e.jsx("span",{style:{padding:"2px 8px",borderRadius:9999,fontSize:10.5,fontWeight:700,letterSpacing:".02em",background:V[i]??n.bgSoft,color:_[i]??n.textSoft},children:i})}const q={OPEN:"#b45309",IN_PROGRESS:"#1d4ed8",DONE:"#15803d",CLOSED:"#6b7280"};function B(){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:"#fff7ed",border:"1px solid #fed7aa",borderRadius:6,padding:"1px 6px",fontSize:10,fontWeight:700,color:"#ea580c"},children:[e.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:"#ea580c",display:"inline-block"}}),"Pending review"]})}function W({status:i,p:n}){const t=q[i]??"#9ca3af";return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,background:n.bgSoft,border:`1px solid ${n.border}`,borderRadius:6,padding:"2px 8px",fontSize:10,fontWeight:600,color:n.textSoft},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:t,display:"inline-block",flexShrink:0}}),i.replace("_"," ")]})}function Y({size:i=16,color:n="currentColor"}){return e.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function E({color:i="currentColor",size:n=11}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"none",stroke:i,strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M8 13V3M3 8l5-5 5 5"})})}function I(i){return new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"})}exports.FeedbackWidget=G;exports.UpstepProvider=A;exports.useUpstep=k;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),L=require("./api-BvhrcMKU.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;
|
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;
|
|
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;AAsE3C,UAAU,kBAAkB;IAC1B,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC/D,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;CACvB;AAID,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,YAAY,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,qBA6DxC;AAED,wBAAgB,SAAS,IAAI,kBAAkB,CAI9C;AAID,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAID,wBAAgB,cAAc,CAAC,EAC7B,QAAyB,EACzB,WAAW,EACX,KAAK,EACL,YAAoB,GACrB,EAAE,mBAAmB,qBAoJrB"}
|
package/dist/react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as r, Fragment as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { U as
|
|
4
|
-
const
|
|
1
|
+
import { jsxs as r, Fragment as E, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as H, useState as p, useEffect as z, useCallback as w, useContext as G } from "react";
|
|
3
|
+
import { U as N } from "./api-B-umoNRf.mjs";
|
|
4
|
+
const $ = "#D97757", O = {
|
|
5
5
|
bg: "#ffffff",
|
|
6
6
|
bgSoft: "#f6f5f2",
|
|
7
7
|
bgHover: "#efede8",
|
|
@@ -20,39 +20,48 @@ const N = "#D97757", $ = {
|
|
|
20
20
|
border: "#33312c",
|
|
21
21
|
overlay: "rgba(0,0,0,.6)"
|
|
22
22
|
};
|
|
23
|
-
function
|
|
24
|
-
|
|
23
|
+
function W() {
|
|
24
|
+
if (typeof document > "u") return !1;
|
|
25
|
+
const i = document.documentElement;
|
|
26
|
+
return i.classList.contains("dark") || i.getAttribute("data-theme") === "dark";
|
|
27
|
+
}
|
|
28
|
+
function V(i) {
|
|
29
|
+
const [n, t] = p(() => i === "dark");
|
|
25
30
|
return z(() => {
|
|
26
|
-
if (i !== "auto"
|
|
31
|
+
if (i !== "auto") {
|
|
27
32
|
t(i === "dark");
|
|
28
33
|
return;
|
|
29
34
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
if (t(W()), typeof MutationObserver > "u") return;
|
|
36
|
+
const u = new MutationObserver(() => t(W()));
|
|
37
|
+
return u.observe(document.documentElement, {
|
|
38
|
+
attributes: !0,
|
|
39
|
+
attributeFilter: ["class", "data-theme"]
|
|
40
|
+
}), () => u.disconnect();
|
|
41
|
+
}, [i]), n ? j : O;
|
|
33
42
|
}
|
|
34
|
-
const
|
|
35
|
-
function
|
|
43
|
+
const T = H(null);
|
|
44
|
+
function oe({
|
|
36
45
|
children: i,
|
|
37
46
|
...n
|
|
38
47
|
}) {
|
|
39
|
-
const [t] =
|
|
48
|
+
const [t] = p(() => new N(n)), [u, h] = p([]), [l, o] = p(!1), [g, b] = p(!0);
|
|
40
49
|
z(() => {
|
|
41
50
|
t.setUserId(n.userId);
|
|
42
51
|
}, [t, n.userId]);
|
|
43
52
|
const d = w(async () => {
|
|
44
53
|
try {
|
|
45
54
|
const f = await t.listFeedback({ sort: "votes", limit: 20 });
|
|
46
|
-
|
|
55
|
+
h(f.items), b(f.showBranding ?? !0);
|
|
47
56
|
} catch {
|
|
48
57
|
}
|
|
49
58
|
}, [t]);
|
|
50
59
|
z(() => {
|
|
51
60
|
d();
|
|
52
61
|
}, [d]);
|
|
53
|
-
const S = w(async (f, k,
|
|
62
|
+
const S = w(async (f, k, x) => {
|
|
54
63
|
const a = { content: k };
|
|
55
|
-
f.trim() && (a.title = f.trim()),
|
|
64
|
+
f.trim() && (a.title = f.trim()), x !== void 0 && (a.type = x), await t.submitFeedback(a), await d();
|
|
56
65
|
}, [t, d]), c = w(async (f, k) => {
|
|
57
66
|
try {
|
|
58
67
|
await t.vote(f, k), await d();
|
|
@@ -63,11 +72,11 @@ function ne({
|
|
|
63
72
|
[t]
|
|
64
73
|
), m = w(() => o(!0), []), F = w(() => o(!1), []), v = w((f) => t.setUserId(f), [t]);
|
|
65
74
|
return /* @__PURE__ */ e(
|
|
66
|
-
|
|
75
|
+
T.Provider,
|
|
67
76
|
{
|
|
68
77
|
value: {
|
|
69
78
|
client: t,
|
|
70
|
-
feedItems:
|
|
79
|
+
feedItems: u,
|
|
71
80
|
loadFeed: d,
|
|
72
81
|
submit: S,
|
|
73
82
|
vote: c,
|
|
@@ -76,46 +85,46 @@ function ne({
|
|
|
76
85
|
open: m,
|
|
77
86
|
close: F,
|
|
78
87
|
identify: v,
|
|
79
|
-
accentColor: n.accentColor ??
|
|
88
|
+
accentColor: n.accentColor ?? $,
|
|
80
89
|
theme: n.theme ?? "auto",
|
|
81
|
-
showBranding:
|
|
90
|
+
showBranding: g
|
|
82
91
|
},
|
|
83
92
|
children: i
|
|
84
93
|
}
|
|
85
94
|
);
|
|
86
95
|
}
|
|
87
96
|
function B() {
|
|
88
|
-
const i = G(
|
|
97
|
+
const i = G(T);
|
|
89
98
|
if (!i) throw new Error("useUpstep must be used inside <UpstepProvider>");
|
|
90
99
|
return i;
|
|
91
100
|
}
|
|
92
|
-
function
|
|
101
|
+
function ie({
|
|
93
102
|
position: i = "bottom-right",
|
|
94
103
|
accentColor: n,
|
|
95
104
|
theme: t,
|
|
96
|
-
hideLauncher:
|
|
105
|
+
hideLauncher: u = !1
|
|
97
106
|
}) {
|
|
98
|
-
const
|
|
107
|
+
const h = B(), l = n ?? h.accentColor, o = V(t ?? h.theme), { isOpen: g, open: b, close: d, showBranding: S } = h, [c, s] = p("list"), [m, F] = p(null), [v, f] = p(!1);
|
|
99
108
|
z(() => {
|
|
100
109
|
const y = window.matchMedia("(max-width: 639px)");
|
|
101
110
|
f(y.matches);
|
|
102
111
|
const C = (P) => f(P.matches);
|
|
103
112
|
return y.addEventListener("change", C), () => y.removeEventListener("change", C);
|
|
104
113
|
}, []);
|
|
105
|
-
const k = i === "bottom-left" ? { position: "fixed", bottom: 24, left: 24 } : { position: "fixed", bottom: 24, right: 24 },
|
|
114
|
+
const k = i === "bottom-left" ? { position: "fixed", bottom: 24, left: 24 } : { position: "fixed", bottom: 24, right: 24 }, x = '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif';
|
|
106
115
|
function a() {
|
|
107
116
|
d(), setTimeout(() => {
|
|
108
117
|
s("list"), F(null);
|
|
109
118
|
}, 300);
|
|
110
119
|
}
|
|
111
|
-
function
|
|
120
|
+
function A(y) {
|
|
112
121
|
F(y), s("detail");
|
|
113
122
|
}
|
|
114
|
-
return /* @__PURE__ */ r(
|
|
115
|
-
!
|
|
123
|
+
return /* @__PURE__ */ r(E, { children: [
|
|
124
|
+
!u && /* @__PURE__ */ r(
|
|
116
125
|
"button",
|
|
117
126
|
{
|
|
118
|
-
onClick:
|
|
127
|
+
onClick: b,
|
|
119
128
|
style: {
|
|
120
129
|
...k,
|
|
121
130
|
zIndex: 9998,
|
|
@@ -130,16 +139,16 @@ function oe({
|
|
|
130
139
|
fontSize: 14,
|
|
131
140
|
fontWeight: 600,
|
|
132
141
|
cursor: "pointer",
|
|
133
|
-
fontFamily:
|
|
142
|
+
fontFamily: x,
|
|
134
143
|
boxShadow: "0 6px 20px rgba(26,25,21,.18)"
|
|
135
144
|
},
|
|
136
145
|
children: [
|
|
137
|
-
/* @__PURE__ */ e(
|
|
146
|
+
/* @__PURE__ */ e(Z, { size: 16 }),
|
|
138
147
|
!v && "Feedback"
|
|
139
148
|
]
|
|
140
149
|
}
|
|
141
150
|
),
|
|
142
|
-
|
|
151
|
+
g && /* @__PURE__ */ e(
|
|
143
152
|
"div",
|
|
144
153
|
{
|
|
145
154
|
onClick: (y) => y.target === y.currentTarget && a(),
|
|
@@ -153,7 +162,7 @@ function oe({
|
|
|
153
162
|
alignItems: "center",
|
|
154
163
|
justifyContent: "center",
|
|
155
164
|
padding: 16,
|
|
156
|
-
fontFamily:
|
|
165
|
+
fontFamily: x
|
|
157
166
|
},
|
|
158
167
|
children: /* @__PURE__ */ r(
|
|
159
168
|
"div",
|
|
@@ -205,20 +214,20 @@ function oe({
|
|
|
205
214
|
] }),
|
|
206
215
|
/* @__PURE__ */ r("div", { style: { flex: 1, overflowY: "auto", padding: "16px 20px 24px" }, children: [
|
|
207
216
|
c === "list" && /* @__PURE__ */ e(
|
|
208
|
-
|
|
217
|
+
_,
|
|
209
218
|
{
|
|
210
|
-
onSelect:
|
|
219
|
+
onSelect: A,
|
|
211
220
|
accent: l,
|
|
212
221
|
p: o
|
|
213
222
|
}
|
|
214
223
|
),
|
|
215
|
-
c === "detail" && m && /* @__PURE__ */ e(
|
|
224
|
+
c === "detail" && m && /* @__PURE__ */ e(Y, { feedbackId: m, accent: l, p: o, font: x }),
|
|
216
225
|
c === "create" && /* @__PURE__ */ e(
|
|
217
|
-
|
|
226
|
+
K,
|
|
218
227
|
{
|
|
219
228
|
accent: l,
|
|
220
229
|
p: o,
|
|
221
|
-
font:
|
|
230
|
+
font: x,
|
|
222
231
|
onDone: () => s("list")
|
|
223
232
|
}
|
|
224
233
|
)
|
|
@@ -252,14 +261,14 @@ function oe({
|
|
|
252
261
|
)
|
|
253
262
|
] });
|
|
254
263
|
}
|
|
255
|
-
function
|
|
264
|
+
function _({
|
|
256
265
|
onSelect: i,
|
|
257
266
|
accent: n,
|
|
258
267
|
p: t
|
|
259
268
|
}) {
|
|
260
|
-
const { feedItems:
|
|
261
|
-
return l.length ? /* @__PURE__ */ e(
|
|
262
|
-
const
|
|
269
|
+
const { feedItems: u, vote: h } = B(), l = u.filter((o) => o.status !== "CLOSED");
|
|
270
|
+
return l.length ? /* @__PURE__ */ e(E, { children: l.map((o) => {
|
|
271
|
+
const g = o.userVote === "UP", b = o.title ?? o.content;
|
|
263
272
|
return /* @__PURE__ */ r(
|
|
264
273
|
"div",
|
|
265
274
|
{
|
|
@@ -279,7 +288,7 @@ function V({
|
|
|
279
288
|
"button",
|
|
280
289
|
{
|
|
281
290
|
onClick: (d) => {
|
|
282
|
-
d.stopPropagation(),
|
|
291
|
+
d.stopPropagation(), h(o.id, "UP");
|
|
283
292
|
},
|
|
284
293
|
style: {
|
|
285
294
|
display: "flex",
|
|
@@ -292,21 +301,21 @@ function V({
|
|
|
292
301
|
borderRadius: 11,
|
|
293
302
|
cursor: "pointer",
|
|
294
303
|
flexShrink: 0,
|
|
295
|
-
border: `1px solid ${
|
|
296
|
-
background:
|
|
304
|
+
border: `1px solid ${g ? n : t.border}`,
|
|
305
|
+
background: g ? `${n}1a` : t.bgSoft
|
|
297
306
|
},
|
|
298
307
|
children: [
|
|
299
|
-
/* @__PURE__ */ e(
|
|
308
|
+
/* @__PURE__ */ e(D, { color: n }),
|
|
300
309
|
/* @__PURE__ */ e("span", { style: { fontSize: 14, fontWeight: 700, color: t.text, lineHeight: 1.1 }, children: o.upvotes })
|
|
301
310
|
]
|
|
302
311
|
}
|
|
303
312
|
),
|
|
304
313
|
/* @__PURE__ */ r("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
305
|
-
/* @__PURE__ */ e("p", { style: { fontSize: 13.5, fontWeight: 600, lineHeight: 1.4, color: t.text, margin: "0 0 6px", overflow: "hidden", display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical" }, children:
|
|
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 }),
|
|
306
315
|
/* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
|
|
307
|
-
/* @__PURE__ */ e(
|
|
308
|
-
o.status === "PENDING" ? /* @__PURE__ */ e(L, {}) : /* @__PURE__ */ e(
|
|
309
|
-
/* @__PURE__ */ e("span", { style: { fontSize: 11, color: t.textFaint }, children:
|
|
316
|
+
/* @__PURE__ */ e(U, { type: o.type, p: t }),
|
|
317
|
+
o.status === "PENDING" ? /* @__PURE__ */ e(L, {}) : /* @__PURE__ */ e(R, { status: o.status, p: t }),
|
|
318
|
+
/* @__PURE__ */ e("span", { style: { fontSize: 11, color: t.textFaint }, children: M(o.createdAt) })
|
|
310
319
|
] })
|
|
311
320
|
] }),
|
|
312
321
|
/* @__PURE__ */ e("span", { style: { color: t.textFaint, fontSize: 18, alignSelf: "center", flexShrink: 0 }, children: "›" })
|
|
@@ -319,24 +328,24 @@ function V({
|
|
|
319
328
|
/* @__PURE__ */ e("div", { style: { color: t.textFaint, fontSize: 14 }, children: "Be the first to share one." })
|
|
320
329
|
] });
|
|
321
330
|
}
|
|
322
|
-
function
|
|
323
|
-
const { vote:
|
|
331
|
+
function Y({ feedbackId: i, accent: n, p: t, font: u }) {
|
|
332
|
+
const { vote: h, getItem: l } = B(), [o, g] = p(null), [b, d] = p(!1);
|
|
324
333
|
z(() => {
|
|
325
334
|
let s = !1;
|
|
326
335
|
return l(i).then((m) => {
|
|
327
|
-
s ||
|
|
336
|
+
s || g(m);
|
|
328
337
|
}).catch(() => {
|
|
329
338
|
}), () => {
|
|
330
339
|
s = !0;
|
|
331
340
|
};
|
|
332
341
|
}, [i, l]);
|
|
333
342
|
async function S() {
|
|
334
|
-
if (!(!o ||
|
|
343
|
+
if (!(!o || b)) {
|
|
335
344
|
d(!0);
|
|
336
345
|
try {
|
|
337
|
-
await
|
|
346
|
+
await h(o.id, "UP");
|
|
338
347
|
const s = await l(i);
|
|
339
|
-
|
|
348
|
+
g(s);
|
|
340
349
|
} catch {
|
|
341
350
|
} finally {
|
|
342
351
|
d(!1);
|
|
@@ -349,15 +358,15 @@ function _({ feedbackId: i, accent: n, p: t, font: h }) {
|
|
|
349
358
|
return /* @__PURE__ */ r("div", { children: [
|
|
350
359
|
c && /* @__PURE__ */ e("div", { style: { fontSize: 20, fontWeight: 700, color: t.text, letterSpacing: "-.02em", marginBottom: 10, lineHeight: 1.3 }, children: c }),
|
|
351
360
|
/* @__PURE__ */ r("div", { style: { display: "flex", gap: 6, marginBottom: 14, flexWrap: "wrap" }, children: [
|
|
352
|
-
/* @__PURE__ */ e(
|
|
353
|
-
o.status === "PENDING" ? /* @__PURE__ */ e(L, {}) : /* @__PURE__ */ e(
|
|
361
|
+
/* @__PURE__ */ e(U, { type: o.type, p: t }),
|
|
362
|
+
o.status === "PENDING" ? /* @__PURE__ */ e(L, {}) : /* @__PURE__ */ e(R, { status: o.status, p: t })
|
|
354
363
|
] }),
|
|
355
364
|
/* @__PURE__ */ e("p", { style: { fontSize: 15, lineHeight: 1.6, color: t.textSoft, marginBottom: 20 }, children: o.content }),
|
|
356
365
|
/* @__PURE__ */ r(
|
|
357
366
|
"button",
|
|
358
367
|
{
|
|
359
368
|
onClick: S,
|
|
360
|
-
disabled:
|
|
369
|
+
disabled: b,
|
|
361
370
|
style: {
|
|
362
371
|
display: "inline-flex",
|
|
363
372
|
alignItems: "center",
|
|
@@ -367,10 +376,10 @@ function _({ feedbackId: i, accent: n, p: t, font: h }) {
|
|
|
367
376
|
borderRadius: 12,
|
|
368
377
|
padding: "10px 16px",
|
|
369
378
|
cursor: "pointer",
|
|
370
|
-
fontFamily:
|
|
379
|
+
fontFamily: u
|
|
371
380
|
},
|
|
372
381
|
children: [
|
|
373
|
-
/* @__PURE__ */ e(
|
|
382
|
+
/* @__PURE__ */ e(D, { color: n, size: 13 }),
|
|
374
383
|
/* @__PURE__ */ e("span", { style: { fontSize: 18, fontWeight: 700, color: t.text }, children: o.upvotes }),
|
|
375
384
|
/* @__PURE__ */ e("span", { style: { fontSize: 13, color: t.textFaint }, children: o.userVote === "UP" ? "Upvoted" : "Upvote" })
|
|
376
385
|
]
|
|
@@ -378,26 +387,26 @@ function _({ feedbackId: i, accent: n, p: t, font: h }) {
|
|
|
378
387
|
),
|
|
379
388
|
o.comments.length > 0 && /* @__PURE__ */ r("div", { style: { marginTop: 28, borderTop: `1px solid ${t.border}`, paddingTop: 20 }, children: [
|
|
380
389
|
/* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: t.textFaint, marginBottom: 12, textTransform: "uppercase" }, children: "Developer response" }),
|
|
381
|
-
o.comments.map((s) => /* @__PURE__ */ e(
|
|
390
|
+
o.comments.map((s) => /* @__PURE__ */ e(q, { comment: s, p: t, accent: n }, s.id))
|
|
382
391
|
] })
|
|
383
392
|
] });
|
|
384
393
|
}
|
|
385
|
-
function
|
|
394
|
+
function q({ comment: i, p: n, accent: t }) {
|
|
386
395
|
return /* @__PURE__ */ r("div", { style: { background: n.bgSoft, border: `1px solid ${n.border}`, borderRadius: 12, padding: 14, marginBottom: 10 }, children: [
|
|
387
396
|
/* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 8 }, children: [
|
|
388
397
|
/* @__PURE__ */ e("span", { style: { background: `${t}20`, color: t, fontSize: 11, fontWeight: 700, borderRadius: 20, padding: "2px 8px" }, children: "Developer" }),
|
|
389
|
-
/* @__PURE__ */ e("span", { style: { fontSize: 11, color: n.textFaint }, children:
|
|
398
|
+
/* @__PURE__ */ e("span", { style: { fontSize: 11, color: n.textFaint }, children: M(i.createdAt) })
|
|
390
399
|
] }),
|
|
391
400
|
/* @__PURE__ */ e("p", { style: { fontSize: 14, lineHeight: 1.5, color: n.textSoft, margin: 0 }, children: i.content })
|
|
392
401
|
] });
|
|
393
402
|
}
|
|
394
|
-
function
|
|
395
|
-
const { submit:
|
|
403
|
+
function K({ accent: i, p: n, font: t, onDone: u }) {
|
|
404
|
+
const { submit: h } = B(), [l, o] = p(""), [g, b] = p(""), [d, S] = p("GENERAL"), [c, s] = p(!1), [m, F] = p(!1), [v, f] = p("");
|
|
396
405
|
async function k() {
|
|
397
406
|
if (!(!l.trim() || c)) {
|
|
398
407
|
s(!0), f("");
|
|
399
408
|
try {
|
|
400
|
-
await
|
|
409
|
+
await h(l.trim(), g.trim() || l.trim(), d), F(!0), setTimeout(u, 1200);
|
|
401
410
|
} catch {
|
|
402
411
|
f("Something went wrong. Please try again.");
|
|
403
412
|
} finally {
|
|
@@ -410,7 +419,7 @@ function q({ accent: i, p: n, font: t, onDone: h }) {
|
|
|
410
419
|
/* @__PURE__ */ e("div", { style: { fontSize: 18, fontWeight: 700, color: n.text, marginBottom: 6 }, children: "Submitted" }),
|
|
411
420
|
/* @__PURE__ */ e("div", { style: { fontSize: 14, color: n.textFaint }, children: "Feedback received. Thank you." })
|
|
412
421
|
] });
|
|
413
|
-
const
|
|
422
|
+
const x = {
|
|
414
423
|
width: "100%",
|
|
415
424
|
border: `1px solid ${n.border}`,
|
|
416
425
|
borderRadius: 12,
|
|
@@ -446,8 +455,8 @@ function q({ accent: i, p: n, font: t, onDone: h }) {
|
|
|
446
455
|
fontFamily: t
|
|
447
456
|
},
|
|
448
457
|
children: [
|
|
449
|
-
|
|
450
|
-
|
|
458
|
+
I[a].icon,
|
|
459
|
+
I[a].label
|
|
451
460
|
]
|
|
452
461
|
},
|
|
453
462
|
a
|
|
@@ -460,7 +469,7 @@ function q({ accent: i, p: n, font: t, onDone: h }) {
|
|
|
460
469
|
onChange: (a) => o(a.target.value),
|
|
461
470
|
placeholder: "Short summary of the issue or idea",
|
|
462
471
|
maxLength: 200,
|
|
463
|
-
style: { ...
|
|
472
|
+
style: { ...x, marginBottom: 16, display: "block" }
|
|
464
473
|
}
|
|
465
474
|
),
|
|
466
475
|
/* @__PURE__ */ r("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: n.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: [
|
|
@@ -470,12 +479,12 @@ function q({ accent: i, p: n, font: t, onDone: h }) {
|
|
|
470
479
|
/* @__PURE__ */ e(
|
|
471
480
|
"textarea",
|
|
472
481
|
{
|
|
473
|
-
value:
|
|
474
|
-
onChange: (a) =>
|
|
482
|
+
value: g,
|
|
483
|
+
onChange: (a) => b(a.target.value),
|
|
475
484
|
placeholder: "Steps to reproduce, expected behaviour, or more context",
|
|
476
485
|
maxLength: 2e3,
|
|
477
486
|
rows: 4,
|
|
478
|
-
style: { ...
|
|
487
|
+
style: { ...x, resize: "vertical", marginBottom: 16 }
|
|
479
488
|
}
|
|
480
489
|
),
|
|
481
490
|
v && /* @__PURE__ */ e("p", { style: { fontSize: 13, color: "#d6453d", marginBottom: 12 }, children: v }),
|
|
@@ -502,7 +511,7 @@ function q({ accent: i, p: n, font: t, onDone: h }) {
|
|
|
502
511
|
)
|
|
503
512
|
] });
|
|
504
513
|
}
|
|
505
|
-
const
|
|
514
|
+
const I = {
|
|
506
515
|
BUG: {
|
|
507
516
|
label: "Bug",
|
|
508
517
|
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: [
|
|
@@ -521,19 +530,19 @@ const W = {
|
|
|
521
530
|
label: "General",
|
|
522
531
|
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" }) })
|
|
523
532
|
}
|
|
524
|
-
},
|
|
525
|
-
function
|
|
533
|
+
}, J = { BUG: "#fdecec", FEATURE: "#e9f0fd" }, Q = { BUG: "#d6453d", FEATURE: "#3b76d6" };
|
|
534
|
+
function U({ type: i, p: n }) {
|
|
526
535
|
return /* @__PURE__ */ e("span", { style: {
|
|
527
536
|
padding: "2px 8px",
|
|
528
537
|
borderRadius: 9999,
|
|
529
538
|
fontSize: 10.5,
|
|
530
539
|
fontWeight: 700,
|
|
531
540
|
letterSpacing: ".02em",
|
|
532
|
-
background:
|
|
533
|
-
color:
|
|
541
|
+
background: J[i] ?? n.bgSoft,
|
|
542
|
+
color: Q[i] ?? n.textSoft
|
|
534
543
|
}, children: i });
|
|
535
544
|
}
|
|
536
|
-
const
|
|
545
|
+
const X = {
|
|
537
546
|
OPEN: "#b45309",
|
|
538
547
|
IN_PROGRESS: "#1d4ed8",
|
|
539
548
|
DONE: "#15803d",
|
|
@@ -545,24 +554,24 @@ function L() {
|
|
|
545
554
|
"Pending review"
|
|
546
555
|
] });
|
|
547
556
|
}
|
|
548
|
-
function
|
|
549
|
-
const t =
|
|
557
|
+
function R({ status: i, p: n }) {
|
|
558
|
+
const t = X[i] ?? "#9ca3af";
|
|
550
559
|
return /* @__PURE__ */ r("span", { style: { display: "inline-flex", alignItems: "center", gap: 5, background: n.bgSoft, border: `1px solid ${n.border}`, borderRadius: 6, padding: "2px 8px", fontSize: 10, fontWeight: 600, color: n.textSoft }, children: [
|
|
551
560
|
/* @__PURE__ */ e("span", { style: { width: 6, height: 6, borderRadius: "50%", background: t, display: "inline-block", flexShrink: 0 } }),
|
|
552
561
|
i.replace("_", " ")
|
|
553
562
|
] });
|
|
554
563
|
}
|
|
555
|
-
function
|
|
564
|
+
function Z({ size: i = 16, color: n = "currentColor" }) {
|
|
556
565
|
return /* @__PURE__ */ e("svg", { width: i, height: i, viewBox: "0 0 24 24", fill: "none", stroke: n, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
|
|
557
566
|
}
|
|
558
|
-
function
|
|
567
|
+
function D({ color: i = "currentColor", size: n = 11 }) {
|
|
559
568
|
return /* @__PURE__ */ e("svg", { width: n, height: n, viewBox: "0 0 16 16", fill: "none", stroke: i, strokeWidth: 2.2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M8 13V3M3 8l5-5 5 5" }) });
|
|
560
569
|
}
|
|
561
|
-
function
|
|
570
|
+
function M(i) {
|
|
562
571
|
return new Date(i).toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
563
572
|
}
|
|
564
573
|
export {
|
|
565
|
-
|
|
566
|
-
|
|
574
|
+
ie as FeedbackWidget,
|
|
575
|
+
oe as UpstepProvider,
|
|
567
576
|
B as useUpstep
|
|
568
577
|
};
|
package/dist/widget.d.ts
CHANGED
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;
|
|
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;IAwBlB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,cAAc;IAyCtB,OAAO,CAAC,eAAe;CAaxB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upstep/js",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
4
4
|
"description": "Upstep feedback widget for web apps",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://upstep.dev",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/TheBugEater/upstep.git",
|
|
10
|
+
"directory": "packages/sdk-web"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/TheBugEater/upstep/issues",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"feedback",
|
|
15
|
+
"widget",
|
|
16
|
+
"roadmap",
|
|
17
|
+
"upstep",
|
|
18
|
+
"react"
|
|
19
|
+
],
|
|
5
20
|
"main": "./dist/index.cjs",
|
|
6
21
|
"module": "./dist/index.js",
|
|
7
22
|
"types": "./dist/index.d.ts",
|
|
@@ -21,7 +36,7 @@
|
|
|
21
36
|
"dist"
|
|
22
37
|
],
|
|
23
38
|
"dependencies": {
|
|
24
|
-
"@upstep/types": "0.5.
|
|
39
|
+
"@upstep/types": "0.5.4"
|
|
25
40
|
},
|
|
26
41
|
"peerDependencies": {
|
|
27
42
|
"react": ">=18",
|