@gelabs/ovr 0.4.2 → 0.4.4

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 (76) hide show
  1. package/dist/accounts.d.ts +52 -0
  2. package/dist/accounts.js +13 -0
  3. package/dist/audit.d.ts +13 -0
  4. package/dist/audit.js +11 -0
  5. package/dist/auth-auth.d.ts +1 -1
  6. package/dist/auth-rate-limit.d.ts +11 -2
  7. package/dist/auth-rate-limit.js +1 -1
  8. package/dist/auth.d.ts +2 -2
  9. package/dist/auth.js +1 -1
  10. package/dist/chunk-4EDMZRGS.js +98 -0
  11. package/dist/chunk-4JMHQKMK.js +268 -0
  12. package/dist/chunk-6662IONX.js +69 -0
  13. package/dist/chunk-6WMPBAUH.js +18 -0
  14. package/dist/{chunk-77ULDXQX.js → chunk-6ZJSEM4Y.js} +6 -1
  15. package/dist/chunk-7GVZZWK3.js +74 -0
  16. package/dist/chunk-ACXED4UH.js +403 -0
  17. package/dist/chunk-BBTAG3FD.js +165 -0
  18. package/dist/chunk-HX7QT2FE.js +452 -0
  19. package/dist/chunk-LC3S47FM.js +468 -0
  20. package/dist/chunk-NPTR7GFZ.js +432 -0
  21. package/dist/chunk-SLQRZBMR.js +66 -0
  22. package/dist/chunk-UBUXPJLN.js +29 -0
  23. package/dist/chunk-UN6Z4WGF.js +31 -0
  24. package/dist/chunk-YE3D2DYY.js +83 -0
  25. package/dist/citizen.d.ts +5 -0
  26. package/dist/citizen.js +12 -0
  27. package/dist/config.d.ts +2 -2
  28. package/dist/core-i18n.d.ts +1 -1
  29. package/dist/core.d.ts +2 -2
  30. package/dist/dashboard.d.ts +10 -0
  31. package/dist/dashboard.js +3 -0
  32. package/dist/data-mock-store.d.ts +1 -1
  33. package/dist/{format-C7MSwUHK.d.ts → format-VyCUfF8R.d.ts} +1 -1
  34. package/dist/index.d.ts +2 -2
  35. package/dist/notifications.d.ts +6 -0
  36. package/dist/notifications.js +11 -0
  37. package/dist/officers.d.ts +27 -0
  38. package/dist/officers.js +11 -0
  39. package/dist/offline.d.ts +1 -1
  40. package/dist/payments.d.ts +15 -0
  41. package/dist/payments.js +11 -0
  42. package/dist/roles.d.ts +37 -0
  43. package/dist/roles.js +12 -0
  44. package/dist/runtime.d.ts +1 -1
  45. package/dist/tickets.d.ts +6 -0
  46. package/dist/tickets.js +24 -0
  47. package/dist/ui-components-admin/accounts-manager.d.ts +3 -52
  48. package/dist/ui-components-admin/accounts-manager.js +11 -472
  49. package/dist/ui-components-admin/admin-nav.js +11 -83
  50. package/dist/ui-components-admin/issuance-form.js +15 -432
  51. package/dist/ui-components-admin/logs-viewer.d.ts +3 -13
  52. package/dist/ui-components-admin/logs-viewer.js +8 -98
  53. package/dist/ui-components-admin/notifications-list.js +6 -66
  54. package/dist/ui-components-admin/officers-manager.d.ts +3 -27
  55. package/dist/ui-components-admin/officers-manager.js +9 -268
  56. package/dist/ui-components-admin/roles-manager.d.ts +3 -37
  57. package/dist/ui-components-admin/roles-manager.js +10 -403
  58. package/dist/ui-components-admin/stat-card.d.ts +2 -10
  59. package/dist/ui-components-admin/stat-card.js +3 -29
  60. package/dist/ui-components-admin/ticket-preview.js +2 -2
  61. package/dist/ui-components-admin/tickets-table.js +7 -69
  62. package/dist/ui-components-admin/violations-manager.js +13 -452
  63. package/dist/ui-components-citizen/citizen-nav.js +3 -31
  64. package/dist/ui-components-citizen/payment-form.d.ts +3 -14
  65. package/dist/ui-components-citizen/payment-form.js +9 -165
  66. package/dist/ui-components-citizen/payment-qr-dialog.js +2 -2
  67. package/dist/ui-components-citizen/ticket-not-found.js +4 -18
  68. package/dist/ui-components-citizen/violation-history-table.js +6 -74
  69. package/dist/ui-config.d.ts +2 -2
  70. package/dist/ui-server.d.ts +2 -2
  71. package/dist/violations.d.ts +3 -0
  72. package/dist/violations.js +14 -0
  73. package/package.json +46 -6
  74. package/dist/{chunk-ZUMEOZ22.js → chunk-JTSTNZAB.js} +1 -1
  75. package/dist/{chunk-TLG4C2XI.js → chunk-QCAURREW.js} +1 -1
  76. package/dist/{schema-CdsFQxIg.d.ts → schema-BUhh_mKX.d.ts} +108 -108
