@korso/shepherd-ui 0.9.1 → 0.10.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/dist/JoinWorkspace.d.ts +12 -0
- package/dist/JoinWorkspace.js +34 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/lib/index.d.ts +13 -0
- package/dist/lib/index.js +382 -337
- package/dist/lib/styles.css +30 -0
- package/dist/selfhost/assets/{index-0s8wNrl-.css → index-CGncP2MD.css} +1 -1
- package/dist/selfhost/index.html +2 -2
- package/package.json +1 -1
- /package/dist/selfhost/assets/{index-BK1xPf0V.js → index-BQL_SpLG.js} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { WorkspaceSummaryT } from "@shepherd/shared";
|
|
2
|
+
export interface JoinWorkspaceProps {
|
|
3
|
+
/** The raw invite code from the URL segment, forwarded opaquely to the hub. */
|
|
4
|
+
code: string;
|
|
5
|
+
/**
|
|
6
|
+
* Invoked once the redeem succeeds, with the workspace just joined. The host
|
|
7
|
+
* navigates to its board surface; the component keeps showing the success
|
|
8
|
+
* state until that navigation lands.
|
|
9
|
+
*/
|
|
10
|
+
onJoined: (workspace: WorkspaceSummaryT) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function JoinWorkspace({ code, onJoined }: JoinWorkspaceProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
3
|
+
import { useShepherdClient } from "./context.js";
|
|
4
|
+
import { describeError } from "./client.js";
|
|
5
|
+
export function JoinWorkspace({ code, onJoined }) {
|
|
6
|
+
const client = useShepherdClient();
|
|
7
|
+
const headingId = useId();
|
|
8
|
+
const [state, setState] = useState({ status: "joining" });
|
|
9
|
+
// Keep the latest onJoined without re-triggering the mount redeem when a
|
|
10
|
+
// host passes a fresh callback identity each render.
|
|
11
|
+
const onJoinedRef = useRef(onJoined);
|
|
12
|
+
onJoinedRef.current = onJoined;
|
|
13
|
+
const redeem = useCallback(async () => {
|
|
14
|
+
setState({ status: "joining" });
|
|
15
|
+
try {
|
|
16
|
+
const res = await client.redeemInvite(code);
|
|
17
|
+
setState({ status: "joined", workspace: res.workspace });
|
|
18
|
+
onJoinedRef.current(res.workspace);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
setState({ status: "error", message: describeError(err) });
|
|
22
|
+
}
|
|
23
|
+
}, [client, code]);
|
|
24
|
+
// Redeem once on mount. The ref guard keeps StrictMode's dev double-mount
|
|
25
|
+
// (which preserves refs across the simulated remount) from firing twice.
|
|
26
|
+
const started = useRef(false);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (started.current)
|
|
29
|
+
return;
|
|
30
|
+
started.current = true;
|
|
31
|
+
void redeem();
|
|
32
|
+
}, [redeem]);
|
|
33
|
+
return (_jsx("section", { className: "shepherd-join", "aria-labelledby": headingId, children: _jsxs("div", { className: "shepherd-join__card", children: [_jsx("p", { className: "shepherd-join__brand", children: "Shepherd" }), state.status === "joining" && (_jsxs(_Fragment, { children: [_jsx("h1", { id: headingId, children: "Joining workspace\u2026" }), _jsx("p", { className: "shepherd-join__copy", role: "status", children: "Hold on while we add you to the team." }), _jsx("div", { className: "shepherd-join__spinner", "aria-hidden": "true" })] })), state.status === "joined" && (_jsxs(_Fragment, { children: [_jsx("h1", { id: headingId, children: "You\u2019re in" }), _jsxs("p", { className: "shepherd-join__copy", role: "status", children: ["Joined ", _jsx("strong", { children: state.workspace.name }), ". Taking you to the board\u2026"] })] })), state.status === "error" && (_jsxs(_Fragment, { children: [_jsx("h1", { id: headingId, children: "Couldn\u2019t join the workspace" }), _jsx("p", { className: "shepherd-join__error", role: "alert", children: state.message }), _jsx("button", { type: "button", className: "shepherd-join__retry", onClick: () => void redeem(), children: "Try again" })] }))] }) }));
|
|
34
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type { ShepherdClient, ShepherdClientConfig } from "./client.js";
|
|
|
11
11
|
export { ShepherdClientProvider, useShepherdClient, } from "./context.js";
|
|
12
12
|
export { ShepherdRoot } from "./ShepherdRoot.js";
|
|
13
13
|
export type { ShepherdRootProps } from "./ShepherdRoot.js";
|
|
14
|
+
export { JoinWorkspace } from "./JoinWorkspace.js";
|
|
15
|
+
export type { JoinWorkspaceProps } from "./JoinWorkspace.js";
|
|
14
16
|
export { Dashboard } from "./components/Dashboard.js";
|
|
15
17
|
export type { DashboardProps } from "./components/Dashboard.js";
|
|
16
18
|
export { ConfigPanel, WorkspaceSwitcher, GeneralSettings, Members, Invites, ConnectAgent, EmptyState, } from "./config/index.js";
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
export { createShepherdClient, ShepherdClientError, describeError, } from "./client.js";
|
|
10
10
|
export { ShepherdClientProvider, useShepherdClient, } from "./context.js";
|
|
11
11
|
export { ShepherdRoot } from "./ShepherdRoot.js";
|
|
12
|
+
// The invite-link landing surface — auto-redeems a code and reports the joined
|
|
13
|
+
// workspace so the host can navigate to the board.
|
|
14
|
+
export { JoinWorkspace } from "./JoinWorkspace.js";
|
|
12
15
|
export { Dashboard } from "./components/Dashboard.js";
|
|
13
16
|
// Config screens — re-exported so consumers can compose the management surface
|
|
14
17
|
// directly without the full ShepherdRoot shell.
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -254,6 +254,19 @@ export declare interface InvitesProps {
|
|
|
254
254
|
onMembersChanged?: () => void;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
+
export declare function JoinWorkspace({ code, onJoined }: JoinWorkspaceProps): JSX_2.Element;
|
|
258
|
+
|
|
259
|
+
export declare interface JoinWorkspaceProps {
|
|
260
|
+
/** The raw invite code from the URL segment, forwarded opaquely to the hub. */
|
|
261
|
+
code: string;
|
|
262
|
+
/**
|
|
263
|
+
* Invoked once the redeem succeeds, with the workspace just joined. The host
|
|
264
|
+
* navigates to its board surface; the component keeps showing the success
|
|
265
|
+
* state until that navigation lands.
|
|
266
|
+
*/
|
|
267
|
+
onJoined: (workspace: WorkspaceSummaryT) => void;
|
|
268
|
+
}
|
|
269
|
+
|
|
257
270
|
declare const ListMembersResponse: z.ZodObject<{
|
|
258
271
|
members: z.ZodArray<z.ZodObject<{
|
|
259
272
|
accountId: z.ZodString;
|