@burdenoff/microfe-auth 2026.917.1 → 2026.917.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.
@@ -5,12 +5,12 @@ import { useUserOperations as i } from "../hooks/useUserOperations.js";
5
5
  import { useAuthPermissions as a } from "../hooks/useAuthPermissions.js";
6
6
  import { ConfirmActionDialog as o } from "../components/ConfirmActionDialog.js";
7
7
  import { nativeImpact as s, nativeNotify as c } from "../../utils/nativeBridge.js";
8
- import { validateUserFields as ee } from "../utils/validation.js";
9
- import { useCallback as te, useEffect as ne, useId as l, useState as u } from "react";
10
- import { useNavigate as re } from "react-router";
8
+ import { validatePhoneNumber as ee, validateUserFields as te } from "../utils/validation.js";
9
+ import { useCallback as ne, useEffect as re, useId as l, useState as u } from "react";
10
+ import { useNavigate as ie } from "react-router";
11
11
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
12
12
  import { Button as m } from "@burdenoff/fe-libs/button";
13
- import { EmphasisPanel as ie, IllustratedEmptyState as h, NextSteps as ae, PagePurpose as oe } from "@burdenoff/fe-libs/ui";
13
+ import { EmphasisPanel as ae, IllustratedEmptyState as h, NextSteps as oe, PagePurpose as se } from "@burdenoff/fe-libs/ui";
14
14
  //#region src/auth/pages/UsersPage.tsx
