@burdenoff/microfe-workspaces 2026.1120.1 → 2026.1121.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 (46) hide show
  1. package/dist/WorkspacesRoutes.js +83 -59
  2. package/dist/components/ProjectCard.js +48 -47
  3. package/dist/constants/navigationV2.d.ts +5 -0
  4. package/dist/constants/navigationV2.js +2 -2
  5. package/dist/generated/global-operations.d.ts +11 -1
  6. package/dist/generated/global-types.d.ts +9866 -574
  7. package/dist/generated/wspace-operations.d.ts +171 -2
  8. package/dist/generated/wspace-operations.js +1088 -52
  9. package/dist/generated/wspace-types.d.ts +193797 -41883
  10. package/dist/hooks/v2/useWorkspacePagesV2Data.d.ts +89 -0
  11. package/dist/hooks/v2/useWorkspacePagesV2Data.js +211 -0
  12. package/dist/index.d.ts +1 -1
  13. package/dist/pages/MembersListPage.js +101 -100
  14. package/dist/pages/ProjectMembersPage.js +116 -115
  15. package/dist/pages/ProjectsListPage.js +233 -232
  16. package/dist/pages/v2/ActivityPage.d.ts +1 -0
  17. package/dist/pages/v2/ActivityPage.js +150 -0
  18. package/dist/pages/v2/InvitePeopleDialog.d.ts +11 -0
  19. package/dist/pages/v2/InvitePeopleDialog.js +208 -0
  20. package/dist/pages/v2/InvitedTab.d.ts +9 -0
  21. package/dist/pages/v2/InvitedTab.js +223 -0
  22. package/dist/pages/v2/MembersPage.d.ts +1 -0
  23. package/dist/pages/v2/MembersPage.js +120 -0
  24. package/dist/pages/v2/PeopleTab.d.ts +20 -0
  25. package/dist/pages/v2/PeopleTab.js +253 -0
  26. package/dist/pages/v2/ProjectsPage.d.ts +1 -0
  27. package/dist/pages/v2/ProjectsPage.js +242 -0
  28. package/dist/pages/v2/WorkspacesPage.d.ts +3 -0
  29. package/dist/pages/v2/WorkspacesPage.js +247 -0
  30. package/dist/pages/v2/activitySentences.d.ts +50 -0
  31. package/dist/pages/v2/activitySentences.js +288 -0
  32. package/dist/pages/v2/inviteEmails.d.ts +12 -0
  33. package/dist/pages/v2/inviteEmails.js +18 -0
  34. package/dist/pages/v2/memberRows.d.ts +54 -0
  35. package/dist/pages/v2/memberRows.js +51 -0
  36. package/dist/pages/v2/projectRows.d.ts +10 -0
  37. package/dist/pages/v2/projectRows.js +10 -0
  38. package/dist/pages/v2/relativeTime.d.ts +6 -0
  39. package/dist/pages/v2/relativeTime.js +30 -0
  40. package/dist/store/workspacesStore.d.ts +2 -1
  41. package/dist/store/workspacesStore.js +1 -1
  42. package/dist/translations/en.d.ts +382 -0
  43. package/dist/translations/en.js +382 -0
  44. package/dist/types/index.d.ts +19 -0
  45. package/dist/utils/nativeBridge.js +1 -1
  46. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ export declare function ActivityPageV2(): import('react').JSX.Element;
