@burdenoff/microfe-workspaces 2026.1113.1 → 2026.1114.2

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 (60) hide show
  1. package/dist/WorkspacesRoot.js +31 -25
  2. package/dist/WorkspacesRoutes.js +56 -55
  3. package/dist/components/CreateProjectDialog.js +81 -78
  4. package/dist/components/CreateWorkspaceDialog.js +41 -41
  5. package/dist/components/InviteMemberDialog.js +54 -54
  6. package/dist/components/MemberListItem.js +53 -53
  7. package/dist/components/PendingInvitesRoute.d.ts +7 -0
  8. package/dist/components/PendingInvitesRoute.js +15 -0
  9. package/dist/components/ProjectCard.js +82 -82
  10. package/dist/components/ProjectMemberPickerDialog.js +46 -46
  11. package/dist/components/RenameProjectDialog.js +16 -16
  12. package/dist/components/WorkspaceCard.js +18 -18
  13. package/dist/components/WorkspacesErrorBoundary.js +25 -25
  14. package/dist/components/tags/ProjectTagsWidget.js +50 -50
  15. package/dist/components/tags/WorkspaceTagsEditor.js +9 -9
  16. package/dist/constants/navigationV2.d.ts +12 -0
  17. package/dist/constants/navigationV2.js +3 -0
  18. package/dist/hooks/useNavigationV2.d.ts +6 -0
  19. package/dist/hooks/useNavigationV2.js +6 -0
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +15 -14
  22. package/dist/pages/ActivityListPage.js +30 -30
  23. package/dist/pages/CreateWorkspacePage.js +205 -173
  24. package/dist/pages/InviteAcceptancePage.js +210 -200
  25. package/dist/pages/MembersListPage.js +165 -164
  26. package/dist/pages/PendingInvitesPage.js +67 -67
  27. package/dist/pages/ProjectDetailPage.js +297 -272
  28. package/dist/pages/ProjectMembersPage.js +59 -59
  29. package/dist/pages/ProjectsListPage.js +275 -244
  30. package/dist/pages/WorkspaceDetailPage.js +175 -172
  31. package/dist/pages/WorkspaceInvitePage.js +606 -503
  32. package/dist/pages/WorkspaceSettingsPage.js +48 -48
  33. package/dist/pages/WorkspacesListPage.js +55 -55
  34. package/dist/pages/dashboard/DashboardCustomizer.js +27 -27
  35. package/dist/pages/dashboard/DashboardPage.js +35 -35
  36. package/dist/pages/dashboard/WidgetWrapper.js +21 -21
  37. package/dist/pages/dashboard/widgets/AgentsWidget.js +25 -25
  38. package/dist/pages/dashboard/widgets/GroupsWidget.js +14 -14
  39. package/dist/pages/dashboard/widgets/MembersWidget.js +15 -15
  40. package/dist/pages/dashboard/widgets/ProjectsWidget.js +20 -20
  41. package/dist/pages/dashboard/widgets/QuickActionsWidget.js +7 -7
  42. package/dist/pages/dashboard/widgets/RecentActivityWidget.js +16 -16
  43. package/dist/pages/dashboard/widgets/SessionsWidget.js +15 -15
  44. package/dist/pages/dashboard/widgets/TagCloudWidget.js +11 -11
  45. package/dist/pages/dashboard/widgets/UpcomingEventsWidget.js +16 -16
  46. package/dist/pages/dashboard/widgets/VibesWidget.js +13 -13
  47. package/dist/pages/dashboard/widgets/WelcomeWidget.js +23 -23
  48. package/dist/pages/dashboard/widgets/WorkflowRunsWidget.js +26 -26
  49. package/dist/pages/dashboard/widgets/WorkflowStatsWidget.js +21 -21
  50. package/dist/pages/dashboard/widgets/WorkflowsOverviewWidget.js +22 -22
  51. package/dist/pages/dashboard/widgets/WorkspacesWidget.js +16 -16
  52. package/dist/providers/WorkspacesProvider.d.ts +5 -0
  53. package/dist/providers/WorkspacesProvider.js +2 -2
  54. package/dist/types/index.d.ts +11 -1
  55. package/dist/utils/createForms.d.ts +21 -0
  56. package/dist/utils/createForms.js +20 -0
  57. package/dist/utils/index.d.ts +1 -0
  58. package/dist/utils/invitationPayload.d.ts +18 -0
  59. package/dist/utils/invitationPayload.js +13 -0
  60. package/package.json +2 -2
@@ -9,16 +9,19 @@ import { useProjects as o } from "../hooks/useProjects.js";
9
9
  import { useWorkspaceInvitations as ne } from "../hooks/useWorkspaceMembers.js";
10
10
  import { useBulkCreateInvitations as re, useCancelInvitation as ie, useCreateInvitation as ae, useResendInvitation as oe } from "../hooks/useMemberMutations.js";
11
11
  import { useWorkspacesPageView as se } from "../hooks/useWorkspacesPageView.js";
12
- import { downloadWorkspaceBulkInviteTemplate as ce, parseWorkspaceBulkInviteCsv as le } from "../utils/workspaceBulkInviteCsv.js";
13
- import { useMemo as s, useRef as ue, useState as c } from "react";
14
- import { AlertCircle as l, ArrowLeft as de, CheckCircle2 as u, Download as fe, Loader2 as d, Mail as pe, RefreshCw as me, Send as f, Upload as he, UserPlus as ge, XCircle as p } from "lucide-react";
15
- import { PermissionProvider as _e } from "@burdenoff/fe-libs/shared/providers/shell";
16
- import { Fragment as ve, jsx as m, jsxs as h } from "react/jsx-runtime";
17
- import { AlertDialog as ye, AlertDialogAction as be, AlertDialogCancel as xe, AlertDialogContent as Se, AlertDialogDescription as Ce, AlertDialogFooter as we, AlertDialogHeader as Te, AlertDialogTitle as Ee, Badge as g, Button as _, CardContent as v, CardHeader as y, CardTitle as b, Checkbox as x, GlassCard as S, IllustratedEmptyState as De, Input as Oe, NextSteps as ke, PagePurpose as Ae, ResponsiveTable as je, Skeleton as C, Tabs as Me, TabsContent as Ne, TabsList as Pe, TabsTrigger as Fe, Tooltip as w, TooltipContent as T, TooltipProvider as Ie, TooltipTrigger as E } from "@burdenoff/fe-libs/ui";
18
- import { useI18n as Le } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
19
- import { useNavigate as Re, useParams as ze } from "react-router";
12
+ import { useNavigationV2 as ce } from "../hooks/useNavigationV2.js";
13
+ import { buildInvitationPayload as le } from "../utils/invitationPayload.js";
14
+ import { NAVIGATION_V2_ORGANIZATION_INVITE_PATH as ue } from "../constants/navigationV2.js";
15
+ import { downloadWorkspaceBulkInviteTemplate as de, parseWorkspaceBulkInviteCsv as fe } from "../utils/workspaceBulkInviteCsv.js";
16
+ import { useMemo as s, useRef as pe, useState as c } from "react";
17
+ import { AlertCircle as l, ArrowLeft as u, CheckCircle2 as d, Download as me, Loader2 as f, Mail as he, RefreshCw as ge, Send as _e, Upload as ve, UserPlus as ye, XCircle as p } from "lucide-react";
18
+ import { AccessGate as be, AlertDialog as xe, AlertDialogAction as Se, AlertDialogCancel as Ce, AlertDialogContent as we, AlertDialogDescription as Te, AlertDialogFooter as Ee, AlertDialogHeader as De, AlertDialogTitle as Oe, Badge as m, Button as h, CardContent as g, CardHeader as _, CardTitle as v, Checkbox as ke, GlassCard as y, IllustratedEmptyState as Ae, Input as je, NextSteps as Me, OptionalFields as Ne, PagePurpose as Pe, ResponsiveTable as Fe, Skeleton as b, Tabs as Ie, TabsContent as Le, TabsList as Re, TabsTrigger as ze, Tooltip as x, TooltipContent as S, TooltipProvider as C, TooltipTrigger as Be } from "@burdenoff/fe-libs/ui";
19
+ import { PermissionProvider as w } from "@burdenoff/fe-libs/shared/providers/shell";
20
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
21
+ import { useI18n as Ve } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
22
+ import { Link as He, useNavigate as Ue, useParams as We } from "react-router";
20
23
  // src/pages/WorkspaceInvitePage.tsx