@@ -1,27 +1,3 @@
1
- import * as React from 'react';
2
- import { NewOfficerInput, Officer } from '../types.js';
3
-
4
- /**
5
- * Apprehending-officers management (GE-025). Add / edit / remove the Officer
6
- * records used in the Issue-Ticket dropdown and linked to enforcer accounts.
7
- * Server actions are INJECTED by the page (mirrors AccountsManager).
8
- */
9
-
10
- type CreateOfficerAction = (input: NewOfficerInput) => Promise<{
11
- error?: string;
12
- } | void>;
13
- type UpdateOfficerAction = (id: string, patch: Partial<NewOfficerInput>) => Promise<{
14
- error?: string;
15
- } | void>;
16
- type DeleteOfficerAction = (id: string) => Promise<{
17
- error?: string;
18
- } | void>;
19
- interface OfficersManagerProps {
20
- officers: Officer[];
21
- createAction: CreateOfficerAction;
22
- updateAction: UpdateOfficerAction;
23
- deleteAction: DeleteOfficerAction;
24
- }
25
- declare function OfficersManager({ officers, createAction, updateAction, deleteAction, }: OfficersManagerProps): React.JSX.Element;
26
-
27
- export { type CreateOfficerAction, type DeleteOfficerAction, OfficersManager, type OfficersManagerProps, type UpdateOfficerAction };
1
+ export { CreateOfficerAction, DeleteOfficerAction, OfficersManager, OfficersManagerProps, UpdateOfficerAction } from '../officers.js';
2
+ import 'react';
3
+ import '../types.js';
@@ -1,271 +1,12 @@
1
1
  "use client";
2
- import { Card, CardContent } from '../chunk-SETIN6XP.js';
3
- import { usePagination, Pagination } from '../chunk-6YFZLXFP.js';
4
- import { Table, TableHeader, TableRow, TableHead, TableBody, TableCell } from '../chunk-OWCGEEAZ.js';
5
- import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose } from '../chunk-M35R6JLA.js';
6
- import { Label } from '../chunk-XQTVSNHC.js';
7
- import { Input } from '../chunk-K3KIBHJF.js';
8
- import { Button } from '../chunk-I4WDVYHX.js';
9
- import { useCopy } from '../chunk-TJSNVTVB.js';
2
+ export { OfficersManager } from '../chunk-4JMHQKMK.js';
3
+ import '../chunk-XQTVSNHC.js';
4
+ import '../chunk-M35R6JLA.js';
5
+ import '../chunk-6YFZLXFP.js';
6
+ import '../chunk-K3KIBHJF.js';
7
+ import '../chunk-OWCGEEAZ.js';
8
+ import '../chunk-I4WDVYHX.js';
9
+ import '../chunk-TJSNVTVB.js';
10
+ import '../chunk-SETIN6XP.js';
10
11
  import '../chunk-77QBZC7J.js';
11
12
  import '../chunk-BI4EGLPG.js';
