@burdenoff/microfe-workspaces 2026.1120.1 → 2026.1123.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.
Files changed (56) hide show
  1. package/dist/WorkspacesRoot.js +39 -31
  2. package/dist/WorkspacesRoutes.js +91 -59
  3. package/dist/components/ProjectCard.js +48 -47
  4. package/dist/constants/navigationV2.d.ts +5 -0
  5. package/dist/constants/navigationV2.js +2 -2
  6. package/dist/generated/global-operations.d.ts +11 -1
  7. package/dist/generated/global-types.d.ts +9866 -574
  8. package/dist/generated/wspace-operations.d.ts +631 -2
  9. package/dist/generated/wspace-operations.js +5428 -1376
  10. package/dist/generated/wspace-types.d.ts +200319 -48046
  11. package/dist/generated/wspace-types.js +19 -0
  12. package/dist/hooks/useCollaboration.d.ts +143 -0
  13. package/dist/hooks/useCollaboration.js +119 -0
  14. package/dist/hooks/useCollaborationMutations.d.ts +177 -0
  15. package/dist/hooks/useCollaborationMutations.js +126 -0
  16. package/dist/hooks/v2/useWorkspacePagesV2Data.d.ts +89 -0
  17. package/dist/hooks/v2/useWorkspacePagesV2Data.js +211 -0
  18. package/dist/index.d.ts +1 -1
  19. package/dist/node_modules/sonner/dist/index.js +167 -0
  20. package/dist/pages/CollaborationConsolePage.d.ts +1 -0
  21. package/dist/pages/CollaborationConsolePage.js +1059 -0
  22. package/dist/pages/MembersListPage.js +101 -100
  23. package/dist/pages/ProjectMembersPage.js +116 -115
  24. package/dist/pages/ProjectsListPage.js +233 -232
  25. package/dist/pages/WorkspacesListPage.js +79 -68
  26. package/dist/pages/v2/ActivityPage.d.ts +1 -0
  27. package/dist/pages/v2/ActivityPage.js +150 -0
  28. package/dist/pages/v2/InvitePeopleDialog.d.ts +11 -0
  29. package/dist/pages/v2/InvitePeopleDialog.js +208 -0
  30. package/dist/pages/v2/InvitedTab.d.ts +9 -0
  31. package/dist/pages/v2/InvitedTab.js +223 -0
  32. package/dist/pages/v2/MembersPage.d.ts +1 -0
  33. package/dist/pages/v2/MembersPage.js +120 -0
  34. package/dist/pages/v2/PeopleTab.d.ts +20 -0
  35. package/dist/pages/v2/PeopleTab.js +253 -0
  36. package/dist/pages/v2/ProjectsPage.d.ts +1 -0
  37. package/dist/pages/v2/ProjectsPage.js +242 -0
  38. package/dist/pages/v2/WorkspacesPage.d.ts +3 -0
  39. package/dist/pages/v2/WorkspacesPage.js +247 -0
  40. package/dist/pages/v2/activitySentences.d.ts +50 -0
  41. package/dist/pages/v2/activitySentences.js +288 -0
  42. package/dist/pages/v2/inviteEmails.d.ts +12 -0
  43. package/dist/pages/v2/inviteEmails.js +18 -0
  44. package/dist/pages/v2/memberRows.d.ts +54 -0
  45. package/dist/pages/v2/memberRows.js +51 -0
  46. package/dist/pages/v2/projectRows.d.ts +10 -0
  47. package/dist/pages/v2/projectRows.js +10 -0
  48. package/dist/pages/v2/relativeTime.d.ts +6 -0
  49. package/dist/pages/v2/relativeTime.js +30 -0
  50. package/dist/store/workspacesStore.d.ts +2 -1
  51. package/dist/store/workspacesStore.js +1 -1
  52. package/dist/translations/en.d.ts +436 -0
  53. package/dist/translations/en.js +436 -0
  54. package/dist/types/index.d.ts +19 -0
  55. package/dist/utils/nativeBridge.js +1 -1
  56. package/package.json +3 -3