15
15
  var g = [
16
16
  "TENANT_ADMIN",
@@ -25,11 +25,11 @@ var g = [
25
25
  "DELETED"
26
26
  ];
27
27
  function v() {
28
- let v = t(), se = re(), y = e((e) => e.isAuthenticated), ce = e((e) => e.user), { canViewUsers: le, canUpdateUsers: ue, canDeleteUsers: b, isLoading: de } = a(), { listUsers: x, updateUser: fe, deleteUser: pe, hardDeleteUser: me, isLoading: S } = i(), C = l(), w = l(), T = l(), E = l(), he = l(), [D, O] = u(!1), k = async () => {
29
- O(!0);
28
+ let v = t(), ce = ie(), y = e((e) => e.isAuthenticated), le = e((e) => e.user), { canViewUsers: ue, canUpdateUsers: de, canDeleteUsers: b, isLoading: fe } = a(), { listUsers: x, updateUser: pe, deleteUser: me, hardDeleteUser: he, isLoading: S } = i(), C = l(), ge = l(), w = l(), T = l(), _e = l(), [E, D] = u(!1), O = async () => {
29
+ D(!0);
30
30
  try {
31
31
  let e = {};
32
- G && (e.search = G), K && (e.role = K), q && (e.status = q);
32
+ K && (e.search = K), q && (e.role = q), J && (e.status = J);
33
33
  let t = (await x(e, {
34
34
  offset: 0,
35
35
  limit: 1e4
@@ -66,11 +66,11 @@ function v() {
66
66
  ].join(","))], a = new Blob([i.join("\n")], { type: "text/csv;charset=utf-8;" }), o = URL.createObjectURL(a), s = document.createElement("a");
67
67
  s.href = o, s.download = `users-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.csv`, s.click(), URL.revokeObjectURL(o);
68
68
  } catch (e) {
69
- z(e instanceof Error ? e.message : "Failed to export users");
69
+ R(e instanceof Error ? e.message : "Failed to export users");
70
70
  } finally {
71
- O(!1);
71
+ D(!1);
72
72
  }
73
- }, [A, ge] = u([]), [j, _e] = u(0), [ve, ye] = u(!1), [M, N] = u("list"), [P, F] = u(null), [I, L] = u({
73
+ }, [k, ve] = u([]), [A, ye] = u(0), [be, xe] = u(!1), [j, M] = u("list"), [N, P] = u(null), [F, I] = u({
74
74
  username: "",
75
75
  firstName: "",
76
76
  lastName: "",
@@ -79,34 +79,34 @@ function v() {
79
79
  role: "MEMBER",
80
80
  status: "ACTIVE",
81
81
  emailVerified: !1
82
- }), [R, z] = u(null), [be, B] = u(!1), [V, H] = u(null), [U, W] = u(null), [G, xe] = u(""), [K, Se] = u(""), [q, Ce] = u(""), [J, Y] = u(0), X = te(async () => {
82
+ }), [L, R] = u(null), [z, B] = u(null), [Se, V] = u(!1), [H, U] = u(null), [W, G] = u(null), [K, Ce] = u(""), [q, we] = u(""), [J, Te] = u(""), [Y, X] = u(0), Z = ne(async () => {
83
83
  if (y) try {
84
- B(!1);
84
+ V(!1);
85
85
  let e = {};
86
- G && (e.search = G), K && (e.role = K), q && (e.status = q);
86
+ K && (e.search = K), q && (e.role = q), J && (e.status = J);
87
87
  let t = await x(e, {
88
- offset: J * 10,
88
+ offset: Y * 10,
89
89
  limit: 10
90
90
  });
91
- ge(t.users), _e(t.totalCount), ye(t.hasMore), z(null);
91
+ ve(t.users), ye(t.totalCount), xe(t.hasMore), R(null);
92
92
  } catch (e) {
93
93
  if (e instanceof Error && (e.name === "AbortError" || e.message.includes("aborted"))) return;
94
94
  let t = e instanceof Error ? e.message : "Failed to fetch users";
95
- t.toLowerCase().includes("not authorized") || t.toLowerCase().includes("forbidden") ? (B(!0), z(null)) : z(t);
95
+ t.toLowerCase().includes("not authorized") || t.toLowerCase().includes("forbidden") ? (V(!0), R(null)) : R(t);
96
96
  }
97
97
  }, [
98
98
  x,
99
- G,
100
99
  K,
101
100
  q,
102
101
  J,
102
+ Y,
103
103
  y
104
104
  ]);
105
- ne(() => {
106
- X();
107
- }, [X]);
108
- let Z = () => {
109
- L({
105
+ re(() => {
106
+ Z();
107
+ }, [Z]);
108
+ let Q = () => {
109
+ I({
110
110
  username: "",
111
111
  firstName: "",
112
112
  lastName: "",
@@ -115,46 +115,50 @@ function v() {
115
115
  role: "MEMBER",
116
116
  status: "ACTIVE",
117
117
  emailVerified: !1
118
- }), F(null), z(null), H(null);
119
- }, we = async (e) => {
120
- if (e.preventDefault(), !P) return;
121
- z(null);
122
- let t = ee(I, { requireAll: !1 });
118
+ }), P(null), R(null), B(null), U(null);
119
+ }, Ee = async (e) => {
120
+ if (e.preventDefault(), !N) return;
121
+ if (R(null), B(null), !ee(F.phoneNumber).valid) {
122
+ let e = v("auth.users.phoneNumber_invalid", "Invalid phone number");
123
+ B(e), R(e);
124
+ return;
125
+ }
126
+ let t = te(F, { requireAll: !1 });
123
127
  if (!t.valid) {
124
- z(t.errors.map((e) => v(`auth.users.${e.field}_${e.code}`, e.message)).join(" · "));
128
+ R(t.errors.map((e) => v(`auth.users.${e.field}_${e.code}`, e.message)).join(" · "));
125
129
  return;
126
130
  }
127
131
  try {
128
- await fe(P.id, {
132
+ await pe(N.id, {
129
133
  username: t.values.username || void 0,
130
134
  firstName: t.values.firstName || void 0,
131
135
  lastName: t.values.lastName || void 0,
132
- name: I.name || void 0,
133
- phoneNumber: I.phoneNumber || void 0,
134
- role: I.role,
135
- status: I.status,
136
- emailVerified: I.emailVerified
137
- }), H(v("auth.users.updateSuccess", "User updated successfully!")), N("list"), Z(), X();
136
+ name: F.name || void 0,
137
+ phoneNumber: F.phoneNumber || void 0,
138
+ role: F.role,
139
+ status: F.status,
140
+ emailVerified: F.emailVerified
141
+ }), U(v("auth.users.updateSuccess", "User updated successfully!")), M("list"), Q(), Z();
138
142
  } catch (e) {
139
- z(e instanceof Error ? e.message : "Failed to update user");
143
+ R(e instanceof Error ? e.message : "Failed to update user");
140
144
  }
141
- }, Te = async (e) => {
145
+ }, De = async (e) => {
142
146
  s("medium");
143
147
  try {
144
- let t = await pe(e.id);
145
- t.success ? (c("success"), H(v("auth.users.userDeactivated", "User \"{email}\" has been deactivated.").replace("{email}", e.email)), W(null), X()) : (c("error"), z(t.message));
148
+ let t = await me(e.id);
149
+ t.success ? (c("success"), U(v("auth.users.userDeactivated", "User \"{email}\" has been deactivated.").replace("{email}", e.email)), G(null), Z()) : (c("error"), R(t.message));
146
150
  } catch (e) {
147
- c("error"), z(e instanceof Error ? e.message : "Failed to delete user");
151
+ c("error"), R(e instanceof Error ? e.message : "Failed to delete user");
148
152
  }
149
- }, Ee = async (e) => {
153
+ }, Oe = async (e) => {
150
154
  try {
151
- let t = await me(e.id);
152
- t.success ? (H(v("auth.users.userPermanentlyDeleted", "User \"{email}\" has been permanently deleted.").replace("{email}", e.email)), W(null), X()) : z(t.message);
155
+ let t = await he(e.id);
156
+ t.success ? (U(v("auth.users.userPermanentlyDeleted", "User \"{email}\" has been permanently deleted.").replace("{email}", e.email)), G(null), Z()) : R(t.message);
153
157
  } catch (e) {
154
- z(e instanceof Error ? e.message : "Failed to hard delete user");
158
+ R(e instanceof Error ? e.message : "Failed to hard delete user");
155
159
  }
156
- }, De = (e) => {
157
- F(e), L({
160
+ }, ke = (e) => {
161
+ P(e), I({
158
162
  username: e.username || "",
159
163
  firstName: e.firstName || "",
160
164
  lastName: e.lastName || "",
@@ -163,26 +167,26 @@ function v() {
163
167
  role: e.role,
164
168
  status: e.status,
165
169
  emailVerified: e.emailVerified
166
- }), N("edit"), z(null);
167
- }, Q = /* @__PURE__ */ f(o, {
168
- open: U !== null,
170
+ }), M("edit"), R(null);
171
+ }, $ = /* @__PURE__ */ f(o, {
172
+ open: W !== null,
169
173
  onOpenChange: (e) => {
170
- e || W(null);
174
+ e || G(null);
171
175
  },
172
- title: U?.type === "hard-delete" ? v("auth.users.hardDeleteTitle", "Permanently delete user?") : v("auth.users.deactivateTitle", "Deactivate user?"),
173
- description: U?.type === "hard-delete" ? U ? v("auth.users.hardDeleteDesc", "This permanently deletes \"{email}\" and cannot be undone.").replace("{email}", U.user.email) : "" : U ? v("auth.users.deactivateDesc", "\"{email}\" will be prevented from signing in until reactivated.").replace("{email}", U.user.email) : "",
174
- confirmText: U?.type === "hard-delete" ? v("auth.users.hardDeleteConfirm", "Delete permanently") : v("auth.users.deactivateConfirm", "Deactivate user"),
175
- variant: U?.type === "hard-delete" ? "danger" : "warning",
176
+ title: W?.type === "hard-delete" ? v("auth.users.hardDeleteTitle", "Permanently delete user?") : v("auth.users.deactivateTitle", "Deactivate user?"),
177
+ description: W?.type === "hard-delete" ? W ? v("auth.users.hardDeleteDesc", "This permanently deletes \"{email}\" and cannot be undone.").replace("{email}", W.user.email) : "" : W ? v("auth.users.deactivateDesc", "\"{email}\" will be prevented from signing in until reactivated.").replace("{email}", W.user.email) : "",
178
+ confirmText: W?.type === "hard-delete" ? v("auth.users.hardDeleteConfirm", "Delete permanently") : v("auth.users.deactivateConfirm", "Deactivate user"),
179
+ variant: W?.type === "hard-delete" ? "danger" : "warning",
176
180
  onConfirm: async () => {
177
- if (U) {
178
- if (U.type === "hard-delete") {
179
- await Ee(U.user);
181
+ if (W) {
182
+ if (W.type === "hard-delete") {
183
+ await Oe(W.user);
180
184
  return;
181
185
  }
182
- await Te(U.user);
186
+ await De(W.user);
183
187
  }
184
188
  }
185
- }), Oe = (e) => {
189
+ }), Ae = (e) => {
186
190
  switch (e) {
187
191
  case "SUPER_ADMIN": return "bg-accent-purple-subtle text-accent-purple";
188
192
  case "TENANT_ADMIN": return "bg-status-info-bg-subtle text-status-info-text";
@@ -192,7 +196,7 @@ function v() {
192
196
  case "GUEST": return "bg-bg-sunken text-text-primary";
193
197
  default: return "bg-bg-sunken text-text-primary";
194
198
  }
195
- }, $ = (e) => {
199
+ }, je = (e) => {
196
200
  switch (e) {
197
201
  case "ACTIVE": return "bg-status-success-bg-subtle text-status-success-text";
198
202
  case "INACTIVE": return "bg-status-warning-bg-subtle text-status-warning-text";
@@ -201,7 +205,7 @@ function v() {
201
205
  default: return "bg-bg-sunken text-text-primary";
202
206
  }
203
207
  };
204
- return y ? de ? /* @__PURE__ */ f("div", {
208
+ return y ? fe ? /* @__PURE__ */ f("div", {
205
209
  className: "max-w-6xl mx-auto p-6",
206
210
  children: /* @__PURE__ */ p("div", {
207
211
  className: "text-center py-16",
@@ -210,7 +214,7 @@ function v() {
210
214
  children: v("auth.users.loadingPermissions", "Loading permissions...")
211
215
  })]
212
216
  })
213
- }) : !le || be ? /* @__PURE__ */ f("div", {
217
+ }) : !ue || Se ? /* @__PURE__ */ f("div", {
214
218
  className: "max-w-6xl mx-auto p-6",
215
219
  children: /* @__PURE__ */ f(h, {
216
220
  illustration: "empty-generic",
@@ -221,10 +225,10 @@ function v() {
221
225
  v("auth.users.requiredRoles", "Required roles: Super Admin, Tenant Admin, or Org Admin")
222
226
  ] })
223
227
  })
224
- }) : M === "list" ? /* @__PURE__ */ p("div", {
228
+ }) : j === "list" ? /* @__PURE__ */ p("div", {
225
229
  className: "max-w-6xl mx-auto p-6",
226
230
  children: [
227
- Q,
231
+ $,
228
232
  /* @__PURE__ */ p("div", {
229
233
  className: "flex items-center justify-between mb-8",
230
234
  children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h1", {
@@ -235,18 +239,18 @@ function v() {
235
239
  children: [
236
240
  v("auth.users.subtitle", "Manage users in your organization"),
237
241
  " (",
238
- j,
242
+ A,
239
243
  " ",
240
244
  v("auth.users.paginationUsers", "total"),
241
245
  ")"
242
246
  ]
243
247
  })] }), /* @__PURE__ */ f("button", {
244
248
  type: "button",
245
- onClick: () => void k(),
246
- disabled: D,
249
+ onClick: () => void O(),
250
+ disabled: E,
247
251
  "aria-label": v("auth.users.exportAriaLabel", "Export user list"),
248
252
  className: "flex items-center gap-2 px-4 py-2.5 rounded-xl border border-border-default text-text-primary bg-bg-surface hover:bg-bg-sunken disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",
249
- children: D ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(r, {
253
+ children: E ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(r, {
250
254
  className: "size-4 animate-spin",
251
255
  "aria-hidden": "true"
252
256
  }), v("auth.users.exporting", "Exporting...")] }) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("svg", {
@@ -264,11 +268,11 @@ function v() {
264
268
  }), v("auth.users.export", "Export")] })
265
269
  })]
266
270
  }),
267
- /* @__PURE__ */ f(oe, {
271
+ /* @__PURE__ */ f(se, {
268
272
  className: "mb-6",
269
273
  children: v("auth.users.purpose", "Manage everyone with access to your organization. Search and filter accounts, review their role and status, edit details, or deactivate people who should no longer have access.")
270
274
  }),
271
- /* @__PURE__ */ p(ie, {
275
+ /* @__PURE__ */ p(ae, {
272
276
  className: "mb-6",
273
277
  children: [
274
278
  /* @__PURE__ */ f("p", {
@@ -277,7 +281,7 @@ function v() {
277
281
  }),
278
282
  /* @__PURE__ */ f("p", {
279
283
  className: "mt-1 text-3xl font-semibold text-text-primary",
280
- children: j
284
+ children: A
281
285
  }),
282
286
  /* @__PURE__ */ f("p", {
283
287
  className: "mt-1 text-sm text-text-secondary",
@@ -289,30 +293,30 @@ function v() {
289
293
  "aria-live": "polite",
290
294
  "aria-atomic": "true",
291
295
  className: "sr-only",
292
- children: V
296
+ children: H
293
297
  }),
294
298
  /* @__PURE__ */ f("div", {
295
299
  role: "alert",
296
300
  "aria-live": "assertive",
297
301
  "aria-atomic": "true",
298
302
  className: "sr-only",
299
- children: R
303
+ children: L
300
304
  }),
301
- V && /* @__PURE__ */ p("output", {
302
- id: he,
305
+ H && /* @__PURE__ */ p("output", {
306
+ id: _e,
303
307
  className: "block mb-6 p-4 rounded-xl bg-status-success-bg-subtle border border-status-success-border",
304
308
  children: [/* @__PURE__ */ f("p", {
305
309
  className: "text-status-success-text",
306
- children: V
310
+ children: H
307
311
  }), /* @__PURE__ */ f("button", {
308
312
  type: "button",
309
- onClick: () => H(null),
313
+ onClick: () => U(null),
310
314
  className: "mt-2 text-sm text-status-success-text hover:underline",
311
315
  children: v("auth.users.dismiss", "Dismiss")
312
316
  })]
313
317
  }),
314
- R && /* @__PURE__ */ p("div", {
315
- id: E,
318
+ L && /* @__PURE__ */ p("div", {
319
+ id: T,
316
320
  role: "alert",
317
321
  className: "mb-6 flex items-start gap-3 p-4 rounded-xl bg-status-error-bg-subtle border border-status-error-border",
318
322
  children: [/* @__PURE__ */ f(n, {
@@ -322,10 +326,10 @@ function v() {
322
326
  className: "flex-1",
323
327
  children: [/* @__PURE__ */ f("p", {
324
328
  className: "text-sm text-status-error-text",
325
- children: R
329
+ children: L
326
330
  }), /* @__PURE__ */ f("button", {
327
331
  type: "button",
328
- onClick: () => z(null),
332
+ onClick: () => R(null),
329
333
  className: "mt-2 text-sm text-status-error-text hover:underline",
330
334
  children: v("auth.users.dismiss", "Dismiss")
331
335
  })]
@@ -347,22 +351,22 @@ function v() {
347
351
  type: "search",
348
352
  "aria-label": v("auth.users.searchLabel", "Search users"),
349
353
  placeholder: v("auth.users.searchPlaceholder", "Search by email, username, or name..."),
350
- value: G,
354
+ value: K,
351
355
  onChange: (e) => {
352
- xe(e.target.value), Y(0);
356
+ Ce(e.target.value), X(0);
353
357
  },
354
358
  className: "w-full px-4 py-2.5 border border-border-default rounded-xl bg-bg-surface text-text-primary placeholder-text-tertiary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all"
355
359
  })]
356
360
  }),
357
361
  /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
358
- htmlFor: w,
362
+ htmlFor: ge,
359
363
  className: "sr-only",
360
364
  children: v("auth.users.filterRoleLabel", "Filter by role")
361
365
  }), /* @__PURE__ */ p("select", {
362
- id: w,
363
- value: K,
366
+ id: ge,
367
+ value: q,
364
368
  onChange: (e) => {
365
- Se(e.target.value), Y(0);
369
+ we(e.target.value), X(0);
366
370
  },
367
371
  className: "px-4 py-2.5 border border-border-default rounded-xl bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all",
368
372
  children: [/* @__PURE__ */ f("option", {
@@ -374,14 +378,14 @@ function v() {
374
378
  }, e))]
375
379
  })] }),
376
380
  /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
377
- htmlFor: T,
381
+ htmlFor: w,
378
382
  className: "sr-only",
379
383
  children: v("auth.users.filterStatusLabel", "Filter by status")
380
384
  }), /* @__PURE__ */ p("select", {
381
- id: T,
382
- value: q,
385
+ id: w,
386
+ value: J,
383
387
  onChange: (e) => {
384
- Ce(e.target.value), Y(0);
388
+ Te(e.target.value), X(0);
385
389
  },
386
390
  className: "px-4 py-2.5 border border-border-default rounded-xl bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all",
387
391
  children: [/* @__PURE__ */ f("option", {
@@ -406,10 +410,10 @@ function v() {
406
410
  className: "ml-3 text-text-secondary",
407
411
  children: v("auth.users.loadingUsers", "Loading users...")
408
412
  })]
409
- }) : A.length === 0 ? /* @__PURE__ */ f(h, {
410
- illustration: G || K || q ? "empty-search" : "empty-people",
413
+ }) : k.length === 0 ? /* @__PURE__ */ f(h, {
414
+ illustration: K || q || J ? "empty-search" : "empty-people",
411
415
  title: v("auth.users.noUsersFound", "No users found"),
412
- description: G || K || q ? v("auth.users.noUsersFilteredDesc", "No users match your current search or filters. Try clearing them to see everyone.") : v("auth.users.noUsersDesc", "Once people join your organization they'll show up here for you to manage.")
416
+ description: K || q || J ? v("auth.users.noUsersFilteredDesc", "No users match your current search or filters. Try clearing them to see everyone.") : v("auth.users.noUsersDesc", "Once people join your organization they'll show up here for you to manage.")
413
417
  }) : /* @__PURE__ */ p(d, { children: [
414
418
  /* @__PURE__ */ f("div", {
415
419
  className: "rounded-xl border border-border-subtle bg-bg-surface overflow-hidden shadow-sm",
@@ -452,7 +456,7 @@ function v() {
452
456
  children: v("auth.users.columnActions", "Actions")
453
457
  })
454
458
  ]
455
- }) }), /* @__PURE__ */ f("tbody", { children: A.map((e) => /* @__PURE__ */ p("tr", {
459
+ }) }), /* @__PURE__ */ f("tbody", { children: k.map((e) => /* @__PURE__ */ p("tr", {
456
460
  className: "border-b border-border-subtle last:border-b-0 hover:bg-bg-sunken/50 transition-colors",
457
461
  children: [
458
462
  /* @__PURE__ */ f("td", {
@@ -477,14 +481,14 @@ function v() {
477
481
  /* @__PURE__ */ f("td", {
478
482
  className: "p-4",
479
483
  children: /* @__PURE__ */ f("span", {
480
- className: `inline-block px-2.5 py-1 rounded-full text-xs font-medium whitespace-nowrap ${Oe(e.role)}`,
484
+ className: `inline-block px-2.5 py-1 rounded-full text-xs font-medium whitespace-nowrap ${Ae(e.role)}`,
481
485
  children: e.role.replace("_", " ")
482
486
  })
483
487
  }),
484
488
  /* @__PURE__ */ f("td", {
485
489
  className: "p-4",
486
490
  children: /* @__PURE__ */ f("span", {
487
- className: `inline-block px-2.5 py-1 rounded-full text-xs font-medium whitespace-nowrap ${$(e.status)}`,
491
+ className: `inline-block px-2.5 py-1 rounded-full text-xs font-medium whitespace-nowrap ${je(e.status)}`,
488
492
  children: e.status
489
493
  })
490
494
  }),
@@ -533,21 +537,21 @@ function v() {
533
537
  children: [
534
538
  /* @__PURE__ */ f("button", {
535
539
  type: "button",
536
- onClick: () => se(`/auth/users/${e.id}`),
540
+ onClick: () => ce(`/auth/users/${e.id}`),
537
541
  "aria-label": `${v("auth.users.actionView", "View")} ${e.name || e.username || e.email}`,
538
542
  className: "px-2.5 py-1.5 rounded-lg text-xs font-medium border border-border-default text-text-primary bg-bg-surface hover:bg-bg-sunken transition-colors whitespace-nowrap flex-shrink-0",
539
543
  children: v("auth.users.actionView", "View")
540
544
  }),
541
- ue && /* @__PURE__ */ f("button", {
545
+ de && /* @__PURE__ */ f("button", {
542
546
  type: "button",
543
- onClick: () => De(e),
547
+ onClick: () => ke(e),
544
548
  "aria-label": `${v("auth.users.actionEdit", "Edit")} ${e.name || e.username || e.email}`,
545
549
  className: "px-2.5 py-1.5 rounded-lg text-xs font-medium border border-status-info-border text-text-link bg-bg-surface hover:bg-status-info-bg-subtle transition-colors whitespace-nowrap flex-shrink-0",
546
550
  children: v("auth.users.actionEdit", "Edit")
547
551
  }),
548
552
  b && e.status !== "DELETED" && /* @__PURE__ */ f("button", {
549
553
  type: "button",
550
- onClick: () => W({
554
+ onClick: () => G({
551
555
  type: "deactivate",
552
556
  user: e
553
557
  }),
@@ -570,15 +574,15 @@ function v() {
570
574
  children: [
571
575
  v("auth.users.showing", "Showing"),
572
576
  " ",
573
- J * 10 + 1,
577
+ Y * 10 + 1,
574
578
  " ",
575
579
  v("auth.users.to", "to"),
576
580
  " ",
577
- Math.min((J + 1) * 10, j),
581
+ Math.min((Y + 1) * 10, A),
578
582
  " ",
579
583
  v("auth.users.of", "of"),
580
584
  " ",
581
- j,
585
+ A,
582
586
  " ",
583
587
  v("auth.users.paginationUsers", "users")
584
588
  ]
@@ -588,15 +592,15 @@ function v() {
588
592
  className: "flex gap-2",
589
593
  children: [/* @__PURE__ */ f("button", {
590
594
  type: "button",
591
- onClick: () => Y((e) => Math.max(0, e - 1)),
592
- disabled: J === 0,
595
+ onClick: () => X((e) => Math.max(0, e - 1)),
596
+ disabled: Y === 0,
593
597
  "aria-label": v("auth.users.previousPageAriaLabel", "Go to previous page"),
594
598
  className: "px-4 py-2 rounded-lg border border-border-default text-text-primary bg-bg-surface disabled:opacity-50 disabled:cursor-not-allowed hover:bg-bg-sunken transition-colors",
595
599
  children: v("auth.users.previousPage", "Previous")
596
600
  }), /* @__PURE__ */ f("button", {
597
601
  type: "button",
598
- onClick: () => Y((e) => e + 1),
599
- disabled: !ve,
602
+ onClick: () => X((e) => e + 1),
603
+ disabled: !be,
600
604
  "aria-label": v("auth.users.nextPageAriaLabel", "Go to next page"),
601
605
  className: "px-4 py-2 rounded-lg border border-border-default text-text-primary bg-bg-surface disabled:opacity-50 disabled:cursor-not-allowed hover:bg-bg-sunken transition-colors",
602
606
  children: v("auth.users.nextPage", "Next")
@@ -604,7 +608,7 @@ function v() {
604
608
  })
605
609
  })]
606
610
  }),
607
- /* @__PURE__ */ f(ae, {
611
+ /* @__PURE__ */ f(oe, {
608
612
  className: "mt-8",
609
613
  storageKey: "auth-users",
610
614
  steps: [{
@@ -619,19 +623,19 @@ function v() {
619
623
  id: "export-users",
620
624
  label: v("auth.users.nextExport", "Export the user list"),
621
625
  description: v("auth.users.nextExportDesc", "Download a CSV of users matching your current filters."),
622
- onClick: () => void k()
626
+ onClick: () => void O()
623
627
  }]
624
628
  })
625
629
  ] })
626
630
  ]
627
- }) : M === "view" && P ? /* @__PURE__ */ p("div", {
631
+ }) : j === "view" && N ? /* @__PURE__ */ p("div", {
628
632
  className: "max-w-4xl mx-auto p-6",
629
633
  children: [
630
- Q,
634
+ $,
631
635
  /* @__PURE__ */ p("button", {
632
636
  type: "button",
633
637
  onClick: () => {
634
- N("list"), Z();
638
+ M("list"), Q();
635
639
  },
636
640
  className: "mb-6 flex items-center gap-2 text-text-link hover:underline font-medium",
637
641
  children: [/* @__PURE__ */ f("svg", {
@@ -654,24 +658,24 @@ function v() {
654
658
  className: "flex items-center gap-4 mb-8",
655
659
  children: [/* @__PURE__ */ f("div", {
656
660
  className: "auth-brand-badge flex size-20 items-center justify-center rounded-full text-3xl font-semibold",
657
- children: (P.name || P.username || P.email).charAt(0).toUpperCase()
661
+ children: (N.name || N.username || N.email).charAt(0).toUpperCase()
658
662
  }), /* @__PURE__ */ p("div", { children: [
659
663
  /* @__PURE__ */ f("h1", {
660
664
  className: "text-2xl font-semibold text-text-primary",
661
- children: P.name || P.username
665
+ children: N.name || N.username
662
666
  }),
663
667
  /* @__PURE__ */ f("p", {
664
668
  className: "text-text-secondary",
665
- children: P.email
669
+ children: N.email
666
670
  }),
667
671
  /* @__PURE__ */ p("div", {
668
672
  className: "flex items-center gap-2 mt-2",
669
673
  children: [/* @__PURE__ */ f("span", {
670
- className: `px-2.5 py-1 rounded-full text-xs font-medium ${Oe(P.role)}`,
671
- children: P.role.replace("_", " ")
674
+ className: `px-2.5 py-1 rounded-full text-xs font-medium ${Ae(N.role)}`,
675
+ children: N.role.replace("_", " ")
672
676
  }), /* @__PURE__ */ f("span", {
673
- className: `px-2.5 py-1 rounded-full text-xs font-medium ${$(P.status)}`,
674
- children: P.status
677
+ className: `px-2.5 py-1 rounded-full text-xs font-medium ${je(N.status)}`,
678
+ children: N.status
675
679
  })]
676
680
  })
677
681
  ] })]
@@ -686,7 +690,7 @@ function v() {
686
690
  children: v("auth.users.viewDetailsUsername", "Username")
687
691
  }), /* @__PURE__ */ f("p", {
688
692
  className: "text-text-primary font-medium",
689
- children: P.username
693
+ children: N.username
690
694
  })]
691
695
  }),
692
696
  /* @__PURE__ */ p("div", {
@@ -696,7 +700,7 @@ function v() {
696
700
  children: v("auth.users.viewDetailsEmail", "Email")
697
701
  }), /* @__PURE__ */ f("p", {
698
702
  className: "text-text-primary font-medium",
699
- children: P.email
703
+ children: N.email
700
704
  })]
701
705
  }),
702
706
  /* @__PURE__ */ p("div", {
@@ -706,7 +710,7 @@ function v() {
706
710
  children: v("auth.users.viewDetailsEmailVerified", "Email Verified")
707
711
  }), /* @__PURE__ */ f("p", {
708
712
  className: "text-text-primary font-medium",
709
- children: P.emailVerified ? /* @__PURE__ */ f("span", {
713
+ children: N.emailVerified ? /* @__PURE__ */ f("span", {
710
714
  className: "text-status-success-text",
711
715
  children: v("auth.users.verifiedYes", "Yes")
712
716
  }) : /* @__PURE__ */ f("span", {
@@ -722,7 +726,7 @@ function v() {
722
726
  children: v("auth.users.viewDetailsMfaEnabled", "MFA Enabled")
723
727
  }), /* @__PURE__ */ f("p", {
724
728
  className: "text-text-primary font-medium",
725
- children: P.mfaEnabled ? /* @__PURE__ */ f("span", {
729
+ children: N.mfaEnabled ? /* @__PURE__ */ f("span", {
726
730
  className: "text-status-success-text",
727
731
  children: v("auth.users.verifiedYes", "Yes")
728
732
  }) : /* @__PURE__ */ f("span", {
@@ -731,14 +735,14 @@ function v() {
731
735
  })
732
736
  })]
733
737
  }),
734
- P.phoneNumber && /* @__PURE__ */ p("div", {
738
+ N.phoneNumber && /* @__PURE__ */ p("div", {
735
739
  className: "p-4 rounded-lg bg-bg-canvas/50",
736
740
  children: [/* @__PURE__ */ f("label", {
737
741
  className: "block text-sm font-medium text-text-secondary mb-1",
738
742
  children: v("auth.users.viewDetailsPhoneNumber", "Phone Number")
739
743
  }), /* @__PURE__ */ f("p", {
740
744
  className: "text-text-primary font-medium",
741
- children: P.phoneNumber
745
+ children: N.phoneNumber
742
746
  })]
743
747
  }),
744
748
  /* @__PURE__ */ p("div", {
@@ -748,7 +752,7 @@ function v() {
748
752
  children: v("auth.users.viewDetailsLastLogin", "Last Login")
749
753
  }), /* @__PURE__ */ f("p", {
750
754
  className: "text-text-primary font-medium",
751
- children: P.lastLoginAt ? new Date(P.lastLoginAt).toLocaleString() : v("auth.users.lastLoginNever", "Never")
755
+ children: N.lastLoginAt ? new Date(N.lastLoginAt).toLocaleString() : v("auth.users.lastLoginNever", "Never")
752
756
  })]
753
757
  }),
754
758
  /* @__PURE__ */ p("div", {
@@ -758,7 +762,7 @@ function v() {
758
762
  children: v("auth.users.viewDetailsCreated", "Created")
759
763
  }), /* @__PURE__ */ f("p", {
760
764
  className: "text-text-primary font-medium",
761
- children: new Date(P.createdAt).toLocaleString()
765
+ children: new Date(N.createdAt).toLocaleString()
762
766
  })]
763
767
  }),
764
768
  /* @__PURE__ */ p("div", {
@@ -768,7 +772,7 @@ function v() {
768
772
  children: v("auth.users.viewDetailsLastUpdated", "Last Updated")
769
773
  }), /* @__PURE__ */ f("p", {
770
774
  className: "text-text-primary font-medium",
771
- children: new Date(P.updatedAt).toLocaleString()
775
+ children: new Date(N.updatedAt).toLocaleString()
772
776
  })]
773
777
  })
774
778
  ]
@@ -778,25 +782,25 @@ function v() {
778
782
  children: [
779
783
  /* @__PURE__ */ f(m, {
780
784
  type: "button",
781
- onClick: () => De(P),
785
+ onClick: () => ke(N),
782
786
  variant: "default",
783
787
  className: "font-semibold",
784
788
  children: v("auth.users.editUser", "Edit User")
785
789
  }),
786
- P.status !== "DELETED" && /* @__PURE__ */ f("button", {
790
+ N.status !== "DELETED" && /* @__PURE__ */ f("button", {
787
791
  type: "button",
788
- onClick: () => W({
792
+ onClick: () => G({
789
793
  type: "deactivate",
790
- user: P
794
+ user: N
791
795
  }),
792
796
  className: "px-4 py-2.5 rounded-xl border border-status-error-border text-status-error-text font-medium hover:bg-status-error-bg-subtle transition-colors",
793
797
  children: v("auth.users.deleteUser", "Delete User")
794
798
  }),
795
- b && P.status === "DELETED" && ce?.role === "SUPER_ADMIN" && /* @__PURE__ */ f("button", {
799
+ b && N.status === "DELETED" && le?.role === "SUPER_ADMIN" && /* @__PURE__ */ f("button", {
796
800
  type: "button",
797
- onClick: () => W({
801
+ onClick: () => G({
798
802
  type: "hard-delete",
799
- user: P
803
+ user: N
800
804
  }),
801
805
  className: "px-4 py-2.5 rounded-xl bg-status-error-bg text-white font-medium hover:bg-status-error-bg-hover transition-colors",
802
806
  children: v("auth.users.permanentlyDelete", "Permanently Delete")
@@ -809,11 +813,11 @@ function v() {
809
813
  }) : /* @__PURE__ */ p("div", {
810
814
  className: "max-w-2xl mx-auto p-6",
811
815
  children: [
812
- Q,
816
+ $,
813
817
  /* @__PURE__ */ p("button", {
814
818
  type: "button",
815
819
  onClick: () => {
816
- N("list"), Z();
820
+ M("list"), Q();
817
821
  },
818
822
  className: "mb-6 flex items-center gap-2 text-text-link hover:underline font-medium",
819
823
  children: [/* @__PURE__ */ f("svg", {
@@ -836,28 +840,28 @@ function v() {
836
840
  className: "text-2xl font-semibold text-text-primary mb-2",
837
841
  children: v("auth.users.editUser", "Edit User")
838
842
  }),
839
- P && /* @__PURE__ */ p("p", {
843
+ N && /* @__PURE__ */ p("p", {
840
844
  className: "text-text-secondary mb-6",
841
845
  children: [
842
846
  v("auth.users.editingUser", "Editing:"),
843
847
  " ",
844
- /* @__PURE__ */ f("strong", { children: P.email })
848
+ /* @__PURE__ */ f("strong", { children: N.email })
845
849
  ]
846
850
  }),
847
- R && /* @__PURE__ */ p("div", {
851
+ L && /* @__PURE__ */ p("div", {
848
852
  className: "mb-6 flex items-start gap-3 p-4 rounded-xl bg-status-error-bg-subtle border border-status-error-border",
849
853
  children: [/* @__PURE__ */ f(n, { className: "size-5 text-status-error-text flex-shrink-0 mt-0.5" }), /* @__PURE__ */ f("div", {
850
854
  className: "flex-1",
851
855
  children: /* @__PURE__ */ f("p", {
852
856
  className: "text-sm text-status-error-text",
853
- children: R
857
+ children: L
854
858
  })
855
859
  })]
856
860
  }),
857
861
  /* @__PURE__ */ p("form", {
858
- onSubmit: we,
862
+ onSubmit: Ee,
859
863
  className: "space-y-6",
860
- "aria-describedby": R ? E : void 0,
864
+ "aria-describedby": L ? T : void 0,
861
865
  noValidate: !0,
862
866
  children: [
863
867
  /* @__PURE__ */ p("div", {
@@ -870,9 +874,9 @@ function v() {
870
874
  id: "edit-username",
871
875
  type: "text",
872
876
  "aria-label": v("auth.users.fieldUsername", "Username"),
873
- value: I.username,
874
- onChange: (e) => L({
875
- ...I,
877
+ value: F.username,
878
+ onChange: (e) => I({
879
+ ...F,
876
880
  username: e.target.value
877
881
  }),
878
882
  className: "block w-full px-4 py-3 border border-border-default rounded-xl bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all"
@@ -884,9 +888,9 @@ function v() {
884
888
  id: "edit-name",
885
889
  type: "text",
886
890
  "aria-label": v("auth.users.fieldName", "Name"),
887
- value: I.name,
888
- onChange: (e) => L({
889
- ...I,
891
+ value: F.name,
892
+ onChange: (e) => I({
893
+ ...F,
890
894
  name: e.target.value
891
895
  }),
892
896
  className: "block w-full px-4 py-3 border border-border-default rounded-xl bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all"
@@ -902,9 +906,9 @@ function v() {
902
906
  id: "edit-firstName",
903
907
  type: "text",
904
908
  "aria-label": v("auth.users.fieldFirstName", "First Name"),
905
- value: I.firstName,
906
- onChange: (e) => L({
907
- ...I,
909
+ value: F.firstName,
910
+ onChange: (e) => I({
911
+ ...F,
908
912
  firstName: e.target.value
909
913
  }),
910
914
  className: "block w-full px-4 py-3 border border-border-default rounded-xl bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all"
@@ -916,29 +920,42 @@ function v() {
916
920
  id: "edit-lastName",
917
921
  type: "text",
918
922
  "aria-label": v("auth.users.fieldLastName", "Last Name"),
919
- value: I.lastName,
920
- onChange: (e) => L({
921
- ...I,
923
+ value: F.lastName,
924
+ onChange: (e) => I({
925
+ ...F,
922
926
  lastName: e.target.value
923
927
  }),
924
928
  className: "block w-full px-4 py-3 border border-border-default rounded-xl bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all"
925
929
  })] })]
926
930
  }),
927
- /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
928
- htmlFor: "edit-phoneNumber",
929
- className: "block text-sm font-medium text-text-primary mb-2",
930
- children: v("auth.users.fieldPhoneNumber", "Phone Number")
931
- }), /* @__PURE__ */ f("input", {
932
- id: "edit-phoneNumber",
933
- type: "tel",
934
- "aria-label": v("auth.users.fieldPhoneNumber", "Phone Number"),
935
- value: I.phoneNumber,
936
- onChange: (e) => L({
937
- ...I,
938
- phoneNumber: e.target.value
931
+ /* @__PURE__ */ p("div", { children: [
932
+ /* @__PURE__ */ f("label", {
933
+ htmlFor: "edit-phoneNumber",
934
+ className: "block text-sm font-medium text-text-primary mb-2",
935
+ children: v("auth.users.fieldPhoneNumber", "Phone Number")
936
+ }),
937
+ /* @__PURE__ */ f("input", {
938
+ id: "edit-phoneNumber",
939
+ type: "tel",
940
+ "aria-label": v("auth.users.fieldPhoneNumber", "Phone Number"),
941
+ "aria-invalid": z ? !0 : void 0,
942
+ "aria-describedby": z ? "edit-phoneNumber-error" : void 0,
943
+ value: F.phoneNumber,
944
+ onChange: (e) => {
945
+ I({
946
+ ...F,
947
+ phoneNumber: e.target.value
948
+ }), z && (B(null), R(null));
949
+ },
950
+ className: "block w-full px-4 py-3 border border-border-default rounded-xl bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all"
939
951
  }),
940
- className: "block w-full px-4 py-3 border border-border-default rounded-xl bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all"
941
- })] }),
952
+ z && /* @__PURE__ */ f("p", {
953
+ id: "edit-phoneNumber-error",
954
+ role: "alert",
955
+ className: "mt-2 text-sm text-[var(--color-status-error-text)]",
956
+ children: z
957
+ })
958
+ ] }),
942
959
  /* @__PURE__ */ p("div", {
943
960
  className: "grid grid-cols-2 gap-4",
944
961
  children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
@@ -948,9 +965,9 @@ function v() {
948
965
  }), /* @__PURE__ */ f("select", {
949
966
  id: "edit-role",
950
967
  "aria-label": v("auth.users.fieldRole", "Role"),
951
- value: I.role,
952
- onChange: (e) => L({
953
- ...I,
968
+ value: F.role,
969
+ onChange: (e) => I({
970
+ ...F,
954
971
  role: e.target.value
955
972
  }),
956
973
  className: "block w-full px-4 py-3 border border-border-default rounded-xl bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all",
@@ -965,9 +982,9 @@ function v() {
965
982
  }), /* @__PURE__ */ f("select", {
966
983
  id: "edit-status",
967
984
  "aria-label": v("auth.users.fieldStatus", "Status"),
968
- value: I.status,
969
- onChange: (e) => L({
970
- ...I,
985
+ value: F.status,
986
+ onChange: (e) => I({
987
+ ...F,
971
988
  status: e.target.value
972
989
  }),
973
990
  className: "block w-full px-4 py-3 border border-border-default rounded-xl bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/20 focus:border-action-primary-bg transition-all",
@@ -982,9 +999,9 @@ function v() {
982
999
  children: [/* @__PURE__ */ f("input", {
983
1000
  type: "checkbox",
984
1001
  id: "emailVerified",
985
- checked: I.emailVerified,
986
- onChange: (e) => L({
987
- ...I,
1002
+ checked: F.emailVerified,
1003
+ onChange: (e) => I({
1004
+ ...F,
988
1005
  emailVerified: e.target.checked
989
1006
  }),
990
1007
  className: "size-5 rounded border-border-default text-text-link focus:ring-action-primary-bg"
@@ -995,7 +1012,7 @@ function v() {
995
1012
  })]
996
1013
  }),
997
1014
  /* @__PURE__ */ p("div", {
998
- className: "flex gap-3 pt-4",
1015
+ className: "flex gap-3 pt-6 mt-6 border-t border-border-default",
999
1016
  children: [/* @__PURE__ */ f(m, {
1000
1017
  type: "submit",
1001
1018
  disabled: S,
@@ -1006,9 +1023,9 @@ function v() {
1006
1023
  }), /* @__PURE__ */ f("button", {
1007
1024
  type: "button",
1008
1025
  onClick: () => {
1009
- N("list"), Z();
1026
+ M("list"), Q();
1010
1027
  },
1011
- className: "px-6 py-3 rounded-xl border border-border-default text-text-primary font-medium hover:bg-bg-sunken transition-colors",
1028
+ className: "inline-flex items-center h-10 px-8 rounded-xl border border-border-default text-text-primary font-medium hover:bg-bg-sunken transition-colors",
1012
1029
  children: v("auth.users.cancel", "Cancel")
1013
1030
  })]
1014
1031
  })