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