@@ -0,0 +1,150 @@
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 { useScopedNavigation as r } from "../../hooks/useScopedNavigation.js";
5
+ import { useTr as i } from "../../hooks/useTr.js";
6
+ import { useWorkspaceActivityLog as a } from "../../hooks/v2/useWorkspacePagesV2Data.js";
7
+ import { toActivitySentences as o } from "./activitySentences.js";
8
+ import { useMemo as s } from "react";
9
+ import { ActivityLog as c, EmptyState as l, EntityAvatar as u, ListPager as d, ListToolbar as f, ListView as p, LockedState as m, WorkspacePage as h, countFilterOptions as g, filterList as _, pageSlice as v, useListState as y } from "@burdenoff/fe-libs/ui";
10
+ import { jsx as b, jsxs as x } from "react/jsx-runtime";
11
+ import { useParams as S, useSearchParams as C } from "react-router";
12
+ import { PageHeader as w } from "@burdenoff/fe-libs/chrome";
13
+ import { useActorProfiles as T } from "@burdenoff/fe-libs/shared";
14
+ // src/pages/v2/ActivityPage.tsx
15
+ function E() {
16
+ let E = i(), { basePath: D = "/workspaces", workspaceId: O, authToken: k, organizationId: A } = e(), { withCurrentSearch: j } = r(), { workspaceId: M } = S(), N = M || O;
17
+ n("workspaces.activity", {
18
+ workspaceId: N,
19
+ requireParams: !0
20
+ });
21
+ let { canViewActivity: P, isLoading: F } = t(), I = a(P ? N : void 0), L = y({
22
+ filters: [
23
+ "who",
24
+ "area",
25
+ "show"
26
+ ],
27
+ url: C()
28
+ }), R = s(() => o(I.data ?? [], E), [I.data, E]), z = s(() => [...new Set(R.filter((e) => e.actorKind === "person").map((e) => e.actorKey))].map((e) => ({
29
+ actorId: e,
30
+ actorType: "user"
31
+ })), [R]), B = T(z, {
32
+ authToken: k || void 0,
33
+ orgId: A,
34
+ workspaceId: N
35
+ }), V = s(() => R.map((e) => ({
36
+ ...e,
37
+ actorName: e.actorKind === "service" ? E("workspacePagesV2.activity.system", "System") : B[e.actorKey]?.displayName ?? E("workspacePagesV2.activity.someone", "Someone")
38
+ })), [
39
+ B,
40
+ R,
41
+ E
42
+ ]), H = s(() => {
43
+ let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
44
+ for (let n of V) e.set(n.actorKey, n.actorName), t.set(n.areaKey, n.area);
45
+ let n = (e, t) => e.label.localeCompare(t.label), r = {
46
+ problems: E("workspacePagesV2.activity.showProblems", "Problems"),
47
+ access: E("workspacePagesV2.activity.showAccess", "Access changes"),
48
+ people: E("workspacePagesV2.activity.showPeople", "What people did")
49
+ };
50
+ return [
51
+ {
52
+ id: "who",
53
+ label: E("workspacePagesV2.activity.whoFilter", "Who"),
54
+ allLabel: E("workspacePagesV2.activity.anyone", "Anyone"),
55
+ options: [...e].map(([e, t]) => ({
56
+ value: e,
57
+ label: t
58
+ })).sort((e, t) => e.value === "system" ? 1 : t.value === "system" ? -1 : n(e, t)),
59
+ getValue: (e) => e.actorKey
60
+ },
61
+ {
62
+ id: "area",
63
+ label: E("workspacePagesV2.activity.areaFilter", "Area"),
64
+ allLabel: E("workspacePagesV2.activity.everywhere", "Everywhere"),
65
+ options: [...t].map(([e, t]) => ({
66
+ value: e,
67
+ label: t
68
+ })).sort(n),
69
+ getValue: (e) => e.areaKey
70
+ },
71
+ {
72
+ id: "show",
73
+ label: E("workspacePagesV2.activity.showFilter", "Show"),
74
+ allLabel: E("workspacePagesV2.activity.everything", "Everything"),
75
+ options: [
76
+ "problems",
77
+ "access",
78
+ "people"
79
+ ].map((e) => ({
80
+ value: e,
81
+ label: r[e]
82
+ })),
83
+ getValue: (e) => e.show
84
+ }
85
+ ];
86
+ }, [V, E]), U = s(() => ({
87
+ text: (e) => `${e.actorName} ${e.verb} ${e.object} ${e.area}`,
88
+ filters: H
89
+ }), [H]), W = _(V, L, U), G = v(W, L.page, L.pageSize).map((e) => ({
90
+ id: e.id,
91
+ at: e.at,
92
+ tone: e.tone,
93
+ actor: e.actorName,
94
+ verb: e.verb,
95
+ object: e.object || void 0,
96
+ area: e.area,
97
+ avatar: /* @__PURE__ */ b(u, {
98
+ name: e.actorName,
99
+ kind: e.actorKind === "service" ? "service" : "person",
100
+ src: e.actorKind === "person" ? B[e.actorKey]?.avatarUrl : void 0,
101
+ size: 24
102
+ })
103
+ })), K = (I.data?.length ?? 0) >= 200, q = /* @__PURE__ */ b(w, {
104
+ variant: "compact",
105
+ title: E("workspacePagesV2.activity.title", "Activity"),
106
+ description: E("workspacePagesV2.activity.purpose", "Who did what in this workspace, newest first."),
107
+ back: {
108
+ label: E("workspacePagesV2.workspaces.title", "Workspaces & invites"),
109
+ to: j(`${D}/list`),
110
+ phoneOnly: !0
111
+ }
112
+ });
113
+ return !F && !P ? /* @__PURE__ */ x(h, { children: [q, /* @__PURE__ */ b(m, {
114
+ title: E("workspacePagesV2.activity.lockedTitle", "Activity is for people with access"),
115
+ description: E("workspacePagesV2.activity.lockedDescription", "It shows who did what in this workspace. Ask an owner of this workspace for access.")
116
+ })] }) : /* @__PURE__ */ x(h, { children: [q, /* @__PURE__ */ b(p, {
117
+ list: L,
118
+ count: W.length,
119
+ loading: (F || I.isPending) && !!N,
120
+ error: I.error,
121
+ onRetry: () => void I.refetch(),
122
+ errorTitle: E("workspacePagesV2.activity.loadFailed", "Couldn’t load the activity"),
123
+ errorDetails: I.error instanceof Error ? I.error.message : void 0,
124
+ summary: K && !L.narrowed ? E("workspacePagesV2.activity.latest", "The latest {{count}} events", { count: W.length }) : W.length === 1 ? E("workspacePagesV2.activity.countOne", "1 event") : E("workspacePagesV2.activity.count", "{{count}} events", { count: W.length }),
125
+ summaryEnd: K && L.narrowed ? E("workspacePagesV2.activity.window", "in the latest {{count}}", { count: 200 }) : void 0,
126
+ toolbar: /* @__PURE__ */ b(f, {
127
+ list: L,
128
+ searchPlaceholder: E("workspacePagesV2.activity.search", "Search activity"),
129
+ filters: H.map((e) => ({
130
+ ...e,
131
+ options: g(V, e, L, U)
132
+ }))
133
+ }),
134
+ pager: /* @__PURE__ */ b(d, {
135
+ list: L,
136
+ total: W.length
137
+ }),
138
+ empty: /* @__PURE__ */ b(l, {
139
+ illustration: "history",
140
+ title: E("workspacePagesV2.activity.emptyTitle", "No activity yet"),
141
+ description: E("workspacePagesV2.activity.emptyDescription", "When people invite, share, run or change things, it’s listed here with who and when.")
142
+ }),
143
+ children: /* @__PURE__ */ b(c, {
144
+ entries: G,
145
+ label: E("workspacePagesV2.activity.logLabel", "Activity"),
146
+ headingLevel: 2
147
+ })
148
+ })] });
149
+ }
150
+ export { E as ActivityPageV2 };
@@ -0,0 +1,11 @@
1
+ type InviteTab = 'email' | 'link';
2
+ export interface InvitePeopleDialogProps {
3
+ open: boolean;
4
+ onOpenChange: (open: boolean) => void;
5
+ /** The workspace the people are invited to. */
6
+ workspaceId: string;
7
+ /** The tab that opens first. Default "By email". */
8
+ initialTab?: InviteTab;
9
+ }
10
+ export declare function InvitePeopleDialog({ open, onOpenChange, workspaceId, initialTab, }: InvitePeopleDialogProps): import('react').JSX.Element;
11
+ export {};
@@ -0,0 +1,208 @@
1
+ import { useBulkCreateInvitations as e, useCreateInvitation as t } from "../../hooks/useMemberMutations.js";
2
+ import { useWorkspaceRoles as n } from "../../hooks/useWorkspaceRoles.js";
3
+ import { useProjects as r } from "../../hooks/useProjects.js";
4
+ import { useTr as i } from "../../hooks/useTr.js";
5
+ import { buildInvitationPayload as a } from "../../utils/invitationPayload.js";
6
+ import { parseEmailList as o } from "./inviteEmails.js";
7
+ import { useId as s, useMemo as c, useState as l } from "react";
8
+ import { Link2 as u, Mail as d, Send as f, UserPlus as p } from "lucide-react";
9
+ import { Button as m, FilterMenu as h, IconTile as g, Label as _, Notice as v, TabbedDialog as y, TabbedDialogContent as b, TabbedDialogFooter as x, TabbedDialogHeader as S, TabbedDialogTabs as C, Textarea as w } from "@burdenoff/fe-libs/ui";
10
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
11
+ // src/pages/v2/InvitePeopleDialog.tsx
12
+ function O({ workspaceId: e, text: t, onText: a, roleId: c, onRole: l, projectIds: u, onProjects: d, result: f }) {
13
+ let p = i(), m = s(), g = s(), { data: y = [], isLoading: b } = n(e), { data: x } = r({ archived: !1 }, { limit: 100 }, e), S = o(t), C = y.find((e) => e.id === c), T = (x?.items ?? []).filter((e) => !e.archived);
14
+ return /* @__PURE__ */ D("div", {
15
+ className: "flex flex-col gap-5",
16
+ children: [
17
+ /* @__PURE__ */ D("div", {
18
+ className: "flex flex-col gap-1.5",
19
+ children: [
20
+ /* @__PURE__ */ E(_, {
21
+ htmlFor: m,
22
+ children: p("workspacePagesV2.invite.emails", "Email addresses")
23
+ }),
24
+ /* @__PURE__ */ E(w, {
25
+ id: m,
26
+ rows: 4,
27
+ value: t,
28
+ onChange: (e) => a(e.target.value),
29
+ placeholder: p("workspacePagesV2.invite.emailsPlaceholder", "name@company.com, another@company.com"),
30
+ "aria-describedby": g,
31
+ "aria-invalid": S.invalid.length > 0 || void 0,
32
+ autoComplete: "off",
33
+ spellCheck: !1
34
+ }),
35
+ /* @__PURE__ */ E("p", {
36
+ id: g,
37
+ className: S.invalid.length > 0 ? "text-xs text-status-error-text" : "text-xs text-text-secondary",
38
+ children: S.invalid.length === 0 ? p("workspacePagesV2.invite.emailsHint", "Paste a list; commas, spaces and new lines all separate addresses.") : S.invalid.length === 1 ? p("workspacePagesV2.invite.oneInvalid", "One address isn’t valid: “{{address}}”. Check it; the others can still be sent.", { address: S.invalid[0] ?? "" }) : p("workspacePagesV2.invite.someInvalid", "{{count}} addresses aren’t valid: {{addresses}}. Check them; the others can still be sent.", {
39
+ count: S.invalid.length,
40
+ addresses: S.invalid.map((e) => `“${e}”`).join(", ")
41
+ })
42
+ })
43
+ ]
44
+ }),
45
+ /* @__PURE__ */ D("div", {
46
+ className: "flex flex-col gap-1.5",
47
+ children: [/* @__PURE__ */ E(h, {
48
+ label: p("workspacePagesV2.invite.role", "Role"),
49
+ allLabel: p("workspacePagesV2.invite.defaultRole", "Default role"),
50
+ multiple: !1,
51
+ disabled: b,
52
+ options: y.map((e) => ({
53
+ value: e.id,
54
+ label: e.name
55
+ })),
56
+ value: c ? [c] : [],
57
+ onChange: (e) => l(e[0] ?? null),
58
+ className: "self-start"
59
+ }), /* @__PURE__ */ E("p", {
60
+ className: "text-xs text-text-secondary",
61
+ children: C?.description || (C ? p("workspacePagesV2.invite.roleChosen", "They get the {{role}} role when they accept.", { role: C.name }) : p("workspacePagesV2.invite.defaultRoleHint", "They get the workspace’s default role when they accept. An admin can change it later."))
62
+ })]
63
+ }),
64
+ T.length > 0 ? /* @__PURE__ */ D("div", {
65
+ className: "flex flex-col gap-1.5",
66
+ children: [/* @__PURE__ */ D("span", {
67
+ className: "text-sm font-medium text-text-primary",
68
+ children: [
69
+ p("workspacePagesV2.invite.projects", "Add them to projects"),
70
+ " ",
71
+ /* @__PURE__ */ E("span", {
72
+ className: "font-normal text-text-muted",
73
+ children: p("workspacePagesV2.invite.optional", "(optional)")
74
+ })
75
+ ]
76
+ }), /* @__PURE__ */ E(h, {
77
+ label: p("workspacePagesV2.invite.projectsShort", "Projects"),
78
+ allLabel: p("workspacePagesV2.invite.noProjects", "None"),
79
+ options: T.map((e) => ({
80
+ value: e.id,
81
+ label: e.name
82
+ })),
83
+ value: u,
84
+ onChange: d,
85
+ className: "self-start"
86
+ })]
87
+ }) : null,
88
+ f ? /* @__PURE__ */ E(v, {
89
+ tone: f.tone,
90
+ role: f.tone === "bad" ? "alert" : "status",
91
+ children: f.text
92
+ }) : null
93
+ ]
94
+ });
95
+ }
96
+ function k({ onUseEmail: e }) {
97
+ let t = i();
98
+ return /* @__PURE__ */ E("div", {
99
+ className: "flex flex-col gap-4",
100
+ children: /* @__PURE__ */ E(v, {
101
+ tone: "info",
102
+ action: /* @__PURE__ */ D(m, {
103
+ type: "button",
104
+ size: "sm",
105
+ variant: "outline",
106
+ onClick: e,
107
+ children: [/* @__PURE__ */ E(d, { "aria-hidden": "true" }), t("workspacePagesV2.invite.useEmail", "Invite by email")]
108
+ }),
109
+ children: t("workspacePagesV2.invite.linkUnavailable", "Invite links aren’t available for workspaces yet. Invite people by email: they get the role you pick when they accept.")
110
+ })
111
+ });
112
+ }
113
+ function A({ open: r, onOpenChange: s, workspaceId: h, initialTab: _ = "email" }) {
114
+ let v = i(), [w, A] = l(_), [j, M] = l(""), [N, P] = l(null), [F, I] = l([]), [L, R] = l(null), { data: z = [] } = n(h), { mutateAsync: B, isPending: V } = t(h), { mutateAsync: H, isPending: U } = e(), W = V || U, G = c(() => o(j), [j]), K = z.find((e) => e.id === N)?.name ?? v("workspacePagesV2.invite.defaultRoleShort", "the default role"), q = c(() => [{
115
+ value: "email",
116
+ label: v("workspacePagesV2.invite.byEmail", "By email"),
117
+ icon: d
118
+ }, {
119
+ value: "link",
120
+ label: v("workspacePagesV2.invite.byLink", "Invite link"),
121
+ icon: u
122
+ }], [v]), J = (e) => {
123
+ e || (R(null), A(_)), s(e);
124
+ }, Y = async () => {
125
+ let e = G.valid;
126
+ if (e.length === 0) return;
127
+ R(null);
128
+ let t = N ? [N] : [], n = e.map((e) => a(h, e, t, F));
129
+ try {
130
+ n.length === 1 && n[0] ? await B(n[0]) : await H(n), M(G.invalid.join("\n")), R({
131
+ tone: "info",
132
+ text: e.length === 1 ? v("workspacePagesV2.invite.sentOne", "Invite sent to {{email}}. It shows in Members › Invited until they accept.", { email: e[0] ?? "" }) : v("workspacePagesV2.invite.sentMany", "{{count}} invites sent. They show in Members › Invited until people accept.", { count: e.length })
133
+ });
134
+ } catch (e) {
135
+ R({
136
+ tone: "bad",
137
+ text: e instanceof Error && e.message ? e.message : v("workspacePagesV2.invite.sendFailed", "Couldn’t send the invites. Try again.")
138
+ });
139
+ }
140
+ };
141
+ return /* @__PURE__ */ E(y, {
142
+ open: r,
143
+ onOpenChange: J,
144
+ children: /* @__PURE__ */ D(b, {
145
+ size: "form",
146
+ width: "medium",
147
+ children: [
148
+ /* @__PURE__ */ E(S, {
149
+ icon: /* @__PURE__ */ E(g, {
150
+ size: "md",
151
+ children: /* @__PURE__ */ E(p, { "aria-hidden": "true" })
152
+ }),
153
+ title: v("workspacePagesV2.invite.title", "Invite people"),
154
+ description: v("workspacePagesV2.invite.description", "They join this workspace with the role you pick when they accept."),
155
+ closeLabel: v("workspacePagesV2.common.close", "Close")
156
+ }),
157
+ /* @__PURE__ */ E(C, {
158
+ tabs: q,
159
+ value: w,
160
+ onValueChange: A,
161
+ layout: "strip",
162
+ "aria-label": v("workspacePagesV2.invite.how", "How to invite"),
163
+ renderPanel: (e) => e === "email" ? /* @__PURE__ */ E(O, {
164
+ workspaceId: h,
165
+ text: j,
166
+ onText: (e) => {
167
+ M(e), R(null);
168
+ },
169
+ roleId: N,
170
+ onRole: P,
171
+ projectIds: F,
172
+ onProjects: I,
173
+ result: L
174
+ }) : /* @__PURE__ */ E(k, { onUseEmail: () => A("email") })
175
+ }),
176
+ /* @__PURE__ */ E(x, { children: w === "email" ? /* @__PURE__ */ D(T, { children: [
177
+ /* @__PURE__ */ E("span", {
178
+ className: "me-auto text-sm text-text-secondary",
179
+ "aria-live": "polite",
180
+ children: G.valid.length === 0 ? v("workspacePagesV2.invite.noneYet", "No addresses yet") : G.valid.length === 1 ? v("workspacePagesV2.invite.oneAs", "1 invite as {{role}}", { role: K }) : v("workspacePagesV2.invite.manyAs", "{{count}} invites as {{role}}", {
181
+ count: G.valid.length,
182
+ role: K
183
+ })
184
+ }),
185
+ /* @__PURE__ */ E(m, {
186
+ type: "button",
187
+ variant: "outline",
188
+ onClick: () => J(!1),
189
+ children: v("workspacePagesV2.common.cancel", "Cancel")
190
+ }),
191
+ /* @__PURE__ */ D(m, {
192
+ type: "button",
193
+ onClick: () => void Y(),
194
+ disabled: W || G.valid.length === 0,
195
+ "aria-busy": W ? !0 : void 0,
196
+ children: [/* @__PURE__ */ E(f, { "aria-hidden": "true" }), v("workspacePagesV2.invite.send", "Send invites")]
197
+ })
198
+ ] }) : /* @__PURE__ */ E(m, {
199
+ type: "button",
200
+ className: "ms-auto",
201
+ onClick: () => J(!1),
202
+ children: v("workspacePagesV2.common.done", "Done")
203
+ }) })
204
+ ]
205
+ })
206
+ });
207
+ }
208
+ export { A as InvitePeopleDialog };
@@ -0,0 +1,9 @@
1
+ import { UseQueryResult } from '@tanstack/react-query';
2
+ import { InvitationWithEmailStatus } from '../../hooks/v2/useWorkspacePagesV2Data';
3
+ export interface InvitedTabProps {
4
+ workspaceId: string | undefined;
5
+ query: UseQueryResult<InvitationWithEmailStatus[]>;
6
+ canInvite: boolean;
7
+ onInvite: () => void;
8
+ }
9
+ export declare function InvitedTab({ workspaceId, query, canInvite, onInvite }: InvitedTabProps): import('react').JSX.Element;
@@ -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;