@korso/shepherd-ui 0.4.0 → 0.5.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/LICENSE +661 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.js +14 -0
- package/dist/config/ConfigPanel.js +1 -1
- package/dist/config/ConnectAgent.d.ts +1 -2
- package/dist/config/ConnectAgent.js +18 -21
- package/dist/config/Members.js +1 -1
- package/dist/lib/{Dashboard-CTXdGRxM.js → Dashboard-qipRa5MO.js} +124 -109
- package/dist/lib/index.d.ts +15 -2
- package/dist/lib/index.js +238 -241
- package/dist/lib/selfhost.js +1 -1
- package/dist/lib/styles.css +4 -3
- package/dist/preview.js +15 -3
- package/dist/selfhost/assets/{index-CK7qrsNo.css → index-DfVGGaT0.css} +1 -1
- package/dist/selfhost/assets/{index-BSnsUIT-.js → index-xMSuivCM.js} +8 -8
- package/dist/selfhost/index.html +2 -2
- package/dist/test/mockClient.js +3 -0
- package/package.json +2 -2
package/dist/lib/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { u as A, d as I, f as
|
|
2
|
-
import { E as
|
|
3
|
-
import { jsxs as n, jsx as e, Fragment as
|
|
4
|
-
import { useId as
|
|
5
|
-
function
|
|
6
|
-
return (
|
|
1
|
+
import { u as A, d as I, f as O, D as G } from "./Dashboard-qipRa5MO.js";
|
|
2
|
+
import { E as ce, S as de, a as ue, c as he } from "./Dashboard-qipRa5MO.js";
|
|
3
|
+
import { jsxs as n, jsx as e, Fragment as F } from "react/jsx-runtime";
|
|
4
|
+
import { useId as B, useRef as P, useState as a, useEffect as U, useCallback as K } from "react";
|
|
5
|
+
function D(i) {
|
|
6
|
+
return (i.trim()[0] ?? "?").toUpperCase();
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
workspaces:
|
|
10
|
-
selected:
|
|
11
|
-
onSelect:
|
|
12
|
-
onChanged:
|
|
8
|
+
function Y({
|
|
9
|
+
workspaces: i,
|
|
10
|
+
selected: t,
|
|
11
|
+
onSelect: d,
|
|
12
|
+
onChanged: v,
|
|
13
13
|
onMembersChanged: o
|
|
14
14
|
}) {
|
|
15
|
-
const h = A(),
|
|
15
|
+
const h = A(), m = B(), p = P(null), [l, y] = a(!1), [b, w] = a("menu"), [g, N] = a(""), [u, C] = a(""), [E, r] = a(null), [k, _] = a(!1);
|
|
16
16
|
function S() {
|
|
17
|
-
|
|
17
|
+
y(!1), w("menu"), N(""), C(""), r(null);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
U(() => {
|
|
20
20
|
if (!l) return;
|
|
21
|
-
function s(
|
|
22
|
-
|
|
21
|
+
function s($) {
|
|
22
|
+
p.current && !p.current.contains($.target) && S();
|
|
23
23
|
}
|
|
24
|
-
function R(
|
|
25
|
-
|
|
24
|
+
function R($) {
|
|
25
|
+
$.key === "Escape" && S();
|
|
26
26
|
}
|
|
27
27
|
return document.addEventListener("mousedown", s), document.addEventListener("keydown", R), () => {
|
|
28
28
|
document.removeEventListener("mousedown", s), document.removeEventListener("keydown", R);
|
|
@@ -30,53 +30,53 @@ function J({
|
|
|
30
30
|
}, [l]);
|
|
31
31
|
async function x() {
|
|
32
32
|
if (!(!g.trim() || k)) {
|
|
33
|
-
_(!0),
|
|
33
|
+
_(!0), r(null);
|
|
34
34
|
try {
|
|
35
35
|
const s = await h.createWorkspace({ name: g.trim() });
|
|
36
|
-
|
|
36
|
+
d(s.id), v(), S();
|
|
37
37
|
} catch (s) {
|
|
38
|
-
|
|
38
|
+
r(I(s));
|
|
39
39
|
} finally {
|
|
40
40
|
_(!1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
async function L() {
|
|
45
|
-
if (!(!
|
|
46
|
-
_(!0),
|
|
45
|
+
if (!(!u.trim() || k)) {
|
|
46
|
+
_(!0), r(null);
|
|
47
47
|
try {
|
|
48
|
-
const s = await h.redeemInvite(
|
|
49
|
-
|
|
48
|
+
const s = await h.redeemInvite(u.trim());
|
|
49
|
+
d(s.workspace.id), v(), o == null || o(), S();
|
|
50
50
|
} catch (s) {
|
|
51
|
-
|
|
51
|
+
r(I(s));
|
|
52
52
|
} finally {
|
|
53
53
|
_(!1);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
return /* @__PURE__ */ n("div", { className: "ws-switcher", ref:
|
|
57
|
+
const f = t !== null, T = t ? t.name : "Get started";
|
|
58
|
+
return /* @__PURE__ */ n("div", { className: "ws-switcher", ref: p, children: [
|
|
59
59
|
/* @__PURE__ */ n(
|
|
60
60
|
"button",
|
|
61
61
|
{
|
|
62
62
|
type: "button",
|
|
63
|
-
className: "ws-trig" + (
|
|
63
|
+
className: "ws-trig" + (f ? "" : " ws-trig--empty"),
|
|
64
64
|
"aria-haspopup": "menu",
|
|
65
65
|
"aria-expanded": l,
|
|
66
|
-
"aria-controls": l ?
|
|
67
|
-
onClick: () => l ? S() :
|
|
66
|
+
"aria-controls": l ? m : void 0,
|
|
67
|
+
onClick: () => l ? S() : y(!0),
|
|
68
68
|
children: [
|
|
69
|
-
|
|
69
|
+
f ? /* @__PURE__ */ e("span", { className: "ws-avatar", "aria-hidden": "true", children: D(T) }) : /* @__PURE__ */ e("span", { className: "ws-plus", "aria-hidden": "true", children: "+" }),
|
|
70
70
|
/* @__PURE__ */ e("span", { className: "ws-name", children: T }),
|
|
71
71
|
/* @__PURE__ */ e("span", { className: "ws-caret", "aria-hidden": "true", children: "▾" })
|
|
72
72
|
]
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
l && /* @__PURE__ */ n("div", { className: "ws-menu", id:
|
|
76
|
-
b === "menu" && /* @__PURE__ */ n(
|
|
77
|
-
/* @__PURE__ */ e("p", { className: "ws-menu__head", children:
|
|
78
|
-
|
|
79
|
-
const R = s.id === (
|
|
75
|
+
l && /* @__PURE__ */ n("div", { className: "ws-menu", id: m, role: "menu", children: [
|
|
76
|
+
b === "menu" && /* @__PURE__ */ n(F, { children: [
|
|
77
|
+
/* @__PURE__ */ e("p", { className: "ws-menu__head", children: f ? "Switch workspace" : "Your workspaces" }),
|
|
78
|
+
i.length === 0 ? /* @__PURE__ */ e("p", { className: "ws-menu__none", children: "None yet" }) : /* @__PURE__ */ e("ul", { className: "ws-menu__list", children: i.map((s) => {
|
|
79
|
+
const R = s.id === (t == null ? void 0 : t.id);
|
|
80
80
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ n(
|
|
81
81
|
"button",
|
|
82
82
|
{
|
|
@@ -85,10 +85,10 @@ function J({
|
|
|
85
85
|
"aria-checked": R,
|
|
86
86
|
className: "ws-mi" + (R ? " ws-mi--on" : ""),
|
|
87
87
|
onClick: () => {
|
|
88
|
-
|
|
88
|
+
d(s.id), S();
|
|
89
89
|
},
|
|
90
90
|
children: [
|
|
91
|
-
/* @__PURE__ */ e("span", { className: "ws-avatar ws-avatar--sm", "aria-hidden": "true", children:
|
|
91
|
+
/* @__PURE__ */ e("span", { className: "ws-avatar ws-avatar--sm", "aria-hidden": "true", children: D(s.name) }),
|
|
92
92
|
/* @__PURE__ */ e("span", { className: "ws-mi__name", children: s.name }),
|
|
93
93
|
R && /* @__PURE__ */ e("span", { className: "ws-mi__check", "aria-hidden": "true", children: "✓" })
|
|
94
94
|
]
|
|
@@ -103,7 +103,7 @@ function J({
|
|
|
103
103
|
role: "menuitem",
|
|
104
104
|
className: "ws-action",
|
|
105
105
|
onClick: () => {
|
|
106
|
-
|
|
106
|
+
r(null), w("create");
|
|
107
107
|
},
|
|
108
108
|
children: "+ Create workspace"
|
|
109
109
|
}
|
|
@@ -115,7 +115,7 @@ function J({
|
|
|
115
115
|
role: "menuitem",
|
|
116
116
|
className: "ws-action",
|
|
117
117
|
onClick: () => {
|
|
118
|
-
|
|
118
|
+
r(null), w("join");
|
|
119
119
|
},
|
|
120
120
|
children: "⎘ Join with a code"
|
|
121
121
|
}
|
|
@@ -130,20 +130,20 @@ function J({
|
|
|
130
130
|
s.preventDefault(), x();
|
|
131
131
|
},
|
|
132
132
|
children: [
|
|
133
|
-
/* @__PURE__ */ e("label", { htmlFor: `${
|
|
133
|
+
/* @__PURE__ */ e("label", { htmlFor: `${m}-name`, children: "New workspace name" }),
|
|
134
134
|
/* @__PURE__ */ e(
|
|
135
135
|
"input",
|
|
136
136
|
{
|
|
137
|
-
id: `${
|
|
137
|
+
id: `${m}-name`,
|
|
138
138
|
type: "text",
|
|
139
139
|
placeholder: "e.g. Acme Engineering",
|
|
140
140
|
value: g,
|
|
141
141
|
autoFocus: !0,
|
|
142
|
-
onChange: (s) =>
|
|
142
|
+
onChange: (s) => N(s.target.value)
|
|
143
143
|
}
|
|
144
144
|
),
|
|
145
145
|
/* @__PURE__ */ n("div", { className: "ws-form__row", children: [
|
|
146
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () =>
|
|
146
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () => w("menu"), children: "Back" }),
|
|
147
147
|
/* @__PURE__ */ e("button", { type: "submit", disabled: k || !g.trim(), children: "Create" })
|
|
148
148
|
] })
|
|
149
149
|
]
|
|
@@ -157,21 +157,21 @@ function J({
|
|
|
157
157
|
s.preventDefault(), L();
|
|
158
158
|
},
|
|
159
159
|
children: [
|
|
160
|
-
/* @__PURE__ */ e("label", { htmlFor: `${
|
|
160
|
+
/* @__PURE__ */ e("label", { htmlFor: `${m}-code`, children: "Invite code" }),
|
|
161
161
|
/* @__PURE__ */ e(
|
|
162
162
|
"input",
|
|
163
163
|
{
|
|
164
|
-
id: `${
|
|
164
|
+
id: `${m}-code`,
|
|
165
165
|
type: "text",
|
|
166
166
|
placeholder: "Paste an invite code",
|
|
167
|
-
value:
|
|
167
|
+
value: u,
|
|
168
168
|
autoFocus: !0,
|
|
169
169
|
onChange: (s) => C(s.target.value)
|
|
170
170
|
}
|
|
171
171
|
),
|
|
172
172
|
/* @__PURE__ */ n("div", { className: "ws-form__row", children: [
|
|
173
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () =>
|
|
174
|
-
/* @__PURE__ */ e("button", { type: "submit", disabled: k || !
|
|
173
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ws-form__back", onClick: () => w("menu"), children: "Back" }),
|
|
174
|
+
/* @__PURE__ */ e("button", { type: "submit", disabled: k || !u.trim(), children: "Join" })
|
|
175
175
|
] })
|
|
176
176
|
]
|
|
177
177
|
}
|
|
@@ -180,150 +180,150 @@ function J({
|
|
|
180
180
|
] })
|
|
181
181
|
] });
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
const
|
|
183
|
+
function J({ workspace: i, onLeft: t }) {
|
|
184
|
+
const d = A(), v = B(), [o, h] = a(null), [m, p] = a(!1);
|
|
185
185
|
async function l() {
|
|
186
|
-
if (!
|
|
187
|
-
|
|
186
|
+
if (!m) {
|
|
187
|
+
p(!0), h(null);
|
|
188
188
|
try {
|
|
189
|
-
await
|
|
190
|
-
} catch (
|
|
191
|
-
h(I(
|
|
189
|
+
await d.leave(i.id), t == null || t();
|
|
190
|
+
} catch (y) {
|
|
191
|
+
h(I(y));
|
|
192
192
|
} finally {
|
|
193
|
-
|
|
193
|
+
p(!1);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
return /* @__PURE__ */ n("section", { className: "shepherd-general", "aria-labelledby":
|
|
197
|
+
return /* @__PURE__ */ n("section", { className: "shepherd-general", "aria-labelledby": v, children: [
|
|
198
198
|
/* @__PURE__ */ n("div", { className: "card-head", children: [
|
|
199
|
-
/* @__PURE__ */ e("h3", { id:
|
|
199
|
+
/* @__PURE__ */ e("h3", { id: v, children: "General" }),
|
|
200
200
|
/* @__PURE__ */ e("p", { className: "card-sub", children: "Your active workspace and its settings." })
|
|
201
201
|
] }),
|
|
202
202
|
/* @__PURE__ */ n("div", { className: "card-body", children: [
|
|
203
203
|
o && /* @__PURE__ */ e("p", { role: "alert", children: o }),
|
|
204
204
|
/* @__PURE__ */ n("div", { className: "field", children: [
|
|
205
205
|
/* @__PURE__ */ e("label", { children: "Workspace name" }),
|
|
206
|
-
/* @__PURE__ */ e("p", { className: "readonly-value", children:
|
|
206
|
+
/* @__PURE__ */ e("p", { className: "readonly-value", children: i.name })
|
|
207
207
|
] }),
|
|
208
208
|
/* @__PURE__ */ n("div", { className: "field", children: [
|
|
209
209
|
/* @__PURE__ */ e("label", { children: "Your role" }),
|
|
210
|
-
/* @__PURE__ */ e("p", { className: "readonly-value", children:
|
|
210
|
+
/* @__PURE__ */ e("p", { className: "readonly-value", children: i.role })
|
|
211
211
|
] }),
|
|
212
212
|
/* @__PURE__ */ n("div", { className: "field leave", children: [
|
|
213
213
|
/* @__PURE__ */ e("label", { children: "Leave workspace" }),
|
|
214
214
|
/* @__PURE__ */ e("p", { className: "helper", children: "Remove yourself from this workspace. You'll need a new invite to rejoin." }),
|
|
215
|
-
/* @__PURE__ */ e("button", { type: "button", className: "danger", onClick: () => void l(), disabled:
|
|
215
|
+
/* @__PURE__ */ e("button", { type: "button", className: "danger", onClick: () => void l(), disabled: m, children: "Leave workspace" })
|
|
216
216
|
] })
|
|
217
217
|
] })
|
|
218
218
|
] });
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
const
|
|
222
|
-
async function C({ keepError:
|
|
223
|
-
|
|
220
|
+
function V({ workspaceId: i, refreshKey: t = 0, canRemove: d = !1 }) {
|
|
221
|
+
const v = A(), o = B(), [h, m] = a([]), [p, l] = a(null), [y, b] = a(null), [w, g] = a(!0), [N, u] = a(null);
|
|
222
|
+
async function C({ keepError: r = !1 } = {}) {
|
|
223
|
+
r || l(null);
|
|
224
224
|
try {
|
|
225
|
-
const k = await
|
|
226
|
-
|
|
225
|
+
const k = await v.listMembers(i);
|
|
226
|
+
m(k.members);
|
|
227
227
|
} catch (k) {
|
|
228
228
|
l(I(k));
|
|
229
229
|
} finally {
|
|
230
230
|
g(!1);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
U(() => {
|
|
234
234
|
g(!0), C();
|
|
235
|
-
}, [
|
|
236
|
-
async function E(
|
|
237
|
-
if (!
|
|
238
|
-
|
|
235
|
+
}, [v, i, t]);
|
|
236
|
+
async function E(r, k) {
|
|
237
|
+
if (!N) {
|
|
238
|
+
u(r), l(null), b(null), m((_) => _.filter((S) => S.accountId !== r));
|
|
239
239
|
try {
|
|
240
|
-
await
|
|
240
|
+
await v.removeMember(i, r), b(`Removed ${k}`);
|
|
241
241
|
} catch (_) {
|
|
242
242
|
l(I(_)), C({ keepError: !0 });
|
|
243
243
|
} finally {
|
|
244
|
-
|
|
244
|
+
u(null);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
return /* @__PURE__ */ n("section", { className: "shepherd-members", "aria-labelledby": o, children: [
|
|
249
249
|
/* @__PURE__ */ e("div", { className: "card-head", children: /* @__PURE__ */ e("h3", { id: o, children: "Members" }) }),
|
|
250
250
|
/* @__PURE__ */ n("div", { className: "card-body", children: [
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const k =
|
|
251
|
+
p && /* @__PURE__ */ e("p", { role: "alert", children: p }),
|
|
252
|
+
y && /* @__PURE__ */ e("p", { role: "status", children: y }),
|
|
253
|
+
w ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : h.length === 0 ? /* @__PURE__ */ e("p", { children: "No members." }) : /* @__PURE__ */ e("ul", { children: h.map((r) => {
|
|
254
|
+
const k = r.displayName ?? r.githubLogin ?? r.email ?? r.accountId;
|
|
255
255
|
return /* @__PURE__ */ n("li", { children: [
|
|
256
256
|
/* @__PURE__ */ e("span", { children: k }),
|
|
257
|
-
/* @__PURE__ */ e("span", { className: "role", children:
|
|
258
|
-
|
|
257
|
+
/* @__PURE__ */ e("span", { className: "role", children: r.role }),
|
|
258
|
+
d && /* @__PURE__ */ e(
|
|
259
259
|
"button",
|
|
260
260
|
{
|
|
261
261
|
type: "button",
|
|
262
262
|
"aria-label": `Remove ${k}`,
|
|
263
|
-
onClick: () => void E(
|
|
264
|
-
disabled:
|
|
263
|
+
onClick: () => void E(r.accountId, k),
|
|
264
|
+
disabled: N === r.accountId,
|
|
265
265
|
children: "Remove"
|
|
266
266
|
}
|
|
267
267
|
)
|
|
268
|
-
] },
|
|
268
|
+
] }, r.accountId);
|
|
269
269
|
}) })
|
|
270
270
|
] })
|
|
271
271
|
] });
|
|
272
272
|
}
|
|
273
|
-
function
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
h(null),
|
|
277
|
-
}, [
|
|
273
|
+
function X({ workspaceId: i, onMembersChanged: t }) {
|
|
274
|
+
const d = A(), v = B(), [o, h] = a(null), [m, p] = a(null), [l, y] = a(!1), [b, w] = a(""), [g, N] = a(null), [u, C] = a(!1), [E, r] = a(null);
|
|
275
|
+
U(() => {
|
|
276
|
+
h(null), N(null);
|
|
277
|
+
}, [i]);
|
|
278
278
|
async function k() {
|
|
279
279
|
if (!l) {
|
|
280
|
-
|
|
280
|
+
y(!0), p(null);
|
|
281
281
|
try {
|
|
282
|
-
const
|
|
283
|
-
h(
|
|
284
|
-
} catch (
|
|
285
|
-
|
|
282
|
+
const f = await d.createInvite(i, {});
|
|
283
|
+
h(f), t == null || t();
|
|
284
|
+
} catch (f) {
|
|
285
|
+
p(I(f));
|
|
286
286
|
} finally {
|
|
287
|
-
|
|
287
|
+
y(!1);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
async function _() {
|
|
292
292
|
if (!(!o || l)) {
|
|
293
|
-
|
|
293
|
+
y(!0), p(null);
|
|
294
294
|
try {
|
|
295
|
-
await
|
|
296
|
-
} catch (
|
|
297
|
-
|
|
295
|
+
await d.revokeInvite(i, o.code), h(null);
|
|
296
|
+
} catch (f) {
|
|
297
|
+
p(I(f));
|
|
298
298
|
} finally {
|
|
299
|
-
|
|
299
|
+
y(!1);
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
async function S() {
|
|
304
|
-
if (!(!b.trim() ||
|
|
305
|
-
C(!0),
|
|
304
|
+
if (!(!b.trim() || u)) {
|
|
305
|
+
C(!0), N(null);
|
|
306
306
|
try {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
} catch (
|
|
310
|
-
|
|
307
|
+
const f = await d.inviteByEmail(i, b.trim());
|
|
308
|
+
N(`Invite sent to ${f.email}.`), w(""), t == null || t();
|
|
309
|
+
} catch (f) {
|
|
310
|
+
N(I(f));
|
|
311
311
|
} finally {
|
|
312
312
|
C(!1);
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
const x = o ? `${window.location.origin}/shepherd/join/${encodeURIComponent(o.code)}` : null;
|
|
317
|
-
async function L(
|
|
318
|
-
await navigator.clipboard.writeText(T),
|
|
317
|
+
async function L(f, T) {
|
|
318
|
+
await navigator.clipboard.writeText(T), r(f), setTimeout(() => r((s) => s === f ? null : s), 2e3);
|
|
319
319
|
}
|
|
320
|
-
return /* @__PURE__ */ n("section", { className: "shepherd-invites", "aria-labelledby":
|
|
320
|
+
return /* @__PURE__ */ n("section", { className: "shepherd-invites", "aria-labelledby": v, children: [
|
|
321
321
|
/* @__PURE__ */ n("div", { className: "card-head", children: [
|
|
322
|
-
/* @__PURE__ */ e("h3", { id:
|
|
322
|
+
/* @__PURE__ */ e("h3", { id: v, children: "Invite people" }),
|
|
323
323
|
/* @__PURE__ */ e("p", { className: "card-sub", children: "Share a code, or send a one-time join link by email." })
|
|
324
324
|
] }),
|
|
325
325
|
/* @__PURE__ */ n("div", { className: "card-body", children: [
|
|
326
|
-
|
|
326
|
+
m && /* @__PURE__ */ e("p", { role: "alert", children: m }),
|
|
327
327
|
/* @__PURE__ */ n("div", { className: "field invites", children: [
|
|
328
328
|
/* @__PURE__ */ e("label", { children: "Invite by code" }),
|
|
329
329
|
/* @__PURE__ */ e("p", { className: "helper", children: "Anyone with the code can join this workspace." }),
|
|
@@ -381,102 +381,99 @@ function q({ workspaceId: t, onMembersChanged: i }) {
|
|
|
381
381
|
type: "email",
|
|
382
382
|
placeholder: "name@example.com",
|
|
383
383
|
value: b,
|
|
384
|
-
onChange: (
|
|
384
|
+
onChange: (f) => w(f.target.value)
|
|
385
385
|
}
|
|
386
386
|
),
|
|
387
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () => void S(), disabled:
|
|
387
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => void S(), disabled: u, children: "Send invite" })
|
|
388
388
|
] }),
|
|
389
389
|
g && /* @__PURE__ */ e("p", { className: "email-invite__status", children: g })
|
|
390
390
|
] })
|
|
391
391
|
] })
|
|
392
392
|
] });
|
|
393
393
|
}
|
|
394
|
-
const
|
|
394
|
+
const q = [
|
|
395
395
|
{ id: "claude", label: "Claude Code" },
|
|
396
396
|
{ id: "codex", label: "Codex" },
|
|
397
397
|
{ id: "pi", label: "Pi" },
|
|
398
398
|
{ id: "generic", label: "Generic (JSON)" }
|
|
399
|
-
],
|
|
400
|
-
claude: "claude mcp add shepherd -s user
|
|
401
|
-
codex: "codex mcp add shepherd
|
|
402
|
-
pi: "pi mcp add shepherd
|
|
399
|
+
], z = "shp_<paste-after-generating>", Q = {
|
|
400
|
+
claude: "claude mcp add shepherd -s user",
|
|
401
|
+
codex: "codex mcp add shepherd",
|
|
402
|
+
pi: "pi mcp add shepherd"
|
|
403
403
|
};
|
|
404
|
-
function
|
|
405
|
-
const
|
|
406
|
-
return `${
|
|
404
|
+
function Z(i, t) {
|
|
405
|
+
const d = `created ${O(i.createdAt, t)}`, v = i.lastUsedAt ? `last used ${O(i.lastUsedAt, t)}` : "never used";
|
|
406
|
+
return `${d} · ${v}`;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
return
|
|
408
|
+
function M(i, t, d) {
|
|
409
|
+
return i === "generic" ? JSON.stringify(
|
|
410
410
|
{
|
|
411
411
|
mcpServers: {
|
|
412
412
|
shepherd: {
|
|
413
413
|
command: "npx",
|
|
414
414
|
args: ["-y", "@korso/shepherd"],
|
|
415
|
-
env: { HUB_URL:
|
|
415
|
+
env: { HUB_URL: t, SHEPHERD_TOKEN: d }
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
},
|
|
419
419
|
null,
|
|
420
420
|
2
|
|
421
421
|
) : [
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
"
|
|
426
|
-
].join(
|
|
427
|
-
`);
|
|
422
|
+
Q[i],
|
|
423
|
+
`-e HUB_URL=${t}`,
|
|
424
|
+
`-e SHEPHERD_TOKEN=${d}`,
|
|
425
|
+
"-- npx -y @korso/shepherd"
|
|
426
|
+
].join(" ");
|
|
428
427
|
}
|
|
429
|
-
function
|
|
430
|
-
const
|
|
431
|
-
async function
|
|
428
|
+
function ee({ hubUrl: i }) {
|
|
429
|
+
const t = A(), d = i ?? t.baseUrl, v = B(), [o, h] = a("claude"), [m, p] = a(""), [l, y] = a(null), [b, w] = a([]), [g, N] = a(null), [u, C] = a(null), [E, r] = a(!1), [k, _] = a(!1), [S, x] = a(!0), [L, f] = a(null);
|
|
430
|
+
async function T() {
|
|
432
431
|
try {
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
} catch (
|
|
436
|
-
|
|
432
|
+
const c = await t.listAccountTokens();
|
|
433
|
+
w(c.tokens);
|
|
434
|
+
} catch (c) {
|
|
435
|
+
N(I(c));
|
|
437
436
|
} finally {
|
|
438
|
-
|
|
437
|
+
x(!1);
|
|
439
438
|
}
|
|
440
439
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}, [r, t]), j(() => {
|
|
444
|
-
b(null);
|
|
440
|
+
U(() => {
|
|
441
|
+
x(!0), T();
|
|
445
442
|
}, [t]);
|
|
446
|
-
async function
|
|
447
|
-
|
|
443
|
+
async function s() {
|
|
444
|
+
r(!0), N(null);
|
|
448
445
|
try {
|
|
449
|
-
const
|
|
450
|
-
t,
|
|
446
|
+
const c = await t.mintAccountToken(
|
|
451
447
|
m.trim() ? { name: m.trim() } : {}
|
|
452
448
|
);
|
|
453
|
-
|
|
454
|
-
} catch (
|
|
455
|
-
|
|
449
|
+
y(c.token), p(""), await T();
|
|
450
|
+
} catch (c) {
|
|
451
|
+
N(I(c));
|
|
456
452
|
} finally {
|
|
457
|
-
|
|
453
|
+
r(!1);
|
|
458
454
|
}
|
|
459
455
|
}
|
|
460
|
-
async function
|
|
461
|
-
if (!
|
|
462
|
-
|
|
456
|
+
async function R(c) {
|
|
457
|
+
if (!L) {
|
|
458
|
+
f(c), N(null), C(null);
|
|
463
459
|
try {
|
|
464
|
-
await
|
|
465
|
-
} catch (
|
|
466
|
-
|
|
460
|
+
await t.revokeAccountToken(c), w((j) => j.filter((W) => W.id !== c)), C("Token revoked");
|
|
461
|
+
} catch (j) {
|
|
462
|
+
N(I(j));
|
|
467
463
|
} finally {
|
|
468
|
-
|
|
464
|
+
f(null);
|
|
469
465
|
}
|
|
470
466
|
}
|
|
471
467
|
}
|
|
472
|
-
const
|
|
473
|
-
async function
|
|
474
|
-
await navigator.clipboard.writeText(
|
|
468
|
+
const $ = M(o, d, l ?? z);
|
|
469
|
+
async function H() {
|
|
470
|
+
await navigator.clipboard.writeText($), _(!0), setTimeout(() => _(!1), 2e3);
|
|
475
471
|
}
|
|
476
|
-
return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby":
|
|
472
|
+
return /* @__PURE__ */ n("section", { className: "shepherd-connect-agent", "aria-labelledby": v, children: [
|
|
477
473
|
/* @__PURE__ */ n("div", { className: "card-head", children: [
|
|
478
|
-
/* @__PURE__ */ e("h3", { id:
|
|
479
|
-
/* @__PURE__ */ e("p", { className: "card-sub", children: "Generate a token
|
|
474
|
+
/* @__PURE__ */ e("h3", { id: v, children: "Connect your agent" }),
|
|
475
|
+
/* @__PURE__ */ e("p", { className: "card-sub", children: "Generate a token — it works across all your workspaces — then paste the command into your coding tool." }),
|
|
476
|
+
/* @__PURE__ */ e("p", { className: "card-sub", children: "The first time the agent opens a repo, it'll ask which workspace to coordinate that repo with." })
|
|
480
477
|
] }),
|
|
481
478
|
/* @__PURE__ */ n("div", { className: "card-body", children: [
|
|
482
479
|
/* @__PURE__ */ n("div", { className: "field", children: [
|
|
@@ -485,9 +482,9 @@ function ne({ workspaceId: t, hubUrl: i }) {
|
|
|
485
482
|
"select",
|
|
486
483
|
{
|
|
487
484
|
id: "connect-tool",
|
|
488
|
-
value:
|
|
489
|
-
onChange: (
|
|
490
|
-
children:
|
|
485
|
+
value: o,
|
|
486
|
+
onChange: (c) => h(c.target.value),
|
|
487
|
+
children: q.map((c) => /* @__PURE__ */ e("option", { value: c.id, children: c.label }, c.id))
|
|
491
488
|
}
|
|
492
489
|
)
|
|
493
490
|
] }),
|
|
@@ -500,27 +497,27 @@ function ne({ workspaceId: t, hubUrl: i }) {
|
|
|
500
497
|
id: "token-name",
|
|
501
498
|
type: "text",
|
|
502
499
|
value: m,
|
|
503
|
-
onChange: (
|
|
500
|
+
onChange: (c) => p(c.target.value),
|
|
504
501
|
placeholder: "e.g. laptop"
|
|
505
502
|
}
|
|
506
503
|
),
|
|
507
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: () => void
|
|
504
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: () => void s(), disabled: E, children: "Generate token" })
|
|
508
505
|
] })
|
|
509
506
|
] }),
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
507
|
+
g && /* @__PURE__ */ e("p", { role: "alert", children: g }),
|
|
508
|
+
u && /* @__PURE__ */ e("p", { role: "status", children: u }),
|
|
509
|
+
l && /* @__PURE__ */ e("p", { className: "token-once", role: "status", children: "Copy this token now — it won't be shown again." }),
|
|
513
510
|
/* @__PURE__ */ n("div", { className: "install-command", children: [
|
|
514
|
-
/* @__PURE__ */ e("pre", { "data-testid": "install-command", children:
|
|
511
|
+
/* @__PURE__ */ e("pre", { "data-testid": "install-command", children: $ }),
|
|
515
512
|
/* @__PURE__ */ e(
|
|
516
513
|
"button",
|
|
517
514
|
{
|
|
518
515
|
type: "button",
|
|
519
516
|
className: "install-command__copy",
|
|
520
|
-
"aria-label":
|
|
521
|
-
title:
|
|
522
|
-
onClick: () => void
|
|
523
|
-
children:
|
|
517
|
+
"aria-label": k ? "Copied" : "Copy command",
|
|
518
|
+
title: k ? "Copied" : "Copy",
|
|
519
|
+
onClick: () => void H(),
|
|
520
|
+
children: k ? /* @__PURE__ */ e(
|
|
524
521
|
"svg",
|
|
525
522
|
{
|
|
526
523
|
width: "15",
|
|
@@ -556,110 +553,110 @@ function ne({ workspaceId: t, hubUrl: i }) {
|
|
|
556
553
|
)
|
|
557
554
|
] }),
|
|
558
555
|
/* @__PURE__ */ e("h4", { children: "Existing tokens" }),
|
|
559
|
-
|
|
560
|
-
const
|
|
556
|
+
S ? /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) : b.length === 0 ? /* @__PURE__ */ e("p", { children: "No tokens yet." }) : /* @__PURE__ */ e("ul", { children: b.map((c) => {
|
|
557
|
+
const j = c.name ?? c.id;
|
|
561
558
|
return /* @__PURE__ */ n("li", { children: [
|
|
562
|
-
/* @__PURE__ */ e("span", { children:
|
|
563
|
-
/* @__PURE__ */ e("span", { className: "token-meta", children:
|
|
564
|
-
|
|
559
|
+
/* @__PURE__ */ e("span", { children: j }),
|
|
560
|
+
/* @__PURE__ */ e("span", { className: "token-meta", children: Z(c, Date.now()) }),
|
|
561
|
+
c.revokedAt ? /* @__PURE__ */ e("span", { className: "revoked", children: "revoked" }) : /* @__PURE__ */ e(
|
|
565
562
|
"button",
|
|
566
563
|
{
|
|
567
564
|
type: "button",
|
|
568
|
-
"aria-label": `Revoke token ${
|
|
569
|
-
onClick: () => void
|
|
570
|
-
disabled:
|
|
565
|
+
"aria-label": `Revoke token ${j}`,
|
|
566
|
+
onClick: () => void R(c.id),
|
|
567
|
+
disabled: L === c.id,
|
|
571
568
|
children: "Revoke"
|
|
572
569
|
}
|
|
573
570
|
)
|
|
574
|
-
] },
|
|
571
|
+
] }, c.id);
|
|
575
572
|
}) })
|
|
576
573
|
] })
|
|
577
574
|
] });
|
|
578
575
|
}
|
|
579
|
-
const
|
|
576
|
+
const ne = [
|
|
580
577
|
{ id: "general", label: "General" },
|
|
581
578
|
{ id: "members", label: "Members" },
|
|
582
579
|
{ id: "agent", label: "Agent" }
|
|
583
580
|
];
|
|
584
|
-
function
|
|
585
|
-
workspace:
|
|
586
|
-
hubUrl:
|
|
587
|
-
membersRefreshKey:
|
|
588
|
-
onMembersChanged:
|
|
581
|
+
function te({
|
|
582
|
+
workspace: i,
|
|
583
|
+
hubUrl: t,
|
|
584
|
+
membersRefreshKey: d,
|
|
585
|
+
onMembersChanged: v,
|
|
589
586
|
onLeft: o
|
|
590
587
|
}) {
|
|
591
|
-
const [h,
|
|
588
|
+
const [h, m] = a("general"), p = i.role === "admin";
|
|
592
589
|
return /* @__PURE__ */ n("div", { className: "config-layout", children: [
|
|
593
|
-
/* @__PURE__ */ e("nav", { className: "config-nav", "aria-label": "Configuration sections", children:
|
|
590
|
+
/* @__PURE__ */ e("nav", { className: "config-nav", "aria-label": "Configuration sections", children: ne.map(({ id: l, label: y }) => /* @__PURE__ */ e(
|
|
594
591
|
"button",
|
|
595
592
|
{
|
|
596
593
|
type: "button",
|
|
597
594
|
className: "config-nav__item" + (h === l ? " config-nav__item--on" : ""),
|
|
598
595
|
"aria-current": h === l ? "page" : void 0,
|
|
599
|
-
onClick: () =>
|
|
600
|
-
children:
|
|
596
|
+
onClick: () => m(l),
|
|
597
|
+
children: y
|
|
601
598
|
},
|
|
602
599
|
l
|
|
603
600
|
)) }),
|
|
604
601
|
/* @__PURE__ */ n("div", { className: "config-panel", children: [
|
|
605
|
-
h === "general" && /* @__PURE__ */ e(
|
|
606
|
-
h === "members" && /* @__PURE__ */ n(
|
|
602
|
+
h === "general" && /* @__PURE__ */ e(J, { workspace: i, onLeft: o }),
|
|
603
|
+
h === "members" && /* @__PURE__ */ n(F, { children: [
|
|
607
604
|
/* @__PURE__ */ e(
|
|
608
|
-
|
|
605
|
+
V,
|
|
609
606
|
{
|
|
610
|
-
workspaceId:
|
|
611
|
-
refreshKey:
|
|
612
|
-
canRemove:
|
|
607
|
+
workspaceId: i.id,
|
|
608
|
+
refreshKey: d,
|
|
609
|
+
canRemove: p
|
|
613
610
|
}
|
|
614
611
|
),
|
|
615
|
-
|
|
612
|
+
p && /* @__PURE__ */ e(X, { workspaceId: i.id, onMembersChanged: v })
|
|
616
613
|
] }),
|
|
617
|
-
h === "agent" && /* @__PURE__ */ e(
|
|
614
|
+
h === "agent" && /* @__PURE__ */ e(ee, { hubUrl: t })
|
|
618
615
|
] })
|
|
619
616
|
] });
|
|
620
617
|
}
|
|
621
|
-
function
|
|
622
|
-
const
|
|
618
|
+
function re({ hubUrl: i }) {
|
|
619
|
+
const t = A(), [d, v] = a({ status: "loading" }), [o, h] = a(null), [m, p] = a(0), l = K(async () => {
|
|
623
620
|
try {
|
|
624
|
-
const
|
|
625
|
-
|
|
621
|
+
const u = await t.listWorkspaces();
|
|
622
|
+
v({ status: "ready", workspaces: u.workspaces }), h(
|
|
626
623
|
(C) => {
|
|
627
624
|
var E;
|
|
628
|
-
return C &&
|
|
625
|
+
return C && u.workspaces.some((r) => r.id === C) ? C : ((E = u.workspaces[0]) == null ? void 0 : E.id) ?? null;
|
|
629
626
|
}
|
|
630
627
|
);
|
|
631
|
-
} catch (
|
|
632
|
-
|
|
628
|
+
} catch (u) {
|
|
629
|
+
v({ status: "error", message: I(u) });
|
|
633
630
|
}
|
|
634
|
-
}, [
|
|
635
|
-
|
|
631
|
+
}, [t]);
|
|
632
|
+
U(() => {
|
|
636
633
|
l();
|
|
637
634
|
}, [l]);
|
|
638
|
-
const
|
|
639
|
-
if (
|
|
635
|
+
const y = d.status === "ready" ? d.workspaces : [], b = y.find((u) => u.id === o) ?? null;
|
|
636
|
+
if (d.status === "loading")
|
|
640
637
|
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "status", children: "Loading…" }) });
|
|
641
|
-
if (
|
|
642
|
-
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children:
|
|
643
|
-
const
|
|
644
|
-
|
|
638
|
+
if (d.status === "error")
|
|
639
|
+
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e("p", { role: "alert", children: d.message }) });
|
|
640
|
+
const w = y.length > 0, g = /* @__PURE__ */ e(
|
|
641
|
+
Y,
|
|
645
642
|
{
|
|
646
|
-
workspaces:
|
|
643
|
+
workspaces: y,
|
|
647
644
|
selected: b,
|
|
648
645
|
onSelect: h,
|
|
649
646
|
onChanged: () => {
|
|
650
647
|
l();
|
|
651
648
|
},
|
|
652
|
-
onMembersChanged: () =>
|
|
649
|
+
onMembersChanged: () => p((u) => u + 1)
|
|
653
650
|
}
|
|
654
|
-
),
|
|
651
|
+
), N = /* @__PURE__ */ n("section", { className: "shepherd-config", "aria-labelledby": "config-heading", children: [
|
|
655
652
|
/* @__PURE__ */ e("h2", { id: "config-heading", children: "Configuration" }),
|
|
656
653
|
b ? /* @__PURE__ */ e(
|
|
657
|
-
|
|
654
|
+
te,
|
|
658
655
|
{
|
|
659
656
|
workspace: b,
|
|
660
|
-
hubUrl:
|
|
661
|
-
membersRefreshKey:
|
|
662
|
-
onMembersChanged: () =>
|
|
657
|
+
hubUrl: i,
|
|
658
|
+
membersRefreshKey: m,
|
|
659
|
+
onMembersChanged: () => p((u) => u + 1),
|
|
663
660
|
onLeft: () => void l()
|
|
664
661
|
}
|
|
665
662
|
) : /* @__PURE__ */ n("p", { className: "config-none", children: [
|
|
@@ -669,28 +666,28 @@ function se({ hubUrl: t }) {
|
|
|
669
666
|
] })
|
|
670
667
|
] });
|
|
671
668
|
return /* @__PURE__ */ e("div", { className: "shepherd-root", children: /* @__PURE__ */ e(
|
|
672
|
-
|
|
669
|
+
G,
|
|
673
670
|
{
|
|
674
671
|
workspaceId: b == null ? void 0 : b.id,
|
|
675
|
-
config:
|
|
672
|
+
config: N,
|
|
676
673
|
switcher: g,
|
|
677
|
-
hasWorkspace:
|
|
674
|
+
hasWorkspace: w
|
|
678
675
|
}
|
|
679
676
|
) });
|
|
680
677
|
}
|
|
681
678
|
export {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
679
|
+
te as ConfigPanel,
|
|
680
|
+
ee as ConnectAgent,
|
|
681
|
+
G as Dashboard,
|
|
682
|
+
ce as EmptyState,
|
|
683
|
+
J as GeneralSettings,
|
|
684
|
+
X as Invites,
|
|
685
|
+
V as Members,
|
|
686
|
+
de as ShepherdClientError,
|
|
687
|
+
ue as ShepherdClientProvider,
|
|
688
|
+
re as ShepherdRoot,
|
|
689
|
+
Y as WorkspaceSwitcher,
|
|
690
|
+
he as createShepherdClient,
|
|
694
691
|
I as describeError,
|
|
695
692
|
A as useShepherdClient
|
|
696
693
|
};
|