@@ -0,0 +1,223 @@
1
+ import { useWorkspacesContext as e } from "../../providers/WorkspacesProvider.js";
2
+ import { useCancelInvitation as t, useResendInvitation as n } from "../../hooks/useMemberMutations.js";
3
+ import { useWorkspaceRoles as r } from "../../hooks/useWorkspaceRoles.js";
4
+ import { useTr as i } from "../../hooks/useTr.js";
5
+ import { invitationState as a } from "./memberRows.js";
6
+ import { relativeTime as o } from "./relativeTime.js";
7
+ import { useMemo as s, useState as c } from "react";
8
+ import { Send as l, UserPlus as u, X as d } from "lucide-react";
9
+ import { ActionMenu as f, Button as p, DataRows as m, EmptyState as h, EntityAvatar as g, ListPager as _, ListToolbar as v, ListView as y, Notice as b, StatusChip as x, countFilterOptions as S, filterList as C, pageSlice as w, sortList as T, useConfirm as E, useListState as D } from "@burdenoff/fe-libs/ui";
10
+ import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
11
+ import { useI18n as j } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
12
+ import { useSearchParams as M } from "react-router";
13
+ import { useActorProfiles as N } from "@burdenoff/fe-libs/shared";
14
+ // src/pages/v2/InvitedTab.tsx
15
+ function P(e) {
16
+ let t = e.context?.metadata?.roleNames;
17
+ return Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim() !== "") : [];
18
+ }
19
+ var F = {
20
+ waiting: "waiting",
21
+ expired: "neutral",
22
+ bounced: "bad"
23
+ };
24
+ function I(t, n, o) {
25
+ let c = i(), { authToken: l, organizationId: u } = e(), { data: d = [] } = r(n), f = s(() => {
26
+ let e = /* @__PURE__ */ new Set();
27
+ for (let n of t) n.invitedById && e.add(n.invitedById);
28
+ return [...e].map((e) => ({
29
+ actorId: e,
30
+ actorType: "user"
31
+ }));
32
+ }, [t]), p = N(f, {
33
+ authToken: l || void 0,
34
+ orgId: u,
35
+ workspaceId: n
36
+ });
37
+ return s(() => {
38
+ let e = new Map(d.map((e) => [e.id, e.name])), n = [];
39
+ for (let r of t) {
40
+ let t = a(r, o);
41
+ if (!t) continue;
42
+ let i = r.roleIds.map((t) => e.get(t)).filter((e) => !!e), s = i.length > 0 ? i : P(r), l = r.invitedById ? p[r.invitedById] : void 0;
43
+ n.push({
44
+ id: r.id,
45
+ email: r.email,
46
+ state: t,
47
+ role: s.length > 0 ? s.join(", ") : c("workspacePagesV2.invited.defaultRole", "Default role"),
48
+ invitedBy: l?.resolved ? l.displayName : null,
49
+ sentAt: r.createdAt
50
+ });
51
+ }
52
+ return n;
53
+ }, [
54
+ t,
55
+ o,
56
+ p,
57
+ d,
58
+ c
59
+ ]);
60
+ }
61
+ function L({ workspaceId: e, query: r, canInvite: a, onInvite: N }) {
62
+ let P = i(), { locale: L } = j(), R = E(), [z] = c(() => /* @__PURE__ */ new Date()), B = I(r.data ?? [], e, z), { mutate: V } = n(e), { mutateAsync: H } = t(e), [U, W] = c(null), [G, K] = c(null), q = D({
63
+ filters: ["status"],
64
+ sorts: ["sent", "email"],
65
+ url: M()
66
+ }), J = s(() => ({
67
+ waiting: P("workspacePagesV2.invited.waiting", "Waiting"),
68
+ expired: P("workspacePagesV2.invited.expired", "Expired"),
69
+ bounced: P("workspacePagesV2.invited.bounced", "Email bounced")
70
+ }), [P]), Y = s(() => ({
71
+ id: "status",
72
+ label: P("workspacePagesV2.invited.statusFilter", "Status"),
73
+ allLabel: P("workspacePagesV2.common.any", "Any"),
74
+ options: [
75
+ "waiting",
76
+ "expired",
77
+ "bounced"
78
+ ].map((e) => ({
79
+ value: e,
80
+ label: J[e]
81
+ })),
82
+ getValue: (e) => e.state
83
+ }), [J, P]), X = s(() => [{
84
+ value: "sent",
85
+ label: P("workspacePagesV2.invited.sortSent", "Newest first"),
86
+ compare: (e, t) => t.sentAt.localeCompare(e.sentAt)
87
+ }, {
88
+ value: "email",
89
+ label: P("workspacePagesV2.invited.sortEmail", "Email A–Z"),
90
+ compare: (e, t) => e.email.localeCompare(t.email)
91
+ }], [P]), Z = s(() => ({
92
+ text: (e) => `${e.email} ${e.role} ${e.invitedBy ?? ""} ${J[e.state]}`,
93
+ filters: [Y]
94
+ }), [J, Y]), Q = T(C(B, q, Z), q.sort, X), $ = (e) => {
95
+ K(null), W(e.id), V(e.id, {
96
+ onSuccess: () => K({
97
+ tone: "info",
98
+ text: P("workspacePagesV2.invited.sentAgain", "Sent the invite to {{email}} again.", { email: e.email })
99
+ }),
100
+ onError: (e) => K({
101
+ tone: "bad",
102
+ text: e instanceof Error && e.message ? e.message : P("workspacePagesV2.invited.sendAgainFailed", "Couldn’t send the invite again. Try again.")
103
+ }),
104
+ onSettled: () => W(null)
105
+ });
106
+ }, ee = async (e) => {
107
+ if (K(null), await R({
108
+ title: P("workspacePagesV2.invited.cancelTitle", "Cancel the invite to {{email}}?", { email: e.email }),
109
+ description: P("workspacePagesV2.invited.cancelDescription", "The link in their email stops working. You can invite them again later."),
110
+ tone: "danger",
111
+ confirmLabel: P("workspacePagesV2.invited.cancel", "Cancel invite"),
112
+ cancelLabel: P("workspacePagesV2.invited.keep", "Keep it")
113
+ })) {
114
+ W(e.id);
115
+ try {
116
+ await H(e.id);
117
+ } catch (e) {
118
+ K({
119
+ tone: "bad",
120
+ text: e instanceof Error && e.message ? e.message : P("workspacePagesV2.invited.cancelFailed", "Couldn’t cancel the invite. Try again.")
121
+ });
122
+ } finally {
123
+ W(null);
124
+ }
125
+ }
126
+ };
127
+ return /* @__PURE__ */ A(O, { children: [G ? /* @__PURE__ */ k(b, {
128
+ tone: G.tone,
129
+ role: G.tone === "bad" ? "alert" : "status",
130
+ children: G.text
131
+ }) : null, /* @__PURE__ */ k(y, {
132
+ list: q,
133
+ count: Q.length,
134
+ loading: r.isPending && !!e,
135
+ error: r.error,
136
+ onRetry: () => void r.refetch(),
137
+ errorTitle: P("workspacePagesV2.invited.loadFailed", "Couldn’t load the invites"),
138
+ errorDetails: r.error instanceof Error ? r.error.message : void 0,
139
+ summary: Q.length === 1 ? P("workspacePagesV2.invited.countOne", "1 invite") : P("workspacePagesV2.invited.count", "{{count}} invites", { count: Q.length }),
140
+ toolbar: /* @__PURE__ */ k(v, {
141
+ list: q,
142
+ searchPlaceholder: P("workspacePagesV2.invited.search", "Search invites"),
143
+ filters: [{
144
+ ...Y,
145
+ options: S(B, Y, q, Z)
146
+ }],
147
+ sorts: X
148
+ }),
149
+ pager: /* @__PURE__ */ k(_, {
150
+ list: q,
151
+ total: Q.length
152
+ }),
153
+ empty: /* @__PURE__ */ k(h, {
154
+ kind: "all-done",
155
+ illustration: "notifications",
156
+ title: P("workspacePagesV2.invited.emptyTitle", "No invites waiting"),
157
+ description: P("workspacePagesV2.invited.emptyDescription", "People you invite show up here until they accept."),
158
+ action: a ? /* @__PURE__ */ A(p, {
159
+ type: "button",
160
+ onClick: N,
161
+ children: [/* @__PURE__ */ k(u, { "aria-hidden": "true" }), P("workspacePagesV2.members.invite", "Invite people")]
162
+ }) : void 0
163
+ }),
164
+ children: /* @__PURE__ */ k(m, {
165
+ label: P("workspacePagesV2.invited.tableLabel", "Invites sent"),
166
+ items: w(Q, q.page, q.pageSize),
167
+ getId: (e) => e.id,
168
+ lead: {
169
+ header: P("workspacePagesV2.invited.invited", "Invited"),
170
+ media: (e) => /* @__PURE__ */ k(g, { name: e.email }),
171
+ title: (e) => e.email,
172
+ subtitle: (e) => e.state === "bounced" ? P("workspacePagesV2.invited.bouncedHint", "The email didn’t reach them. Check the address.") : e.invitedBy ? P("workspacePagesV2.invited.by", "By {{name}}", { name: e.invitedBy }) : void 0,
173
+ subtitleTone: (e) => e.state === "bounced" ? "bad" : void 0
174
+ },
175
+ columns: [
176
+ {
177
+ id: "role",
178
+ header: P("workspacePagesV2.members.role", "Role"),
179
+ width: "160px",
180
+ cell: (e) => e.role
181
+ },
182
+ {
183
+ id: "status",
184
+ header: P("workspacePagesV2.invited.status", "Status"),
185
+ width: "150px",
186
+ phone: "bare",
187
+ cell: (e) => /* @__PURE__ */ k(x, {
188
+ status: F[e.state],
189
+ children: J[e.state]
190
+ })
191
+ },
192
+ {
193
+ id: "sent",
194
+ header: P("workspacePagesV2.invited.sent", "Sent"),
195
+ width: "130px",
196
+ cell: (e) => o(e.sentAt, z, L) ?? "—"
197
+ }
198
+ ],
199
+ tone: (e) => e.state === "bounced" ? "bad" : void 0,
200
+ actions: (e) => /* @__PURE__ */ A(O, { children: [e.state !== "bounced" && a ? /* @__PURE__ */ A(p, {
201
+ type: "button",
202
+ size: "sm",
203
+ variant: "outline",
204
+ disabled: U === e.id,
205
+ onClick: () => $(e),
206
+ "aria-label": P("workspacePagesV2.invited.sendAgainNamed", "Send the invite to {{email}} again", { email: e.email }),
207
+ children: [/* @__PURE__ */ k(l, { "aria-hidden": "true" }), P("workspacePagesV2.invited.sendAgain", "Send again")]
208
+ }) : null, /* @__PURE__ */ k(f, {
209
+ label: P("workspacePagesV2.invited.actionsFor", "Actions for the invite to {{email}}", { email: e.email }),
210
+ items: [{
211
+ id: "cancel",
212
+ label: P("workspacePagesV2.invited.cancelInvite", "Cancel invite…"),
213
+ icon: d,
214
+ danger: !0,
215
+ locked: !a,
216
+ lockedReason: P("workspacePagesV2.invited.cancelLocked", "Only people who can invite can cancel an invite."),
217
+ onSelect: () => void ee(e)
218
+ }]
219
+ })] })
220
+ })
221
+ })] });
222
+ }
223
+ export { L as InvitedTab };
@@ -0,0 +1 @@
1
+ export declare function MembersPageV2(): import('react').JSX.Element;
@@ -0,0 +1,120 @@
1
+ import { useWorkspacesContext as e } from "../../providers/WorkspacesProvider.js";
2
+ import { useWorkspacePermissions as t } from "../../hooks/useWorkspacePermissions.js";
3
+ import { useWorkspacesPageView as n } from "../../hooks/useWorkspacesPageView.js";
4
+ import { useTr as r } from "../../hooks/useTr.js";
5
+ import { useAllWorkspaceInvitations as i, useAllWorkspaceMembers as a } from "../../hooks/v2/useWorkspacePagesV2Data.js";
6
+ import { NAVIGATION_V2_PEOPLE_ACCESS_PATH as o } from "../../constants/navigationV2.js";
7
+ import { invitationState as s, memberStatusTab as c, memberTabOf as l } from "./memberRows.js";
8
+ import { InvitedTab as u } from "./InvitedTab.js";
9
+ import { InvitePeopleDialog as d } from "./InvitePeopleDialog.js";
10
+ import { PeopleTab as f } from "./PeopleTab.js";
11
+ import { useCallback as p, useMemo as m, useState as h } from "react";
12
+ import { CircleX as g, Clock as _, UserCheck as v, UserPlus as y } from "lucide-react";
13
+ import { LockedButton as b, LockedState as x, WorkspacePage as S } from "@burdenoff/fe-libs/ui";
14
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
15
+ import { useParams as T, useSearchParams as E } from "react-router";
16
+ import { PageHeader as D, Tabs as O } from "@burdenoff/fe-libs/chrome";
17
+ // src/pages/v2/MembersPage.tsx
18
+ var k = [
19
+ "q",
20
+ "sort",
21
+ "page",
22
+ "role",
23
+ "status"
24
+ ];
25
+ function A() {
26
+ let A = r(), { workspaceId: j } = e(), { workspaceId: M } = T(), N = M || j;
27
+ n("workspaces.members", {
28
+ workspaceId: N,
29
+ requireParams: !0
30
+ });
31
+ let [P, F] = E(), I = l(P.get("tab")), L = P.get("dialog") === "invite" || P.get("invite") === "true", { canListMembers: R, canInviteMember: z, canRemoveMember: B, isLoading: V } = t(), H = a(N), U = i(N, z || R), [W] = h(() => /* @__PURE__ */ new Date()), G = m(() => {
32
+ let e = H.data ?? [];
33
+ return {
34
+ active: e.filter((e) => c(e.status) === "active").length,
35
+ suspended: e.filter((e) => c(e.status) === "suspended").length,
36
+ invited: (U.data ?? []).filter((e) => s(e, W) !== null).length
37
+ };
38
+ }, [
39
+ U.data,
40
+ H.data,
41
+ W
42
+ ]), K = p((e) => {
43
+ let t = new URLSearchParams(P);
44
+ e(t), F(t, { replace: !0 });
45
+ }, [P, F]), q = (e) => K((t) => {
46
+ for (let e of k) t.delete(e);
47
+ e === "active" ? t.delete("tab") : t.set("tab", e);
48
+ }), J = () => K((e) => e.set("dialog", "invite")), Y = () => K((e) => {
49
+ e.delete("dialog"), e.delete("invite");
50
+ }), X = /* @__PURE__ */ C(D, {
51
+ variant: "compact",
52
+ title: A("workspacePagesV2.members.title", "Members"),
53
+ description: A("workspacePagesV2.members.purpose", "Everyone in this workspace: their role, and when they joined."),
54
+ back: {
55
+ label: A("workspacePagesV2.members.back", "People & access"),
56
+ to: o,
57
+ phoneOnly: !0
58
+ },
59
+ primary: /* @__PURE__ */ C(b, {
60
+ locked: !V && !z,
61
+ reason: A("workspacePagesV2.members.inviteLocked", "Inviting people is for workspace admins and managers. Ask an owner of this workspace."),
62
+ icon: y,
63
+ onClick: J,
64
+ disabled: !N,
65
+ children: A("workspacePagesV2.members.invite", "Invite people")
66
+ })
67
+ });
68
+ if (!V && !R && !z) return /* @__PURE__ */ w(S, { children: [X, /* @__PURE__ */ C(x, {
69
+ title: A("workspacePagesV2.members.lockedTitle", "Members is for people with access"),
70
+ description: A("workspacePagesV2.members.lockedDescription", "It lists everyone in this workspace and their role. Ask an owner of this workspace for access.")
71
+ })] });
72
+ let Z = [
73
+ {
74
+ id: "active",
75
+ label: A("workspacePagesV2.members.tabActive", "Active"),
76
+ icon: /* @__PURE__ */ C(v, { "aria-hidden": "true" }),
77
+ badge: H.data ? G.active : void 0
78
+ },
79
+ {
80
+ id: "invited",
81
+ label: A("workspacePagesV2.members.tabInvited", "Invited"),
82
+ icon: /* @__PURE__ */ C(_, { "aria-hidden": "true" }),
83
+ badge: U.data ? G.invited : void 0
84
+ },
85
+ {
86
+ id: "suspended",
87
+ label: A("workspacePagesV2.members.tabSuspended", "Suspended"),
88
+ icon: /* @__PURE__ */ C(g, { "aria-hidden": "true" }),
89
+ badge: H.data ? G.suspended : void 0
90
+ }
91
+ ];
92
+ return /* @__PURE__ */ w(S, { children: [
93
+ X,
94
+ /* @__PURE__ */ C(O, {
95
+ variant: "check",
96
+ ariaLabel: A("workspacePagesV2.members.tabsLabel", "Members"),
97
+ activeTabId: I,
98
+ onTabChange: q,
99
+ items: Z
100
+ }),
101
+ I === "invited" ? /* @__PURE__ */ C(u, {
102
+ workspaceId: N,
103
+ query: U,
104
+ canInvite: z,
105
+ onInvite: J
106
+ }) : /* @__PURE__ */ C(f, {
107
+ tab: I,
108
+ workspaceId: N,
109
+ canRemove: B,
110
+ canInvite: z,
111
+ onInvite: J
112
+ }, I),
113
+ N ? /* @__PURE__ */ C(d, {
114
+ open: L && z,
115
+ onOpenChange: (e) => e ? J() : Y(),
116
+ workspaceId: N
117
+ }) : null
118
+ ] });
119
+ }
120
+ export { A as MembersPageV2 };
@@ -0,0 +1,20 @@
1
+ export interface MemberRow {
2
+ id: string;
3
+ userId: string;
4
+ name: string;
5
+ email: string | null;
6
+ avatarUrl: string | null;
7
+ role: string;
8
+ joinedAt: string;
9
+ isYou: boolean;
10
+ }
11
+ type PeopleTabKind = 'active' | 'suspended';
12
+ export interface PeopleTabProps {
13
+ tab: PeopleTabKind;
14
+ workspaceId: string | undefined;
15
+ canRemove: boolean;
16
+ canInvite: boolean;
17
+ onInvite: () => void;
18
+ }
19
+ export declare function PeopleTab({ tab, workspaceId, canRemove, canInvite, onInvite }: PeopleTabProps): import('react').JSX.Element;
20
+ export {};
@@ -0,0 +1,253 @@
1
+ import { useWorkspacesContext as e } from "../../providers/WorkspacesProvider.js";
2
+ import { useRemoveUserFromWorkspace as t } from "../../hooks/useMemberMutations.js";
3
+ import { useTr as n } from "../../hooks/useTr.js";
4
+ import { useAllWorkspaceMembers as r, useWorkspaceActorRoles as i } from "../../hooks/v2/useWorkspacePagesV2Data.js";
5
+ import { nativeImpact as a } from "../../utils/nativeBridge.js";
6
+ import { memberIdentity as o, memberRoleText as s, memberStatusTab as c } from "./memberRows.js";
7
+ import { relativeTime as l } from "./relativeTime.js";
8
+ import { useCallback as u, useMemo as d, useState as f } from "react";
9
+ import { UserMinus as p, UserPlus as m } from "lucide-react";
10
+ import { ActionMenu as h, BulkBar as g, Button as _, DataRows as v, EmptyState as y, EntityAvatar as b, ListPager as x, ListToolbar as S, ListView as C, Notice as w, countFilterOptions as T, filterList as E, pageSlice as D, sortList as O, useConfirm as k, useListState as A } from "@burdenoff/fe-libs/ui";
11
+ import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
12
+ import { useI18n as P } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
13
+ import { useSearchParams as F } from "react-router";
14
+ import { useActorProfiles as I } from "@burdenoff/fe-libs/shared";
15
+ // src/pages/v2/PeopleTab.tsx
16
+ function L(t, r, a) {
17
+ let l = n(), { authToken: u, organizationId: f, currentUser: p } = e(), m = i(a), h = d(() => t.map((e) => ({
18
+ actorId: e.userId,
19
+ actorType: "user"
20
+ })), [t]), g = I(h, {
21
+ authToken: u || void 0,
22
+ orgId: f,
23
+ workspaceId: a
24
+ });
25
+ return d(() => t.filter((e) => c(e.status) === r).map((e) => {
26
+ let t = o(e, g[e.userId], l);
27
+ return {
28
+ id: e.id,
29
+ userId: e.userId,
30
+ name: t.name,
31
+ email: t.email,
32
+ avatarUrl: t.avatarUrl,
33
+ role: s(m.data?.[e.userId], e.role, l),
34
+ joinedAt: e.createdAt,
35
+ isYou: e.userId === p?.id
36
+ };
37
+ }), [
38
+ p?.id,
39
+ t,
40
+ g,
41
+ m.data,
42
+ r,
43
+ l
44
+ ]);
45
+ }
46
+ function R(e) {
47
+ let t = n(), r = A({
48
+ filters: ["role"],
49
+ sorts: ["name", "joined"],
50
+ url: F()
51
+ }), i = d(() => ({
52
+ id: "role",
53
+ label: t("workspacePagesV2.members.roleFilter", "Role"),
54
+ allLabel: t("workspacePagesV2.common.any", "Any"),
55
+ options: [...new Set(e.map((e) => e.role))].sort((e, t) => e.localeCompare(t)).map((e) => ({
56
+ value: e,
57
+ label: e
58
+ })),
59
+ getValue: (e) => e.role
60
+ }), [e, t]), a = d(() => [{
61
+ value: "name",
62
+ label: t("workspacePagesV2.common.sortName", "Name A–Z"),
63
+ compare: (e, t) => e.name.localeCompare(t.name)
64
+ }, {
65
+ value: "joined",
66
+ label: t("workspacePagesV2.members.sortJoined", "Newest first"),
67
+ compare: (e, t) => t.joinedAt.localeCompare(e.joinedAt)
68
+ }], [t]), o = d(() => ({
69
+ text: (e) => `${e.name} ${e.email ?? ""} ${e.role}`,
70
+ filters: [i]
71
+ }), [i]);
72
+ return {
73
+ list: r,
74
+ roleFilter: i,
75
+ sorts: a,
76
+ config: o,
77
+ matched: O(E(e, r, o), r.sort, a)
78
+ };
79
+ }
80
+ function z(e, t) {
81
+ let n = e.length === 1 ? e[0] : void 0;
82
+ return {
83
+ title: n ? t("workspacePagesV2.members.removeOneTitle", "Remove {{name}} from this workspace?", { name: n.name }) : t("workspacePagesV2.members.removeManyTitle", "Remove {{count}} people from this workspace?", { count: e.length }),
84
+ description: t("workspacePagesV2.members.removeDescription", "They lose access to its projects and data straight away."),
85
+ consequences: [t("workspacePagesV2.members.removeKeepsOrganization", "They stay in the organization"), t("workspacePagesV2.members.removeCanReinvite", "You can invite them again later")],
86
+ tone: "danger",
87
+ confirmLabel: n ? t("workspacePagesV2.members.removeOne", "Remove") : t("workspacePagesV2.members.removeMany", "Remove {{count}} people", { count: e.length })
88
+ };
89
+ }
90
+ function B(e) {
91
+ let r = n(), i = k(), { mutateAsync: o, isPending: s } = t(e), [c, l] = f(null);
92
+ return {
93
+ remove: u(async (e, t) => {
94
+ if (e.length === 0 || (a("medium"), !await i(z(e, r)))) return;
95
+ l(null);
96
+ let n = await Promise.allSettled(e.map((e) => o(e.userId))), s = new Set(e.filter((e, t) => n[t]?.status === "rejected").map((e) => e.id));
97
+ if (t(new Set(e.filter((e) => !s.has(e.id)).map((e) => e.id))), s.size === 0) return;
98
+ let c = n.find((e) => e.status === "rejected"), u = c?.status === "rejected" && c.reason instanceof Error ? c.reason.message : "";
99
+ l(r("workspacePagesV2.members.removeFailed", "Couldn’t remove {{names}}. {{reason}}", {
100
+ names: e.filter((e) => s.has(e.id)).map((e) => e.name).join(", "),
101
+ reason: u
102
+ }).trim());
103
+ }, [
104
+ i,
105
+ o,
106
+ r
107
+ ]),
108
+ removing: s,
109
+ failure: c
110
+ };
111
+ }
112
+ function V({ onInvite: e, panel: t }) {
113
+ let r = n();
114
+ return /* @__PURE__ */ M(y, {
115
+ size: t ? "panel" : void 0,
116
+ illustration: "people",
117
+ title: r("workspacePagesV2.members.emptyTitle", "It’s just you here"),
118
+ description: r("workspacePagesV2.members.emptyDescription", "Invite the people you work with. They get the role you pick and show up here once they accept."),
119
+ action: e ? /* @__PURE__ */ N(_, {
120
+ type: "button",
121
+ variant: t ? "outline" : "default",
122
+ onClick: e,
123
+ children: [/* @__PURE__ */ M(m, { "aria-hidden": "true" }), r("workspacePagesV2.members.invite", "Invite people")]
124
+ }) : void 0
125
+ });
126
+ }
127
+ function H() {
128
+ let e = n();
129
+ return /* @__PURE__ */ M(y, {
130
+ kind: "all-done",
131
+ illustration: "people",
132
+ title: e("workspacePagesV2.members.noSuspendedTitle", "No one is suspended"),
133
+ description: e("workspacePagesV2.members.noSuspendedDescription", "Suspended people keep their history but can’t sign in to this workspace.")
134
+ });
135
+ }
136
+ function U({ row: e, canRemove: t, onRemove: r }) {
137
+ let i = n();
138
+ return e.isYou ? null : /* @__PURE__ */ M(h, {
139
+ label: i("workspacePagesV2.members.actionsFor", "Actions for {{name}}", { name: e.name }),
140
+ items: [{
141
+ id: "remove",
142
+ label: i("workspacePagesV2.members.removeFromWorkspace", "Remove from workspace…"),
143
+ icon: p,
144
+ danger: !0,
145
+ locked: !t,
146
+ lockedReason: i("workspacePagesV2.members.removeLocked", "Only workspace admins can remove people."),
147
+ onSelect: () => r(e)
148
+ }]
149
+ });
150
+ }
151
+ function W({ count: e, removing: t, onClear: r, onRemove: i }) {
152
+ let a = n();
153
+ return /* @__PURE__ */ M(g, {
154
+ count: e,
155
+ label: e === 1 ? a("workspacePagesV2.members.selectedOne", "1 person selected") : a("workspacePagesV2.members.selected", "{{count}} people selected", { count: e }),
156
+ onClear: r,
157
+ clearLabel: a("workspacePagesV2.common.clearSelection", "Clear selection"),
158
+ actions: /* @__PURE__ */ N(_, {
159
+ type: "button",
160
+ size: "sm",
161
+ variant: "outline",
162
+ disabled: t,
163
+ onClick: i,
164
+ children: [/* @__PURE__ */ M(p, { "aria-hidden": "true" }), a("workspacePagesV2.members.removeFromWorkspace", "Remove from workspace…")]
165
+ })
166
+ });
167
+ }
168
+ function G({ tab: e, workspaceId: t, canRemove: i, canInvite: a, onInvite: o }) {
169
+ let s = n(), { locale: c } = P(), u = r(t), d = L(u.data ?? [], e, t), { list: p, roleFilter: m, sorts: h, config: g, matched: _ } = R(d), { remove: y, removing: E, failure: O } = B(t), [k, A] = f([]), [F] = f(() => /* @__PURE__ */ new Date()), I = new Set(k), z = d.filter((e) => I.has(e.id)), G = i && e === "active", K = a ? o : void 0, q = e === "active" && d.length === 1 && d[0]?.isYou === !0 && !p.narrowed, J = (e) => A((t) => t.filter((t) => !e.has(t)));
170
+ return /* @__PURE__ */ N(j, { children: [
171
+ O ? /* @__PURE__ */ M(w, {
172
+ tone: "bad",
173
+ role: "alert",
174
+ children: O
175
+ }) : null,
176
+ /* @__PURE__ */ M(C, {
177
+ list: p,
178
+ count: _.length,
179
+ loading: u.isPending && !!t,
180
+ error: u.error,
181
+ onRetry: () => void u.refetch(),
182
+ errorTitle: s("workspacePagesV2.members.loadFailed", "Couldn’t load the members"),
183
+ errorDetails: u.error?.message,
184
+ summary: _.length === 1 ? s("workspacePagesV2.members.countOne", "1 person") : s("workspacePagesV2.members.count", "{{count}} people", { count: _.length }),
185
+ toolbar: /* @__PURE__ */ M(S, {
186
+ list: p,
187
+ searchPlaceholder: s("workspacePagesV2.members.search", "Search people"),
188
+ filters: [{
189
+ ...m,
190
+ options: T(d, m, p, g)
191
+ }],
192
+ sorts: h
193
+ }),
194
+ bulk: G ? /* @__PURE__ */ M(W, {
195
+ count: z.length,
196
+ removing: E,
197
+ onClear: () => A([]),
198
+ onRemove: () => void y(z, J)
199
+ }) : void 0,
200
+ pager: /* @__PURE__ */ M(x, {
201
+ list: p,
202
+ total: _.length
203
+ }),
204
+ empty: e === "suspended" ? /* @__PURE__ */ M(H, {}) : /* @__PURE__ */ M(V, { onInvite: K }),
205
+ children: /* @__PURE__ */ M(v, {
206
+ label: s("workspacePagesV2.members.tableLabel", "Members"),
207
+ items: D(_, p.page, p.pageSize),
208
+ getId: (e) => e.id,
209
+ selection: G ? {
210
+ selected: k,
211
+ onChange: A,
212
+ canSelect: (e) => !e.isYou,
213
+ rowLabel: (e) => s("workspacePagesV2.members.selectPerson", "Select {{name}}", { name: e.name }),
214
+ allLabel: s("workspacePagesV2.common.selectPage", "Select everyone on this page")
215
+ } : void 0,
216
+ lead: {
217
+ header: s("workspacePagesV2.members.person", "Person"),
218
+ media: (e) => /* @__PURE__ */ M(b, {
219
+ name: e.name,
220
+ src: e.avatarUrl
221
+ }),
222
+ title: (e) => e.isYou ? s("workspacePagesV2.members.you", "{{name}} (you)", { name: e.name }) : e.name,
223
+ subtitle: (e) => e.email ?? void 0
224
+ },
225
+ columns: [{
226
+ id: "role",
227
+ header: s("workspacePagesV2.members.role", "Role"),
228
+ width: "200px",
229
+ cell: (e) => /* @__PURE__ */ M("span", {
230
+ className: "font-medium text-text-primary",
231
+ children: e.role
232
+ })
233
+ }, {
234
+ id: "joined",
235
+ header: s("workspacePagesV2.members.joined", "Joined"),
236
+ width: "140px",
237
+ cell: (e) => l(e.joinedAt, F, c) ?? "—"
238
+ }],
239
+ actionsWidth: "44px",
240
+ actions: (e) => /* @__PURE__ */ M(U, {
241
+ row: e,
242
+ canRemove: i,
243
+ onRemove: (e) => void y([e], J)
244
+ })
245
+ })
246
+ }),
247
+ q && K ? /* @__PURE__ */ M(V, {
248
+ onInvite: K,
249
+ panel: !0
250
+ }) : null
251
+ ] });
252
+ }
253
+ export { G as PeopleTab };
@@ -0,0 +1 @@
1
+ export declare function ProjectsPageV2(): import('react').JSX.Element;