12
- import * as React from 'react';
13
- import { toast } from 'sonner';
14
- import { useRouter } from 'next/navigation';
15
- import { UserPlus, Pencil, Loader2, Trash2 } from 'lucide-react';
16
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
17
-
18
- function OfficersManager({
19
- officers,
20
- createAction,
21
- updateAction,
22
- deleteAction
23
- }) {
24
- const t = useCopy().admin.officersPage;
25
- const router = useRouter();
26
- const { pageItems, page, setPage, totalPages, from, to, total } = usePagination(officers, 12);
27
- return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-4xl p-4 sm:p-6 lg:p-8", children: [
28
- /* @__PURE__ */ jsxs("div", { className: "mb-6 flex items-center justify-between gap-3", children: [
29
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
30
- /* @__PURE__ */ jsx("h1", { className: "font-heading text-2xl font-semibold tracking-tight", children: t.title }),
31
- /* @__PURE__ */ jsx("p", { className: "max-w-2xl text-sm text-muted-foreground", children: t.subtitle })
32
- ] }),
33
- /* @__PURE__ */ jsx(
34
- OfficerDialog,
35
- {
36
- mode: "create",
37
- createAction,
38
- onDone: () => router.refresh()
39
- }
40
- )
41
- ] }),
42
- /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { className: "p-0", children: officers.length === 0 ? /* @__PURE__ */ jsx("p", { className: "p-8 text-center text-sm text-muted-foreground", children: t.empty }) : /* @__PURE__ */ jsxs(Fragment, { children: [
43
- /* @__PURE__ */ jsxs(Table, { children: [
44
- /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
45
- /* @__PURE__ */ jsx(TableHead, { children: t.name }),
46
- /* @__PURE__ */ jsx(TableHead, { children: t.badge }),
47
- /* @__PURE__ */ jsx(TableHead, { children: t.office }),
48
- /* @__PURE__ */ jsx(TableHead, { className: "text-right", children: t.actions })
49
- ] }) }),
50
- /* @__PURE__ */ jsx(TableBody, { children: pageItems.map((o) => /* @__PURE__ */ jsxs(TableRow, { children: [
51
- /* @__PURE__ */ jsx(TableCell, { className: "font-medium", children: o.name }),
52
- /* @__PURE__ */ jsx(TableCell, { className: "text-muted-foreground", children: o.badgeNo ?? "\u2014" }),
53
- /* @__PURE__ */ jsx(TableCell, { className: "text-muted-foreground", children: o.office }),
54
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-1.5", children: [
55
- /* @__PURE__ */ jsx(
56
- OfficerDialog,
57
- {
58
- mode: "edit",
59
- officer: o,
60
- updateAction,
61
- onDone: () => router.refresh()
62
- }
63
- ),
64
- /* @__PURE__ */ jsx(
65
- DeleteOfficerButton,
66
- {
67
- officer: o,
68
- deleteAction,
69
- onDone: () => router.refresh()
70
- }
71
- )
72
- ] }) })
73
- ] }, o.id)) })
74
- ] }),
75
- /* @__PURE__ */ jsx(
76
- Pagination,
77
- {
78
- page,
79
- totalPages,
80
- from,
81
- to,
82
- total,
83
- onPage: setPage
84
- }
85
- )
86
- ] }) }) })
87
- ] });
88
- }
89
- function OfficerDialog({
90
- mode,
91
- officer,
92
- createAction,
93
- updateAction,
94
- onDone
95
- }) {
96
- const t = useCopy().admin.officersPage;
97
- const [open, setOpen] = React.useState(false);
98
- const [name, setName] = React.useState(officer?.name ?? "");
99
- const [badgeNo, setBadgeNo] = React.useState(officer?.badgeNo ?? "");
100
- const [office, setOffice] = React.useState(officer?.office ?? "");
101
- const [submitting, setSubmitting] = React.useState(false);
102
- function resetTo(o) {
103
- setName(o?.name ?? "");
104
- setBadgeNo(o?.badgeNo ?? "");
105
- setOffice(o?.office ?? "");
106
- }
107
- async function submit(e) {
108
- e.preventDefault();
109
- if (!name.trim()) return toast.error(`${t.name} is required.`);
110
- if (!office.trim()) return toast.error(`${t.office} is required.`);
111
- setSubmitting(true);
112
- try {
113
- const input = {
114
- name: name.trim(),
115
- badgeNo: badgeNo.trim() || void 0,
116
- office: office.trim()
117
- };
118
- const res = mode === "create" ? await createAction?.(input) : await updateAction?.(officer.id, input);
119
- if (res?.error) {
120
- toast.error(res.error);
121
- return;
122
- }
123
- toast.success(
124
- `${mode === "create" ? t.create : t.editTitle}: ${name.trim()}`
125
- );
126
- setOpen(false);
127
- onDone();
128
- } finally {
129
- setSubmitting(false);
130
- }
131
- }
132
- return /* @__PURE__ */ jsxs(
133
- Dialog,
134
- {
135
- open,
136
- onOpenChange: (o) => {
137
- if (o) resetTo(officer);
138
- setOpen(o);
139
- },
140
- children: [
141
- /* @__PURE__ */ jsxs(
142
- DialogTrigger,
143
- {
144
- render: mode === "create" ? /* @__PURE__ */ jsx(Button, { className: "gap-1.5" }) : /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", className: "gap-1.5" }),
145
- children: [
146
- mode === "create" ? /* @__PURE__ */ jsx(UserPlus, { className: "size-4" }) : /* @__PURE__ */ jsx(Pencil, { className: "size-3.5" }),
147
- /* @__PURE__ */ jsx("span", { className: mode === "create" ? "" : "hidden sm:inline", children: mode === "create" ? t.newOfficer : t.edit })
148
- ]
149
- }
150
- ),
151
- /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
152
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
153
- /* @__PURE__ */ jsx(DialogTitle, { children: mode === "create" ? t.newOfficer : t.editTitle }),
154
- /* @__PURE__ */ jsx(DialogDescription, { children: t.subtitle })
155
- ] }),
156
- /* @__PURE__ */ jsxs("form", { onSubmit: submit, className: "space-y-4", children: [
157
- /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
158
- /* @__PURE__ */ jsx(Label, { htmlFor: "off-name", children: t.name }),
159
- /* @__PURE__ */ jsx(
160
- Input,
161
- {
162
- id: "off-name",
163
- value: name,
164
- onChange: (e) => setName(e.target.value),
165
- placeholder: t.namePlaceholder,
166
- autoComplete: "off",
167
- autoFocus: true
168
- }
169
- )
170
- ] }),
171
- /* @__PURE__ */ jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [
172
- /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
173
- /* @__PURE__ */ jsx(Label, { htmlFor: "off-badge", children: t.badge }),
174
- /* @__PURE__ */ jsx(
175
- Input,
176
- {
177
- id: "off-badge",
178
- value: badgeNo,
179
- onChange: (e) => setBadgeNo(e.target.value),
180
- placeholder: t.badgePlaceholder,
181
- autoComplete: "off"
182
- }
183
- )
184
- ] }),
185
- /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
186
- /* @__PURE__ */ jsx(Label, { htmlFor: "off-office", children: t.office }),
187
- /* @__PURE__ */ jsx(
188
- Input,
189
- {
190
- id: "off-office",
191
- value: office,
192
- onChange: (e) => setOffice(e.target.value),
193
- placeholder: t.officePlaceholder,
194
- autoComplete: "off"
195
- }
196
- )
197
- ] })
198
- ] }),
199
- /* @__PURE__ */ jsxs(DialogFooter, { children: [
200
- /* @__PURE__ */ jsx(DialogClose, { render: /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline" }), children: t.cancel }),
201
- /* @__PURE__ */ jsxs(Button, { type: "submit", disabled: submitting, className: "gap-1.5", children: [
202
- submitting ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }) : null,
203
- submitting ? mode === "create" ? t.creating : t.saving : mode === "create" ? t.create : t.save
204
- ] })
205
- ] })
206
- ] })
207
- ] })
208
- ]
209
- }
210
- );
211
- }
212
- function DeleteOfficerButton({
213
- officer,
214
- deleteAction,
215
- onDone
216
- }) {
217
- const t = useCopy().admin.officersPage;
218
- const [deleting, setDeleting] = React.useState(false);
219
- async function remove() {
220
- setDeleting(true);
221
- try {
222
- const res = await deleteAction(officer.id);
223
- if (res?.error) {
224
- toast.error(res.error);
225
- return;
226
- }
227
- toast.success(`${t.delete}: ${officer.name}`);
228
- onDone();
229
- } finally {
230
- setDeleting(false);
231
- }
232
- }
233
- return /* @__PURE__ */ jsxs(Dialog, { children: [
234
- /* @__PURE__ */ jsxs(
235
- DialogTrigger,
236
- {
237
- render: /* @__PURE__ */ jsx(Button, { variant: "destructive", size: "sm", className: "gap-1.5" }),
238
- children: [
239
- /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }),
240
- /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: t.delete })
241
- ]
242
- }
243
- ),
244
- /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-sm", children: [
245
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
246
- /* @__PURE__ */ jsx(DialogTitle, { children: t.deleteConfirmTitle }),
247
- /* @__PURE__ */ jsxs(DialogDescription, { children: [
248
- officer.name,
249
- " \u2014 ",
250
- t.deleteConfirmBody
251
- ] })
252
- ] }),
253
- /* @__PURE__ */ jsxs(DialogFooter, { children: [
254
- /* @__PURE__ */ jsx(DialogClose, { render: /* @__PURE__ */ jsx(Button, { variant: "outline" }), children: t.cancel }),
255
- /* @__PURE__ */ jsxs(
256
- DialogClose,
257
- {
258
- render: /* @__PURE__ */ jsx(Button, { variant: "destructive", className: "gap-2", disabled: deleting }),
259
- onClick: remove,
260
- children: [
261
- /* @__PURE__ */ jsx(Trash2, { className: "size-4" }),
262
- t.delete
263
- ]
264
- }
265
- )
266
- ] })
267
- ] })
268
- ] });
269
- }
270
-
271
- export { OfficersManager };
@@ -1,37 +1,3 @@
1
- import * as React from 'react';
2
- import { Permission, RoleDef } from '../types.js';
3
-
4
- /**
5
- * Roles & permissions editor (GE-013, custom roles). Each role is a COMPACT card
6
- * (name + a one-line permission summary); the permission checklist lives in a
7
- * MODAL opened by "Edit permissions". Super admins create custom roles + delete
8
- * unused ones. SUPER_ADMIN's management permissions are locked on (anti-lockout)
9
- * here AND re-asserted server-side.
10
- */
11
-
12
- type CreateRoleAction = (input: {
13
- label: string;
14
- permissions: Permission[];
15
- }) => Promise<{
16
- error?: string;
17
- } | void>;
18
- type UpdateRoleAction = (name: string, patch: {
19
- label?: string;
20
- permissions?: Permission[];
21
- }) => Promise<{
22
- error?: string;
23
- } | void>;
24
- type DeleteRoleAction = (name: string) => Promise<{
25
- error?: string;
26
- } | void>;
27
- interface RolesManagerProps {
28
- roles: RoleDef[];
29
- /** username count per role name — shown as "N in use" + blocks delete. */
30
- usage?: Record<string, number>;
31
- createAction: CreateRoleAction;
32
- updateAction: UpdateRoleAction;
33
- deleteAction: DeleteRoleAction;
34
- }
35
- declare function RolesManager({ roles, usage, createAction, updateAction, deleteAction, }: RolesManagerProps): React.JSX.Element;
36
-
37
- export { type CreateRoleAction, type DeleteRoleAction, RolesManager, type RolesManagerProps, type UpdateRoleAction };
1
+ export { CreateRoleAction, DeleteRoleAction, RolesManager, RolesManagerProps, UpdateRoleAction } from '../roles.js';
2
+ import 'react';
3
+ import '../types.js';