@upstep/js 0.6.0 → 0.6.1

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,5 +1,5 @@
1
- import { jsxs as s, Fragment as U, jsx as e } from "react/jsx-runtime";
2
- import { createContext as G, useState as f, useEffect as S, useCallback as F, useContext as O, useRef as j } from "react";
1
+ import { jsxs as d, Fragment as T, jsx as e } from "react/jsx-runtime";
2
+ import { createContext as G, useState as h, useEffect as S, useCallback as F, useContext as j, useRef as O } from "react";
3
3
  import { U as V } from "./api-C1UV7Szw.mjs";
4
4
  const _ = "#D97757", Y = {
5
5
  bg: "#ffffff",
@@ -20,130 +20,130 @@ const _ = "#D97757", Y = {
20
20
  border: "#33312c",
21
21
  overlay: "rgba(0,0,0,.6)"
22
22
  };
23
- function T() {
23
+ function E() {
24
24
  if (typeof document > "u") return !1;
25
- const o = document.documentElement;
26
- return o.classList.contains("dark") || o.getAttribute("data-theme") === "dark";
25
+ const n = document.documentElement;
26
+ return n.classList.contains("dark") || n.getAttribute("data-theme") === "dark";
27
27
  }
28
- function K(o) {
29
- const [n, t] = f(() => o === "dark");
28
+ function K(n) {
29
+ const [o, t] = h(() => n === "dark");
30
30
  return S(() => {
31
- if (o !== "auto") {
32
- t(o === "dark");
31
+ if (n !== "auto") {
32
+ t(n === "dark");
33
33
  return;
34
34
  }
35
- if (t(T()), typeof MutationObserver > "u") return;
36
- const u = new MutationObserver(() => t(T()));
37
- return u.observe(document.documentElement, {
35
+ if (t(E()), typeof MutationObserver > "u") return;
36
+ const f = new MutationObserver(() => t(E()));
37
+ return f.observe(document.documentElement, {
38
38
  attributes: !0,
39
39
  attributeFilter: ["class", "data-theme"]
40
- }), () => u.disconnect();
41
- }, [o]), n ? q : Y;
40
+ }), () => f.disconnect();
41
+ }, [n]), o ? q : Y;
42
42
  }
43
43
  const R = G(null);
44
44
  function de({
45
- children: o,
46
- ...n
45
+ children: n,
46
+ ...o
47
47
  }) {
48
- const [t] = f(() => new V(n)), [u, h] = f([]), [i, r] = f(!1), [l, y] = f(!0);
48
+ const [t] = h(() => new V(o)), [f, g] = h([]), [i, r] = h(!1), [l, y] = h(!0);
49
49
  S(() => {
50
- t.setUserId(n.userId);
51
- }, [t, n.userId]), S(() => {
52
- t.supportIdentityToken = n.supportIdentityToken, document.querySelectorAll("iframe[data-upstep-support]").forEach((c) => {
53
- var x;
54
- return (x = c.contentWindow) == null ? void 0 : x.postMessage({ type: "upstep:support:identity", token: n.supportIdentityToken }, new URL(t.baseUrl).origin);
50
+ t.setUserId(o.userId);
51
+ }, [t, o.userId]), S(() => {
52
+ t.supportIdentityToken = o.supportIdentityToken, document.querySelectorAll("iframe[data-upstep-support]").forEach((c) => {
53
+ var m;
54
+ return (m = c.contentWindow) == null ? void 0 : m.postMessage({ type: "upstep:support:identity", token: o.supportIdentityToken }, new URL(t.baseUrl).origin);
55
55
  });
56
- }, [t, n.supportIdentityToken]);
56
+ }, [t, o.supportIdentityToken]);
57
57
  const a = F(async () => {
58
58
  try {
59
59
  const c = await t.listFeedback({ sort: "votes", limit: 20 });
60
- h(c.items), y(c.showBranding ?? !0);
60
+ g(c.items), y(c.showBranding ?? !0);
61
61
  } catch {
62
62
  }
63
63
  }, [t]);
64
64
  S(() => {
65
65
  a();
66
66
  }, [a]);
67
- const v = F(async (c, x, k) => {
68
- const p = { content: x };
69
- c.trim() && (p.title = c.trim()), k !== void 0 && (p.type = k), await t.submitFeedback(p), await a();
70
- }, [t, a]), m = F(async (c, x) => {
67
+ const w = F(async (c, m, v) => {
68
+ const p = { content: m };
69
+ c.trim() && (p.title = c.trim()), v !== void 0 && (p.type = v), await t.submitFeedback(p), await a();
70
+ }, [t, a]), x = F(async (c, m) => {
71
71
  try {
72
- await t.vote(c, x), await a();
72
+ await t.vote(c, m), await a();
73
73
  } catch {
74
74
  }
75
- }, [t, a]), d = F(
75
+ }, [t, a]), s = F(
76
76
  (c) => t.getItem(c),
77
77
  [t]
78
- ), b = F(() => r(!0), []), z = F(() => r(!1), []), w = F((c) => t.setUserId(c), [t]);
78
+ ), b = F(() => r(!0), []), k = F(() => r(!1), []), C = F((c) => t.setUserId(c), [t]);
79
79
  return /* @__PURE__ */ e(
80
80
  R.Provider,
81
81
  {
82
82
  value: {
83
83
  client: t,
84
- feedItems: u,
84
+ feedItems: f,
85
85
  loadFeed: a,
86
- submit: v,
87
- vote: m,
88
- getItem: d,
86
+ submit: w,
87
+ vote: x,
88
+ getItem: s,
89
89
  isOpen: i,
90
90
  open: b,
91
- close: z,
92
- identify: w,
93
- accentColor: n.accentColor ?? _,
94
- theme: n.theme ?? "auto",
91
+ close: k,
92
+ identify: C,
93
+ accentColor: o.accentColor ?? _,
94
+ theme: o.theme ?? "auto",
95
95
  showBranding: l,
96
- chat: n.chat !== !1
96
+ chat: o.chat !== !1
97
97
  },
98
- children: o
98
+ children: n
99
99
  }
100
100
  );
101
101
  }
102
- function B() {
103
- const o = O(R);
104
- if (!o) throw new Error("useUpstep must be used inside <UpstepProvider>");
105
- return o;
102
+ function I() {
103
+ const n = j(R);
104
+ if (!n) throw new Error("useUpstep must be used inside <UpstepProvider>");
105
+ return n;
106
106
  }
107
107
  function ae({
108
- position: o = "bottom-right",
109
- accentColor: n,
108
+ position: n = "bottom-right",
109
+ accentColor: o,
110
110
  theme: t,
111
- hideLauncher: u = !1,
112
- chat: h = !0
111
+ hideLauncher: f = !1,
112
+ chat: g = !0
113
113
  }) {
114
- const i = B(), r = n ?? i.accentColor, l = K(t ?? i.theme), { isOpen: y, open: a, close: v, showBranding: m } = i, [d, b] = f("list"), [z, w] = f(!1);
114
+ const i = I(), r = o ?? i.accentColor, l = K(t ?? i.theme), { isOpen: y, open: a, close: w, showBranding: x } = i, [s, b] = h("list"), [k, C] = h(!1);
115
115
  S(() => {
116
- let g = !0;
117
- if (i.client.chat = i.chat, !i.chat || !h) {
118
- w(!1);
116
+ let u = !0;
117
+ if (i.client.chat = i.chat, !i.chat || !g) {
118
+ C(!1);
119
119
  return;
120
120
  }
121
- return i.client.supportEnabled().then((C) => {
122
- g && w(C);
121
+ return i.client.supportEnabled().then((z) => {
122
+ u && C(z);
123
123
  }), () => {
124
- g = !1;
124
+ u = !1;
125
125
  };
126
- }, [i.client, i.chat, h]), S(() => {
127
- (!i.chat || !h) && d === "support" && b("list");
128
- }, [i.chat, h, d]);
129
- const [c, x] = f(null), [k, p] = f(!1);
126
+ }, [i.client, i.chat, g]), S(() => {
127
+ (!i.chat || !g) && s === "support" && b("list");
128
+ }, [i.chat, g, s]);
129
+ const [c, m] = h(null), [v, p] = h(!1);
130
130
  S(() => {
131
- const g = window.matchMedia("(max-width: 639px)");
132
- p(g.matches);
133
- const C = ($) => p($.matches);
134
- return g.addEventListener("change", C), () => g.removeEventListener("change", C);
131
+ const u = window.matchMedia("(max-width: 639px)");
132
+ p(u.matches);
133
+ const z = ($) => p($.matches);
134
+ return u.addEventListener("change", z), () => u.removeEventListener("change", z);
135
135
  }, []);
136
- const H = o === "bottom-left" ? { position: "fixed", bottom: 24, left: 24 } : { position: "fixed", bottom: 24, right: 24 }, I = '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif';
136
+ const H = 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';
137
137
  function W() {
138
- v(), setTimeout(() => {
139
- b("list"), x(null);
138
+ w(), setTimeout(() => {
139
+ b("list"), m(null);
140
140
  }, 300);
141
141
  }
142
- function N(g) {
143
- x(g), b("detail");
142
+ function N(u) {
143
+ m(u), b("detail");
144
144
  }
145
- return /* @__PURE__ */ s(U, { children: [
146
- !u && /* @__PURE__ */ s(
145
+ return /* @__PURE__ */ d(T, { children: [
146
+ !f && /* @__PURE__ */ d(
147
147
  "button",
148
148
  {
149
149
  onClick: a,
@@ -157,23 +157,23 @@ function ae({
157
157
  color: "#fff",
158
158
  border: "none",
159
159
  borderRadius: 9999,
160
- padding: k ? "12px" : "12px 18px",
160
+ padding: v ? "12px" : "12px 18px",
161
161
  fontSize: 14,
162
162
  fontWeight: 600,
163
163
  cursor: "pointer",
164
- fontFamily: I,
164
+ fontFamily: B,
165
165
  boxShadow: "0 6px 20px rgba(26,25,21,.18)"
166
166
  },
167
167
  children: [
168
168
  /* @__PURE__ */ e(re, { size: 16 }),
169
- !k && "Feedback"
169
+ !v && (k && g && i.chat ? "Help & feedback" : "Feedback")
170
170
  ]
171
171
  }
172
172
  ),
173
173
  y && /* @__PURE__ */ e(
174
174
  "div",
175
175
  {
176
- onClick: (g) => g.target === g.currentTarget && W(),
176
+ onClick: (u) => u.target === u.currentTarget && W(),
177
177
  style: {
178
178
  position: "fixed",
179
179
  inset: 0,
@@ -184,9 +184,9 @@ function ae({
184
184
  alignItems: "center",
185
185
  justifyContent: "center",
186
186
  padding: 16,
187
- fontFamily: I
187
+ fontFamily: B
188
188
  },
189
- children: /* @__PURE__ */ s(
189
+ children: /* @__PURE__ */ d(
190
190
  "div",
191
191
  {
192
192
  style: {
@@ -194,7 +194,7 @@ function ae({
194
194
  border: `1px solid ${l.border}`,
195
195
  borderRadius: 20,
196
196
  width: "100%",
197
- maxWidth: 440,
197
+ maxWidth: k && g && i.chat ? 460 : 440,
198
198
  maxHeight: "88vh",
199
199
  display: "flex",
200
200
  flexDirection: "column",
@@ -202,9 +202,12 @@ function ae({
202
202
  boxShadow: "0 24px 64px rgba(0,0,0,.28)"
203
203
  },
204
204
  children: [
205
- /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "16px 20px", borderBottom: `1px solid ${l.border}`, flexShrink: 0 }, children: [
206
- /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
207
- d !== "list" && /* @__PURE__ */ e(
205
+ k && g && i.chat ? /* @__PURE__ */ d("div", { style: { display: "flex", alignItems: "center", gap: 14, padding: "10px 14px", borderBottom: `1px solid ${l.border}`, flexShrink: 0 }, children: [
206
+ /* @__PURE__ */ e("div", { style: { display: "flex", flex: 1, gap: 4 }, children: [["support", "Support"], ["list", "Feedback"]].map(([u, z]) => /* @__PURE__ */ e("button", { onClick: () => b(u), style: { flex: 1, border: 0, borderRadius: 8, padding: "9px 12px", background: (s === "support" ? u === "support" : u === "list") ? l.bgSoft : "transparent", color: (s === "support" ? u === "support" : u === "list") ? l.text : l.textSoft, fontSize: 12, fontWeight: 600, cursor: "pointer" }, children: z }, u)) }),
207
+ /* @__PURE__ */ e("button", { "aria-label": "Close", onClick: W, style: { border: 0, background: "transparent", color: l.textSoft, padding: 6, cursor: "pointer", fontSize: 14 }, children: "✕" })
208
+ ] }) : /* @__PURE__ */ d("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "16px 20px", borderBottom: `1px solid ${l.border}`, flexShrink: 0 }, children: [
209
+ /* @__PURE__ */ d("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
210
+ s !== "list" && /* @__PURE__ */ e(
208
211
  "button",
209
212
  {
210
213
  onClick: () => b("list"),
@@ -212,11 +215,11 @@ function ae({
212
215
  children: "← Back"
213
216
  }
214
217
  ),
215
- d === "list" && /* @__PURE__ */ e("span", { style: { fontWeight: 700, fontSize: 16, color: l.text, letterSpacing: "-.01em" }, children: "Feedback" }),
216
- d === "create" && /* @__PURE__ */ e("span", { style: { fontWeight: 700, fontSize: 16, color: l.text, letterSpacing: "-.01em" }, children: "New feedback" })
218
+ s === "list" && /* @__PURE__ */ e("span", { style: { fontWeight: 700, fontSize: 16, color: l.text, letterSpacing: "-.01em" }, children: "Feedback" }),
219
+ s === "create" && /* @__PURE__ */ e("span", { style: { fontWeight: 700, fontSize: 16, color: l.text, letterSpacing: "-.01em" }, children: "New feedback" })
217
220
  ] }),
218
- /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
219
- d === "list" && /* @__PURE__ */ e(
221
+ /* @__PURE__ */ d("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
222
+ s === "list" && /* @__PURE__ */ e(
220
223
  "button",
221
224
  {
222
225
  onClick: () => b("create"),
@@ -234,10 +237,13 @@ function ae({
234
237
  )
235
238
  ] })
236
239
  ] }),
237
- z && h && i.chat && /* @__PURE__ */ e("div", { style: { display: "flex", gap: 4, padding: "12px 20px 0" }, children: [["list", "Feedback"], ["support", "Support"]].map(([g, C]) => /* @__PURE__ */ e("button", { onClick: () => b(g), style: { flex: 1, padding: 8, border: `1px solid ${l.border}`, borderRadius: 9, background: d === g ? l.bgSoft : l.bg, color: l.text, cursor: "pointer", fontSize: 12 }, children: C }, g)) }),
238
- /* @__PURE__ */ s("div", { style: { flex: 1, overflowY: "auto", padding: "16px 20px 24px" }, children: [
239
- d === "support" && h && i.chat && /* @__PURE__ */ e(J, { client: i.client, theme: l.bg === "#000000" ? "dark" : "light" }),
240
- d === "list" && /* @__PURE__ */ e(
240
+ /* @__PURE__ */ d("div", { style: { flex: 1, overflowY: "auto", padding: s === "support" ? 0 : "16px 20px 24px" }, children: [
241
+ s === "support" && g && i.chat && /* @__PURE__ */ e(J, { client: i.client, theme: l.bg === "#000000" ? "dark" : "light" }),
242
+ k && g && i.chat && s !== "support" && /* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 16 }, children: s === "list" ? /* @__PURE__ */ d(T, { children: [
243
+ /* @__PURE__ */ e("span", { style: { fontSize: 14, fontWeight: 600, color: l.text }, children: "Feedback & ideas" }),
244
+ /* @__PURE__ */ e("button", { onClick: () => b("create"), style: { border: 0, borderRadius: 8, background: r, color: "white", fontSize: 12, padding: "7px 10px", cursor: "pointer" }, children: "+ New" })
245
+ ] }) : /* @__PURE__ */ e("button", { onClick: () => b("list"), style: { border: 0, background: "none", padding: 0, color: l.textSoft, fontSize: 12, cursor: "pointer" }, children: "← Back to feedback" }) }),
246
+ s === "list" && /* @__PURE__ */ e(
241
247
  Q,
242
248
  {
243
249
  onSelect: N,
@@ -245,18 +251,18 @@ function ae({
245
251
  p: l
246
252
  }
247
253
  ),
248
- d === "detail" && c && /* @__PURE__ */ e(X, { feedbackId: c, accent: r, p: l, font: I }),
249
- d === "create" && /* @__PURE__ */ e(
254
+ s === "detail" && c && /* @__PURE__ */ e(X, { feedbackId: c, accent: r, p: l, font: B }),
255
+ s === "create" && /* @__PURE__ */ e(
250
256
  ee,
251
257
  {
252
258
  accent: r,
253
259
  p: l,
254
- font: I,
260
+ font: B,
255
261
  onDone: () => b("list")
256
262
  }
257
263
  )
258
264
  ] }),
259
- m && /* @__PURE__ */ s(
265
+ x && s !== "support" && /* @__PURE__ */ d(
260
266
  "a",
261
267
  {
262
268
  href: "https://upstep.dev",
@@ -285,24 +291,24 @@ function ae({
285
291
  )
286
292
  ] });
287
293
  }
288
- function J({ client: o, theme: n }) {
289
- const t = j(null);
294
+ function J({ client: n, theme: o }) {
295
+ const t = O(null);
290
296
  return S(() => {
291
- if (t.current) return o.connectSupportFrame(t.current);
292
- }, [o]), /* @__PURE__ */ e("iframe", { ref: t, "data-upstep-support": !0, title: "Customer support", src: o.supportFrameUrl(n), style: { width: "100%", height: 480, border: 0, display: "block", borderRadius: 12 } });
297
+ if (t.current) return n.connectSupportFrame(t.current);
298
+ }, [n]), /* @__PURE__ */ e("iframe", { ref: t, "data-upstep-support": !0, title: "Customer support", src: n.supportFrameUrl(o), style: { width: "100%", height: "min(560px, calc(88dvh - 56px))", minHeight: 300, border: 0, display: "block" } });
293
299
  }
294
300
  function Q({
295
- onSelect: o,
296
- accent: n,
301
+ onSelect: n,
302
+ accent: o,
297
303
  p: t
298
304
  }) {
299
- const { feedItems: u, vote: h } = B(), i = u.filter((r) => r.status !== "CLOSED");
300
- return i.length ? /* @__PURE__ */ e(U, { children: i.map((r) => {
305
+ const { feedItems: f, vote: g } = I(), i = f.filter((r) => r.status !== "CLOSED");
306
+ return i.length ? /* @__PURE__ */ e(T, { children: i.map((r) => {
301
307
  const l = r.userVote === "UP", y = r.title ?? r.content;
302
- return /* @__PURE__ */ s(
308
+ return /* @__PURE__ */ d(
303
309
  "div",
304
310
  {
305
- onClick: () => o(r.id),
311
+ onClick: () => n(r.id),
306
312
  style: {
307
313
  display: "flex",
308
314
  gap: 12,
@@ -314,11 +320,11 @@ function Q({
314
320
  cursor: "pointer"
315
321
  },
316
322
  children: [
317
- /* @__PURE__ */ s(
323
+ /* @__PURE__ */ d(
318
324
  "button",
319
325
  {
320
326
  onClick: (a) => {
321
- a.stopPropagation(), h(r.id, "UP");
327
+ a.stopPropagation(), g(r.id, "UP");
322
328
  },
323
329
  style: {
324
330
  display: "flex",
@@ -331,18 +337,18 @@ function Q({
331
337
  borderRadius: 11,
332
338
  cursor: "pointer",
333
339
  flexShrink: 0,
334
- border: `1px solid ${l ? n : t.border}`,
335
- background: l ? `${n}1a` : t.bgSoft
340
+ border: `1px solid ${l ? o : t.border}`,
341
+ background: l ? `${o}1a` : t.bgSoft
336
342
  },
337
343
  children: [
338
- /* @__PURE__ */ e(D, { color: n }),
344
+ /* @__PURE__ */ e(D, { color: o }),
339
345
  /* @__PURE__ */ e("span", { style: { fontSize: 14, fontWeight: 700, color: t.text, lineHeight: 1.1 }, children: r.upvotes })
340
346
  ]
341
347
  }
342
348
  ),
343
- /* @__PURE__ */ s("div", { style: { flex: 1, minWidth: 0 }, children: [
349
+ /* @__PURE__ */ d("div", { style: { flex: 1, minWidth: 0 }, children: [
344
350
  /* @__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: y }),
345
- /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
351
+ /* @__PURE__ */ d("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
346
352
  /* @__PURE__ */ e(L, { type: r.type, p: t }),
347
353
  r.status === "PENDING" ? /* @__PURE__ */ e(M, {}) : /* @__PURE__ */ e(A, { status: r.status, boardStatus: r.boardStatus, p: t }),
348
354
  /* @__PURE__ */ e("span", { style: { fontSize: 11, color: t.textFaint }, children: P(r.createdAt) })
@@ -353,29 +359,29 @@ function Q({
353
359
  },
354
360
  r.id
355
361
  );
356
- }) }) : /* @__PURE__ */ s("div", { style: { textAlign: "center", padding: "40px 0" }, children: [
362
+ }) }) : /* @__PURE__ */ d("div", { style: { textAlign: "center", padding: "40px 0" }, children: [
357
363
  /* @__PURE__ */ e("div", { style: { color: t.textSoft, fontSize: 15, fontWeight: 600, marginBottom: 4 }, children: "No open feedback yet" }),
358
364
  /* @__PURE__ */ e("div", { style: { color: t.textFaint, fontSize: 14 }, children: "Be the first to share one." })
359
365
  ] });
360
366
  }
361
- function X({ feedbackId: o, accent: n, p: t, font: u }) {
362
- const { vote: h, getItem: i } = B(), [r, l] = f(null), [y, a] = f(!1);
367
+ function X({ feedbackId: n, accent: o, p: t, font: f }) {
368
+ const { vote: g, getItem: i } = I(), [r, l] = h(null), [y, a] = h(!1);
363
369
  S(() => {
364
- let d = !1;
365
- return i(o).then((b) => {
366
- d || l(b);
370
+ let s = !1;
371
+ return i(n).then((b) => {
372
+ s || l(b);
367
373
  }).catch(() => {
368
374
  }), () => {
369
- d = !0;
375
+ s = !0;
370
376
  };
371
- }, [o, i]);
372
- async function v() {
377
+ }, [n, i]);
378
+ async function w() {
373
379
  if (!(!r || y)) {
374
380
  a(!0);
375
381
  try {
376
- await h(r.id, "UP");
377
- const d = await i(o);
378
- l(d);
382
+ await g(r.id, "UP");
383
+ const s = await i(n);
384
+ l(s);
379
385
  } catch {
380
386
  } finally {
381
387
  a(!1);
@@ -384,91 +390,91 @@ function X({ feedbackId: o, accent: n, p: t, font: u }) {
384
390
  }
385
391
  if (!r)
386
392
  return /* @__PURE__ */ e("div", { style: { textAlign: "center", padding: "40px 0", color: t.textFaint, fontSize: 14 }, children: "Loading…" });
387
- const m = r.title;
388
- return /* @__PURE__ */ s("div", { children: [
389
- m && /* @__PURE__ */ e("div", { style: { fontSize: 20, fontWeight: 700, color: t.text, letterSpacing: "-.02em", marginBottom: 10, lineHeight: 1.3 }, children: m }),
390
- /* @__PURE__ */ s("div", { style: { display: "flex", gap: 6, marginBottom: 14, flexWrap: "wrap" }, children: [
393
+ const x = r.title;
394
+ return /* @__PURE__ */ d("div", { children: [
395
+ x && /* @__PURE__ */ e("div", { style: { fontSize: 20, fontWeight: 700, color: t.text, letterSpacing: "-.02em", marginBottom: 10, lineHeight: 1.3 }, children: x }),
396
+ /* @__PURE__ */ d("div", { style: { display: "flex", gap: 6, marginBottom: 14, flexWrap: "wrap" }, children: [
391
397
  /* @__PURE__ */ e(L, { type: r.type, p: t }),
392
398
  r.status === "PENDING" ? /* @__PURE__ */ e(M, {}) : /* @__PURE__ */ e(A, { status: r.status, boardStatus: r.boardStatus, p: t })
393
399
  ] }),
394
400
  /* @__PURE__ */ e("p", { style: { fontSize: 15, lineHeight: 1.6, color: t.textSoft, marginBottom: 20 }, children: r.content }),
395
- /* @__PURE__ */ s(
401
+ /* @__PURE__ */ d(
396
402
  "button",
397
403
  {
398
- onClick: v,
404
+ onClick: w,
399
405
  disabled: y,
400
406
  style: {
401
407
  display: "inline-flex",
402
408
  alignItems: "center",
403
409
  gap: 8,
404
- border: `1px solid ${r.userVote === "UP" ? n : t.border}`,
405
- background: r.userVote === "UP" ? `${n}15` : t.bgSoft,
410
+ border: `1px solid ${r.userVote === "UP" ? o : t.border}`,
411
+ background: r.userVote === "UP" ? `${o}15` : t.bgSoft,
406
412
  borderRadius: 12,
407
413
  padding: "10px 16px",
408
414
  cursor: "pointer",
409
- fontFamily: u
415
+ fontFamily: f
410
416
  },
411
417
  children: [
412
- /* @__PURE__ */ e(D, { color: n, size: 13 }),
418
+ /* @__PURE__ */ e(D, { color: o, size: 13 }),
413
419
  /* @__PURE__ */ e("span", { style: { fontSize: 18, fontWeight: 700, color: t.text }, children: r.upvotes }),
414
420
  /* @__PURE__ */ e("span", { style: { fontSize: 13, color: t.textFaint }, children: r.userVote === "UP" ? "Upvoted" : "Upvote" })
415
421
  ]
416
422
  }
417
423
  ),
418
- r.comments.length > 0 && /* @__PURE__ */ s("div", { style: { marginTop: 28, borderTop: `1px solid ${t.border}`, paddingTop: 20 }, children: [
424
+ r.comments.length > 0 && /* @__PURE__ */ d("div", { style: { marginTop: 28, borderTop: `1px solid ${t.border}`, paddingTop: 20 }, children: [
419
425
  /* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: t.textFaint, marginBottom: 12, textTransform: "uppercase" }, children: "Comments" }),
420
- r.comments.map((d) => /* @__PURE__ */ e(Z, { comment: d, p: t, accent: n }, d.id))
426
+ r.comments.map((s) => /* @__PURE__ */ e(Z, { comment: s, p: t, accent: o }, s.id))
421
427
  ] })
422
428
  ] });
423
429
  }
424
- function Z({ comment: o, p: n, accent: t }) {
425
- var u;
426
- return /* @__PURE__ */ s("div", { style: { background: n.bgSoft, border: `1px solid ${n.border}`, borderRadius: 12, padding: 14, marginBottom: 10 }, children: [
427
- /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 8 }, children: [
428
- /* @__PURE__ */ e("span", { style: { background: `${t}20`, color: t, fontSize: 11, fontWeight: 700, borderRadius: 20, padding: "2px 8px" }, children: ((u = o.authorName) == null ? void 0 : u.trim()) || "UpStep Team" }),
429
- /* @__PURE__ */ e("span", { style: { fontSize: 11, color: n.textFaint }, children: P(o.createdAt) })
430
+ function Z({ comment: n, p: o, accent: t }) {
431
+ var f;
432
+ return /* @__PURE__ */ d("div", { style: { background: o.bgSoft, border: `1px solid ${o.border}`, borderRadius: 12, padding: 14, marginBottom: 10 }, children: [
433
+ /* @__PURE__ */ d("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 8 }, children: [
434
+ /* @__PURE__ */ e("span", { style: { background: `${t}20`, color: t, fontSize: 11, fontWeight: 700, borderRadius: 20, padding: "2px 8px" }, children: ((f = n.authorName) == null ? void 0 : f.trim()) || "UpStep Team" }),
435
+ /* @__PURE__ */ e("span", { style: { fontSize: 11, color: o.textFaint }, children: P(n.createdAt) })
430
436
  ] }),
431
- /* @__PURE__ */ e("p", { style: { fontSize: 14, lineHeight: 1.5, color: n.textSoft, margin: 0 }, children: o.content })
437
+ /* @__PURE__ */ e("p", { style: { fontSize: 14, lineHeight: 1.5, color: o.textSoft, margin: 0 }, children: n.content })
432
438
  ] });
433
439
  }
434
- function ee({ accent: o, p: n, font: t, onDone: u }) {
435
- const { submit: h } = B(), [i, r] = f(""), [l, y] = f(""), [a, v] = f("GENERAL"), [m, d] = f(!1), [b, z] = f(!1), [w, c] = f("");
436
- async function x() {
437
- if (!(!i.trim() || m)) {
438
- d(!0), c("");
440
+ function ee({ accent: n, p: o, font: t, onDone: f }) {
441
+ const { submit: g } = I(), [i, r] = h(""), [l, y] = h(""), [a, w] = h("GENERAL"), [x, s] = h(!1), [b, k] = h(!1), [C, c] = h("");
442
+ async function m() {
443
+ if (!(!i.trim() || x)) {
444
+ s(!0), c("");
439
445
  try {
440
- await h(i.trim(), l.trim() || i.trim(), a), z(!0), setTimeout(u, 1200);
446
+ await g(i.trim(), l.trim() || i.trim(), a), k(!0), setTimeout(f, 1200);
441
447
  } catch {
442
448
  c("Something went wrong. Please try again.");
443
449
  } finally {
444
- d(!1);
450
+ s(!1);
445
451
  }
446
452
  }
447
453
  }
448
454
  if (b)
449
- return /* @__PURE__ */ s("div", { style: { textAlign: "center", paddingTop: 40 }, children: [
450
- /* @__PURE__ */ e("div", { style: { fontSize: 18, fontWeight: 700, color: n.text, marginBottom: 6 }, children: "Submitted" }),
451
- /* @__PURE__ */ e("div", { style: { fontSize: 14, color: n.textFaint }, children: "Feedback received. Thank you." })
455
+ return /* @__PURE__ */ d("div", { style: { textAlign: "center", paddingTop: 40 }, children: [
456
+ /* @__PURE__ */ e("div", { style: { fontSize: 18, fontWeight: 700, color: o.text, marginBottom: 6 }, children: "Submitted" }),
457
+ /* @__PURE__ */ e("div", { style: { fontSize: 14, color: o.textFaint }, children: "Feedback received. Thank you." })
452
458
  ] });
453
- const k = {
459
+ const v = {
454
460
  width: "100%",
455
- border: `1px solid ${n.border}`,
461
+ border: `1px solid ${o.border}`,
456
462
  borderRadius: 12,
457
463
  padding: "10px 12px",
458
464
  fontSize: 14,
459
465
  lineHeight: 1.5,
460
466
  outline: "none",
461
- background: n.bgSoft,
462
- color: n.text,
467
+ background: o.bgSoft,
468
+ color: o.text,
463
469
  fontFamily: t,
464
470
  boxSizing: "border-box"
465
471
  };
466
- return /* @__PURE__ */ s("div", { children: [
467
- /* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: n.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: "Type" }),
468
- /* @__PURE__ */ e("div", { style: { display: "flex", gap: 7, marginBottom: 16 }, children: ["BUG", "FEATURE", "GENERAL"].map((p) => /* @__PURE__ */ s(
472
+ return /* @__PURE__ */ d("div", { children: [
473
+ /* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: o.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: "Type" }),
474
+ /* @__PURE__ */ e("div", { style: { display: "flex", gap: 7, marginBottom: 16 }, children: ["BUG", "FEATURE", "GENERAL"].map((p) => /* @__PURE__ */ d(
469
475
  "button",
470
476
  {
471
- onClick: () => v(p),
477
+ onClick: () => w(p),
472
478
  style: {
473
479
  flex: 1,
474
480
  display: "flex",
@@ -480,19 +486,19 @@ function ee({ accent: o, p: n, font: t, onDone: u }) {
480
486
  fontSize: 12.5,
481
487
  fontWeight: 600,
482
488
  cursor: "pointer",
483
- background: a === p ? o : n.bg,
484
- color: a === p ? "#fff" : n.textSoft,
485
- border: `1px solid ${a === p ? o : n.border}`,
489
+ background: a === p ? n : o.bg,
490
+ color: a === p ? "#fff" : o.textSoft,
491
+ border: `1px solid ${a === p ? n : o.border}`,
486
492
  fontFamily: t
487
493
  },
488
494
  children: [
489
- E[p].icon,
490
- E[p].label
495
+ U[p].icon,
496
+ U[p].label
491
497
  ]
492
498
  },
493
499
  p
494
500
  )) }),
495
- /* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: n.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: "Title" }),
501
+ /* @__PURE__ */ e("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: o.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: "Title" }),
496
502
  /* @__PURE__ */ e(
497
503
  "input",
498
504
  {
@@ -500,10 +506,10 @@ function ee({ accent: o, p: n, font: t, onDone: u }) {
500
506
  onChange: (p) => r(p.target.value),
501
507
  placeholder: "Short summary of the issue or idea",
502
508
  maxLength: 200,
503
- style: { ...k, marginBottom: 16, display: "block" }
509
+ style: { ...v, marginBottom: 16, display: "block" }
504
510
  }
505
511
  ),
506
- /* @__PURE__ */ s("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: n.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: [
512
+ /* @__PURE__ */ d("div", { style: { fontSize: 10, fontWeight: 700, letterSpacing: ".08em", color: o.textFaint, marginBottom: 8, textTransform: "uppercase" }, children: [
507
513
  "Description ",
508
514
  /* @__PURE__ */ e("span", { style: { fontWeight: 400, textTransform: "none", letterSpacing: 0 }, children: "(optional)" })
509
515
  ] }),
@@ -515,44 +521,44 @@ function ee({ accent: o, p: n, font: t, onDone: u }) {
515
521
  placeholder: "Steps to reproduce, expected behaviour, or more context",
516
522
  maxLength: 2e3,
517
523
  rows: 4,
518
- style: { ...k, resize: "vertical", marginBottom: 16 }
524
+ style: { ...v, resize: "vertical", marginBottom: 16 }
519
525
  }
520
526
  ),
521
- w && /* @__PURE__ */ e("p", { style: { fontSize: 13, color: "#d6453d", marginBottom: 12 }, children: w }),
527
+ C && /* @__PURE__ */ e("p", { style: { fontSize: 13, color: "#d6453d", marginBottom: 12 }, children: C }),
522
528
  /* @__PURE__ */ e(
523
529
  "button",
524
530
  {
525
- onClick: x,
526
- disabled: m || !i.trim(),
531
+ onClick: m,
532
+ disabled: x || !i.trim(),
527
533
  style: {
528
534
  width: "100%",
529
535
  padding: 12,
530
- background: o,
536
+ background: n,
531
537
  color: "#fff",
532
538
  border: "none",
533
539
  borderRadius: 11,
534
540
  fontSize: 14,
535
541
  fontWeight: 600,
536
542
  cursor: "pointer",
537
- opacity: m || !i.trim() ? 0.5 : 1,
543
+ opacity: x || !i.trim() ? 0.5 : 1,
538
544
  fontFamily: t
539
545
  },
540
- children: m ? "Submitting…" : "Submit feedback"
546
+ children: x ? "Submitting…" : "Submit feedback"
541
547
  }
542
548
  )
543
549
  ] });
544
550
  }
545
- const E = {
551
+ const U = {
546
552
  BUG: {
547
553
  label: "Bug",
548
- icon: /* @__PURE__ */ s("svg", { width: 12, height: 12, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", children: [
554
+ icon: /* @__PURE__ */ d("svg", { width: 12, height: 12, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", children: [
549
555
  /* @__PURE__ */ e("ellipse", { cx: "8", cy: "10", rx: "3.5", ry: "4.5" }),
550
556
  /* @__PURE__ */ e("path", { d: "M8 5.5V4M5.5 6.5 3.5 5M10.5 6.5 12.5 5M4.5 10.5 2.5 10M11.5 10.5 13.5 10" })
551
557
  ] })
552
558
  },
553
559
  FEATURE: {
554
560
  label: "Feature",
555
- icon: /* @__PURE__ */ s("svg", { width: 12, height: 12, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", children: [
561
+ icon: /* @__PURE__ */ d("svg", { width: 12, height: 12, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", children: [
556
562
  /* @__PURE__ */ e("path", { d: "M8 2v1.5M8 12.5V14M2 8h1.5M12.5 8H14M4.1 4.1l1 1M10.9 10.9l1 1M11.9 4.1l-1 1M5.1 10.9l-1 1" }),
557
563
  /* @__PURE__ */ e("circle", { cx: "8", cy: "8", r: "2.5" })
558
564
  ] })
@@ -561,52 +567,52 @@ const E = {
561
567
  label: "General",
562
568
  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" }) })
563
569
  }
564
- }, te = { BUG: "#fdecec", FEATURE: "#e9f0fd" }, ne = { BUG: "#d6453d", FEATURE: "#3b76d6" };
565
- function L({ type: o, p: n }) {
570
+ }, te = { BUG: "#fdecec", FEATURE: "#e9f0fd" }, oe = { BUG: "#d6453d", FEATURE: "#3b76d6" };
571
+ function L({ type: n, p: o }) {
566
572
  return /* @__PURE__ */ e("span", { style: {
567
573
  padding: "2px 8px",
568
574
  borderRadius: 9999,
569
575
  fontSize: 10.5,
570
576
  fontWeight: 700,
571
577
  letterSpacing: ".02em",
572
- background: te[o] ?? n.bgSoft,
573
- color: ne[o] ?? n.textSoft
574
- }, children: o });
578
+ background: te[n] ?? o.bgSoft,
579
+ color: oe[n] ?? o.textSoft
580
+ }, children: n });
575
581
  }
576
- const oe = {
582
+ const ne = {
577
583
  OPEN: "#b45309",
578
584
  IN_PROGRESS: "#1d4ed8",
579
585
  DONE: "#15803d",
580
586
  CLOSED: "#6b7280"
581
587
  };
582
588
  function M() {
583
- return /* @__PURE__ */ s("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: [
589
+ return /* @__PURE__ */ d("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: [
584
590
  /* @__PURE__ */ e("span", { style: { width: 5, height: 5, borderRadius: "50%", background: "#ea580c", display: "inline-block" } }),
585
591
  "Pending review"
586
592
  ] });
587
593
  }
588
594
  function A({
589
- status: o,
590
- boardStatus: n,
595
+ status: n,
596
+ boardStatus: o,
591
597
  p: t
592
598
  }) {
593
- const u = (n == null ? void 0 : n.color) ?? oe[o] ?? "#9ca3af";
594
- return /* @__PURE__ */ s("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: [
595
- /* @__PURE__ */ e("span", { style: { width: 6, height: 6, borderRadius: "50%", background: u, display: "inline-block", flexShrink: 0 } }),
596
- (n == null ? void 0 : n.name) ?? o.replace("_", " ")
599
+ const f = (o == null ? void 0 : o.color) ?? ne[n] ?? "#9ca3af";
600
+ return /* @__PURE__ */ d("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: [
601
+ /* @__PURE__ */ e("span", { style: { width: 6, height: 6, borderRadius: "50%", background: f, display: "inline-block", flexShrink: 0 } }),
602
+ (o == null ? void 0 : o.name) ?? n.replace("_", " ")
597
603
  ] });
598
604
  }
599
- function re({ size: o = 16, color: n = "currentColor" }) {
600
- return /* @__PURE__ */ e("svg", { width: o, height: o, 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" }) });
605
+ function re({ size: n = 16, color: o = "currentColor" }) {
606
+ return /* @__PURE__ */ e("svg", { width: n, height: n, viewBox: "0 0 24 24", fill: "none", stroke: o, 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" }) });
601
607
  }
602
- function D({ color: o = "currentColor", size: n = 11 }) {
603
- return /* @__PURE__ */ e("svg", { width: n, height: n, viewBox: "0 0 16 16", fill: "none", stroke: o, strokeWidth: 2.2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M8 13V3M3 8l5-5 5 5" }) });
608
+ function D({ color: n = "currentColor", size: o = 11 }) {
609
+ return /* @__PURE__ */ e("svg", { width: o, height: o, 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" }) });
604
610
  }
605
- function P(o) {
606
- return new Date(o).toLocaleDateString(void 0, { month: "short", day: "numeric" });
611
+ function P(n) {
612
+ return new Date(n).toLocaleDateString(void 0, { month: "short", day: "numeric" });
607
613
  }
608
614
  export {
609
615
  ae as FeedbackWidget,
610
616
  de as UpstepProvider,
611
- B as useUpstep
617
+ I as useUpstep
612
618
  };