@upstep/js 0.5.4 → 0.5.6

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