21
- var Be = 1048576, D = 500, Ve = [
24
+ var Ge = 1048576, O = 500, Ke = [
22
25
  {
23
26
  key: "rowNumber",
24
27
  header: "#",
@@ -33,7 +36,7 @@ var Be = 1048576, D = 500, Ve = [
33
36
  priority: "primary",
34
37
  headerClassName: "text-xs font-semibold uppercase tracking-wide text-text-secondary",
35
38
  cellClassName: "text-sm",
36
- cell: (e) => e.email || /* @__PURE__ */ m("span", {
39
+ cell: (e) => e.email || /* @__PURE__ */ E("span", {
37
40
  className: "italic text-text-secondary",
38
41
  children: "(empty)"
39
42
  })
@@ -44,34 +47,34 @@ var Be = 1048576, D = 500, Ve = [
44
47
  priority: "secondary",
45
48
  headerClassName: "text-xs font-semibold uppercase tracking-wide text-text-secondary",
46
49
  cellClassName: "text-xs",
47
- cell: (e) => e.errors.length > 0 ? /* @__PURE__ */ m("div", {
50
+ cell: (e) => e.errors.length > 0 ? /* @__PURE__ */ E("div", {
48
51
  className: "space-y-1 text-status-error-text",
49
- children: e.errors.map((t) => /* @__PURE__ */ h("span", {
52
+ children: e.errors.map((t) => /* @__PURE__ */ D("span", {
50
53
  className: "inline-flex items-center gap-1 pr-3",
51
- children: [/* @__PURE__ */ m(p, { size: 14 }), t]
54
+ children: [/* @__PURE__ */ E(p, { size: 14 }), t]
52
55
  }, `${e.rowNumber}-${t}`))
53
- }) : e.status.kind === "sending" ? /* @__PURE__ */ h("span", {
56
+ }) : e.status.kind === "sending" ? /* @__PURE__ */ D("span", {
54
57
  className: "inline-flex items-center gap-1 text-text-secondary",
55
- children: [/* @__PURE__ */ m(d, {
58
+ children: [/* @__PURE__ */ E(f, {
56
59
  size: 14,
57
60
  className: "animate-spin"
58
61
  }), "Sending..."]
59
- }) : e.status.kind === "invited" ? /* @__PURE__ */ h("span", {
62
+ }) : e.status.kind === "invited" ? /* @__PURE__ */ D("span", {
60
63
  className: "inline-flex items-center gap-1 text-status-success-text",
61
- children: [/* @__PURE__ */ m(u, { size: 14 }), "Invited"]
62
- }) : e.status.kind === "failed" ? /* @__PURE__ */ h("span", {
64
+ children: [/* @__PURE__ */ E(d, { size: 14 }), "Invited"]
65
+ }) : e.status.kind === "failed" ? /* @__PURE__ */ D("span", {
63
66
  className: "inline-flex items-center gap-1 text-status-error-text",
64
- children: [/* @__PURE__ */ m(p, { size: 14 }), e.status.message]
65
- }) : /* @__PURE__ */ m("span", {
67
+ children: [/* @__PURE__ */ E(p, { size: 14 }), e.status.message]
68
+ }) : /* @__PURE__ */ E("span", {
66
69
  className: "text-text-secondary",
67
70
  children: "Ready"
68
71
  })
69
72
  }
70
73
  ];
71
- function He(e) {
74
+ function qe(e) {
72
75
  return e.type === "text/csv" || e.name.toLowerCase().endsWith(".csv");
73
76
  }
74
- function Ue(e) {
77
+ function Je(e) {
75
78
  if (!e) return null;
76
79
  let t = new Date(e);
77
80
  return Number.isNaN(t.getTime()) ? null : t.toLocaleDateString(void 0, {
@@ -82,80 +85,69 @@ function Ue(e) {
82
85
  minute: "2-digit"
83
86
  });
84
87
  }
85
- function O(e) {
88
+ function k(e) {
86
89
  let t = e instanceof Error ? e.message : String(e);
87
90
  return t.includes("CONFLICT") ? "An invite already exists for this email address." : t.includes("already a member") ? "This user is already a member of the workspace." : "Something went wrong. Please try again or contact support.";
88
91
  }
89
- function We(e, t, n) {
92
+ function Ye(e, t, n) {
90
93
  return e.length === 0 ? t : e.map((e) => n ? n(e) : e).join(", ");
91
94
  }
92
- function Ge(e, t, n, r) {
93
- return {
94
- email: t,
95
- workspaceId: e,
96
- roleIds: n,
97
- ...r.length > 0 ? { context: {
98
- type: "workspace.invitation",
99
- metadata: { projectIds: r }
100
- } } : {}
101
- };
102
- }
103
- function Ke({ selectedRoleIds: e, onRoleToggle: t, selectedProjectIds: n, onProjectToggle: r, availableRoles: i, availableProjects: a, isLoadingRoles: ee, isLoadingProjects: te, disabled: o }) {
104
- return /* @__PURE__ */ h("div", {
95
+ function Xe({ selectedRoleIds: e, onRoleToggle: t, selectedProjectIds: n, onProjectToggle: r, availableRoles: i, availableProjects: a, isLoadingRoles: ee, isLoadingProjects: te, disabled: o }) {
96
+ return /* @__PURE__ */ D("div", {
105
97
  className: "space-y-6",
106
- children: [/* @__PURE__ */ h("div", {
98
+ children: [/* @__PURE__ */ D("div", {
107
99
  className: "space-y-3",
108
- children: [/* @__PURE__ */ h("div", {
100
+ children: [/* @__PURE__ */ D("div", {
109
101
  className: "flex flex-wrap items-center justify-between gap-2",
110
- children: [/* @__PURE__ */ h("div", {
102
+ children: [/* @__PURE__ */ D("div", {
111
103
  className: "space-y-1",
112
- children: [/* @__PURE__ */ m("h3", {
104
+ children: [/* @__PURE__ */ E("h3", {
113
105
  className: "text-base font-semibold",
114
106
  children: "Roles (Optional)"
115
- }), /* @__PURE__ */ m("p", {
107
+ }), /* @__PURE__ */ E("p", {
116
108
  className: "text-sm text-text-secondary",
117
109
  children: "Choose roles. Hover any role to preview its full description."
118
110
  })]
119
- }), e.length > 0 ? /* @__PURE__ */ h(g, {
111
+ }), e.length > 0 ? /* @__PURE__ */ D(m, {
120
112
  variant: "secondary",
121
113
  children: [e.length, " selected"]
122
114
  }) : null]
123
- }), /* @__PURE__ */ m(Ie, { children: /* @__PURE__ */ m("div", {
115
+ }), /* @__PURE__ */ E(C, { children: /* @__PURE__ */ E("div", {
124
116
  className: "grid grid-cols-1 gap-2 md:grid-cols-2 xl:grid-cols-3",
125
- children: ee ? /* @__PURE__ */ m("p", {
117
+ children: ee ? /* @__PURE__ */ E("p", {
126
118
  className: "text-sm text-text-secondary",
127
119
  children: "Loading roles…"
128
- }) : i.length === 0 ? /* @__PURE__ */ m("p", {
120
+ }) : i.length === 0 ? /* @__PURE__ */ E("p", {
129
121
  className: "text-sm text-text-secondary",
130
122
  children: "No assignable roles were returned for this workspace."
131
123
  }) : i.map((n) => {
132
124
  let r = e.includes(n.id);
133
- return /* @__PURE__ */ h(w, { children: [/* @__PURE__ */ m(E, {
125
+ return /* @__PURE__ */ D(x, { children: [/* @__PURE__ */ E(Be, {
134
126
  asChild: !0,
135
- children: /* @__PURE__ */ h("label", {
127
+ children: /* @__PURE__ */ D("label", {
136
128
  className: `flex cursor-pointer items-center justify-between gap-3 rounded-lg border px-3 py-3 text-left text-sm font-medium transition-colors focus-within:ring-2 focus-within:ring-[var(--color-focus-ring)] focus-within:ring-offset-2 ${r ? "border-primary bg-action-primary-bg/10 text-text-primary shadow-sm" : "border-border-subtle bg-bg-surface text-text-primary hover:bg-accent"} ${o ? "opacity-70" : ""}`,
137
- children: [/* @__PURE__ */ m("span", {
129
+ children: [/* @__PURE__ */ E("span", {
138
130
  className: "min-w-0 flex-1 truncate",
139
131
  children: n.name
140
- }), /* @__PURE__ */ m(x, {
132
+ }), /* @__PURE__ */ E(ke, {
141
133
  checked: r,
142
134
  disabled: o,
143
135
  onCheckedChange: (e) => t(n.id, !!e),
144
136
  "aria-label": `Select ${n.name}`
145
137
  })]
146
138
  })
147
- }), /* @__PURE__ */ h(T, {
139
+ }), /* @__PURE__ */ D(S, {
148
140
  className: "max-w-xs text-sm leading-6",
149
141
  children: [
150
- /* @__PURE__ */ m("p", {
142
+ /* @__PURE__ */ E("p", {
151
143
  className: "font-medium",
152
144
  children: n.name
153
145
  }),
154
- /* @__PURE__ */ m("p", {
146
+ /* @__PURE__ */ E("p", {
155
147
  className: "mt-1 text-text-secondary",
156
148
  children: n.description || "No description available for this role."
157
149
  }),
158
- n.isSystem ? /* @__PURE__ */ m("p", {
150
+ n.isSystem ? /* @__PURE__ */ E("p", {
159
151
  className: "mt-2 text-xs",
160
152
  children: "System role"
161
153
  }) : null
@@ -163,51 +155,51 @@ function Ke({ selectedRoleIds: e, onRoleToggle: t, selectedProjectIds: n, onProj
163
155
  })] }, n.id);
164
156
  })
165
157
  }) })]
166
- }), /* @__PURE__ */ h("div", {
158
+ }), /* @__PURE__ */ D("div", {
167
159
  className: "space-y-3",
168
- children: [/* @__PURE__ */ h("div", {
160
+ children: [/* @__PURE__ */ D("div", {
169
161
  className: "flex flex-wrap items-center justify-between gap-2",
170
- children: [/* @__PURE__ */ h("div", {
162
+ children: [/* @__PURE__ */ D("div", {
171
163
  className: "space-y-1",
172
- children: [/* @__PURE__ */ m("h3", {
164
+ children: [/* @__PURE__ */ E("h3", {
173
165
  className: "text-base font-semibold",
174
166
  children: "Projects to add on acceptance (Optional)"
175
- }), /* @__PURE__ */ m("p", {
167
+ }), /* @__PURE__ */ E("p", {
176
168
  className: "text-sm text-text-secondary",
177
169
  children: "The invited user will be added to these projects automatically after they accept."
178
170
  })]
179
- }), n.length > 0 ? /* @__PURE__ */ h(g, {
171
+ }), n.length > 0 ? /* @__PURE__ */ D(m, {
180
172
  variant: "secondary",
181
173
  children: [n.length, " selected"]
182
174
  }) : null]
183
- }), /* @__PURE__ */ m("div", {
175
+ }), /* @__PURE__ */ E("div", {
184
176
  className: "grid grid-cols-1 gap-2 md:grid-cols-2 xl:grid-cols-3",
185
- children: te ? /* @__PURE__ */ m("p", {
177
+ children: te ? /* @__PURE__ */ E("p", {
186
178
  className: "text-sm text-text-secondary",
187
179
  children: "Loading projects…"
188
- }) : a.length === 0 ? /* @__PURE__ */ m("p", {
180
+ }) : a.length === 0 ? /* @__PURE__ */ E("p", {
189
181
  className: "text-sm text-text-secondary",
190
182
  children: "No active projects are available in this workspace yet."
191
183
  }) : a.map((e) => {
192
184
  let t = n.includes(e.id);
193
- return /* @__PURE__ */ h("label", {
185
+ return /* @__PURE__ */ D("label", {
194
186
  className: `flex cursor-pointer items-start justify-between gap-3 rounded-lg border px-3 py-3 transition-colors focus-within:ring-2 focus-within:ring-[var(--color-focus-ring)] focus-within:ring-offset-2 ${t ? "border-primary bg-action-primary-bg/10 text-text-primary shadow-sm" : "border-border-subtle bg-bg-surface text-text-primary hover:bg-accent"} ${o ? "opacity-70" : ""}`,
195
- children: [/* @__PURE__ */ h("div", {
187
+ children: [/* @__PURE__ */ D("div", {
196
188
  className: "min-w-0 flex-1 space-y-1",
197
- children: [/* @__PURE__ */ m("p", {
189
+ children: [/* @__PURE__ */ E("p", {
198
190
  className: "truncate text-sm font-semibold leading-tight",
199
191
  children: e.name
200
- }), /* @__PURE__ */ h("div", {
192
+ }), /* @__PURE__ */ D("div", {
201
193
  className: "flex items-center gap-2 text-xs text-text-secondary",
202
- children: [/* @__PURE__ */ m("span", {
194
+ children: [/* @__PURE__ */ E("span", {
203
195
  className: "truncate font-mono",
204
196
  children: e.key
205
- }), /* @__PURE__ */ m(g, {
197
+ }), /* @__PURE__ */ E(m, {
206
198
  variant: "outline",
207
199
  children: e.status
208
200
  })]
209
201
  })]
210
- }), /* @__PURE__ */ m(x, {
202
+ }), /* @__PURE__ */ E(ke, {
211
203
  checked: t,
212
204
  disabled: o,
213
205
  onCheckedChange: (t) => r(e.id, !!t),
@@ -219,27 +211,27 @@ function Ke({ selectedRoleIds: e, onRoleToggle: t, selectedProjectIds: n, onProj
219
211
  })]
220
212
  });
221
213
  }
222
- function k() {
223
- let { workspaceId: _e } = ze(), { t: x } = Le(), w = Re(), { basePath: T = "/workspaces", workspaceId: Ie } = i(), { withCurrentSearch: E } = r(), k = _e || Ie || "";
224
- se("workspaces.invite", { workspaceId: k || void 0 });
225
- let { canInviteMember: qe, isLoading: Je } = ee(), { data: Ye, isLoading: Xe, error: Ze } = a(k), { data: A = [], isLoading: Qe } = te(k), { data: j, isLoading: $e } = o({ archived: !1 }, { limit: 100 }, k), { data: et, isLoading: tt, isFetching: M, error: nt, refetch: rt } = ne(k, "PENDING", { limit: 50 }, { retry: !1 }), N = s(() => (j?.items ?? []).filter((e) => !e.archived), [j?.items]), [it, at] = c("single"), [P, ot] = c(""), [F, st] = c([]), [I, ct] = c([]), [lt, L] = c(null), [ut, dt] = c(null), [ft, R] = c(null), [pt, z] = c(null), [B, V] = c(null), [H, U] = c([]), [mt, ht] = c(null), [gt, _t] = c(!1), [W, vt] = c(!1), yt = ue(null), [G, bt] = c(null), { mutateAsync: xt, isPending: K } = ae(k), { mutateAsync: St, isPending: q } = re(), { mutate: Ct, isPending: J } = oe(k), { mutate: wt, isPending: Y } = ie(k), [Tt, X] = c(null), Z = et?.items ?? [], Et = K || q || W, Dt = s(() => A.filter((e) => F.includes(e.id)).map((e) => e.name), [A, F]), Ot = s(() => N.filter((e) => I.includes(e.id)).map((e) => e.name), [N, I]), Q = s(() => H.filter((e) => e.errors.length === 0 && e.status.kind !== "invited"), [H]), $ = s(() => H.filter((e) => e.errors.length > 0), [H]);
226
- if (!k) return /* @__PURE__ */ m("div", {
214
+ function A() {
215
+ let { workspaceId: ke } = We(), { t: x } = Ve(), S = Ue(), { basePath: C = "/workspaces", workspaceId: Be } = i(), { withCurrentSearch: w } = r(), A = ce(), j = ke || Be || "";
216
+ se("workspaces.invite", { workspaceId: j || void 0 });
217
+ let { canInviteMember: Ze, isLoading: Qe } = ee(), { data: $e, isLoading: et, error: tt } = a(j), { data: M = [], isLoading: nt } = te(j), { data: rt, isLoading: it } = o({ archived: !1 }, { limit: 100 }, j), { data: at, isLoading: ot, isFetching: N, error: st, refetch: ct } = ne(j, "PENDING", { limit: 50 }, { retry: !1 }), P = s(() => (rt?.items ?? []).filter((e) => !e.archived), [rt?.items]), [lt, ut] = c("single"), [F, dt] = c(""), [I, ft] = c([]), [L, pt] = c([]), [mt, ht] = c(null), [gt, _t] = c(null), [vt, R] = c(null), [yt, bt] = c(null), [z, B] = c(null), [V, H] = c([]), [xt, St] = c(null), [Ct, wt] = c(!1), [U, Tt] = c(!1), Et = pe(null), [W, Dt] = c(null), { mutateAsync: Ot, isPending: G } = ae(j), { mutateAsync: kt, isPending: At } = re(), { mutate: jt, isPending: K } = oe(j), { mutate: Mt, isPending: q } = ie(j), [Nt, J] = c(null), Y = at?.items ?? [], Pt = G || At || U, X = s(() => M.filter((e) => I.includes(e.id)).map((e) => e.name), [M, I]), Z = s(() => P.filter((e) => L.includes(e.id)).map((e) => e.name), [P, L]), Q = s(() => V.filter((e) => e.errors.length === 0 && e.status.kind !== "invited"), [V]), $ = s(() => V.filter((e) => e.errors.length > 0), [V]);
218
+ if (!j) return /* @__PURE__ */ E("div", {
227
219
  className: "space-y-4 p-6",
228
- children: /* @__PURE__ */ h("div", {
220
+ children: /* @__PURE__ */ D("div", {
229
221
  className: "rounded-xl border bg-bg-surface p-8 text-center",
230
222
  children: [
231
- /* @__PURE__ */ m("h1", {
223
+ /* @__PURE__ */ E("h1", {
232
224
  className: "text-2xl font-bold",
233
225
  children: e(x, "workspaceInvite.noWorkspaceTitle", "Select a workspace first")
234
226
  }),
235
- /* @__PURE__ */ m("p", {
227
+ /* @__PURE__ */ E("p", {
236
228
  className: "mt-2 text-text-secondary",
237
229
  children: e(x, "workspaceInvite.noWorkspaceDescription", "Choose a current workspace from the header or open a workspace detail page before inviting members.")
238
230
  }),
239
- /* @__PURE__ */ m("div", {
231
+ /* @__PURE__ */ E("div", {
240
232
  className: "mt-4",
241
- children: /* @__PURE__ */ m(_, {
242
- onClick: () => w(E(`${T}/list`)),
233
+ children: /* @__PURE__ */ E(h, {
234
+ onClick: () => S(w(`${C}/list`)),
243
235
  variant: "outline",
244
236
  children: e(x, "workspaceInvite.backToWorkspaces", "Back to Workspaces")
245
237
  })
@@ -247,83 +239,93 @@ function k() {
247
239
  ]
248
240
  })
249
241
  });
250
- if (Je || Xe) return /* @__PURE__ */ h("div", {
242
+ if (Qe || et) return /* @__PURE__ */ D("div", {
251
243
  className: "space-y-6 p-6",
252
244
  children: [
253
- /* @__PURE__ */ m(C, { className: "h-10 w-48" }),
254
- /* @__PURE__ */ m(C, { className: "h-40 w-full" }),
255
- /* @__PURE__ */ m(C, { className: "h-80 w-full" })
245
+ /* @__PURE__ */ E(b, { className: "h-10 w-48" }),
246
+ /* @__PURE__ */ E(b, { className: "h-40 w-full" }),
247
+ /* @__PURE__ */ E(b, { className: "h-80 w-full" })
256
248
  ]
257
249
  });
258
- if (!qe) return /* @__PURE__ */ m("div", {
250
+ if (!Ze && A) return /* @__PURE__ */ D("div", {
251
+ className: "mx-auto max-w-3xl p-3 sm:p-6",
252
+ children: [/* @__PURE__ */ E("h1", {
253
+ className: "sr-only",
254
+ children: e(x, "workspaceInvite.v2.title", "Invite people")
255
+ }), /* @__PURE__ */ E(be, {
256
+ message: e(x, "workspaceInvite.v2.needAccess", "You need access to invite people to this workspace"),
257
+ granterHint: e(x, "workspaceInvite.v2.needAccessHint", "Ask an owner or admin of this workspace to invite them, or to give you access.")
258
+ })]
259
+ });
260
+ if (!Ze) return /* @__PURE__ */ E("div", {
259
261
  className: "flex min-h-[400px] items-center justify-center",
260
- children: /* @__PURE__ */ h("div", {
262
+ children: /* @__PURE__ */ D("div", {
261
263
  className: "space-y-2 text-center",
262
- children: [/* @__PURE__ */ m("h2", {
264
+ children: [/* @__PURE__ */ E("h2", {
263
265
  className: "text-lg font-semibold",
264
266
  children: e(x, "workspaceInvite.accessDenied", "Access Denied")
265
- }), /* @__PURE__ */ m("p", {
267
+ }), /* @__PURE__ */ E("p", {
266
268
  className: "text-sm text-text-secondary",
267
269
  children: e(x, "workspaceInvite.accessDeniedDescription", "You don't have permission to invite members into this workspace.")
268
270
  })]
269
271
  })
270
272
  });
271
- if (Ze || !Ye) return /* @__PURE__ */ h("div", {
273
+ if (tt || !$e) return /* @__PURE__ */ D("div", {
272
274
  className: "space-y-4 p-6",
273
- children: [/* @__PURE__ */ h(_, {
275
+ children: [/* @__PURE__ */ D(h, {
274
276
  variant: "ghost",
275
- onClick: () => w(E(`${T}/list`)),
277
+ onClick: () => S(w(`${C}/list`)),
276
278
  className: "gap-2",
277
- children: [/* @__PURE__ */ m(de, { size: 18 }), e(x, "workspaceInvite.backToWorkspaces", "Back to Workspaces")]
278
- }), /* @__PURE__ */ m("div", {
279
+ children: [/* @__PURE__ */ E(u, { size: 18 }), e(x, "workspaceInvite.backToWorkspaces", "Back to Workspaces")]
280
+ }), /* @__PURE__ */ E("div", {
279
281
  className: "rounded-xl border bg-bg-surface p-8 text-center text-status-error-text",
280
282
  children: e(x, "workspaceInvite.workspaceLoadError", "Unable to load workspace invite details.")
281
283
  })]
282
284
  });
283
- let kt = (e, t) => {
284
- st((n) => t ? [...n, e].filter((e, t, n) => n.indexOf(e) === t) : n.filter((t) => t !== e));
285
- }, At = (e, t) => {
286
- ct((n) => t ? [...n, e].filter((e, t, n) => n.indexOf(e) === t) : n.filter((t) => t !== e));
287
- }, jt = async (e) => {
288
- if (e.preventDefault(), L(null), dt(null), V(null), !P.trim()) L("Email is required.");
285
+ let Ft = (e, t) => {
286
+ ft((n) => t ? [...n, e].filter((e, t, n) => n.indexOf(e) === t) : n.filter((t) => t !== e));
287
+ }, It = (e, t) => {
288
+ pt((n) => t ? [...n, e].filter((e, t, n) => n.indexOf(e) === t) : n.filter((t) => t !== e));
289
+ }, Lt = async (e) => {
290
+ if (e.preventDefault(), ht(null), _t(null), B(null), !F.trim()) ht("Email is required.");
289
291
  else try {
290
- await xt(Ge(k, P.trim().toLowerCase(), F, I)), ot(""), dt(`Invitation sent to ${P.trim().toLowerCase()}.`);
292
+ await Ot(le(j, F.trim().toLowerCase(), I, L)), dt(""), _t(`Invitation sent to ${F.trim().toLowerCase()}.`);
291
293
  } catch (e) {
292
- L(O(e));
294
+ ht(k(e));
293
295
  }
294
- }, Mt = (e) => {
295
- if (!He(e)) {
296
+ }, Rt = (e) => {
297
+ if (!qe(e)) {
296
298
  R("Please upload a .csv file.");
297
299
  return;
298
300
  }
299
- if (e.size > Be) {
301
+ if (e.size > Ge) {
300
302
  R("CSV file is too large (max 1 MB).");
301
303
  return;
302
304
  }
303
305
  let t = new FileReader();
304
306
  t.onload = () => {
305
- let n = typeof t.result == "string" ? t.result : "", r = le(n), i = r.slice(0, D);
306
- U(i.map((e) => ({
307
+ let n = typeof t.result == "string" ? t.result : "", r = fe(n), i = r.slice(0, O);
308
+ H(i.map((e) => ({
307
309
  ...e,
308
310
  status: { kind: "idle" }
309
- }))), ht(e.name), R(r.length > D ? `Only the first ${D} rows were loaded. Split larger CSV files into smaller batches.` : null), z(null), V(null);
311
+ }))), St(e.name), R(r.length > O ? `Only the first ${O} rows were loaded. Split larger CSV files into smaller batches.` : null), bt(null), B(null);
310
312
  }, t.onerror = () => {
311
313
  R("Failed to read CSV file.");
312
314
  }, t.readAsText(e);
313
- }, Nt = async () => {
314
- if (!(Q.length === 0 || W)) {
315
- R(null), z(null), V(null), vt(!0), U((e) => e.map((e) => e.errors.length === 0 && e.status.kind !== "invited" ? {
315
+ }, zt = async () => {
316
+ if (!(Q.length === 0 || U)) {
317
+ R(null), bt(null), B(null), Tt(!0), H((e) => e.map((e) => e.errors.length === 0 && e.status.kind !== "invited" ? {
316
318
  ...e,
317
319
  status: { kind: "sending" }
318
320
  } : e));
319
321
  try {
320
- await St(Q.map((e) => Ge(k, e.email, F, I))), U((e) => e.map((e) => e.status.kind === "sending" ? {
322
+ await kt(Q.map((e) => le(j, e.email, I, L))), H((e) => e.map((e) => e.status.kind === "sending" ? {
321
323
  ...e,
322
324
  status: { kind: "invited" }
323
- } : e)), z(`Sent ${Q.length} workspace invitation${Q.length === 1 ? "" : "s"}.`);
325
+ } : e)), bt(`Sent ${Q.length} workspace invitation${Q.length === 1 ? "" : "s"}.`);
324
326
  } catch (e) {
325
- let t = O(e);
326
- U((e) => e.map((e) => e.status.kind === "sending" ? {
327
+ let t = k(e);
328
+ H((e) => e.map((e) => e.status.kind === "sending" ? {
327
329
  ...e,
328
330
  status: {
329
331
  kind: "failed",
@@ -331,79 +333,472 @@ function k() {
331
333
  }
332
334
  } : e)), R(t);
333
335
  } finally {
334
- vt(!1);
336
+ Tt(!1);
335
337
  }
336
338
  }
337
- }, Pt = (e) => {
338
- V(null), X(e.id), Ct(e.id, {
339
+ }, Bt = (e) => {
340
+ B(null), J(e.id), jt(e.id, {
339
341
  onSuccess: () => {
340
- V({
342
+ B({
341
343
  tone: "success",
342
344
  message: `Invitation resent to ${e.email}.`
343
345
  });
344
346
  },
345
347
  onError: (e) => {
346
- V({
348
+ B({
347
349
  tone: "error",
348
- message: O(e)
350
+ message: k(e)
349
351
  });
350
352
  },
351
- onSettled: () => X(null)
353
+ onSettled: () => J(null)
352
354
  });
353
- };
354
- return /* @__PURE__ */ h(ve, { children: [/* @__PURE__ */ m(ye, {
355
- open: !!G,
356
- onOpenChange: (e) => !e && bt(null),
357
- children: /* @__PURE__ */ h(Se, { children: [/* @__PURE__ */ h(Te, { children: [/* @__PURE__ */ m(Ee, { children: "Cancel pending invitation?" }), /* @__PURE__ */ m(Ce, { children: G ? `This will revoke the pending invite for ${G.email}. They will need a new invitation to join later.` : "This will revoke the pending invitation." })] }), /* @__PURE__ */ h(we, { children: [/* @__PURE__ */ m(xe, {
358
- disabled: Y,
359
- children: "Keep invitation"
360
- }), /* @__PURE__ */ h(be, {
361
- onClick: () => {
362
- G && (V(null), X(G.id), wt(G.id, {
363
- onSuccess: () => {
364
- V({
365
- tone: "success",
366
- message: `Invitation cancelled for ${G.email}.`
367
- }), bt(null);
368
- },
369
- onError: (e) => {
370
- V({
371
- tone: "error",
372
- message: O(e)
373
- });
355
+ }, Vt = () => {
356
+ W && (B(null), J(W.id), Mt(W.id, {
357
+ onSuccess: () => {
358
+ B({
359
+ tone: "success",
360
+ message: `Invitation cancelled for ${W.email}.`
361
+ }), Dt(null);
362
+ },
363
+ onError: (e) => {
364
+ B({
365
+ tone: "error",
366
+ message: k(e)
367
+ });
368
+ },
369
+ onSettled: () => J(null)
370
+ }));
371
+ }, Ht = /* @__PURE__ */ D(T, { children: [
372
+ mt ? /* @__PURE__ */ D("div", {
373
+ className: "flex items-center gap-2 rounded-md border border-status-error-border/20 bg-status-error-bg/10 p-3 text-sm text-status-error-text",
374
+ children: [/* @__PURE__ */ E(l, { className: "size-4 shrink-0" }), /* @__PURE__ */ E("span", { children: mt })]
375
+ }) : null,
376
+ gt ? /* @__PURE__ */ D("div", {
377
+ className: "flex items-center gap-2 rounded-md border border-status-success/30 bg-status-success/10 p-3 text-sm text-status-success-text",
378
+ children: [/* @__PURE__ */ E(d, { className: "size-4 shrink-0" }), /* @__PURE__ */ E("span", { children: gt })]
379
+ }) : null,
380
+ /* @__PURE__ */ D("form", {
381
+ onSubmit: Lt,
382
+ className: "space-y-4",
383
+ children: [/* @__PURE__ */ D("div", {
384
+ className: "space-y-2",
385
+ children: [/* @__PURE__ */ E("label", {
386
+ htmlFor: "workspace-invite-email",
387
+ className: "text-sm font-medium",
388
+ children: e(x, "workspaceInvite.emailLabel", "Email Address")
389
+ }), /* @__PURE__ */ E(je, {
390
+ id: "workspace-invite-email",
391
+ type: "email",
392
+ placeholder: e(x, "workspaceInvite.emailPlaceholder", "member@example.com"),
393
+ value: F,
394
+ onChange: (e) => dt(e.target.value),
395
+ disabled: G
396
+ })]
397
+ }), /* @__PURE__ */ E("div", {
398
+ className: "flex justify-end",
399
+ children: /* @__PURE__ */ D(h, {
400
+ type: "submit",
401
+ disabled: G,
402
+ className: "gap-2",
403
+ children: [G ? /* @__PURE__ */ E(f, { className: "size-4 animate-spin" }) : /* @__PURE__ */ E(_e, { className: "size-4" }), e(x, "workspaceInvite.sendSingleButton", "Send Invitation")]
404
+ })
405
+ })]
406
+ })
407
+ ] }), Ut = /* @__PURE__ */ D(T, { children: [
408
+ vt ? /* @__PURE__ */ D("div", {
409
+ className: "flex items-center gap-2 rounded-md border border-status-error-border/20 bg-status-error-bg/10 p-3 text-sm text-status-error-text",
410
+ children: [/* @__PURE__ */ E(l, { className: "size-4 shrink-0" }), /* @__PURE__ */ E("span", { children: vt })]
411
+ }) : null,
412
+ yt ? /* @__PURE__ */ D("div", {
413
+ className: "flex items-center gap-2 rounded-md border border-status-success/30 bg-status-success/10 p-3 text-sm text-status-success-text",
414
+ children: [/* @__PURE__ */ E(d, { className: "size-4 shrink-0" }), /* @__PURE__ */ E("span", { children: yt })]
415
+ }) : null,
416
+ /* @__PURE__ */ D("div", {
417
+ className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
418
+ children: [/* @__PURE__ */ D("div", {
419
+ className: "space-y-1",
420
+ children: [
421
+ /* @__PURE__ */ E("p", {
422
+ className: "text-sm text-text-secondary",
423
+ children: e(x, "workspaceInvite.bulkDescription", "Upload a CSV with one email column. All valid rows will receive the currently selected roles and projects.")
424
+ }),
425
+ /* @__PURE__ */ D("div", {
426
+ className: "rounded-md border bg-bg-sunken/30 px-3 py-2 text-xs text-text-secondary",
427
+ children: [/* @__PURE__ */ E("p", {
428
+ className: "font-medium text-text-primary",
429
+ children: "Sample format"
430
+ }), /* @__PURE__ */ D("pre", {
431
+ className: "mt-1 whitespace-pre-wrap",
432
+ children: [
433
+ "email",
434
+ "\n",
435
+ "alice@example.com",
436
+ "\n",
437
+ "bob@example.com"
438
+ ]
439
+ })]
440
+ }),
441
+ (rt?.total ?? 0) > P.length ? /* @__PURE__ */ D("p", {
442
+ className: "text-xs text-text-secondary",
443
+ children: [
444
+ "Showing the first ",
445
+ P.length,
446
+ " active projects. Narrow the workspace project list if you need to invite into more."
447
+ ]
448
+ }) : null
449
+ ]
450
+ }), /* @__PURE__ */ D(h, {
451
+ type: "button",
452
+ variant: "outline",
453
+ onClick: de,
454
+ className: "gap-2",
455
+ children: [/* @__PURE__ */ E(me, { size: 16 }), e(x, "workspaceInvite.downloadTemplate", "Download template")]
456
+ })]
457
+ }),
458
+ /* @__PURE__ */ D("div", {
459
+ onDragOver: (e) => {
460
+ e.preventDefault(), wt(!0);
461
+ },
462
+ onDragLeave: () => wt(!1),
463
+ onDrop: (e) => {
464
+ e.preventDefault(), wt(!1);
465
+ let t = e.dataTransfer.files?.[0];
466
+ t ? Rt(t) : R("Please upload a .csv file.");
467
+ },
468
+ className: `flex flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed p-8 transition-colors ${Ct ? "border-primary bg-action-primary-bg/5" : "border-border-subtle bg-bg-surface"}`,
469
+ children: [
470
+ /* @__PURE__ */ E(ve, {
471
+ size: 28,
472
+ className: "text-text-secondary"
473
+ }),
474
+ /* @__PURE__ */ D("div", {
475
+ className: "text-center",
476
+ children: [/* @__PURE__ */ E("p", {
477
+ className: "text-sm font-medium",
478
+ children: xt || "Drop a CSV file here or click to browse"
479
+ }), /* @__PURE__ */ E("p", {
480
+ className: "mt-1 text-xs text-text-secondary",
481
+ children: "CSV files only. Required column: email."
482
+ })]
483
+ }),
484
+ /* @__PURE__ */ E("input", {
485
+ ref: Et,
486
+ type: "file",
487
+ accept: ".csv,text/csv",
488
+ onChange: (e) => {
489
+ let t = e.target.files?.[0];
490
+ t && Rt(t), e.target.value = "";
374
491
  },
375
- onSettled: () => X(null)
376
- }));
492
+ className: "hidden",
493
+ "aria-label": e(x, "workspaceInvite.chooseCsvFileAriaLabel", "Choose CSV file")
494
+ }),
495
+ /* @__PURE__ */ E(h, {
496
+ type: "button",
497
+ onClick: () => Et.current?.click(),
498
+ children: e(x, "workspaceInvite.chooseFile", "Choose file")
499
+ })
500
+ ]
501
+ }),
502
+ V.length > 0 ? /* @__PURE__ */ D(T, { children: [
503
+ /* @__PURE__ */ D("div", {
504
+ className: "flex flex-wrap gap-4 text-xs text-text-secondary",
505
+ children: [
506
+ /* @__PURE__ */ D("span", { children: ["Total rows: ", V.length] }),
507
+ /* @__PURE__ */ D("span", { children: ["Ready: ", Q.length] }),
508
+ /* @__PURE__ */ D("span", { children: ["With errors: ", $.length] }),
509
+ $.length > 0 ? /* @__PURE__ */ E(m, {
510
+ variant: "destructive",
511
+ children: "Invalid rows will be skipped"
512
+ }) : null
513
+ ]
514
+ }),
515
+ $.length > 0 ? /* @__PURE__ */ D("div", {
516
+ className: "rounded-md border border-status-error-border/20 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
517
+ children: [
518
+ $.length,
519
+ " row",
520
+ $.length === 1 ? "" : "s",
521
+ " need attention. Only valid rows can be invited."
522
+ ]
523
+ }) : null,
524
+ /* @__PURE__ */ E("div", {
525
+ className: "overflow-hidden rounded-xl border",
526
+ children: /* @__PURE__ */ E(Fe, {
527
+ columns: Ke,
528
+ data: V,
529
+ rowKey: (e) => `${e.rowNumber}-${e.email}`
530
+ })
531
+ })
532
+ ] }) : /* @__PURE__ */ E("div", {
533
+ className: "rounded-xl border border-dashed p-6 text-center text-sm text-text-secondary",
534
+ children: "Upload a CSV to preview invite rows here before sending."
535
+ }),
536
+ /* @__PURE__ */ E("div", {
537
+ className: "flex justify-end",
538
+ children: /* @__PURE__ */ D(h, {
539
+ type: "button",
540
+ onClick: zt,
541
+ disabled: Q.length === 0 || At || U,
542
+ className: "gap-2",
543
+ children: [At || U ? /* @__PURE__ */ E(f, { className: "size-4 animate-spin" }) : /* @__PURE__ */ E(_e, { className: "size-4" }), e(x, "workspaceInvite.sendBulkButton", "Send Bulk Invites")]
544
+ })
545
+ })
546
+ ] }), Wt = /* @__PURE__ */ D(T, { children: [z ? /* @__PURE__ */ D("div", {
547
+ className: `mb-4 flex items-center gap-2 rounded-md border p-3 text-sm ${z.tone === "success" ? "border-status-success/30 bg-status-success/10 text-status-success-text" : "border-status-error-border/20 bg-status-error-bg/10 text-status-error-text"}`,
548
+ children: [z.tone === "success" ? /* @__PURE__ */ E(d, { className: "size-4 shrink-0" }) : /* @__PURE__ */ E(l, { className: "size-4 shrink-0" }), /* @__PURE__ */ E("span", { children: z.message })]
549
+ }) : null, ot ? /* @__PURE__ */ D("div", {
550
+ className: "space-y-3",
551
+ children: [/* @__PURE__ */ E(b, { className: "h-20 w-full" }), /* @__PURE__ */ E(b, { className: "h-20 w-full" })]
552
+ }) : st && Y.length === 0 ? /* @__PURE__ */ D("div", {
553
+ role: "alert",
554
+ className: "space-y-3 rounded-md border border-status-error-border/20 bg-status-error-bg/10 p-3 text-sm text-status-error-text",
555
+ children: [/* @__PURE__ */ E("p", { children: e(x, "workspaceInvite.pendingLoadFailed", "Failed to load pending invitations for this workspace.") }), /* @__PURE__ */ E(h, {
556
+ type: "button",
557
+ variant: "outline",
558
+ size: "sm",
559
+ className: "w-fit",
560
+ disabled: N,
561
+ onClick: () => {
562
+ ct();
377
563
  },
378
- disabled: Y,
379
- children: [Y ? /* @__PURE__ */ m(d, { className: "size-4 animate-spin" }) : null, "Cancel invitation"]
564
+ children: N ? e(x, "workspaceInvite.retrying", "Retrying…") : e(x, "workspaceInvite.tryAgain", "Try again")
565
+ })]
566
+ }) : Y.length === 0 ? /* @__PURE__ */ E(Ae, {
567
+ illustration: "empty-notifications",
568
+ title: e(x, "workspaceInvite.pendingEmptyTitle", "No pending invitations"),
569
+ description: e(x, "workspaceInvite.pendingEmpty", "Invitations you send for this workspace will show up here until they are accepted, so you can resend or cancel them.")
570
+ }) : /* @__PURE__ */ D("div", {
571
+ className: "space-y-3",
572
+ children: [st ? /* @__PURE__ */ D("div", {
573
+ role: "alert",
574
+ className: "flex flex-wrap items-center justify-between gap-3 rounded-md border border-status-error-border/20 bg-status-error-bg/10 p-3 text-sm text-status-error-text",
575
+ children: [/* @__PURE__ */ E("span", { children: e(x, "workspaceInvite.pendingStaleWarning", "Pending invitations may be outdated. Try again to refresh this list.") }), /* @__PURE__ */ E(h, {
576
+ type: "button",
577
+ variant: "outline",
578
+ size: "sm",
579
+ className: "w-fit",
580
+ disabled: N,
581
+ onClick: () => {
582
+ ct();
583
+ },
584
+ children: N ? e(x, "workspaceInvite.retrying", "Retrying…") : e(x, "workspaceInvite.tryAgain", "Try again")
585
+ })]
586
+ }) : null, Y.map((e) => {
587
+ let r = n(e), i = t(e), a = Nt === e.id && (K || q);
588
+ return /* @__PURE__ */ E("div", {
589
+ className: "rounded-lg border p-4",
590
+ children: /* @__PURE__ */ D("div", {
591
+ className: "flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",
592
+ children: [/* @__PURE__ */ D("div", {
593
+ className: "space-y-3",
594
+ children: [
595
+ /* @__PURE__ */ D("div", {
596
+ className: "flex flex-wrap items-center gap-2",
597
+ children: [/* @__PURE__ */ E("p", {
598
+ className: "font-semibold",
599
+ children: e.email
600
+ }), /* @__PURE__ */ E(m, {
601
+ variant: "outline",
602
+ children: e.status
603
+ })]
604
+ }),
605
+ /* @__PURE__ */ D("div", {
606
+ className: "grid gap-3 text-sm text-text-secondary sm:grid-cols-2",
607
+ children: [/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
608
+ className: "font-medium text-text-primary",
609
+ children: "Received"
610
+ }), /* @__PURE__ */ E("p", { children: Je(e.createdAt) ?? "—" })] }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
611
+ className: "font-medium text-text-primary",
612
+ children: "Expires"
613
+ }), /* @__PURE__ */ E("p", { children: Je(e.expiresAt) ?? "—" })] })]
614
+ }),
615
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
616
+ className: "mb-2 text-sm font-medium text-text-primary",
617
+ children: "Roles"
618
+ }), /* @__PURE__ */ E("div", {
619
+ className: "flex flex-wrap gap-2",
620
+ children: r.length > 0 ? r.map((t, n) => /* @__PURE__ */ E(m, {
621
+ variant: "outline",
622
+ children: t
623
+ }, `${e.id}-${e.roleIds[n] ?? t}`)) : /* @__PURE__ */ E("span", {
624
+ className: "text-sm text-text-secondary",
625
+ children: "No roles selected"
626
+ })
627
+ })] }),
628
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
629
+ className: "mb-2 text-sm font-medium text-text-primary",
630
+ children: "Projects"
631
+ }), /* @__PURE__ */ E("div", {
632
+ className: "flex flex-wrap gap-2",
633
+ children: i.length > 0 ? i.map((t, n) => /* @__PURE__ */ E(m, {
634
+ variant: "secondary",
635
+ children: t
636
+ }, `${e.id}-project-${t}-${n}`)) : /* @__PURE__ */ E("span", {
637
+ className: "text-sm text-text-secondary",
638
+ children: "No project access will be granted automatically"
639
+ })
640
+ })] })
641
+ ]
642
+ }), /* @__PURE__ */ D("div", {
643
+ className: "flex gap-2",
644
+ children: [/* @__PURE__ */ D(h, {
645
+ type: "button",
646
+ variant: "outline",
647
+ disabled: K || q,
648
+ onClick: () => Bt(e),
649
+ className: "gap-2",
650
+ children: [a && K ? /* @__PURE__ */ E(ge, { className: "size-4 animate-spin" }) : /* @__PURE__ */ E(ge, { className: "size-4" }), "Resend"]
651
+ }), /* @__PURE__ */ D(h, {
652
+ type: "button",
653
+ variant: "outline",
654
+ disabled: K || q,
655
+ onClick: () => Dt(e),
656
+ className: "gap-2",
657
+ children: [a && q ? /* @__PURE__ */ E(f, { className: "size-4 animate-spin" }) : /* @__PURE__ */ E(p, { className: "size-4" }), "Cancel"]
658
+ })]
659
+ })]
660
+ })
661
+ }, e.id);
662
+ })]
663
+ })] }), Gt = /* @__PURE__ */ E(xe, {
664
+ open: !!W,
665
+ onOpenChange: (e) => !e && Dt(null),
666
+ children: /* @__PURE__ */ D(we, { children: [/* @__PURE__ */ D(De, { children: [/* @__PURE__ */ E(Oe, { children: A ? e(x, "workspaceInvite.v2.cancelTitle", "Cancel the invite for {email}?", { email: W?.email ?? "" }) : "Cancel pending invitation?" }), /* @__PURE__ */ E(Te, { children: A ? e(x, "workspaceInvite.v2.cancelDescription", "{email} won't be able to join with this invite. You can invite them again later.", { email: W?.email ?? "" }) : W ? `This will revoke the pending invite for ${W.email}. They will need a new invitation to join later.` : "This will revoke the pending invitation." })] }), /* @__PURE__ */ D(Ee, { children: [/* @__PURE__ */ E(Ce, {
667
+ disabled: q,
668
+ children: A ? e(x, "workspaceInvite.v2.cancelKeep", "Keep invite") : "Keep invitation"
669
+ }), /* @__PURE__ */ D(Se, {
670
+ onClick: Vt,
671
+ disabled: q,
672
+ children: [q ? /* @__PURE__ */ E(f, { className: "size-4 animate-spin" }) : null, A ? e(x, "workspaceInvite.v2.cancelConfirm", "Cancel invite") : "Cancel invitation"]
380
673
  })] })] })
381
- }), /* @__PURE__ */ h("div", {
674
+ });
675
+ if (A) {
676
+ let t = [X.length > 0 ? e(x, "workspaceInvite.v2.summaryRoles", "Roles: {names}", { names: X.join(", ") }) : null, Z.length > 0 ? e(x, "workspaceInvite.v2.summaryProjects", "Projects: {names}", { names: Z.join(", ") }) : null].filter((e) => e !== null);
677
+ return /* @__PURE__ */ D(T, { children: [Gt, /* @__PURE__ */ D("div", {
678
+ className: "mx-auto max-w-3xl space-y-6 p-3 sm:p-6",
679
+ children: [
680
+ /* @__PURE__ */ D("div", { children: [
681
+ /* @__PURE__ */ D(h, {
682
+ variant: "ghost",
683
+ onClick: () => S(w(`${C}/${j}`)),
684
+ className: "-ml-2 mb-2 gap-2",
685
+ children: [/* @__PURE__ */ E(u, { size: 18 }), e(x, "workspaceInvite.backToWorkspace", "Back to Workspace")]
686
+ }),
687
+ /* @__PURE__ */ E("h1", {
688
+ className: "text-2xl font-bold sm:text-3xl",
689
+ children: e(x, "workspaceInvite.v2.title", "Invite people")
690
+ }),
691
+ /* @__PURE__ */ E("p", {
692
+ className: "mt-2 text-sm text-text-secondary sm:text-base",
693
+ children: e(x, "workspaceInvite.v2.subtitle", "Invite people to {workspace}. They get access when they accept.", { workspace: $e.name })
694
+ })
695
+ ] }),
696
+ /* @__PURE__ */ E(y, {
697
+ treatment: "plain",
698
+ id: "invite-send-section",
699
+ className: "border-border-seam",
700
+ children: /* @__PURE__ */ D(g, {
701
+ className: "space-y-4 pt-6",
702
+ children: [
703
+ Ht,
704
+ t.length > 0 ? /* @__PURE__ */ D("p", {
705
+ className: "text-sm text-text-secondary",
706
+ "data-testid": "invite-access-summary",
707
+ children: [
708
+ e(x, "workspaceInvite.v2.summaryLead", "Every invite you send from here also gives:"),
709
+ " ",
710
+ t.join(" · ")
711
+ ]
712
+ }) : null,
713
+ /* @__PURE__ */ E(Ne, {
714
+ storageKey: "workspaces.invite.form",
715
+ children: /* @__PURE__ */ D("div", {
716
+ className: "space-y-8",
717
+ children: [/* @__PURE__ */ E(Xe, {
718
+ selectedRoleIds: I,
719
+ onRoleToggle: Ft,
720
+ selectedProjectIds: L,
721
+ onProjectToggle: It,
722
+ availableRoles: M,
723
+ availableProjects: P,
724
+ isLoadingRoles: nt,
725
+ isLoadingProjects: it,
726
+ disabled: Pt
727
+ }), /* @__PURE__ */ D("section", {
728
+ className: "space-y-5",
729
+ "aria-labelledby": "invite-bulk-heading",
730
+ children: [/* @__PURE__ */ E("h3", {
731
+ id: "invite-bulk-heading",
732
+ className: "text-base font-semibold",
733
+ children: e(x, "workspaceInvite.v2.bulkTitle", "Invite many people from a CSV")
734
+ }), Ut]
735
+ })]
736
+ })
737
+ })
738
+ ]
739
+ })
740
+ }),
741
+ /* @__PURE__ */ D("p", {
742
+ className: "text-sm text-text-secondary",
743
+ children: [
744
+ e(x, "workspaceInvite.v2.organizationLead", "Want them in a whole organization instead?"),
745
+ " ",
746
+ /* @__PURE__ */ E(He, {
747
+ to: ue,
748
+ className: "rounded font-medium text-text-link underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
749
+ children: e(x, "workspaceInvite.v2.organizationLink", "Invite to an organization")
750
+ })
751
+ ]
752
+ }),
753
+ /* @__PURE__ */ D(y, {
754
+ treatment: "plain",
755
+ id: "invite-pending-section",
756
+ className: "border-border-seam",
757
+ children: [/* @__PURE__ */ E(_, { children: /* @__PURE__ */ D("h2", {
758
+ className: "flex items-center gap-2 text-lg font-semibold",
759
+ children: [
760
+ /* @__PURE__ */ E(he, {
761
+ className: "size-5 text-primary",
762
+ "aria-hidden": "true"
763
+ }),
764
+ e(x, "workspaceInvite.pendingTitle", "Pending Invitations"),
765
+ /* @__PURE__ */ E(m, {
766
+ variant: "secondary",
767
+ className: "tabular-nums",
768
+ children: Y.length
769
+ })
770
+ ]
771
+ }) }), /* @__PURE__ */ E(g, { children: Wt })]
772
+ })
773
+ ]
774
+ })] });
775
+ }
776
+ return /* @__PURE__ */ D(T, { children: [Gt, /* @__PURE__ */ D("div", {
382
777
  className: "space-y-6 p-3 sm:p-6",
383
778
  children: [
384
- /* @__PURE__ */ m("div", {
779
+ /* @__PURE__ */ E("div", {
385
780
  className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",
386
- children: /* @__PURE__ */ h("div", { children: [
387
- /* @__PURE__ */ h(_, {
781
+ children: /* @__PURE__ */ D("div", { children: [
782
+ /* @__PURE__ */ D(h, {
388
783
  variant: "ghost",
389
- onClick: () => w(E(`${T}/${k}`)),
784
+ onClick: () => S(w(`${C}/${j}`)),
390
785
  className: "-ml-2 mb-2 gap-2",
391
- children: [/* @__PURE__ */ m(de, { size: 18 }), e(x, "workspaceInvite.backToWorkspace", "Back to Workspace")]
786
+ children: [/* @__PURE__ */ E(u, { size: 18 }), e(x, "workspaceInvite.backToWorkspace", "Back to Workspace")]
392
787
  }),
393
- /* @__PURE__ */ h("div", {
788
+ /* @__PURE__ */ D("div", {
394
789
  className: "flex items-center gap-2",
395
- children: [/* @__PURE__ */ m(ge, {
790
+ children: [/* @__PURE__ */ E(ye, {
396
791
  className: "text-primary",
397
792
  size: 24
398
- }), /* @__PURE__ */ m("h1", {
793
+ }), /* @__PURE__ */ E("h1", {
399
794
  className: "text-2xl font-bold sm:text-3xl",
400
795
  children: e(x, "workspaceInvite.title", "Invite Members")
401
796
  })]
402
797
  }),
403
- /* @__PURE__ */ h("p", {
798
+ /* @__PURE__ */ D("p", {
404
799
  className: "mt-2 text-sm text-text-secondary sm:text-base",
405
800
  children: [
406
- Ye.name,
801
+ $e.name,
407
802
  " —",
408
803
  " ",
409
804
  e(x, "workspaceInvite.subtitle", "Invite people into this workspace and optionally grant project access.")
@@ -411,15 +806,15 @@ function k() {
411
806
  })
412
807
  ] })
413
808
  }),
414
- /* @__PURE__ */ m(Ae, { children: e(x, "workspaceInvite.purpose", "Use this page to bring new people into the workspace. First choose the roles and projects they should get the moment they accept, then send a single invitation by email or upload a CSV to invite many people at once. Invitations you have already sent appear at the bottom, where you can resend or cancel them.") }),
415
- /* @__PURE__ */ m(ke, {
809
+ /* @__PURE__ */ E(Pe, { children: e(x, "workspaceInvite.purpose", "Use this page to bring new people into the workspace. First choose the roles and projects they should get the moment they accept, then send a single invitation by email or upload a CSV to invite many people at once. Invitations you have already sent appear at the bottom, where you can resend or cancel them.") }),
810
+ /* @__PURE__ */ E(Me, {
416
811
  storageKey: "workspaces-workspace-invite",
417
812
  steps: [
418
813
  {
419
814
  id: "pick-access",
420
815
  label: e(x, "workspaceInvite.stepAccess", "Pick the roles and projects to grant"),
421
816
  description: e(x, "workspaceInvite.stepAccessDesc", "These are applied automatically when each person accepts."),
422
- icon: /* @__PURE__ */ m(ge, { size: 16 }),
817
+ icon: /* @__PURE__ */ E(ye, { size: 16 }),
423
818
  onClick: () => document.getElementById("invite-access-section")?.scrollIntoView({
424
819
  behavior: "smooth",
425
820
  block: "start"
@@ -429,7 +824,7 @@ function k() {
429
824
  id: "send-invite",
430
825
  label: e(x, "workspaceInvite.stepSend", "Send the invitation"),
431
826
  description: e(x, "workspaceInvite.stepSendDesc", "Enter one email, or switch to the Bulk CSV tab to invite many at once."),
432
- icon: /* @__PURE__ */ m(f, { size: 16 }),
827
+ icon: /* @__PURE__ */ E(_e, { size: 16 }),
433
828
  onClick: () => document.getElementById("invite-send-section")?.scrollIntoView({
434
829
  behavior: "smooth",
435
830
  block: "start"
@@ -439,7 +834,7 @@ function k() {
439
834
  id: "review-pending",
440
835
  label: e(x, "workspaceInvite.stepPending", "Track your pending invitations"),
441
836
  description: e(x, "workspaceInvite.stepPendingDesc", "Resend or cancel invitations that have not been accepted yet."),
442
- icon: /* @__PURE__ */ m(pe, { size: 16 }),
837
+ icon: /* @__PURE__ */ E(he, { size: 16 }),
443
838
  onClick: () => document.getElementById("invite-pending-section")?.scrollIntoView({
444
839
  behavior: "smooth",
445
840
  block: "start"
@@ -447,411 +842,119 @@ function k() {
447
842
  }
448
843
  ]
449
844
  }),
450
- /* @__PURE__ */ h(S, {
845
+ /* @__PURE__ */ D(y, {
451
846
  treatment: "plain",
452
847
  id: "invite-access-section",
453
848
  className: "border-border-seam",
454
- children: [/* @__PURE__ */ m(y, { children: /* @__PURE__ */ m(b, { children: e(x, "workspaceInvite.setupTitle", "Access to grant on acceptance") }) }), /* @__PURE__ */ m(v, { children: /* @__PURE__ */ m(Ke, {
455
- selectedRoleIds: F,
456
- onRoleToggle: kt,
457
- selectedProjectIds: I,
458
- onProjectToggle: At,
459
- availableRoles: A,
460
- availableProjects: N,
461
- isLoadingRoles: Qe,
462
- isLoadingProjects: $e,
463
- disabled: Et
849
+ children: [/* @__PURE__ */ E(_, { children: /* @__PURE__ */ E(v, { children: e(x, "workspaceInvite.setupTitle", "Access to grant on acceptance") }) }), /* @__PURE__ */ E(g, { children: /* @__PURE__ */ E(Xe, {
850
+ selectedRoleIds: I,
851
+ onRoleToggle: Ft,
852
+ selectedProjectIds: L,
853
+ onProjectToggle: It,
854
+ availableRoles: M,
855
+ availableProjects: P,
856
+ isLoadingRoles: nt,
857
+ isLoadingProjects: it,
858
+ disabled: Pt
464
859
  }) })]
465
860
  }),
466
- /* @__PURE__ */ h(S, {
861
+ /* @__PURE__ */ D(y, {
467
862
  treatment: "metric",
468
863
  glow: !0,
469
864
  className: "border-border-seam",
470
- children: [/* @__PURE__ */ m(y, { children: /* @__PURE__ */ m(b, { children: "Selection summary" }) }), /* @__PURE__ */ h(v, {
865
+ children: [/* @__PURE__ */ E(_, { children: /* @__PURE__ */ E(v, { children: "Selection summary" }) }), /* @__PURE__ */ D(g, {
471
866
  className: "grid gap-4 md:grid-cols-2",
472
- children: [/* @__PURE__ */ h("div", {
867
+ children: [/* @__PURE__ */ D("div", {
473
868
  className: "space-y-2 rounded-lg border border-border-seam bg-bg-surface p-4",
474
- children: [/* @__PURE__ */ h("div", {
869
+ children: [/* @__PURE__ */ D("div", {
475
870
  className: "flex items-center justify-between gap-2",
476
- children: [/* @__PURE__ */ m("p", {
871
+ children: [/* @__PURE__ */ E("p", {
477
872
  className: "text-sm font-medium",
478
873
  children: "Roles"
479
- }), /* @__PURE__ */ m(g, {
874
+ }), /* @__PURE__ */ E(m, {
480
875
  variant: "secondary",
481
876
  className: "tabular-nums",
482
- children: Dt.length
877
+ children: X.length
483
878
  })]
484
- }), /* @__PURE__ */ m("p", {
879
+ }), /* @__PURE__ */ E("p", {
485
880
  className: "text-sm text-text-muted",
486
- children: We(Dt, "No roles selected")
881
+ children: Ye(X, "No roles selected")
487
882
  })]
488
- }), /* @__PURE__ */ h("div", {
883
+ }), /* @__PURE__ */ D("div", {
489
884
  className: "space-y-2 rounded-lg border border-border-seam bg-bg-surface p-4",
490
- children: [/* @__PURE__ */ h("div", {
885
+ children: [/* @__PURE__ */ D("div", {
491
886
  className: "flex items-center justify-between gap-2",
492
- children: [/* @__PURE__ */ m("p", {
887
+ children: [/* @__PURE__ */ E("p", {
493
888
  className: "text-sm font-medium",
494
889
  children: "Projects"
495
- }), /* @__PURE__ */ m(g, {
890
+ }), /* @__PURE__ */ E(m, {
496
891
  variant: "secondary",
497
892
  className: "tabular-nums",
498
- children: Ot.length
893
+ children: Z.length
499
894
  })]
500
- }), /* @__PURE__ */ m("p", {
895
+ }), /* @__PURE__ */ E("p", {
501
896
  className: "text-sm text-text-muted",
502
- children: We(Ot, "No project access will be granted automatically")
897
+ children: Ye(Z, "No project access will be granted automatically")
503
898
  })]
504
899
  })]
505
900
  })]
506
901
  }),
507
- /* @__PURE__ */ h(S, {
902
+ /* @__PURE__ */ D(y, {
508
903
  treatment: "plain",
509
904
  id: "invite-send-section",
510
905
  className: "border-border-seam",
511
- children: [/* @__PURE__ */ m(y, { children: /* @__PURE__ */ m(b, { children: e(x, "workspaceInvite.sendTitle", "Send invitations") }) }), /* @__PURE__ */ m(v, { children: /* @__PURE__ */ h(Me, {
512
- value: it,
513
- onValueChange: (e) => at(e),
906
+ children: [/* @__PURE__ */ E(_, { children: /* @__PURE__ */ E(v, { children: e(x, "workspaceInvite.sendTitle", "Send invitations") }) }), /* @__PURE__ */ E(g, { children: /* @__PURE__ */ D(Ie, {
907
+ value: lt,
908
+ onValueChange: (e) => ut(e),
514
909
  className: "space-y-5",
515
910
  children: [
516
- /* @__PURE__ */ h(Pe, { children: [/* @__PURE__ */ m(Fe, {
911
+ /* @__PURE__ */ D(Re, { children: [/* @__PURE__ */ E(ze, {
517
912
  value: "single",
518
913
  children: e(x, "workspaceInvite.modeSingle", "Single")
519
- }), /* @__PURE__ */ m(Fe, {
914
+ }), /* @__PURE__ */ E(ze, {
520
915
  value: "bulk",
521
916
  children: e(x, "workspaceInvite.modeBulk", "Bulk CSV")
522
917
  })] }),
523
- /* @__PURE__ */ h(Ne, {
918
+ /* @__PURE__ */ E(Le, {
524
919
  value: "single",
525
920
  className: "space-y-4",
526
- children: [
527
- lt ? /* @__PURE__ */ h("div", {
528
- className: "flex items-center gap-2 rounded-md border border-status-error-border/20 bg-status-error-bg/10 p-3 text-sm text-status-error-text",
529
- children: [/* @__PURE__ */ m(l, { className: "size-4 shrink-0" }), /* @__PURE__ */ m("span", { children: lt })]
530
- }) : null,
531
- ut ? /* @__PURE__ */ h("div", {
532
- className: "flex items-center gap-2 rounded-md border border-status-success/30 bg-status-success/10 p-3 text-sm text-status-success-text",
533
- children: [/* @__PURE__ */ m(u, { className: "size-4 shrink-0" }), /* @__PURE__ */ m("span", { children: ut })]
534
- }) : null,
535
- /* @__PURE__ */ h("form", {
536
- onSubmit: jt,
537
- className: "space-y-4",
538
- children: [/* @__PURE__ */ h("div", {
539
- className: "space-y-2",
540
- children: [/* @__PURE__ */ m("label", {
541
- htmlFor: "workspace-invite-email",
542
- className: "text-sm font-medium",
543
- children: e(x, "workspaceInvite.emailLabel", "Email Address")
544
- }), /* @__PURE__ */ m(Oe, {
545
- id: "workspace-invite-email",
546
- type: "email",
547
- placeholder: e(x, "workspaceInvite.emailPlaceholder", "member@example.com"),
548
- value: P,
549
- onChange: (e) => ot(e.target.value),
550
- disabled: K
551
- })]
552
- }), /* @__PURE__ */ m("div", {
553
- className: "flex justify-end",
554
- children: /* @__PURE__ */ h(_, {
555
- type: "submit",
556
- disabled: K,
557
- className: "gap-2",
558
- children: [K ? /* @__PURE__ */ m(d, { className: "size-4 animate-spin" }) : /* @__PURE__ */ m(f, { className: "size-4" }), e(x, "workspaceInvite.sendSingleButton", "Send Invitation")]
559
- })
560
- })]
561
- })
562
- ]
921
+ children: Ht
563
922
  }),
564
- /* @__PURE__ */ h(Ne, {
923
+ /* @__PURE__ */ E(Le, {
565
924
  value: "bulk",
566
925
  className: "space-y-5",
567
- children: [
568
- ft ? /* @__PURE__ */ h("div", {
569
- className: "flex items-center gap-2 rounded-md border border-status-error-border/20 bg-status-error-bg/10 p-3 text-sm text-status-error-text",
570
- children: [/* @__PURE__ */ m(l, { className: "size-4 shrink-0" }), /* @__PURE__ */ m("span", { children: ft })]
571
- }) : null,
572
- pt ? /* @__PURE__ */ h("div", {
573
- className: "flex items-center gap-2 rounded-md border border-status-success/30 bg-status-success/10 p-3 text-sm text-status-success-text",
574
- children: [/* @__PURE__ */ m(u, { className: "size-4 shrink-0" }), /* @__PURE__ */ m("span", { children: pt })]
575
- }) : null,
576
- /* @__PURE__ */ h("div", {
577
- className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
578
- children: [/* @__PURE__ */ h("div", {
579
- className: "space-y-1",
580
- children: [
581
- /* @__PURE__ */ m("p", {
582
- className: "text-sm text-text-secondary",
583
- children: e(x, "workspaceInvite.bulkDescription", "Upload a CSV with one email column. All valid rows will receive the currently selected roles and projects.")
584
- }),
585
- /* @__PURE__ */ h("div", {
586
- className: "rounded-md border bg-bg-sunken/30 px-3 py-2 text-xs text-text-secondary",
587
- children: [/* @__PURE__ */ m("p", {
588
- className: "font-medium text-text-primary",
589
- children: "Sample format"
590
- }), /* @__PURE__ */ h("pre", {
591
- className: "mt-1 whitespace-pre-wrap",
592
- children: [
593
- "email",
594
- "\n",
595
- "alice@example.com",
596
- "\n",
597
- "bob@example.com"
598
- ]
599
- })]
600
- }),
601
- (j?.total ?? 0) > N.length ? /* @__PURE__ */ h("p", {
602
- className: "text-xs text-text-secondary",
603
- children: [
604
- "Showing the first ",
605
- N.length,
606
- " active projects. Narrow the workspace project list if you need to invite into more."
607
- ]
608
- }) : null
609
- ]
610
- }), /* @__PURE__ */ h(_, {
611
- type: "button",
612
- variant: "outline",
613
- onClick: ce,
614
- className: "gap-2",
615
- children: [/* @__PURE__ */ m(fe, { size: 16 }), e(x, "workspaceInvite.downloadTemplate", "Download template")]
616
- })]
617
- }),
618
- /* @__PURE__ */ h("div", {
619
- onDragOver: (e) => {
620
- e.preventDefault(), _t(!0);
621
- },
622
- onDragLeave: () => _t(!1),
623
- onDrop: (e) => {
624
- e.preventDefault(), _t(!1);
625
- let t = e.dataTransfer.files?.[0];
626
- t ? Mt(t) : R("Please upload a .csv file.");
627
- },
628
- className: `flex flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed p-8 transition-colors ${gt ? "border-primary bg-action-primary-bg/5" : "border-border-subtle bg-bg-surface"}`,
629
- children: [
630
- /* @__PURE__ */ m(he, {
631
- size: 28,
632
- className: "text-text-secondary"
633
- }),
634
- /* @__PURE__ */ h("div", {
635
- className: "text-center",
636
- children: [/* @__PURE__ */ m("p", {
637
- className: "text-sm font-medium",
638
- children: mt || "Drop a CSV file here or click to browse"
639
- }), /* @__PURE__ */ m("p", {
640
- className: "mt-1 text-xs text-text-secondary",
641
- children: "CSV files only. Required column: email."
642
- })]
643
- }),
644
- /* @__PURE__ */ m("input", {
645
- ref: yt,
646
- type: "file",
647
- accept: ".csv,text/csv",
648
- onChange: (e) => {
649
- let t = e.target.files?.[0];
650
- t && Mt(t), e.target.value = "";
651
- },
652
- className: "hidden",
653
- "aria-label": e(x, "workspaceInvite.chooseCsvFileAriaLabel", "Choose CSV file")
654
- }),
655
- /* @__PURE__ */ m(_, {
656
- type: "button",
657
- onClick: () => yt.current?.click(),
658
- children: e(x, "workspaceInvite.chooseFile", "Choose file")
659
- })
660
- ]
661
- }),
662
- H.length > 0 ? /* @__PURE__ */ h(ve, { children: [
663
- /* @__PURE__ */ h("div", {
664
- className: "flex flex-wrap gap-4 text-xs text-text-secondary",
665
- children: [
666
- /* @__PURE__ */ h("span", { children: ["Total rows: ", H.length] }),
667
- /* @__PURE__ */ h("span", { children: ["Ready: ", Q.length] }),
668
- /* @__PURE__ */ h("span", { children: ["With errors: ", $.length] }),
669
- $.length > 0 ? /* @__PURE__ */ m(g, {
670
- variant: "destructive",
671
- children: "Invalid rows will be skipped"
672
- }) : null
673
- ]
674
- }),
675
- $.length > 0 ? /* @__PURE__ */ h("div", {
676
- className: "rounded-md border border-status-error-border/20 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
677
- children: [
678
- $.length,
679
- " row",
680
- $.length === 1 ? "" : "s",
681
- " need attention. Only valid rows can be invited."
682
- ]
683
- }) : null,
684
- /* @__PURE__ */ m("div", {
685
- className: "overflow-hidden rounded-xl border",
686
- children: /* @__PURE__ */ m(je, {
687
- columns: Ve,
688
- data: H,
689
- rowKey: (e) => `${e.rowNumber}-${e.email}`
690
- })
691
- })
692
- ] }) : /* @__PURE__ */ m("div", {
693
- className: "rounded-xl border border-dashed p-6 text-center text-sm text-text-secondary",
694
- children: "Upload a CSV to preview invite rows here before sending."
695
- }),
696
- /* @__PURE__ */ m("div", {
697
- className: "flex justify-end",
698
- children: /* @__PURE__ */ h(_, {
699
- type: "button",
700
- onClick: Nt,
701
- disabled: Q.length === 0 || q || W,
702
- className: "gap-2",
703
- children: [q || W ? /* @__PURE__ */ m(d, { className: "size-4 animate-spin" }) : /* @__PURE__ */ m(f, { className: "size-4" }), e(x, "workspaceInvite.sendBulkButton", "Send Bulk Invites")]
704
- })
705
- })
706
- ]
926
+ children: Ut
707
927
  })
708
928
  ]
709
929
  }) })]
710
930
  }),
711
- /* @__PURE__ */ h(S, {
931
+ /* @__PURE__ */ D(y, {
712
932
  treatment: "plain",
713
933
  id: "invite-pending-section",
714
934
  className: "border-border-seam",
715
- children: [/* @__PURE__ */ m(y, { children: /* @__PURE__ */ h(b, {
935
+ children: [/* @__PURE__ */ E(_, { children: /* @__PURE__ */ D(v, {
716
936
  className: "flex items-center gap-2",
717
937
  children: [
718
- /* @__PURE__ */ m(pe, { className: "size-5 text-primary" }),
938
+ /* @__PURE__ */ E(he, { className: "size-5 text-primary" }),
719
939
  e(x, "workspaceInvite.pendingTitle", "Pending Invitations"),
720
- /* @__PURE__ */ m(g, {
940
+ /* @__PURE__ */ E(m, {
721
941
  variant: "secondary",
722
942
  className: "tabular-nums",
723
- children: Z.length
943
+ children: Y.length
724
944
  })
725
945
  ]
726
- }) }), /* @__PURE__ */ h(v, { children: [B ? /* @__PURE__ */ h("div", {
727
- className: `mb-4 flex items-center gap-2 rounded-md border p-3 text-sm ${B.tone === "success" ? "border-status-success/30 bg-status-success/10 text-status-success-text" : "border-status-error-border/20 bg-status-error-bg/10 text-status-error-text"}`,
728
- children: [B.tone === "success" ? /* @__PURE__ */ m(u, { className: "size-4 shrink-0" }) : /* @__PURE__ */ m(l, { className: "size-4 shrink-0" }), /* @__PURE__ */ m("span", { children: B.message })]
729
- }) : null, tt ? /* @__PURE__ */ h("div", {
730
- className: "space-y-3",
731
- children: [/* @__PURE__ */ m(C, { className: "h-20 w-full" }), /* @__PURE__ */ m(C, { className: "h-20 w-full" })]
732
- }) : nt && Z.length === 0 ? /* @__PURE__ */ h("div", {
733
- role: "alert",
734
- className: "space-y-3 rounded-md border border-status-error-border/20 bg-status-error-bg/10 p-3 text-sm text-status-error-text",
735
- children: [/* @__PURE__ */ m("p", { children: e(x, "workspaceInvite.pendingLoadFailed", "Failed to load pending invitations for this workspace.") }), /* @__PURE__ */ m(_, {
736
- type: "button",
737
- variant: "outline",
738
- size: "sm",
739
- className: "w-fit",
740
- disabled: M,
741
- onClick: () => {
742
- rt();
743
- },
744
- children: M ? e(x, "workspaceInvite.retrying", "Retrying…") : e(x, "workspaceInvite.tryAgain", "Try again")
745
- })]
746
- }) : Z.length === 0 ? /* @__PURE__ */ m(De, {
747
- illustration: "empty-notifications",
748
- title: e(x, "workspaceInvite.pendingEmptyTitle", "No pending invitations"),
749
- description: e(x, "workspaceInvite.pendingEmpty", "Invitations you send for this workspace will show up here until they are accepted, so you can resend or cancel them.")
750
- }) : /* @__PURE__ */ h("div", {
751
- className: "space-y-3",
752
- children: [nt ? /* @__PURE__ */ h("div", {
753
- role: "alert",
754
- className: "flex flex-wrap items-center justify-between gap-3 rounded-md border border-status-error-border/20 bg-status-error-bg/10 p-3 text-sm text-status-error-text",
755
- children: [/* @__PURE__ */ m("span", { children: e(x, "workspaceInvite.pendingStaleWarning", "Pending invitations may be outdated. Try again to refresh this list.") }), /* @__PURE__ */ m(_, {
756
- type: "button",
757
- variant: "outline",
758
- size: "sm",
759
- className: "w-fit",
760
- disabled: M,
761
- onClick: () => {
762
- rt();
763
- },
764
- children: M ? e(x, "workspaceInvite.retrying", "Retrying…") : e(x, "workspaceInvite.tryAgain", "Try again")
765
- })]
766
- }) : null, Z.map((e) => {
767
- let r = n(e), i = t(e), a = Tt === e.id && (J || Y);
768
- return /* @__PURE__ */ m("div", {
769
- className: "rounded-lg border p-4",
770
- children: /* @__PURE__ */ h("div", {
771
- className: "flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",
772
- children: [/* @__PURE__ */ h("div", {
773
- className: "space-y-3",
774
- children: [
775
- /* @__PURE__ */ h("div", {
776
- className: "flex flex-wrap items-center gap-2",
777
- children: [/* @__PURE__ */ m("p", {
778
- className: "font-semibold",
779
- children: e.email
780
- }), /* @__PURE__ */ m(g, {
781
- variant: "outline",
782
- children: e.status
783
- })]
784
- }),
785
- /* @__PURE__ */ h("div", {
786
- className: "grid gap-3 text-sm text-text-secondary sm:grid-cols-2",
787
- children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
788
- className: "font-medium text-text-primary",
789
- children: "Received"
790
- }), /* @__PURE__ */ m("p", { children: Ue(e.createdAt) ?? "—" })] }), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
791
- className: "font-medium text-text-primary",
792
- children: "Expires"
793
- }), /* @__PURE__ */ m("p", { children: Ue(e.expiresAt) ?? "—" })] })]
794
- }),
795
- /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
796
- className: "mb-2 text-sm font-medium text-text-primary",
797
- children: "Roles"
798
- }), /* @__PURE__ */ m("div", {
799
- className: "flex flex-wrap gap-2",
800
- children: r.length > 0 ? r.map((t, n) => /* @__PURE__ */ m(g, {
801
- variant: "outline",
802
- children: t
803
- }, `${e.id}-${e.roleIds[n] ?? t}`)) : /* @__PURE__ */ m("span", {
804
- className: "text-sm text-text-secondary",
805
- children: "No roles selected"
806
- })
807
- })] }),
808
- /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
809
- className: "mb-2 text-sm font-medium text-text-primary",
810
- children: "Projects"
811
- }), /* @__PURE__ */ m("div", {
812
- className: "flex flex-wrap gap-2",
813
- children: i.length > 0 ? i.map((t, n) => /* @__PURE__ */ m(g, {
814
- variant: "secondary",
815
- children: t
816
- }, `${e.id}-project-${t}-${n}`)) : /* @__PURE__ */ m("span", {
817
- className: "text-sm text-text-secondary",
818
- children: "No project access will be granted automatically"
819
- })
820
- })] })
821
- ]
822
- }), /* @__PURE__ */ h("div", {
823
- className: "flex gap-2",
824
- children: [/* @__PURE__ */ h(_, {
825
- type: "button",
826
- variant: "outline",
827
- disabled: J || Y,
828
- onClick: () => Pt(e),
829
- className: "gap-2",
830
- children: [a && J ? /* @__PURE__ */ m(me, { className: "size-4 animate-spin" }) : /* @__PURE__ */ m(me, { className: "size-4" }), "Resend"]
831
- }), /* @__PURE__ */ h(_, {
832
- type: "button",
833
- variant: "outline",
834
- disabled: J || Y,
835
- onClick: () => bt(e),
836
- className: "gap-2",
837
- children: [a && Y ? /* @__PURE__ */ m(d, { className: "size-4 animate-spin" }) : /* @__PURE__ */ m(p, { className: "size-4" }), "Cancel"]
838
- })]
839
- })]
840
- })
841
- }, e.id);
842
- })]
843
- })] })]
946
+ }) }), /* @__PURE__ */ E(g, { children: Wt })]
844
947
  })
845
948
  ]
846
949
  })] });
847
950
  }
848
- function qe() {
849
- let { workspaceId: e } = ze(), { workspaceId: t } = i();
850
- return /* @__PURE__ */ m(_e, {
951
+ function j() {
952
+ let { workspaceId: e } = We(), { workspaceId: t } = i();
953
+ return /* @__PURE__ */ E(w, {
851
954
  scopeId: e || t || null,
852
955
  gateway: "workspace",
853
956
  debug: !1,
854
- children: /* @__PURE__ */ m(k, {})
957
+ children: /* @__PURE__ */ E(A, {})
855
958
  });
856
959
  }
857
- export { qe as WorkspaceInvitePage };
960
+ export { j as WorkspaceInvitePage };