@raystack/frontier 0.89.3-test4 → 0.90.0

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.
@@ -0,0 +1,3302 @@
1
+ 'use client'
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
+ var __objRest = (source, exclude) => {
23
+ var target = {};
24
+ for (var prop in source)
25
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
26
+ target[prop] = source[prop];
27
+ if (source != null && __getOwnPropSymbols)
28
+ for (var prop of __getOwnPropSymbols(source)) {
29
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
30
+ target[prop] = source[prop];
31
+ }
32
+ return target;
33
+ };
34
+ var __async = (__this, __arguments, generator) => {
35
+ return new Promise((resolve, reject) => {
36
+ var fulfilled = (value) => {
37
+ try {
38
+ step(generator.next(value));
39
+ } catch (e) {
40
+ reject(e);
41
+ }
42
+ };
43
+ var rejected = (value) => {
44
+ try {
45
+ step(generator.throw(value));
46
+ } catch (e) {
47
+ reject(e);
48
+ }
49
+ };
50
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
51
+ step((generator = generator.apply(__this, __arguments)).next());
52
+ });
53
+ };
54
+
55
+ // admin/views/roles/index.tsx
56
+ import { EmptyState, Flex as Flex5, DataTable as DataTable2, Sheet } from "@raystack/apsara";
57
+ import { useCallback, useState } from "react";
58
+
59
+ // admin/utils/helper.ts
60
+ function reduceByKey(data, key) {
61
+ return data.reduce(
62
+ (acc, value) => __spreadProps(__spreadValues({}, acc), {
63
+ [String(value[key])]: value
64
+ }),
65
+ {}
66
+ );
67
+ }
68
+ var ZERO_UUID = "00000000-0000-0000-0000-000000000000";
69
+ function isZeroUUID(uuid) {
70
+ if (typeof uuid !== "string")
71
+ return false;
72
+ return uuid.toLowerCase() === ZERO_UUID;
73
+ }
74
+
75
+ // admin/views/roles/columns.tsx
76
+ import { Flex } from "@raystack/apsara";
77
+
78
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-U4KkjDyRaOeD/lib/admin/views/roles/roles.module.css.js
79
+ var digest = "7f2e3cf608240ef8ff76d6102bd72dd5f78d3b89f6dbefa1bb6e500054c0d557";
80
+ var css = `._tableRoot_4yb15_1 {
81
+ width: 100%;
82
+ }
83
+
84
+ ._tableWrapper_4yb15_5 {
85
+ width: 100%;
86
+ }
87
+
88
+ ._table_4yb15_1 {
89
+ table-layout: fixed;
90
+ }
91
+
92
+ ._header_4yb15_13 {
93
+ background-color: var(--rs-color-background-base-primary);
94
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
95
+ }
96
+
97
+ ._permissionsColumn_4yb15_18 {
98
+ max-width: 500px;
99
+ text-wrap: wrap;
100
+ }
101
+
102
+ ._sheetContent_4yb15_23 {
103
+ width: 400px;
104
+ padding: 0;
105
+ }
106
+
107
+ ._sheetContentBody_4yb15_28 {
108
+ padding: var(--rs-space-5);
109
+ }`;
110
+ (function() {
111
+ if (typeof document === "undefined") {
112
+ return;
113
+ }
114
+ if (!document.getElementById(digest)) {
115
+ var el = document.createElement("style");
116
+ el.id = digest;
117
+ el.textContent = css;
118
+ document.head.appendChild(el);
119
+ }
120
+ })();
121
+ var roles_module_css_default = { "tableRoot": "_tableRoot_4yb15_1", "tableWrapper": "_tableWrapper_4yb15_5", "table": "_table_4yb15_1", "header": "_header_4yb15_13", "permissionsColumn": "_permissionsColumn_4yb15_18", "sheetContent": "_sheetContent_4yb15_23", "sheetContentBody": "_sheetContentBody_4yb15_28" };
122
+
123
+ // admin/views/roles/columns.tsx
124
+ import { jsx } from "react/jsx-runtime";
125
+ var getColumns = () => {
126
+ return [
127
+ {
128
+ accessorKey: "id",
129
+ header: "ID",
130
+ filterVariant: "text",
131
+ cell: ({ getValue }) => getValue()
132
+ },
133
+ {
134
+ header: "Title",
135
+ accessorKey: "title",
136
+ filterVariant: "text",
137
+ cell: (info) => info.getValue()
138
+ },
139
+ {
140
+ header: "Name",
141
+ accessorKey: "name",
142
+ filterVariant: "text",
143
+ cell: (info) => info.getValue()
144
+ },
145
+ {
146
+ header: "Permissions",
147
+ accessorKey: "permissions",
148
+ enableColumnFilter: false,
149
+ classNames: {
150
+ cell: roles_module_css_default.permissionsColumn
151
+ },
152
+ cell: (info) => /* @__PURE__ */ jsx(Flex, { direction: "column", gap: 1, className: roles_module_css_default.permissionsColumn, children: (info.getValue() || []).map((p, i) => /* @__PURE__ */ jsx("span", { children: p }, i)) }),
153
+ footer: (props) => props.column.id
154
+ }
155
+ ];
156
+ };
157
+
158
+ // admin/views/roles/header.tsx
159
+ import { DataTable } from "@raystack/apsara";
160
+
161
+ // admin/components/PageHeader.tsx
162
+ import { Flex as Flex2, Text } from "@raystack/apsara";
163
+
164
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-j7vJFXxDjWk8/lib/admin/components/page-header.module.css.js
165
+ var digest2 = "26633b4b89927779e036744ff45a2785a60069b497a86c59004ddd71b2870004";
166
+ var css2 = `._breadcrumb_1kaun_1 {
167
+ list-style: none;
168
+ padding: 0;
169
+ margin: 0;
170
+ display: flex;
171
+ font-size: 14px;
172
+ }
173
+
174
+ ._breadcrumb_1kaun_1 a {
175
+ text-decoration: none;
176
+ color: #007bff;
177
+ display: inline-block;
178
+ margin-right: 5px;
179
+ }
180
+
181
+ ._breadcrumb_1kaun_1 a::before {
182
+ content: ">";
183
+ color: #666;
184
+ }
185
+
186
+ ._breadcrumb_1kaun_1 a:first-child::before {
187
+ content: "";
188
+ }
189
+
190
+ ._breadcrumb_1kaun_1 a:last-child {
191
+ margin-right: 0;
192
+ }
193
+
194
+ ._breadcrumbItem_1kaun_29 {
195
+ margin-right: 5px;
196
+ }
197
+
198
+ ._breadcrumbItem_1kaun_29::before {
199
+ content: ">";
200
+ color: #666;
201
+ margin-right: 5px;
202
+ }
203
+
204
+ ._breadcrumbItem_1kaun_29:first-of-type::before {
205
+ content: "";
206
+ margin-right: 0;
207
+ }`;
208
+ (function() {
209
+ if (typeof document === "undefined") {
210
+ return;
211
+ }
212
+ if (!document.getElementById(digest2)) {
213
+ var el = document.createElement("style");
214
+ el.id = digest2;
215
+ el.textContent = css2;
216
+ document.head.appendChild(el);
217
+ }
218
+ })();
219
+ var page_header_module_css_default = { "breadcrumb": "_breadcrumb_1kaun_1", "breadcrumbItem": "_breadcrumbItem_1kaun_29" };
220
+
221
+ // admin/components/PageHeader.tsx
222
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
223
+ function PageHeader(_a) {
224
+ var _b = _a, {
225
+ title,
226
+ breadcrumb,
227
+ onBreadcrumbClick,
228
+ children,
229
+ className,
230
+ style = {}
231
+ } = _b, props = __objRest(_b, [
232
+ "title",
233
+ "breadcrumb",
234
+ "onBreadcrumbClick",
235
+ "children",
236
+ "className",
237
+ "style"
238
+ ]);
239
+ return /* @__PURE__ */ jsxs(
240
+ Flex2,
241
+ __spreadProps(__spreadValues({
242
+ align: "center",
243
+ justify: "between",
244
+ className,
245
+ style: __spreadValues({ padding: "16px 24px" }, style)
246
+ }, props), {
247
+ children: [
248
+ /* @__PURE__ */ jsx2(Flex2, { align: "center", gap: "medium", children: /* @__PURE__ */ jsxs(Flex2, { align: "center", gap: "small", className: page_header_module_css_default.breadcrumb, children: [
249
+ /* @__PURE__ */ jsx2(Text, { style: { fontSize: "14px", fontWeight: "500" }, children: title }),
250
+ breadcrumb.map(
251
+ (item) => item.href && onBreadcrumbClick ? /* @__PURE__ */ jsx2(
252
+ "span",
253
+ {
254
+ role: "button",
255
+ tabIndex: 0,
256
+ className: page_header_module_css_default.breadcrumbItem,
257
+ "data-test-id": "page-header-breadcrumb-link",
258
+ onClick: () => onBreadcrumbClick == null ? void 0 : onBreadcrumbClick(item),
259
+ onKeyDown: (e) => {
260
+ if (e.key === "Enter" || e.key === " ") {
261
+ e.preventDefault();
262
+ onBreadcrumbClick == null ? void 0 : onBreadcrumbClick(item);
263
+ }
264
+ },
265
+ style: { cursor: "pointer" },
266
+ children: item.name
267
+ },
268
+ item.name
269
+ ) : /* @__PURE__ */ jsx2("span", { className: page_header_module_css_default.breadcrumbItem, children: item.name }, item.name)
270
+ )
271
+ ] }) }),
272
+ /* @__PURE__ */ jsx2(Flex2, { gap: "small", children })
273
+ ]
274
+ })
275
+ );
276
+ }
277
+
278
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-kgflw9KEShHo/lib/admin/views/roles/roles.module.css.js
279
+ var digest3 = "10b98842816282eba04a9c79bab1f82a701959414df16e98ee70e43c1eec8b69";
280
+ var css3 = `._tableRoot_4yb15_1 {
281
+ width: 100%;
282
+ }
283
+
284
+ ._tableWrapper_4yb15_5 {
285
+ width: 100%;
286
+ }
287
+
288
+ ._table_4yb15_1 {
289
+ table-layout: fixed;
290
+ }
291
+
292
+ ._header_4yb15_13 {
293
+ background-color: var(--rs-color-background-base-primary);
294
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
295
+ }
296
+
297
+ ._permissionsColumn_4yb15_18 {
298
+ max-width: 500px;
299
+ text-wrap: wrap;
300
+ }
301
+
302
+ ._sheetContent_4yb15_23 {
303
+ width: 400px;
304
+ padding: 0;
305
+ }
306
+
307
+ ._sheetContentBody_4yb15_28 {
308
+ padding: var(--rs-space-5);
309
+ }`;
310
+ (function() {
311
+ if (typeof document === "undefined") {
312
+ return;
313
+ }
314
+ if (!document.getElementById(digest3)) {
315
+ var el = document.createElement("style");
316
+ el.id = digest3;
317
+ el.textContent = css3;
318
+ document.head.appendChild(el);
319
+ }
320
+ })();
321
+ var roles_module_css_default2 = { "tableRoot": "_tableRoot_4yb15_1", "tableWrapper": "_tableWrapper_4yb15_5", "table": "_table_4yb15_1", "header": "_header_4yb15_13", "permissionsColumn": "_permissionsColumn_4yb15_18", "sheetContent": "_sheetContent_4yb15_23", "sheetContentBody": "_sheetContentBody_4yb15_28" };
322
+
323
+ // admin/views/roles/header.tsx
324
+ import { jsx as jsx3 } from "react/jsx-runtime";
325
+ var pageHeader = {
326
+ title: "Roles",
327
+ breadcrumb: []
328
+ };
329
+ var RolesHeader = () => {
330
+ return /* @__PURE__ */ jsx3(
331
+ PageHeader,
332
+ {
333
+ title: pageHeader.title,
334
+ breadcrumb: pageHeader.breadcrumb,
335
+ className: roles_module_css_default2.header,
336
+ children: /* @__PURE__ */ jsx3(DataTable.Search, { size: "small", placeholder: "Search roles..." })
337
+ }
338
+ );
339
+ };
340
+
341
+ // ../node_modules/.pnpm/@radix-ui+react-icons@1.3.2_react@18.3.1/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js
342
+ import { forwardRef, createElement } from "react";
343
+ function _objectWithoutPropertiesLoose(source, excluded) {
344
+ if (source == null)
345
+ return {};
346
+ var target = {};
347
+ var sourceKeys = Object.keys(source);
348
+ var key, i;
349
+ for (i = 0; i < sourceKeys.length; i++) {
350
+ key = sourceKeys[i];
351
+ if (excluded.indexOf(key) >= 0)
352
+ continue;
353
+ target[key] = source[key];
354
+ }
355
+ return target;
356
+ }
357
+ var _excluded$1q = ["color"];
358
+ var Cross1Icon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
359
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$1q);
360
+ return createElement("svg", Object.assign({
361
+ width: "15",
362
+ height: "15",
363
+ viewBox: "0 0 15 15",
364
+ fill: "none",
365
+ xmlns: "http://www.w3.org/2000/svg"
366
+ }, props, {
367
+ ref: forwardedRef
368
+ }), createElement("path", {
369
+ d: "M12.8536 2.85355C13.0488 2.65829 13.0488 2.34171 12.8536 2.14645C12.6583 1.95118 12.3417 1.95118 12.1464 2.14645L7.5 6.79289L2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.79289 7.5L2.14645 12.1464C1.95118 12.3417 1.95118 12.6583 2.14645 12.8536C2.34171 13.0488 2.65829 13.0488 2.85355 12.8536L7.5 8.20711L12.1464 12.8536C12.3417 13.0488 12.6583 13.0488 12.8536 12.8536C13.0488 12.6583 13.0488 12.3417 12.8536 12.1464L8.20711 7.5L12.8536 2.85355Z",
370
+ fill: color,
371
+ fillRule: "evenodd",
372
+ clipRule: "evenodd"
373
+ }));
374
+ });
375
+ var _excluded$1r = ["color"];
376
+ var Cross2Icon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
377
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$1r);
378
+ return createElement("svg", Object.assign({
379
+ width: "15",
380
+ height: "15",
381
+ viewBox: "0 0 15 15",
382
+ fill: "none",
383
+ xmlns: "http://www.w3.org/2000/svg"
384
+ }, props, {
385
+ ref: forwardedRef
386
+ }), createElement("path", {
387
+ d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",
388
+ fill: color,
389
+ fillRule: "evenodd",
390
+ clipRule: "evenodd"
391
+ }));
392
+ });
393
+ var _excluded$1B = ["color"];
394
+ var DesktopIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
395
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$1B);
396
+ return createElement("svg", Object.assign({
397
+ width: "15",
398
+ height: "15",
399
+ viewBox: "0 0 15 15",
400
+ fill: "none",
401
+ xmlns: "http://www.w3.org/2000/svg"
402
+ }, props, {
403
+ ref: forwardedRef
404
+ }), createElement("path", {
405
+ d: "M1 3.25C1 3.11193 1.11193 3 1.25 3H13.75C13.8881 3 14 3.11193 14 3.25V10.75C14 10.8881 13.8881 11 13.75 11H1.25C1.11193 11 1 10.8881 1 10.75V3.25ZM1.25 2C0.559643 2 0 2.55964 0 3.25V10.75C0 11.4404 0.559644 12 1.25 12H5.07341L4.82991 13.2986C4.76645 13.6371 5.02612 13.95 5.37049 13.95H9.62951C9.97389 13.95 10.2336 13.6371 10.1701 13.2986L9.92659 12H13.75C14.4404 12 15 11.4404 15 10.75V3.25C15 2.55964 14.4404 2 13.75 2H1.25ZM9.01091 12H5.98909L5.79222 13.05H9.20778L9.01091 12Z",
406
+ fill: color,
407
+ fillRule: "evenodd",
408
+ clipRule: "evenodd"
409
+ }));
410
+ });
411
+ var _excluded$1P = ["color"];
412
+ var DownloadIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
413
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$1P);
414
+ return createElement("svg", Object.assign({
415
+ width: "15",
416
+ height: "15",
417
+ viewBox: "0 0 15 15",
418
+ fill: "none",
419
+ xmlns: "http://www.w3.org/2000/svg"
420
+ }, props, {
421
+ ref: forwardedRef
422
+ }), createElement("path", {
423
+ d: "M7.50005 1.04999C7.74858 1.04999 7.95005 1.25146 7.95005 1.49999V8.41359L10.1819 6.18179C10.3576 6.00605 10.6425 6.00605 10.8182 6.18179C10.994 6.35753 10.994 6.64245 10.8182 6.81819L7.81825 9.81819C7.64251 9.99392 7.35759 9.99392 7.18185 9.81819L4.18185 6.81819C4.00611 6.64245 4.00611 6.35753 4.18185 6.18179C4.35759 6.00605 4.64251 6.00605 4.81825 6.18179L7.05005 8.41359V1.49999C7.05005 1.25146 7.25152 1.04999 7.50005 1.04999ZM2.5 10C2.77614 10 3 10.2239 3 10.5V12C3 12.5539 3.44565 13 3.99635 13H11.0012C11.5529 13 12 12.5528 12 12V10.5C12 10.2239 12.2239 10 12.5 10C12.7761 10 13 10.2239 13 10.5V12C13 13.1041 12.1062 14 11.0012 14H3.99635C2.89019 14 2 13.103 2 12V10.5C2 10.2239 2.22386 10 2.5 10Z",
424
+ fill: color,
425
+ fillRule: "evenodd",
426
+ clipRule: "evenodd"
427
+ }));
428
+ });
429
+ var _excluded$20 = ["color"];
430
+ var ExclamationTriangleIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
431
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$20);
432
+ return createElement("svg", Object.assign({
433
+ width: "15",
434
+ height: "15",
435
+ viewBox: "0 0 15 15",
436
+ fill: "none",
437
+ xmlns: "http://www.w3.org/2000/svg"
438
+ }, props, {
439
+ ref: forwardedRef
440
+ }), createElement("path", {
441
+ d: "M8.4449 0.608765C8.0183 -0.107015 6.9817 -0.107015 6.55509 0.608766L0.161178 11.3368C-0.275824 12.07 0.252503 13 1.10608 13H13.8939C14.7475 13 15.2758 12.07 14.8388 11.3368L8.4449 0.608765ZM7.4141 1.12073C7.45288 1.05566 7.54712 1.05566 7.5859 1.12073L13.9798 11.8488C14.0196 11.9154 13.9715 12 13.8939 12H1.10608C1.02849 12 0.980454 11.9154 1.02018 11.8488L7.4141 1.12073ZM6.8269 4.48611C6.81221 4.10423 7.11783 3.78663 7.5 3.78663C7.88217 3.78663 8.18778 4.10423 8.1731 4.48612L8.01921 8.48701C8.00848 8.766 7.7792 8.98664 7.5 8.98664C7.2208 8.98664 6.99151 8.766 6.98078 8.48701L6.8269 4.48611ZM8.24989 10.476C8.24989 10.8902 7.9141 11.226 7.49989 11.226C7.08567 11.226 6.74989 10.8902 6.74989 10.476C6.74989 10.0618 7.08567 9.72599 7.49989 9.72599C7.9141 9.72599 8.24989 10.0618 8.24989 10.476Z",
442
+ fill: color,
443
+ fillRule: "evenodd",
444
+ clipRule: "evenodd"
445
+ }));
446
+ });
447
+ var _excluded$2n = ["color"];
448
+ var GlobeIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
449
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$2n);
450
+ return createElement("svg", Object.assign({
451
+ width: "15",
452
+ height: "15",
453
+ viewBox: "0 0 15 15",
454
+ fill: "none",
455
+ xmlns: "http://www.w3.org/2000/svg"
456
+ }, props, {
457
+ ref: forwardedRef
458
+ }), createElement("path", {
459
+ d: "M7.49996 1.80002C4.35194 1.80002 1.79996 4.352 1.79996 7.50002C1.79996 10.648 4.35194 13.2 7.49996 13.2C10.648 13.2 13.2 10.648 13.2 7.50002C13.2 4.352 10.648 1.80002 7.49996 1.80002ZM0.899963 7.50002C0.899963 3.85494 3.85488 0.900024 7.49996 0.900024C11.145 0.900024 14.1 3.85494 14.1 7.50002C14.1 11.1451 11.145 14.1 7.49996 14.1C3.85488 14.1 0.899963 11.1451 0.899963 7.50002Z",
460
+ fill: color,
461
+ fillRule: "evenodd",
462
+ clipRule: "evenodd"
463
+ }), createElement("path", {
464
+ d: "M13.4999 7.89998H1.49994V7.09998H13.4999V7.89998Z",
465
+ fill: color,
466
+ fillRule: "evenodd",
467
+ clipRule: "evenodd"
468
+ }), createElement("path", {
469
+ d: "M7.09991 13.5V1.5H7.89991V13.5H7.09991zM10.375 7.49998C10.375 5.32724 9.59364 3.17778 8.06183 1.75656L8.53793 1.24341C10.2396 2.82218 11.075 5.17273 11.075 7.49998 11.075 9.82724 10.2396 12.1778 8.53793 13.7566L8.06183 13.2434C9.59364 11.8222 10.375 9.67273 10.375 7.49998zM3.99969 7.5C3.99969 5.17611 4.80786 2.82678 6.45768 1.24719L6.94177 1.75281C5.4582 3.17323 4.69969 5.32389 4.69969 7.5 4.6997 9.67611 5.45822 11.8268 6.94179 13.2472L6.45769 13.7528C4.80788 12.1732 3.9997 9.8239 3.99969 7.5z",
470
+ fill: color,
471
+ fillRule: "evenodd",
472
+ clipRule: "evenodd"
473
+ }), createElement("path", {
474
+ d: "M7.49996 3.95801C9.66928 3.95801 11.8753 4.35915 13.3706 5.19448 13.5394 5.28875 13.5998 5.50197 13.5055 5.67073 13.4113 5.83948 13.198 5.89987 13.0293 5.8056 11.6794 5.05155 9.60799 4.65801 7.49996 4.65801 5.39192 4.65801 3.32052 5.05155 1.97064 5.8056 1.80188 5.89987 1.58866 5.83948 1.49439 5.67073 1.40013 5.50197 1.46051 5.28875 1.62927 5.19448 3.12466 4.35915 5.33063 3.95801 7.49996 3.95801zM7.49996 10.85C9.66928 10.85 11.8753 10.4488 13.3706 9.6135 13.5394 9.51924 13.5998 9.30601 13.5055 9.13726 13.4113 8.9685 13.198 8.90812 13.0293 9.00238 11.6794 9.75643 9.60799 10.15 7.49996 10.15 5.39192 10.15 3.32052 9.75643 1.97064 9.00239 1.80188 8.90812 1.58866 8.9685 1.49439 9.13726 1.40013 9.30601 1.46051 9.51924 1.62927 9.6135 3.12466 10.4488 5.33063 10.85 7.49996 10.85z",
475
+ fill: color,
476
+ fillRule: "evenodd",
477
+ clipRule: "evenodd"
478
+ }));
479
+ });
480
+ var _excluded$33 = ["color"];
481
+ var MagnifyingGlassIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
482
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$33);
483
+ return createElement("svg", Object.assign({
484
+ width: "15",
485
+ height: "15",
486
+ viewBox: "0 0 15 15",
487
+ fill: "none",
488
+ xmlns: "http://www.w3.org/2000/svg"
489
+ }, props, {
490
+ ref: forwardedRef
491
+ }), createElement("path", {
492
+ d: "M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",
493
+ fill: color,
494
+ fillRule: "evenodd",
495
+ clipRule: "evenodd"
496
+ }));
497
+ });
498
+ var _excluded$4E = ["color"];
499
+ var TransformIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
500
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$4E);
501
+ return createElement("svg", Object.assign({
502
+ width: "15",
503
+ height: "15",
504
+ viewBox: "0 0 15 15",
505
+ fill: "none",
506
+ xmlns: "http://www.w3.org/2000/svg"
507
+ }, props, {
508
+ ref: forwardedRef
509
+ }), createElement("path", {
510
+ d: "M0.849976 1.74998C0.849976 1.25292 1.25292 0.849976 1.74998 0.849976H3.24998C3.74703 0.849976 4.14998 1.25292 4.14998 1.74998V2.04998H10.85V1.74998C10.85 1.25292 11.2529 0.849976 11.75 0.849976H13.25C13.747 0.849976 14.15 1.25292 14.15 1.74998V3.24998C14.15 3.74703 13.747 4.14998 13.25 4.14998H12.95V10.85H13.25C13.747 10.85 14.15 11.2529 14.15 11.75V13.25C14.15 13.747 13.747 14.15 13.25 14.15H11.75C11.2529 14.15 10.85 13.747 10.85 13.25V12.95H4.14998V13.25C4.14998 13.747 3.74703 14.15 3.24998 14.15H1.74998C1.25292 14.15 0.849976 13.747 0.849976 13.25V11.75C0.849976 11.2529 1.25292 10.85 1.74998 10.85H2.04998V4.14998H1.74998C1.25292 4.14998 0.849976 3.74703 0.849976 3.24998V1.74998ZM2.94998 4.14998V10.85H3.24998C3.74703 10.85 4.14998 11.2529 4.14998 11.75V12.05H10.85V11.75C10.85 11.2529 11.2529 10.85 11.75 10.85H12.05V4.14998H11.75C11.2529 4.14998 10.85 3.74703 10.85 3.24998V2.94998H4.14998V3.24998C4.14998 3.74703 3.74703 4.14998 3.24998 4.14998H2.94998ZM2.34998 1.74998H1.74998V2.34998V2.64998V3.24998H2.34998H2.64998H3.24998V2.64998V2.34998V1.74998H2.64998H2.34998ZM5.09998 5.99998C5.09998 5.50292 5.50292 5.09998 5.99998 5.09998H6.99998C7.49703 5.09998 7.89998 5.50292 7.89998 5.99998V6.99998C7.89998 7.03591 7.89787 7.07134 7.89378 7.10618C7.92861 7.10208 7.96405 7.09998 7.99998 7.09998H8.99998C9.49703 7.09998 9.89998 7.50292 9.89998 7.99998V8.99998C9.89998 9.49703 9.49703 9.89998 8.99998 9.89998H7.99998C7.50292 9.89998 7.09998 9.49703 7.09998 8.99998V7.99998C7.09998 7.96405 7.10208 7.92861 7.10618 7.89378C7.07134 7.89787 7.03591 7.89998 6.99998 7.89998H5.99998C5.50292 7.89998 5.09998 7.49703 5.09998 6.99998V5.99998ZM6.09998 5.99998H5.99998V6.09998V6.89998V6.99998H6.09998H6.89998H6.99998V6.89998V6.09998V5.99998H6.89998H6.09998ZM7.99998 7.99998H8.09998H8.89998H8.99998V8.09998V8.89998V8.99998H8.89998H8.09998H7.99998V8.89998V8.09998V7.99998ZM2.64998 11.75H2.34998H1.74998V12.35V12.65V13.25H2.34998H2.64998H3.24998V12.65V12.35V11.75H2.64998ZM11.75 1.74998H12.35H12.65H13.25V2.34998V2.64998V3.24998H12.65H12.35H11.75V2.64998V2.34998V1.74998ZM12.65 11.75H12.35H11.75V12.35V12.65V13.25H12.35H12.65H13.25V12.65V12.35V11.75H12.65Z",
511
+ fill: color,
512
+ fillRule: "evenodd",
513
+ clipRule: "evenodd"
514
+ }));
515
+ });
516
+
517
+ // admin/components/PageTitle.tsx
518
+ import { useEffect } from "react";
519
+ function PageTitle({ title, appName }) {
520
+ var _a;
521
+ const fullTitle = title && appName ? `${title} | ${appName}` : (_a = title != null ? title : appName) != null ? _a : "";
522
+ useEffect(() => {
523
+ if (fullTitle)
524
+ document.title = fullTitle;
525
+ return () => {
526
+ document.title = appName != null ? appName : "";
527
+ };
528
+ }, [fullTitle, appName]);
529
+ return null;
530
+ }
531
+
532
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-MJZvzj4lIxWX/lib/admin/views/roles/roles.module.css.js
533
+ var digest4 = "8b4f92cd0aa5c22e60b1b74ef8f6a9661467ddc78a8793f0ed4644672ae85091";
534
+ var css4 = `._tableRoot_4yb15_1 {
535
+ width: 100%;
536
+ }
537
+
538
+ ._tableWrapper_4yb15_5 {
539
+ width: 100%;
540
+ }
541
+
542
+ ._table_4yb15_1 {
543
+ table-layout: fixed;
544
+ }
545
+
546
+ ._header_4yb15_13 {
547
+ background-color: var(--rs-color-background-base-primary);
548
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
549
+ }
550
+
551
+ ._permissionsColumn_4yb15_18 {
552
+ max-width: 500px;
553
+ text-wrap: wrap;
554
+ }
555
+
556
+ ._sheetContent_4yb15_23 {
557
+ width: 400px;
558
+ padding: 0;
559
+ }
560
+
561
+ ._sheetContentBody_4yb15_28 {
562
+ padding: var(--rs-space-5);
563
+ }`;
564
+ (function() {
565
+ if (typeof document === "undefined") {
566
+ return;
567
+ }
568
+ if (!document.getElementById(digest4)) {
569
+ var el = document.createElement("style");
570
+ el.id = digest4;
571
+ el.textContent = css4;
572
+ document.head.appendChild(el);
573
+ }
574
+ })();
575
+ var roles_module_css_default3 = { "tableRoot": "_tableRoot_4yb15_1", "tableWrapper": "_tableWrapper_4yb15_5", "table": "_table_4yb15_1", "header": "_header_4yb15_13", "permissionsColumn": "_permissionsColumn_4yb15_18", "sheetContent": "_sheetContent_4yb15_23", "sheetContentBody": "_sheetContentBody_4yb15_28" };
576
+
577
+ // admin/components/SheetHeader.tsx
578
+ import { Flex as Flex3, Text as Text2 } from "@raystack/apsara";
579
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
580
+ function SheetHeader({ title, onClick, "data-testid": dataTestId }) {
581
+ return /* @__PURE__ */ jsxs2(Flex3, { justify: "between", style: styles.header, children: [
582
+ /* @__PURE__ */ jsx4(Text2, { size: 4, style: { fontWeight: "500" }, children: title }),
583
+ /* @__PURE__ */ jsx4(
584
+ Cross1Icon,
585
+ {
586
+ onClick,
587
+ style: { cursor: "pointer" },
588
+ "data-testid": dataTestId != null ? dataTestId : "admin-close-btn"
589
+ }
590
+ )
591
+ ] });
592
+ }
593
+ var styles = {
594
+ header: {
595
+ padding: "18px 32px",
596
+ borderBottom: "1px solid var(--rs-color-border-base-primary)"
597
+ }
598
+ };
599
+
600
+ // admin/views/roles/index.tsx
601
+ import { FrontierServiceQueries } from "@raystack/proton/frontier";
602
+ import { useQuery } from "@connectrpc/connect-query";
603
+
604
+ // admin/views/roles/details.tsx
605
+ import { Flex as Flex4, Text as Text3, Grid } from "@raystack/apsara";
606
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
607
+ function RoleDetails({ role }) {
608
+ return /* @__PURE__ */ jsxs3(Flex4, { direction: "column", gap: 9, children: [
609
+ /* @__PURE__ */ jsx5(Text3, { size: 4, children: role == null ? void 0 : role.name }),
610
+ /* @__PURE__ */ jsx5(Flex4, { direction: "column", gap: 9, children: /* @__PURE__ */ jsxs3(Grid, { columns: 2, gap: "small", children: [
611
+ /* @__PURE__ */ jsx5(Text3, { size: 1, children: "Name" }),
612
+ /* @__PURE__ */ jsx5(Text3, { size: 1, children: role == null ? void 0 : role.name })
613
+ ] }) })
614
+ ] });
615
+ }
616
+
617
+ // admin/views/roles/index.tsx
618
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
619
+ function RolesView({
620
+ selectedRoleId: controlledRoleId,
621
+ onSelectRole,
622
+ onCloseDetail,
623
+ appName
624
+ } = {}) {
625
+ var _a;
626
+ const [internalRoleId, setInternalRoleId] = useState();
627
+ const selectedRoleId = controlledRoleId != null ? controlledRoleId : internalRoleId;
628
+ const handleClose = useCallback(
629
+ () => onCloseDetail ? onCloseDetail() : setInternalRoleId(void 0),
630
+ [onCloseDetail]
631
+ );
632
+ const handleRowClick = useCallback(
633
+ (role) => {
634
+ var _a2, _b;
635
+ return onSelectRole ? onSelectRole((_a2 = role.id) != null ? _a2 : "") : setInternalRoleId((_b = role.id) != null ? _b : void 0);
636
+ },
637
+ [onSelectRole]
638
+ );
639
+ const {
640
+ data: roles = [],
641
+ isLoading,
642
+ error,
643
+ isError
644
+ } = useQuery(
645
+ FrontierServiceQueries.listRoles,
646
+ {},
647
+ {
648
+ select: (data) => {
649
+ var _a2;
650
+ return (_a2 = data == null ? void 0 : data.roles) != null ? _a2 : [];
651
+ }
652
+ }
653
+ );
654
+ const roleMapByName = reduceByKey(roles != null ? roles : [], "id");
655
+ if (isError) {
656
+ console.error("ConnectRPC Error:", error);
657
+ return /* @__PURE__ */ jsx6(
658
+ EmptyState,
659
+ {
660
+ icon: /* @__PURE__ */ jsx6(ExclamationTriangleIcon, {}),
661
+ heading: "Error Loading Roles",
662
+ subHeading: (error == null ? void 0 : error.message) || "Something went wrong while loading roles. Please try again."
663
+ }
664
+ );
665
+ }
666
+ const columns = getColumns();
667
+ return /* @__PURE__ */ jsx6(
668
+ DataTable2,
669
+ {
670
+ onRowClick: handleRowClick,
671
+ data: roles,
672
+ columns,
673
+ mode: "client",
674
+ defaultSort: { name: "title", order: "asc" },
675
+ isLoading,
676
+ children: /* @__PURE__ */ jsxs4(Flex5, { direction: "column", children: [
677
+ /* @__PURE__ */ jsx6(PageTitle, { title: "Roles", appName }),
678
+ /* @__PURE__ */ jsx6(RolesHeader, {}),
679
+ /* @__PURE__ */ jsx6(
680
+ DataTable2.Content,
681
+ {
682
+ emptyState: noDataChildren,
683
+ classNames: {
684
+ root: roles_module_css_default3.tableRoot,
685
+ table: roles_module_css_default3.table
686
+ }
687
+ }
688
+ ),
689
+ /* @__PURE__ */ jsx6(Sheet, { open: selectedRoleId !== void 0, children: /* @__PURE__ */ jsxs4(Sheet.Content, { className: roles_module_css_default3.sheetContent, children: [
690
+ /* @__PURE__ */ jsx6(
691
+ SheetHeader,
692
+ {
693
+ title: "Role Details",
694
+ onClick: handleClose,
695
+ "data-testid": "role-details-header"
696
+ }
697
+ ),
698
+ /* @__PURE__ */ jsx6(Flex5, { className: roles_module_css_default3.sheetContentBody, children: /* @__PURE__ */ jsx6(
699
+ RoleDetails,
700
+ {
701
+ role: selectedRoleId ? (_a = roleMapByName[selectedRoleId]) != null ? _a : null : null
702
+ }
703
+ ) })
704
+ ] }) })
705
+ ] })
706
+ }
707
+ );
708
+ }
709
+ var noDataChildren = /* @__PURE__ */ jsx6(EmptyState, { icon: /* @__PURE__ */ jsx6(ExclamationTriangleIcon, {}), heading: "0 role created" });
710
+
711
+ // admin/views/invoices/index.tsx
712
+ import {
713
+ DataTable as DataTable4,
714
+ EmptyState as EmptyState2,
715
+ Flex as Flex7
716
+ } from "@raystack/apsara";
717
+ import { useState as useState3 } from "react";
718
+
719
+ // admin/views/invoices/navbar.tsx
720
+ import { DataTable as DataTable3, Flex as Flex6, IconButton, Text as Text4 } from "@raystack/apsara";
721
+
722
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-MHyNVl1G52y6/lib/admin/views/invoices/invoices.module.css.js
723
+ var digest5 = "f2216e33826f3db04eea34b33941fa9be9f4db8bb5e44bde504ac1d2c1d715e9";
724
+ var css5 = `._navbar_9c4wr_1 {
725
+ padding: var(--rs-space-4) var(--rs-space-7);
726
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
727
+ background: var(--rs-color-background-base-primary);
728
+ display: flex;
729
+ align-items: center;
730
+ justify-content: space-between;
731
+ }
732
+
733
+ ._table_9c4wr_10 {
734
+ height: auto;
735
+ }
736
+
737
+ ._table-empty_9c4wr_14 {
738
+ height: 100%;
739
+ }
740
+
741
+ ._empty-state_9c4wr_18 {
742
+ height: 100%;
743
+ }
744
+
745
+ ._table-wrapper_9c4wr_22 {
746
+ /* Navbar Height + Toolbar height */
747
+ height: calc(100vh - 90px);
748
+ overflow: auto;
749
+ }
750
+
751
+ ._table-header_9c4wr_28 {
752
+ /* position: relative; */
753
+ z-index: 2;
754
+ }
755
+
756
+ ._table_9c4wr_10 th:first-child,
757
+ ._table_9c4wr_10 td:first-child {
758
+ padding-left: var(--rs-space-7);
759
+ max-width: 200px;
760
+ }
761
+ `;
762
+ (function() {
763
+ if (typeof document === "undefined") {
764
+ return;
765
+ }
766
+ if (!document.getElementById(digest5)) {
767
+ var el = document.createElement("style");
768
+ el.id = digest5;
769
+ el.textContent = css5;
770
+ document.head.appendChild(el);
771
+ }
772
+ })();
773
+ var invoices_module_css_default = { "navbar": "_navbar_9c4wr_1", "table": "_table_9c4wr_10", "table-empty": "_table-empty_9c4wr_14", "tableEmpty": "_table-empty_9c4wr_14", "empty-state": "_empty-state_9c4wr_18", "emptyState": "_empty-state_9c4wr_18", "table-wrapper": "_table-wrapper_9c4wr_22", "tableWrapper": "_table-wrapper_9c4wr_22", "table-header": "_table-header_9c4wr_28", "tableHeader": "_table-header_9c4wr_28" };
774
+
775
+ // admin/assets/icons/InvoicesIcon.tsx
776
+ import { jsx as jsx7 } from "react/jsx-runtime";
777
+ function InvoicesIcon(props) {
778
+ return /* @__PURE__ */ jsx7(
779
+ "svg",
780
+ __spreadProps(__spreadValues({
781
+ width: "16",
782
+ height: "16",
783
+ viewBox: "0 0 16 16",
784
+ fill: "none",
785
+ xmlns: "http://www.w3.org/2000/svg"
786
+ }, props), {
787
+ children: /* @__PURE__ */ jsx7("g", { id: "compass", children: /* @__PURE__ */ jsx7(
788
+ "path",
789
+ {
790
+ id: "Subtract",
791
+ fillRule: "evenodd",
792
+ clipRule: "evenodd",
793
+ d: "M14.6667 7.99998C14.6667 11.6819 11.6819 14.6666 8.00001 14.6666C4.31811 14.6666 1.33334 11.6819 1.33334 7.99998C1.33334 4.31808 4.31811 1.33331 8.00001 1.33331C11.6819 1.33331 14.6667 4.31808 14.6667 7.99998ZM10.7634 5.36305C10.7895 5.28488 10.7151 5.2105 10.6369 5.23656L6.63411 6.57084C6.60425 6.58079 6.58082 6.60422 6.57087 6.63408L5.23659 10.6369C5.21053 10.7151 5.28491 10.7895 5.36308 10.7634L9.36591 9.42913C9.39577 9.41917 9.4192 9.39574 9.42916 9.36588L10.7634 5.36305Z",
794
+ fill: "currentColor"
795
+ }
796
+ ) })
797
+ })
798
+ );
799
+ }
800
+
801
+ // admin/views/invoices/navbar.tsx
802
+ import { useState as useState2 } from "react";
803
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
804
+ var InvoicesNavabar = ({ searchQuery }) => {
805
+ const [showSearch, setShowSearch] = useState2(searchQuery ? true : false);
806
+ function toggleSearch() {
807
+ setShowSearch((prev) => !prev);
808
+ }
809
+ function onSearchBlur(e) {
810
+ const value = e.target.value;
811
+ if (!value) {
812
+ setShowSearch(false);
813
+ }
814
+ }
815
+ return /* @__PURE__ */ jsxs5("nav", { className: invoices_module_css_default.navbar, children: [
816
+ /* @__PURE__ */ jsxs5(Flex6, { gap: 2, children: [
817
+ /* @__PURE__ */ jsx8(InvoicesIcon, {}),
818
+ /* @__PURE__ */ jsx8(Text4, { size: 2, weight: 500, children: "Invoices" })
819
+ ] }),
820
+ /* @__PURE__ */ jsx8(Flex6, { align: "center", children: showSearch ? /* @__PURE__ */ jsx8(
821
+ DataTable3.Search,
822
+ {
823
+ showClearButton: true,
824
+ size: "small",
825
+ onBlur: onSearchBlur,
826
+ autoFocus: true
827
+ }
828
+ ) : /* @__PURE__ */ jsx8(
829
+ IconButton,
830
+ {
831
+ size: 3,
832
+ "aria-label": "Search",
833
+ "data-test-id": "admin-search-invoices-btn",
834
+ onClick: toggleSearch,
835
+ children: /* @__PURE__ */ jsx8(MagnifyingGlassIcon, {})
836
+ }
837
+ ) })
838
+ ] });
839
+ };
840
+
841
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-hh1Swm0X3q5i/lib/admin/views/invoices/invoices.module.css.js
842
+ var digest6 = "fc702bdea6e299d071c641917d65edcd901df2903515dcbd04114cfff1e122ab";
843
+ var css6 = `._navbar_9c4wr_1 {
844
+ padding: var(--rs-space-4) var(--rs-space-7);
845
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
846
+ background: var(--rs-color-background-base-primary);
847
+ display: flex;
848
+ align-items: center;
849
+ justify-content: space-between;
850
+ }
851
+
852
+ ._table_9c4wr_10 {
853
+ height: auto;
854
+ }
855
+
856
+ ._table-empty_9c4wr_14 {
857
+ height: 100%;
858
+ }
859
+
860
+ ._empty-state_9c4wr_18 {
861
+ height: 100%;
862
+ }
863
+
864
+ ._table-wrapper_9c4wr_22 {
865
+ /* Navbar Height + Toolbar height */
866
+ height: calc(100vh - 90px);
867
+ overflow: auto;
868
+ }
869
+
870
+ ._table-header_9c4wr_28 {
871
+ /* position: relative; */
872
+ z-index: 2;
873
+ }
874
+
875
+ ._table_9c4wr_10 th:first-child,
876
+ ._table_9c4wr_10 td:first-child {
877
+ padding-left: var(--rs-space-7);
878
+ max-width: 200px;
879
+ }
880
+ `;
881
+ (function() {
882
+ if (typeof document === "undefined") {
883
+ return;
884
+ }
885
+ if (!document.getElementById(digest6)) {
886
+ var el = document.createElement("style");
887
+ el.id = digest6;
888
+ el.textContent = css6;
889
+ document.head.appendChild(el);
890
+ }
891
+ })();
892
+ var invoices_module_css_default2 = { "navbar": "_navbar_9c4wr_1", "table": "_table_9c4wr_10", "table-empty": "_table-empty_9c4wr_14", "tableEmpty": "_table-empty_9c4wr_14", "empty-state": "_empty-state_9c4wr_18", "emptyState": "_empty-state_9c4wr_18", "table-wrapper": "_table-wrapper_9c4wr_22", "tableWrapper": "_table-wrapper_9c4wr_22", "table-header": "_table-header_9c4wr_28", "tableHeader": "_table-header_9c4wr_28" };
893
+
894
+ // admin/views/invoices/columns.tsx
895
+ import { Amount, Link, Text as Text5 } from "@raystack/apsara";
896
+ import dayjs from "dayjs";
897
+
898
+ // admin/utils/connect-timestamp.ts
899
+ import { timestampDate } from "@bufbuild/protobuf/wkt";
900
+ function timestampToDate(timestamp) {
901
+ if (!timestamp)
902
+ return null;
903
+ return timestampDate(timestamp);
904
+ }
905
+ function isNullTimestamp(timestamp) {
906
+ if (!timestamp)
907
+ return true;
908
+ return Number(timestamp.seconds) <= 0;
909
+ }
910
+
911
+ // admin/views/invoices/columns.tsx
912
+ import { jsx as jsx9 } from "react/jsx-runtime";
913
+ var getColumns2 = () => {
914
+ return [
915
+ {
916
+ accessorKey: "createdAt",
917
+ header: "Billed on",
918
+ filterType: "date",
919
+ enableColumnFilter: true,
920
+ cell: ({ getValue }) => {
921
+ const value = getValue();
922
+ const date = isNullTimestamp(value) ? "-" : dayjs(timestampToDate(value)).format("YYYY-MM-DD");
923
+ return /* @__PURE__ */ jsx9(Text5, { children: date });
924
+ },
925
+ enableHiding: true,
926
+ enableSorting: true
927
+ },
928
+ {
929
+ enableColumnFilter: true,
930
+ accessorKey: "state",
931
+ filterOptions: ["paid", "open", "draft"].map((value) => ({
932
+ value,
933
+ label: value
934
+ })),
935
+ filterType: "select",
936
+ header: "State",
937
+ cell: ({ row, getValue }) => {
938
+ return getValue();
939
+ }
940
+ },
941
+ {
942
+ accessorKey: "orgTitle",
943
+ header: "Organization",
944
+ cell: ({ row, getValue }) => {
945
+ return getValue();
946
+ }
947
+ },
948
+ {
949
+ header: "Amount",
950
+ accessorKey: "amount",
951
+ cell: ({ row, getValue }) => {
952
+ const value = Number(getValue());
953
+ return /* @__PURE__ */ jsx9(Amount, { value, currency: row.original.currency });
954
+ }
955
+ },
956
+ {
957
+ accessorKey: "invoiceLink",
958
+ header: "",
959
+ cell: ({ row, getValue }) => {
960
+ const link = getValue();
961
+ return link ? /* @__PURE__ */ jsx9(Link, { href: link, external: true, children: "Link" }) : /* @__PURE__ */ jsx9(Text5, { children: "-" });
962
+ }
963
+ }
964
+ ];
965
+ };
966
+
967
+ // admin/views/invoices/index.tsx
968
+ import { useInfiniteQuery } from "@connectrpc/connect-query";
969
+ import { AdminServiceQueries } from "@raystack/proton/frontier";
970
+
971
+ // admin/utils/connect-pagination.ts
972
+ var DEFAULT_PAGE_SIZE = 50;
973
+ function getConnectNextPageParam(lastPage, queryParams, itemsKey = "organizations") {
974
+ const pagination = lastPage.pagination;
975
+ const currentOffset = (pagination == null ? void 0 : pagination.offset) || 0;
976
+ const limit = (pagination == null ? void 0 : pagination.limit) || DEFAULT_PAGE_SIZE;
977
+ const items = Array.isArray(lastPage[itemsKey]) ? lastPage[itemsKey] : [];
978
+ const hasMorePages = items && items.length !== 0 && items.length === limit;
979
+ if (!hasMorePages) {
980
+ return void 0;
981
+ }
982
+ const nextOffset = currentOffset + limit;
983
+ const nextParams = __spreadProps(__spreadValues({}, queryParams.query), {
984
+ offset: nextOffset
985
+ });
986
+ return nextParams;
987
+ }
988
+ function getGroupCountMapFromFirstPage(infiniteData) {
989
+ var _a;
990
+ if (!((_a = infiniteData == null ? void 0 : infiniteData.pages) == null ? void 0 : _a[0])) {
991
+ return {};
992
+ }
993
+ const firstPage = infiniteData.pages[0];
994
+ const group = firstPage.group;
995
+ if (!(group == null ? void 0 : group.data) || !group.name) {
996
+ return {};
997
+ }
998
+ const groupCount = group.data.reduce(
999
+ (acc, groupItem) => {
1000
+ acc[groupItem.name || ""] = groupItem.count || 0;
1001
+ return acc;
1002
+ },
1003
+ {}
1004
+ );
1005
+ const groupKey = group.name;
1006
+ return { [groupKey]: groupCount };
1007
+ }
1008
+
1009
+ // admin/utils/transform-query.ts
1010
+ import { RQLRequestSchema, RQLFilterSchema, RQLSortSchema } from "@raystack/proton/frontier";
1011
+ import { create } from "@bufbuild/protobuf";
1012
+ function convertFilterValue(value) {
1013
+ switch (typeof value) {
1014
+ case "boolean":
1015
+ return { case: "boolValue", value };
1016
+ case "number":
1017
+ return { case: "numberValue", value };
1018
+ case "string":
1019
+ return { case: "stringValue", value };
1020
+ default:
1021
+ return { case: "stringValue", value: value != null ? value : "" };
1022
+ }
1023
+ }
1024
+ function transformFilter(filter, fieldNameMapping) {
1025
+ var _a;
1026
+ let value;
1027
+ if (filter.boolValue !== void 0) {
1028
+ value = { case: "boolValue", value: filter.boolValue };
1029
+ } else if (filter.numberValue !== void 0) {
1030
+ value = { case: "numberValue", value: filter.numberValue };
1031
+ } else if (filter.stringValue !== void 0) {
1032
+ value = { case: "stringValue", value: filter.stringValue };
1033
+ } else {
1034
+ value = convertFilterValue(filter.value);
1035
+ }
1036
+ const operator = filter.operator === "ilike" && value.case === "stringValue" ? "like" : filter.operator;
1037
+ const fieldName = (_a = fieldNameMapping == null ? void 0 : fieldNameMapping[filter.name]) != null ? _a : filter.name;
1038
+ return create(RQLFilterSchema, {
1039
+ name: fieldName,
1040
+ operator,
1041
+ value
1042
+ });
1043
+ }
1044
+ function transformSort(sort, fieldNameMapping) {
1045
+ if (!sort || sort.length === 0) {
1046
+ return void 0;
1047
+ }
1048
+ return sort.map((s) => {
1049
+ var _a;
1050
+ return create(RQLSortSchema, __spreadProps(__spreadValues({}, s), {
1051
+ name: (_a = fieldNameMapping == null ? void 0 : fieldNameMapping[s.name]) != null ? _a : s.name
1052
+ }));
1053
+ });
1054
+ }
1055
+ function transformDataTableQueryToRQLRequest(query, options = {}) {
1056
+ var _a;
1057
+ const { defaultLimit = 50, fieldNameMapping } = options;
1058
+ const filters = ((_a = query.filters) == null ? void 0 : _a.length) ? query.filters.map((filter) => transformFilter(filter, fieldNameMapping)) : [];
1059
+ const rqlRequest = create(RQLRequestSchema, {
1060
+ filters,
1061
+ groupBy: query.group_by || [],
1062
+ offset: query.offset || 0,
1063
+ limit: query.limit || defaultLimit,
1064
+ sort: transformSort(query.sort || [], fieldNameMapping) || [],
1065
+ search: query.search || ""
1066
+ });
1067
+ return rqlRequest;
1068
+ }
1069
+
1070
+ // admin/views/invoices/index.tsx
1071
+ import { Fragment, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1072
+ var NoInvoices = () => {
1073
+ return /* @__PURE__ */ jsx10(
1074
+ EmptyState2,
1075
+ {
1076
+ classNames: {
1077
+ container: invoices_module_css_default2["empty-state"],
1078
+ subHeading: invoices_module_css_default2["empty-state-subheading"]
1079
+ },
1080
+ heading: "No invoices found",
1081
+ subHeading: "Start billing to organizations to populate the table",
1082
+ icon: /* @__PURE__ */ jsx10(InvoicesIcon, {})
1083
+ }
1084
+ );
1085
+ };
1086
+ var DEFAULT_SORT = { name: "createdAt", order: "desc" };
1087
+ var INITIAL_QUERY = {
1088
+ offset: 0,
1089
+ limit: DEFAULT_PAGE_SIZE
1090
+ };
1091
+ function InvoicesView({ appName } = {}) {
1092
+ var _a;
1093
+ const [tableQuery, setTableQuery] = useState3(INITIAL_QUERY);
1094
+ const query = transformDataTableQueryToRQLRequest(tableQuery, {
1095
+ fieldNameMapping: {
1096
+ createdAt: "created_at"
1097
+ }
1098
+ });
1099
+ const {
1100
+ data: infiniteData,
1101
+ isLoading,
1102
+ isFetchingNextPage,
1103
+ fetchNextPage,
1104
+ error,
1105
+ isError,
1106
+ hasNextPage
1107
+ } = useInfiniteQuery(
1108
+ AdminServiceQueries.searchInvoices,
1109
+ { query },
1110
+ {
1111
+ pageParamKey: "query",
1112
+ getNextPageParam: (lastPage) => getConnectNextPageParam(lastPage, { query }, "invoices"),
1113
+ staleTime: 0,
1114
+ refetchOnWindowFocus: false,
1115
+ retry: 1,
1116
+ retryDelay: 1e3
1117
+ }
1118
+ );
1119
+ const data = ((_a = infiniteData == null ? void 0 : infiniteData.pages) == null ? void 0 : _a.flatMap((page) => (page == null ? void 0 : page.invoices) || [])) || [];
1120
+ const onTableQueryChange = (newQuery) => {
1121
+ setTableQuery(__spreadProps(__spreadValues({}, newQuery), {
1122
+ offset: 0,
1123
+ limit: newQuery.limit || DEFAULT_PAGE_SIZE
1124
+ }));
1125
+ };
1126
+ const handleLoadMore = () => __async(this, null, function* () {
1127
+ try {
1128
+ if (!hasNextPage)
1129
+ return;
1130
+ yield fetchNextPage();
1131
+ } catch (error2) {
1132
+ console.error("Error loading more invoices:", error2);
1133
+ }
1134
+ });
1135
+ const columns = getColumns2();
1136
+ const loading = isLoading || isFetchingNextPage;
1137
+ if (isError) {
1138
+ console.error("ConnectRPC Error:", error);
1139
+ return /* @__PURE__ */ jsxs6(Fragment, { children: [
1140
+ /* @__PURE__ */ jsx10(PageTitle, { title: "Invoices", appName }),
1141
+ /* @__PURE__ */ jsx10(
1142
+ EmptyState2,
1143
+ {
1144
+ icon: /* @__PURE__ */ jsx10(ExclamationTriangleIcon, {}),
1145
+ heading: "Error Loading Invoices",
1146
+ subHeading: (error == null ? void 0 : error.message) || "Something went wrong while loading invoices. Please try again."
1147
+ }
1148
+ )
1149
+ ] });
1150
+ }
1151
+ const tableClassName = data.length || loading ? invoices_module_css_default2["table"] : invoices_module_css_default2["table-empty"];
1152
+ return /* @__PURE__ */ jsxs6(Fragment, { children: [
1153
+ /* @__PURE__ */ jsx10(PageTitle, { title: "Invoices", appName }),
1154
+ /* @__PURE__ */ jsx10(
1155
+ DataTable4,
1156
+ {
1157
+ query: tableQuery,
1158
+ columns,
1159
+ data,
1160
+ isLoading: loading,
1161
+ defaultSort: DEFAULT_SORT,
1162
+ onTableQueryChange,
1163
+ mode: "server",
1164
+ onLoadMore: handleLoadMore,
1165
+ children: /* @__PURE__ */ jsxs6(Flex7, { direction: "column", style: { width: "100%" }, children: [
1166
+ /* @__PURE__ */ jsx10(InvoicesNavabar, { searchQuery: tableQuery.search || "" }),
1167
+ /* @__PURE__ */ jsx10(DataTable4.Toolbar, {}),
1168
+ /* @__PURE__ */ jsx10(
1169
+ DataTable4.VirtualizedContent,
1170
+ {
1171
+ classNames: {
1172
+ root: invoices_module_css_default2["table-wrapper"],
1173
+ table: tableClassName,
1174
+ header: invoices_module_css_default2["table-header"]
1175
+ },
1176
+ emptyState: /* @__PURE__ */ jsx10(NoInvoices, {}),
1177
+ rowHeight: 48,
1178
+ groupHeaderHeight: 48
1179
+ }
1180
+ )
1181
+ ] })
1182
+ }
1183
+ )
1184
+ ] });
1185
+ }
1186
+
1187
+ // admin/views/products/index.tsx
1188
+ import { EmptyState as EmptyState3, Flex as Flex10, DataTable as DataTable6 } from "@raystack/apsara";
1189
+ import { useQuery as useQuery2 } from "@connectrpc/connect-query";
1190
+ import { FrontierServiceQueries as FrontierServiceQueries2 } from "@raystack/proton/frontier";
1191
+
1192
+ // admin/views/products/columns.tsx
1193
+ import { Flex as Flex8, Image, Amount as Amount2 } from "@raystack/apsara";
1194
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
1195
+ var getColumns3 = (onNavigateToPrices) => {
1196
+ return [
1197
+ {
1198
+ accessorKey: "id",
1199
+ header: "",
1200
+ cell: (info) => {
1201
+ return /* @__PURE__ */ jsx11(
1202
+ Image,
1203
+ {
1204
+ src: "/product.svg",
1205
+ alt: "product-icon",
1206
+ width: 24,
1207
+ height: 24,
1208
+ style: {
1209
+ backgroundColor: "var(--rs-color-background-neutral-secondary)",
1210
+ borderRadius: "var(--rs-radius-3)",
1211
+ border: "1px solid var(--rs-color-border-base-primary)",
1212
+ margin: "var(--rs-space-3)"
1213
+ }
1214
+ }
1215
+ );
1216
+ }
1217
+ },
1218
+ {
1219
+ header: "Name",
1220
+ accessorKey: "title",
1221
+ cell: ({ row }) => {
1222
+ var _a, _b, _c, _d, _e;
1223
+ const prices = (_a = row == null ? void 0 : row.original) == null ? void 0 : _a.prices;
1224
+ const productId = (_b = row == null ? void 0 : row.original) == null ? void 0 : _b.id;
1225
+ const priceComp = (prices == null ? void 0 : prices.length) === 1 ? /* @__PURE__ */ jsx11(
1226
+ Amount2,
1227
+ {
1228
+ value: Number((_c = prices[0].amount) != null ? _c : 0),
1229
+ currency: prices[0].currency
1230
+ }
1231
+ ) : onNavigateToPrices && productId ? /* @__PURE__ */ jsxs7(
1232
+ "button",
1233
+ {
1234
+ "data-test-id": "products-table-prices-link",
1235
+ type: "button",
1236
+ onClick: (e) => {
1237
+ e.stopPropagation();
1238
+ onNavigateToPrices(productId);
1239
+ },
1240
+ style: {
1241
+ background: "none",
1242
+ border: "none",
1243
+ padding: 0,
1244
+ cursor: "pointer",
1245
+ textDecoration: "underline",
1246
+ font: "inherit",
1247
+ color: "inherit"
1248
+ },
1249
+ children: [
1250
+ prices == null ? void 0 : prices.length,
1251
+ " prices"
1252
+ ]
1253
+ }
1254
+ ) : /* @__PURE__ */ jsxs7("span", { children: [
1255
+ (_d = prices == null ? void 0 : prices.length) != null ? _d : 0,
1256
+ " prices"
1257
+ ] });
1258
+ return /* @__PURE__ */ jsxs7(Flex8, { direction: "column", gap: "extra-small", children: [
1259
+ /* @__PURE__ */ jsx11(Flex8, { children: (_e = row == null ? void 0 : row.original) == null ? void 0 : _e.title }),
1260
+ /* @__PURE__ */ jsx11(Flex8, { children: priceComp })
1261
+ ] });
1262
+ }
1263
+ },
1264
+ {
1265
+ header: "Product Id",
1266
+ accessorKey: "id",
1267
+ filterVariant: "text",
1268
+ cell: (info) => info.getValue()
1269
+ },
1270
+ {
1271
+ header: "Created on",
1272
+ accessorKey: "createdAt",
1273
+ cell: ({ getValue }) => {
1274
+ const timestamp = getValue();
1275
+ const date = timestampToDate(timestamp);
1276
+ if (!date)
1277
+ return "-";
1278
+ return date.toLocaleString("en", {
1279
+ month: "long",
1280
+ day: "numeric",
1281
+ year: "numeric"
1282
+ });
1283
+ },
1284
+ filterVariant: "date"
1285
+ },
1286
+ {
1287
+ header: "Updated on",
1288
+ accessorKey: "updatedAt",
1289
+ cell: ({ getValue }) => {
1290
+ const timestamp = getValue();
1291
+ const date = timestampToDate(timestamp);
1292
+ if (!date)
1293
+ return "-";
1294
+ return date.toLocaleString("en", {
1295
+ month: "long",
1296
+ day: "numeric",
1297
+ year: "numeric"
1298
+ });
1299
+ },
1300
+ filterVariant: "date"
1301
+ }
1302
+ ];
1303
+ };
1304
+
1305
+ // admin/views/products/header.tsx
1306
+ import { DataTable as DataTable5 } from "@raystack/apsara";
1307
+
1308
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-p02Ac66GJGqC/lib/admin/views/products/products.module.css.js
1309
+ var digest7 = "8a833c64ffa15104f772e422ef2546ed461e83f9337b3a124a1b27a3831c0717";
1310
+ var css7 = `._tableRoot_1lzjd_1 {
1311
+ width: 100%;
1312
+ }
1313
+
1314
+ ._tableWrapper_1lzjd_5 {
1315
+ width: 100%;
1316
+ }
1317
+
1318
+ ._table_1lzjd_1 {
1319
+ table-layout: fixed;
1320
+ }
1321
+
1322
+ ._header_1lzjd_13 {
1323
+ background-color: var(--rs-color-background-base-primary);
1324
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
1325
+ }
1326
+
1327
+ ._sheetContent_1lzjd_18 {
1328
+ width: 400px;
1329
+ padding: 0;
1330
+ }
1331
+
1332
+ ._sheetContentBody_1lzjd_23 {
1333
+ padding: var(--rs-space-5);
1334
+ }
1335
+
1336
+ ._linkButton_1lzjd_27 {
1337
+ background: none;
1338
+ border: none;
1339
+ padding: 0;
1340
+ cursor: pointer;
1341
+ text-decoration: underline;
1342
+ font: inherit;
1343
+ color: inherit;
1344
+ }`;
1345
+ (function() {
1346
+ if (typeof document === "undefined") {
1347
+ return;
1348
+ }
1349
+ if (!document.getElementById(digest7)) {
1350
+ var el = document.createElement("style");
1351
+ el.id = digest7;
1352
+ el.textContent = css7;
1353
+ document.head.appendChild(el);
1354
+ }
1355
+ })();
1356
+ var products_module_css_default = { "tableRoot": "_tableRoot_1lzjd_1", "tableWrapper": "_tableWrapper_1lzjd_5", "table": "_table_1lzjd_1", "header": "_header_1lzjd_13", "sheetContent": "_sheetContent_1lzjd_18", "sheetContentBody": "_sheetContentBody_1lzjd_23", "linkButton": "_linkButton_1lzjd_27" };
1357
+
1358
+ // admin/views/products/header.tsx
1359
+ import { jsx as jsx12 } from "react/jsx-runtime";
1360
+ var defaultPageHeader = {
1361
+ title: "Products",
1362
+ breadcrumb: []
1363
+ };
1364
+ var ProductsHeader = ({
1365
+ header = defaultPageHeader,
1366
+ onBreadcrumbClick
1367
+ }) => {
1368
+ return /* @__PURE__ */ jsx12(
1369
+ PageHeader,
1370
+ {
1371
+ title: header.title,
1372
+ breadcrumb: header.breadcrumb,
1373
+ onBreadcrumbClick,
1374
+ className: products_module_css_default.header,
1375
+ children: /* @__PURE__ */ jsx12(DataTable5.Search, { placeholder: "Search products...", size: "small" })
1376
+ }
1377
+ );
1378
+ };
1379
+
1380
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-bAGT2vPKyy1l/lib/admin/views/products/products.module.css.js
1381
+ var digest8 = "c664a979268adf31312761a92eea1b3437a8a36b1b054eb6ca2bd99456c6737c";
1382
+ var css8 = `._tableRoot_1lzjd_1 {
1383
+ width: 100%;
1384
+ }
1385
+
1386
+ ._tableWrapper_1lzjd_5 {
1387
+ width: 100%;
1388
+ }
1389
+
1390
+ ._table_1lzjd_1 {
1391
+ table-layout: fixed;
1392
+ }
1393
+
1394
+ ._header_1lzjd_13 {
1395
+ background-color: var(--rs-color-background-base-primary);
1396
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
1397
+ }
1398
+
1399
+ ._sheetContent_1lzjd_18 {
1400
+ width: 400px;
1401
+ padding: 0;
1402
+ }
1403
+
1404
+ ._sheetContentBody_1lzjd_23 {
1405
+ padding: var(--rs-space-5);
1406
+ }
1407
+
1408
+ ._linkButton_1lzjd_27 {
1409
+ background: none;
1410
+ border: none;
1411
+ padding: 0;
1412
+ cursor: pointer;
1413
+ text-decoration: underline;
1414
+ font: inherit;
1415
+ color: inherit;
1416
+ }`;
1417
+ (function() {
1418
+ if (typeof document === "undefined") {
1419
+ return;
1420
+ }
1421
+ if (!document.getElementById(digest8)) {
1422
+ var el = document.createElement("style");
1423
+ el.id = digest8;
1424
+ el.textContent = css8;
1425
+ document.head.appendChild(el);
1426
+ }
1427
+ })();
1428
+ var products_module_css_default2 = { "tableRoot": "_tableRoot_1lzjd_1", "tableWrapper": "_tableWrapper_1lzjd_5", "table": "_table_1lzjd_1", "header": "_header_1lzjd_13", "sheetContent": "_sheetContent_1lzjd_18", "sheetContentBody": "_sheetContentBody_1lzjd_23", "linkButton": "_linkButton_1lzjd_27" };
1429
+
1430
+ // admin/views/products/details.tsx
1431
+ import { Flex as Flex9, Text as Text6, Grid as Grid2, Sheet as Sheet2 } from "@raystack/apsara";
1432
+
1433
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-6EpxqI9xEgjj/lib/admin/views/products/products.module.css.js
1434
+ var digest9 = "0b01379dcbee3f78b56a399af9038639ef48e3a9362cdf3794146f4df0031a81";
1435
+ var css9 = `._tableRoot_1lzjd_1 {
1436
+ width: 100%;
1437
+ }
1438
+
1439
+ ._tableWrapper_1lzjd_5 {
1440
+ width: 100%;
1441
+ }
1442
+
1443
+ ._table_1lzjd_1 {
1444
+ table-layout: fixed;
1445
+ }
1446
+
1447
+ ._header_1lzjd_13 {
1448
+ background-color: var(--rs-color-background-base-primary);
1449
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
1450
+ }
1451
+
1452
+ ._sheetContent_1lzjd_18 {
1453
+ width: 400px;
1454
+ padding: 0;
1455
+ }
1456
+
1457
+ ._sheetContentBody_1lzjd_23 {
1458
+ padding: var(--rs-space-5);
1459
+ }
1460
+
1461
+ ._linkButton_1lzjd_27 {
1462
+ background: none;
1463
+ border: none;
1464
+ padding: 0;
1465
+ cursor: pointer;
1466
+ text-decoration: underline;
1467
+ font: inherit;
1468
+ color: inherit;
1469
+ }`;
1470
+ (function() {
1471
+ if (typeof document === "undefined") {
1472
+ return;
1473
+ }
1474
+ if (!document.getElementById(digest9)) {
1475
+ var el = document.createElement("style");
1476
+ el.id = digest9;
1477
+ el.textContent = css9;
1478
+ document.head.appendChild(el);
1479
+ }
1480
+ })();
1481
+ var products_module_css_default3 = { "tableRoot": "_tableRoot_1lzjd_1", "tableWrapper": "_tableWrapper_1lzjd_5", "table": "_table_1lzjd_1", "header": "_header_1lzjd_13", "sheetContent": "_sheetContent_1lzjd_18", "sheetContentBody": "_sheetContentBody_1lzjd_23", "linkButton": "_linkButton_1lzjd_27" };
1482
+
1483
+ // admin/views/products/details.tsx
1484
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
1485
+ function ProductDetails({
1486
+ product,
1487
+ onClose,
1488
+ onNavigateToPrices
1489
+ }) {
1490
+ return /* @__PURE__ */ jsx13(Sheet2, { open: true, children: /* @__PURE__ */ jsxs8(Sheet2.Content, { className: products_module_css_default3.sheetContent, children: [
1491
+ /* @__PURE__ */ jsx13(SheetHeader, { title: "Product Details", onClick: onClose }),
1492
+ /* @__PURE__ */ jsxs8(Flex9, { className: products_module_css_default3.sheetContentBody, direction: "column", gap: 9, children: [
1493
+ /* @__PURE__ */ jsx13(Text6, { size: 4, children: product == null ? void 0 : product.title }),
1494
+ /* @__PURE__ */ jsxs8(Flex9, { direction: "column", gap: 9, children: [
1495
+ /* @__PURE__ */ jsxs8(Grid2, { columns: 2, gap: "small", children: [
1496
+ /* @__PURE__ */ jsx13(Text6, { size: 1, children: "Name" }),
1497
+ /* @__PURE__ */ jsx13(Text6, { size: 1, children: product == null ? void 0 : product.title })
1498
+ ] }),
1499
+ /* @__PURE__ */ jsxs8(Grid2, { columns: 2, gap: "small", children: [
1500
+ /* @__PURE__ */ jsx13(Text6, { size: 1, children: "Prices" }),
1501
+ /* @__PURE__ */ jsx13(Text6, { size: 1, children: /* @__PURE__ */ jsx13(
1502
+ "button",
1503
+ {
1504
+ type: "button",
1505
+ className: products_module_css_default3.linkButton,
1506
+ "data-test-id": "product-details-prices-link",
1507
+ onClick: () => (product == null ? void 0 : product.id) && onNavigateToPrices(product.id),
1508
+ children: "Go to prices"
1509
+ }
1510
+ ) })
1511
+ ] })
1512
+ ] })
1513
+ ] })
1514
+ ] }) });
1515
+ }
1516
+
1517
+ // admin/views/products/index.tsx
1518
+ import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
1519
+ function ProductsView({
1520
+ selectedProductId,
1521
+ onSelectProduct,
1522
+ onCloseDetail,
1523
+ onNavigateToPrices,
1524
+ appName
1525
+ } = {}) {
1526
+ var _a;
1527
+ const {
1528
+ data: productsResponse,
1529
+ isLoading: isProductsLoading,
1530
+ error,
1531
+ isError
1532
+ } = useQuery2(FrontierServiceQueries2.listProducts, {}, {
1533
+ staleTime: Infinity
1534
+ });
1535
+ const products = (productsResponse == null ? void 0 : productsResponse.products) || [];
1536
+ const productMapById = reduceByKey(products != null ? products : [], "id");
1537
+ const product = selectedProductId ? (_a = productMapById[selectedProductId]) != null ? _a : null : null;
1538
+ const columns = getColumns3(onNavigateToPrices);
1539
+ const handleRowClick = (p) => {
1540
+ var _a2;
1541
+ onSelectProduct == null ? void 0 : onSelectProduct((_a2 = p.id) != null ? _a2 : "");
1542
+ };
1543
+ if (isError) {
1544
+ console.error("ConnectRPC Error:", error);
1545
+ return /* @__PURE__ */ jsxs9(Fragment2, { children: [
1546
+ /* @__PURE__ */ jsx14(PageTitle, { title: "Products", appName }),
1547
+ /* @__PURE__ */ jsx14(
1548
+ EmptyState3,
1549
+ {
1550
+ icon: /* @__PURE__ */ jsx14(ExclamationTriangleIcon, {}),
1551
+ heading: "Error Loading Products",
1552
+ subHeading: (error == null ? void 0 : error.message) || "Something went wrong while loading products. Please try again."
1553
+ }
1554
+ )
1555
+ ] });
1556
+ }
1557
+ return /* @__PURE__ */ jsxs9(Fragment2, { children: [
1558
+ /* @__PURE__ */ jsx14(PageTitle, { title: "Products", appName }),
1559
+ /* @__PURE__ */ jsx14(
1560
+ DataTable6,
1561
+ {
1562
+ data: products,
1563
+ columns,
1564
+ isLoading: isProductsLoading,
1565
+ mode: "client",
1566
+ defaultSort: { name: "title", order: "asc" },
1567
+ onRowClick: handleRowClick,
1568
+ children: /* @__PURE__ */ jsxs9(Flex10, { direction: "column", className: products_module_css_default2.tableWrapper, children: [
1569
+ /* @__PURE__ */ jsx14(ProductsHeader, {}),
1570
+ /* @__PURE__ */ jsx14(
1571
+ DataTable6.Content,
1572
+ {
1573
+ emptyState: noDataChildren2,
1574
+ classNames: { root: products_module_css_default2.tableRoot }
1575
+ }
1576
+ ),
1577
+ product && /* @__PURE__ */ jsx14(
1578
+ ProductDetails,
1579
+ {
1580
+ product,
1581
+ onClose: onCloseDetail != null ? onCloseDetail : () => {
1582
+ },
1583
+ onNavigateToPrices: onNavigateToPrices != null ? onNavigateToPrices : () => {
1584
+ }
1585
+ }
1586
+ )
1587
+ ] })
1588
+ }
1589
+ )
1590
+ ] });
1591
+ }
1592
+ var noDataChildren2 = /* @__PURE__ */ jsx14(
1593
+ EmptyState3,
1594
+ {
1595
+ icon: /* @__PURE__ */ jsx14(ExclamationTriangleIcon, {}),
1596
+ heading: "0 product created",
1597
+ subHeading: "Try creating a new product."
1598
+ }
1599
+ );
1600
+
1601
+ // admin/views/products/prices/index.tsx
1602
+ import { Flex as Flex11, EmptyState as EmptyState4, DataTable as DataTable7 } from "@raystack/apsara";
1603
+ import { useQuery as useQuery3 } from "@connectrpc/connect-query";
1604
+ import { FrontierServiceQueries as FrontierServiceQueries3 } from "@raystack/proton/frontier";
1605
+
1606
+ // admin/views/products/prices/columns.tsx
1607
+ import { Amount as Amount3 } from "@raystack/apsara";
1608
+ import { jsx as jsx15 } from "react/jsx-runtime";
1609
+ var getColumns4 = (prices) => {
1610
+ return [
1611
+ {
1612
+ header: "Id",
1613
+ accessorKey: "id",
1614
+ cell: (info) => info.getValue(),
1615
+ filterVariant: "text"
1616
+ },
1617
+ {
1618
+ header: "name",
1619
+ accessorKey: "name",
1620
+ cell: (info) => info.getValue(),
1621
+ filterVariant: "text"
1622
+ },
1623
+ {
1624
+ header: "interval",
1625
+ accessorKey: "interval",
1626
+ cell: (info) => info.getValue(),
1627
+ filterVariant: "text"
1628
+ },
1629
+ {
1630
+ header: "Usage Type",
1631
+ accessorKey: "usageType",
1632
+ cell: (info) => info.getValue(),
1633
+ filterVariant: "text"
1634
+ },
1635
+ {
1636
+ header: "billing_scheme",
1637
+ accessorKey: "billingScheme",
1638
+ cell: (info) => info.getValue(),
1639
+ filterVariant: "text"
1640
+ },
1641
+ {
1642
+ header: "Amount",
1643
+ accessorKey: "amount",
1644
+ cell: ({ row }) => {
1645
+ var _a;
1646
+ return /* @__PURE__ */ jsx15(
1647
+ Amount3,
1648
+ {
1649
+ value: Number((_a = row.original.amount) != null ? _a : 0),
1650
+ currency: row.original.currency
1651
+ }
1652
+ );
1653
+ },
1654
+ filterVariant: "text"
1655
+ },
1656
+ {
1657
+ header: "creation date",
1658
+ accessorKey: "createdAt",
1659
+ cell: ({ getValue }) => {
1660
+ const timestamp = getValue();
1661
+ const date = timestampToDate(timestamp);
1662
+ if (!date)
1663
+ return "-";
1664
+ return date.toLocaleString("en", {
1665
+ month: "long",
1666
+ day: "numeric",
1667
+ year: "numeric"
1668
+ });
1669
+ }
1670
+ },
1671
+ {
1672
+ header: "Updated date",
1673
+ accessorKey: "updatedAt",
1674
+ enableColumnFilter: false,
1675
+ cell: ({ getValue }) => {
1676
+ const timestamp = getValue();
1677
+ const date = timestampToDate(timestamp);
1678
+ if (!date)
1679
+ return "-";
1680
+ return date.toLocaleString("en", {
1681
+ month: "long",
1682
+ day: "numeric",
1683
+ year: "numeric"
1684
+ });
1685
+ }
1686
+ }
1687
+ ];
1688
+ };
1689
+
1690
+ // admin/views/products/prices/index.tsx
1691
+ import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
1692
+ function ProductPricesView({
1693
+ productId,
1694
+ appName,
1695
+ onBreadcrumbClick
1696
+ }) {
1697
+ const {
1698
+ data: productResponse,
1699
+ isLoading: isProductLoading,
1700
+ error,
1701
+ isError
1702
+ } = useQuery3(
1703
+ FrontierServiceQueries3.getProduct,
1704
+ { id: productId != null ? productId : "" },
1705
+ { staleTime: Infinity }
1706
+ );
1707
+ const product = productResponse == null ? void 0 : productResponse.product;
1708
+ const pageHeader2 = {
1709
+ title: "Products",
1710
+ breadcrumb: [
1711
+ { href: `/products`, name: "Product list" },
1712
+ { href: `/products/${productId}`, name: `${productId}` },
1713
+ { href: "", name: "Prices" }
1714
+ ]
1715
+ };
1716
+ if (isError) {
1717
+ console.error("ConnectRPC Error:", error);
1718
+ return /* @__PURE__ */ jsxs10(Fragment3, { children: [
1719
+ /* @__PURE__ */ jsx16(PageTitle, { title: "Product Prices", appName }),
1720
+ /* @__PURE__ */ jsx16(
1721
+ EmptyState4,
1722
+ {
1723
+ icon: /* @__PURE__ */ jsx16(ExclamationTriangleIcon, {}),
1724
+ heading: "Error Loading Product",
1725
+ subHeading: (error == null ? void 0 : error.message) || "Something went wrong while loading product. Please try again."
1726
+ }
1727
+ )
1728
+ ] });
1729
+ }
1730
+ const prices = (product == null ? void 0 : product.prices) || [];
1731
+ return /* @__PURE__ */ jsxs10(Fragment3, { children: [
1732
+ /* @__PURE__ */ jsx16(PageTitle, { title: "Product Prices", appName }),
1733
+ /* @__PURE__ */ jsx16(Flex11, { direction: "row", style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ jsx16(
1734
+ DataTable7,
1735
+ {
1736
+ data: prices,
1737
+ columns: getColumns4(prices),
1738
+ mode: "client",
1739
+ isLoading: isProductLoading,
1740
+ defaultSort: { name: "createdAt", order: "desc" },
1741
+ children: /* @__PURE__ */ jsxs10(Flex11, { direction: "column", width: "full", children: [
1742
+ /* @__PURE__ */ jsx16(ProductsHeader, { header: pageHeader2, onBreadcrumbClick }),
1743
+ /* @__PURE__ */ jsx16(DataTable7.Content, { emptyState: noDataChildren3 })
1744
+ ] })
1745
+ }
1746
+ ) })
1747
+ ] });
1748
+ }
1749
+ var noDataChildren3 = /* @__PURE__ */ jsx16(EmptyState4, { icon: /* @__PURE__ */ jsx16(ExclamationTriangleIcon, {}), heading: "0 prices found" });
1750
+
1751
+ // admin/views/audit-logs/index.tsx
1752
+ import {
1753
+ DataTable as DataTable9,
1754
+ EmptyState as EmptyState5,
1755
+ Flex as Flex17
1756
+ } from "@raystack/apsara";
1757
+ import { useDebouncedState } from "@raystack/apsara/hooks";
1758
+ import { useCallback as useCallback3, useMemo, useState as useState5 } from "react";
1759
+
1760
+ // admin/views/audit-logs/navbar.tsx
1761
+ import { DataTable as DataTable8, Flex as Flex12, Text as Text7, IconButton as IconButton2, Spinner } from "@raystack/apsara";
1762
+
1763
+ // admin/assets/icons/CpuChipIcon.tsx
1764
+ import { jsx as jsx17 } from "react/jsx-runtime";
1765
+ function CpuChipIcon(props) {
1766
+ return /* @__PURE__ */ jsx17(
1767
+ "svg",
1768
+ __spreadProps(__spreadValues({
1769
+ xmlns: "http://www.w3.org/2000/svg",
1770
+ width: "16",
1771
+ height: "16",
1772
+ viewBox: "0 0 16 16",
1773
+ fill: "none"
1774
+ }, props), {
1775
+ children: /* @__PURE__ */ jsx17(
1776
+ "path",
1777
+ {
1778
+ d: "M5.5 2V3M3 5.5H2M14 5.5H13M3 8H2M14 8H13M3 10.5H2M14 10.5H13M5.5 13V14M8 2V3M8 13V14M10.5 2V3M10.5 13V14M4.5 13H11.5C11.8978 13 12.2794 12.842 12.5607 12.5607C12.842 12.2794 13 11.8978 13 11.5V4.5C13 4.10218 12.842 3.72064 12.5607 3.43934C12.2794 3.15804 11.8978 3 11.5 3H4.5C4.10218 3 3.72064 3.15804 3.43934 3.43934C3.15804 3.72064 3 4.10218 3 4.5V11.5C3 11.8978 3.15804 12.2794 3.43934 12.5607C3.72064 12.842 4.10218 13 4.5 13ZM5 5H11V11H5V5Z",
1779
+ stroke: "currentColor",
1780
+ strokeWidth: "1.5",
1781
+ strokeLinecap: "round",
1782
+ strokeLinejoin: "round"
1783
+ }
1784
+ )
1785
+ })
1786
+ );
1787
+ }
1788
+
1789
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-c0j8ltsvs9KE/lib/admin/views/audit-logs/audit-logs.module.css.js
1790
+ var digest10 = "99680cc7a26379ba0cb099fe4670a1c408e2a884aebeccce130239501095a4d2";
1791
+ var css10 = `._navbar_sfza7_1 {
1792
+ padding: var(--rs-space-4) var(--rs-space-7);
1793
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
1794
+ background: var(--rs-color-background-base-primary);
1795
+ display: flex;
1796
+ align-items: center;
1797
+ justify-content: space-between;
1798
+ }
1799
+
1800
+ ._table_sfza7_10 {
1801
+ height: auto;
1802
+ }
1803
+
1804
+ ._table-empty_sfza7_14 {
1805
+ height: 100%;
1806
+ }
1807
+
1808
+ ._empty-state_sfza7_18 {
1809
+ height: 100%;
1810
+ }
1811
+
1812
+ ._empty-state-subheading_sfza7_22 {
1813
+ max-width: 360px;
1814
+ text-wrap: auto;
1815
+ }
1816
+
1817
+ ._name-column_sfza7_27 {
1818
+ padding-left: var(--rs-space-7);
1819
+ min-width: 300px;
1820
+ }
1821
+ ._org-column_sfza7_31 {
1822
+ min-width: 300px;
1823
+ }
1824
+
1825
+ ._table-wrapper_sfza7_35 {
1826
+ flex: 1;
1827
+ height: 100%;
1828
+ }
1829
+
1830
+ ._table-header_sfza7_40 {
1831
+ z-index: 2;
1832
+ }
1833
+
1834
+ ._side-panel_sfza7_44 {
1835
+ position: sticky;
1836
+ top: 0;
1837
+ }
1838
+
1839
+ ._capitalize_sfza7_49 {
1840
+ text-transform: capitalize;
1841
+ }
1842
+
1843
+ ._table-content-container_sfza7_53 {
1844
+ width: 100%;
1845
+ height: 100%;
1846
+ height: calc(100vh - 90px);
1847
+ overflow: auto;
1848
+ position: relative;
1849
+ }
1850
+
1851
+ ._text-overflow_sfza7_61 {
1852
+ width: fit-content;
1853
+ max-width: 180px;
1854
+ overflow: hidden;
1855
+ text-overflow: ellipsis;
1856
+ white-space: nowrap;
1857
+ }
1858
+
1859
+ ._code-block-container_sfza7_69 {
1860
+ padding: 0;
1861
+ }
1862
+ ._code-block_sfza7_69 {
1863
+ max-height: 400px;
1864
+ overflow: auto;
1865
+ }
1866
+ ._sidepanel-link-trigger_sfza7_76 {
1867
+ width: 100%;
1868
+ justify-content: start;
1869
+ border-radius: var(--rs-radius-2);
1870
+ padding: 0 var(--rs-space-3);
1871
+ cursor: pointer;
1872
+ height: 32px;
1873
+ }
1874
+ ._sidepanel-list-link_sfza7_84 {
1875
+ padding: var(--rs-space-2) 0;
1876
+ display: flex;
1877
+ align-items: center;
1878
+ }
1879
+ ._sidepanel-list-link_sfza7_84 a {
1880
+ text-decoration: none;
1881
+ }
1882
+ `;
1883
+ (function() {
1884
+ if (typeof document === "undefined") {
1885
+ return;
1886
+ }
1887
+ if (!document.getElementById(digest10)) {
1888
+ var el = document.createElement("style");
1889
+ el.id = digest10;
1890
+ el.textContent = css10;
1891
+ document.head.appendChild(el);
1892
+ }
1893
+ })();
1894
+ var audit_logs_module_css_default = { "navbar": "_navbar_sfza7_1", "table": "_table_sfza7_10", "table-empty": "_table-empty_sfza7_14", "tableEmpty": "_table-empty_sfza7_14", "empty-state": "_empty-state_sfza7_18", "emptyState": "_empty-state_sfza7_18", "empty-state-subheading": "_empty-state-subheading_sfza7_22", "emptyStateSubheading": "_empty-state-subheading_sfza7_22", "name-column": "_name-column_sfza7_27", "nameColumn": "_name-column_sfza7_27", "org-column": "_org-column_sfza7_31", "orgColumn": "_org-column_sfza7_31", "table-wrapper": "_table-wrapper_sfza7_35", "tableWrapper": "_table-wrapper_sfza7_35", "table-header": "_table-header_sfza7_40", "tableHeader": "_table-header_sfza7_40", "side-panel": "_side-panel_sfza7_44", "sidePanel": "_side-panel_sfza7_44", "capitalize": "_capitalize_sfza7_49", "table-content-container": "_table-content-container_sfza7_53", "tableContentContainer": "_table-content-container_sfza7_53", "text-overflow": "_text-overflow_sfza7_61", "textOverflow": "_text-overflow_sfza7_61", "code-block-container": "_code-block-container_sfza7_69", "codeBlockContainer": "_code-block-container_sfza7_69", "code-block": "_code-block_sfza7_69", "codeBlock": "_code-block_sfza7_69", "sidepanel-link-trigger": "_sidepanel-link-trigger_sfza7_76", "sidepanelLinkTrigger": "_sidepanel-link-trigger_sfza7_76", "sidepanel-list-link": "_sidepanel-list-link_sfza7_84", "sidepanelListLink": "_sidepanel-list-link_sfza7_84" };
1895
+
1896
+ // admin/views/audit-logs/navbar.tsx
1897
+ import { useCallback as useCallback2, useState as useState4 } from "react";
1898
+ import { useQueryClient } from "@tanstack/react-query";
1899
+
1900
+ // admin/views/audit-logs/util.ts
1901
+ import { toJsonString } from "@bufbuild/protobuf";
1902
+ import {
1903
+ AuditRecordSchema
1904
+ } from "@raystack/proton/frontier";
1905
+ var getAuditLogActorName = (actor, maxLength = 15) => {
1906
+ var _a;
1907
+ if ((actor == null ? void 0 : actor.type) === ACTOR_TYPES.SYSTEM)
1908
+ return "System";
1909
+ const name = (actor == null ? void 0 : actor.title) || (actor == null ? void 0 : actor.name) || "-";
1910
+ if (((_a = actor == null ? void 0 : actor.metadata) == null ? void 0 : _a["is_super_user"]) === true)
1911
+ if (name.length > maxLength)
1912
+ return name.substring(0, maxLength) + "... (Admin)";
1913
+ else
1914
+ return name + " (Admin)";
1915
+ return name;
1916
+ };
1917
+ var actionBadgeColorPatterns = {
1918
+ warning: /invite|unverify|unverified/i,
1919
+ success: /success|create|verify|verified/i,
1920
+ danger: /error|delete|revoke|remove|disable/i
1921
+ };
1922
+ var getActionBadgeColor = (action) => {
1923
+ for (const [color, pattern] of Object.entries(actionBadgeColorPatterns)) {
1924
+ if (pattern.test(action))
1925
+ return color;
1926
+ }
1927
+ return "accent";
1928
+ };
1929
+ var ACTOR_TYPES = {
1930
+ USER: "app/user",
1931
+ SERVICE_USER: "app/serviceuser",
1932
+ SYSTEM: "system"
1933
+ };
1934
+ var AUDIT_LOG_QUERY_KEY = ["audit-logs", "table-query"];
1935
+ var auditLogToJson = (auditLog) => {
1936
+ return toJsonString(AuditRecordSchema, auditLog, { prettySpaces: 2 });
1937
+ };
1938
+
1939
+ // admin/views/audit-logs/navbar.tsx
1940
+ import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
1941
+ var Navbar = ({ searchQuery, onExportCsv }) => {
1942
+ const [showSearch, setShowSearch] = useState4(searchQuery ? true : false);
1943
+ const [isDownloading, setIsDownloading] = useState4(false);
1944
+ const queryClient = useQueryClient();
1945
+ const toggleSearch = useCallback2(() => {
1946
+ setShowSearch((prev) => !prev);
1947
+ }, []);
1948
+ const onSearchBlur = useCallback2((e) => {
1949
+ const value = e.target.value;
1950
+ if (!value) {
1951
+ setShowSearch(false);
1952
+ }
1953
+ }, []);
1954
+ const onDownloadClick = useCallback2(() => __async(void 0, null, function* () {
1955
+ if (!onExportCsv)
1956
+ return;
1957
+ try {
1958
+ setIsDownloading(true);
1959
+ const query = queryClient.getQueryData(
1960
+ AUDIT_LOG_QUERY_KEY
1961
+ );
1962
+ yield onExportCsv(query);
1963
+ } catch (error) {
1964
+ console.error(error);
1965
+ } finally {
1966
+ setIsDownloading(false);
1967
+ }
1968
+ }), [queryClient, onExportCsv]);
1969
+ return /* @__PURE__ */ jsxs11("nav", { className: audit_logs_module_css_default.navbar, children: [
1970
+ /* @__PURE__ */ jsxs11(Flex12, { gap: 2, children: [
1971
+ /* @__PURE__ */ jsx18(CpuChipIcon, {}),
1972
+ /* @__PURE__ */ jsx18(Text7, { size: 2, weight: 500, children: "Audit Logs" })
1973
+ ] }),
1974
+ /* @__PURE__ */ jsxs11(Flex12, { align: "center", gap: 4, children: [
1975
+ showSearch ? /* @__PURE__ */ jsx18(
1976
+ DataTable8.Search,
1977
+ {
1978
+ autoFocus: true,
1979
+ showClearButton: true,
1980
+ size: "small",
1981
+ onBlur: onSearchBlur
1982
+ }
1983
+ ) : /* @__PURE__ */ jsx18(
1984
+ IconButton2,
1985
+ {
1986
+ size: 3,
1987
+ "aria-label": "Search",
1988
+ "data-test-id": "admin-search-audit-logs-btn",
1989
+ onClick: toggleSearch,
1990
+ children: /* @__PURE__ */ jsx18(MagnifyingGlassIcon, {})
1991
+ }
1992
+ ),
1993
+ onExportCsv && /* @__PURE__ */ jsx18(
1994
+ IconButton2,
1995
+ {
1996
+ size: 3,
1997
+ "aria-label": "Download",
1998
+ "data-test-id": "admin-download-audit-logs-list-btn",
1999
+ onClick: onDownloadClick,
2000
+ disabled: isDownloading,
2001
+ children: isDownloading ? /* @__PURE__ */ jsx18(Spinner, {}) : /* @__PURE__ */ jsx18(DownloadIcon, {})
2002
+ }
2003
+ )
2004
+ ] })
2005
+ ] });
2006
+ };
2007
+ var navbar_default = Navbar;
2008
+
2009
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-WTH7t5USDGMK/lib/admin/views/audit-logs/audit-logs.module.css.js
2010
+ var digest11 = "c6bdb24d2c4e9d994ae81d5fc37488184b38d2e075ed108ded55dc47ce267ab3";
2011
+ var css11 = `._navbar_sfza7_1 {
2012
+ padding: var(--rs-space-4) var(--rs-space-7);
2013
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2014
+ background: var(--rs-color-background-base-primary);
2015
+ display: flex;
2016
+ align-items: center;
2017
+ justify-content: space-between;
2018
+ }
2019
+
2020
+ ._table_sfza7_10 {
2021
+ height: auto;
2022
+ }
2023
+
2024
+ ._table-empty_sfza7_14 {
2025
+ height: 100%;
2026
+ }
2027
+
2028
+ ._empty-state_sfza7_18 {
2029
+ height: 100%;
2030
+ }
2031
+
2032
+ ._empty-state-subheading_sfza7_22 {
2033
+ max-width: 360px;
2034
+ text-wrap: auto;
2035
+ }
2036
+
2037
+ ._name-column_sfza7_27 {
2038
+ padding-left: var(--rs-space-7);
2039
+ min-width: 300px;
2040
+ }
2041
+ ._org-column_sfza7_31 {
2042
+ min-width: 300px;
2043
+ }
2044
+
2045
+ ._table-wrapper_sfza7_35 {
2046
+ flex: 1;
2047
+ height: 100%;
2048
+ }
2049
+
2050
+ ._table-header_sfza7_40 {
2051
+ z-index: 2;
2052
+ }
2053
+
2054
+ ._side-panel_sfza7_44 {
2055
+ position: sticky;
2056
+ top: 0;
2057
+ }
2058
+
2059
+ ._capitalize_sfza7_49 {
2060
+ text-transform: capitalize;
2061
+ }
2062
+
2063
+ ._table-content-container_sfza7_53 {
2064
+ width: 100%;
2065
+ height: 100%;
2066
+ height: calc(100vh - 90px);
2067
+ overflow: auto;
2068
+ position: relative;
2069
+ }
2070
+
2071
+ ._text-overflow_sfza7_61 {
2072
+ width: fit-content;
2073
+ max-width: 180px;
2074
+ overflow: hidden;
2075
+ text-overflow: ellipsis;
2076
+ white-space: nowrap;
2077
+ }
2078
+
2079
+ ._code-block-container_sfza7_69 {
2080
+ padding: 0;
2081
+ }
2082
+ ._code-block_sfza7_69 {
2083
+ max-height: 400px;
2084
+ overflow: auto;
2085
+ }
2086
+ ._sidepanel-link-trigger_sfza7_76 {
2087
+ width: 100%;
2088
+ justify-content: start;
2089
+ border-radius: var(--rs-radius-2);
2090
+ padding: 0 var(--rs-space-3);
2091
+ cursor: pointer;
2092
+ height: 32px;
2093
+ }
2094
+ ._sidepanel-list-link_sfza7_84 {
2095
+ padding: var(--rs-space-2) 0;
2096
+ display: flex;
2097
+ align-items: center;
2098
+ }
2099
+ ._sidepanel-list-link_sfza7_84 a {
2100
+ text-decoration: none;
2101
+ }
2102
+ `;
2103
+ (function() {
2104
+ if (typeof document === "undefined") {
2105
+ return;
2106
+ }
2107
+ if (!document.getElementById(digest11)) {
2108
+ var el = document.createElement("style");
2109
+ el.id = digest11;
2110
+ el.textContent = css11;
2111
+ document.head.appendChild(el);
2112
+ }
2113
+ })();
2114
+ var audit_logs_module_css_default2 = { "navbar": "_navbar_sfza7_1", "table": "_table_sfza7_10", "table-empty": "_table-empty_sfza7_14", "tableEmpty": "_table-empty_sfza7_14", "empty-state": "_empty-state_sfza7_18", "emptyState": "_empty-state_sfza7_18", "empty-state-subheading": "_empty-state-subheading_sfza7_22", "emptyStateSubheading": "_empty-state-subheading_sfza7_22", "name-column": "_name-column_sfza7_27", "nameColumn": "_name-column_sfza7_27", "org-column": "_org-column_sfza7_31", "orgColumn": "_org-column_sfza7_31", "table-wrapper": "_table-wrapper_sfza7_35", "tableWrapper": "_table-wrapper_sfza7_35", "table-header": "_table-header_sfza7_40", "tableHeader": "_table-header_sfza7_40", "side-panel": "_side-panel_sfza7_44", "sidePanel": "_side-panel_sfza7_44", "capitalize": "_capitalize_sfza7_49", "table-content-container": "_table-content-container_sfza7_53", "tableContentContainer": "_table-content-container_sfza7_53", "text-overflow": "_text-overflow_sfza7_61", "textOverflow": "_text-overflow_sfza7_61", "code-block-container": "_code-block-container_sfza7_69", "codeBlockContainer": "_code-block-container_sfza7_69", "code-block": "_code-block_sfza7_69", "codeBlock": "_code-block_sfza7_69", "sidepanel-link-trigger": "_sidepanel-link-trigger_sfza7_76", "sidepanelLinkTrigger": "_sidepanel-link-trigger_sfza7_76", "sidepanel-list-link": "_sidepanel-list-link_sfza7_84", "sidepanelListLink": "_sidepanel-list-link_sfza7_84" };
2115
+
2116
+ // admin/views/audit-logs/columns.tsx
2117
+ import { Badge, Flex as Flex14, Text as Text9 } from "@raystack/apsara";
2118
+ import dayjs2 from "dayjs";
2119
+
2120
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-6akhMrnYE3Ac/lib/admin/views/audit-logs/audit-logs.module.css.js
2121
+ var digest12 = "e45439cd8df4f47a67f6881483b0510bb2d89f295ff3a69f726273e47ecffb84";
2122
+ var css12 = `._navbar_sfza7_1 {
2123
+ padding: var(--rs-space-4) var(--rs-space-7);
2124
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2125
+ background: var(--rs-color-background-base-primary);
2126
+ display: flex;
2127
+ align-items: center;
2128
+ justify-content: space-between;
2129
+ }
2130
+
2131
+ ._table_sfza7_10 {
2132
+ height: auto;
2133
+ }
2134
+
2135
+ ._table-empty_sfza7_14 {
2136
+ height: 100%;
2137
+ }
2138
+
2139
+ ._empty-state_sfza7_18 {
2140
+ height: 100%;
2141
+ }
2142
+
2143
+ ._empty-state-subheading_sfza7_22 {
2144
+ max-width: 360px;
2145
+ text-wrap: auto;
2146
+ }
2147
+
2148
+ ._name-column_sfza7_27 {
2149
+ padding-left: var(--rs-space-7);
2150
+ min-width: 300px;
2151
+ }
2152
+ ._org-column_sfza7_31 {
2153
+ min-width: 300px;
2154
+ }
2155
+
2156
+ ._table-wrapper_sfza7_35 {
2157
+ flex: 1;
2158
+ height: 100%;
2159
+ }
2160
+
2161
+ ._table-header_sfza7_40 {
2162
+ z-index: 2;
2163
+ }
2164
+
2165
+ ._side-panel_sfza7_44 {
2166
+ position: sticky;
2167
+ top: 0;
2168
+ }
2169
+
2170
+ ._capitalize_sfza7_49 {
2171
+ text-transform: capitalize;
2172
+ }
2173
+
2174
+ ._table-content-container_sfza7_53 {
2175
+ width: 100%;
2176
+ height: 100%;
2177
+ height: calc(100vh - 90px);
2178
+ overflow: auto;
2179
+ position: relative;
2180
+ }
2181
+
2182
+ ._text-overflow_sfza7_61 {
2183
+ width: fit-content;
2184
+ max-width: 180px;
2185
+ overflow: hidden;
2186
+ text-overflow: ellipsis;
2187
+ white-space: nowrap;
2188
+ }
2189
+
2190
+ ._code-block-container_sfza7_69 {
2191
+ padding: 0;
2192
+ }
2193
+ ._code-block_sfza7_69 {
2194
+ max-height: 400px;
2195
+ overflow: auto;
2196
+ }
2197
+ ._sidepanel-link-trigger_sfza7_76 {
2198
+ width: 100%;
2199
+ justify-content: start;
2200
+ border-radius: var(--rs-radius-2);
2201
+ padding: 0 var(--rs-space-3);
2202
+ cursor: pointer;
2203
+ height: 32px;
2204
+ }
2205
+ ._sidepanel-list-link_sfza7_84 {
2206
+ padding: var(--rs-space-2) 0;
2207
+ display: flex;
2208
+ align-items: center;
2209
+ }
2210
+ ._sidepanel-list-link_sfza7_84 a {
2211
+ text-decoration: none;
2212
+ }
2213
+ `;
2214
+ (function() {
2215
+ if (typeof document === "undefined") {
2216
+ return;
2217
+ }
2218
+ if (!document.getElementById(digest12)) {
2219
+ var el = document.createElement("style");
2220
+ el.id = digest12;
2221
+ el.textContent = css12;
2222
+ document.head.appendChild(el);
2223
+ }
2224
+ })();
2225
+ var audit_logs_module_css_default3 = { "navbar": "_navbar_sfza7_1", "table": "_table_sfza7_10", "table-empty": "_table-empty_sfza7_14", "tableEmpty": "_table-empty_sfza7_14", "empty-state": "_empty-state_sfza7_18", "emptyState": "_empty-state_sfza7_18", "empty-state-subheading": "_empty-state-subheading_sfza7_22", "emptyStateSubheading": "_empty-state-subheading_sfza7_22", "name-column": "_name-column_sfza7_27", "nameColumn": "_name-column_sfza7_27", "org-column": "_org-column_sfza7_31", "orgColumn": "_org-column_sfza7_31", "table-wrapper": "_table-wrapper_sfza7_35", "tableWrapper": "_table-wrapper_sfza7_35", "table-header": "_table-header_sfza7_40", "tableHeader": "_table-header_sfza7_40", "side-panel": "_side-panel_sfza7_44", "sidePanel": "_side-panel_sfza7_44", "capitalize": "_capitalize_sfza7_49", "table-content-container": "_table-content-container_sfza7_53", "tableContentContainer": "_table-content-container_sfza7_53", "text-overflow": "_text-overflow_sfza7_61", "textOverflow": "_text-overflow_sfza7_61", "code-block-container": "_code-block-container_sfza7_69", "codeBlockContainer": "_code-block-container_sfza7_69", "code-block": "_code-block_sfza7_69", "codeBlock": "_code-block_sfza7_69", "sidepanel-link-trigger": "_sidepanel-link-trigger_sfza7_76", "sidepanelLinkTrigger": "_sidepanel-link-trigger_sfza7_76", "sidepanel-list-link": "_sidepanel-list-link_sfza7_84", "sidepanelListLink": "_sidepanel-list-link_sfza7_84" };
2226
+
2227
+ // admin/views/audit-logs/actor-cell.tsx
2228
+ import { Avatar, Flex as Flex13, getAvatarColor, Text as Text8 } from "@raystack/apsara";
2229
+
2230
+ // admin/assets/images/system.jpg
2231
+ var system_default = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wEEEAAMAAwADAAMAAwADAANAA4ADgANABIAEwARABMAEgAbABgAFgAWABgAGwAoAB0AHwAdAB8AHQAoAD0AJgAtACYAJgAtACYAPQA2AEIANQAyADUAQgA2AGEATABEAEQATABhAHAAXgBZAF4AcACIAHoAegCIAKsAowCrAOAA4AEtEQAMAAwADAAMAAwADAANAA4ADgANABIAEwARABMAEgAbABgAFgAWABgAGwAoAB0AHwAdAB8AHQAoAD0AJgAtACYAJgAtACYAPQA2AEIANQAyADUAQgA2AGEATABEAEQATABhAHAAXgBZAF4AcACIAHoAegCIAKsAowCrAOAA4AEt/8IAEQgA0gEYAwEiAAIRAQMRAf/EADMAAQACAwEBAAAAAAAAAAAAAAAFBgMEBwIBAQEAAwEBAQAAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAADpAw4gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD5XpmxKBgtboyiTELG8e60AAAAAAAAAAAAAVWFomuu/o2S/S5Nudo+xThmPu8SnmF9rFbtbuahXzKn0VqAAAAAAAAAApds4dfTB0KG6HfHcw4PtvJyPn3fL1kx/dL7FVsfrHs4tf9Cr5ej2tob+FAgAAAAAAAAPhTOZ9SjNuSWktf5Xztz1TozfXo3rl3vTbqH3m8hebyrE7OWXj/ZYGk6d2qlq4+z6M+gAAAAAAABFylbtza/x80+ez86uNT19zzIX/U7I5pj6HQK9X2albDOFK9XmkU0vfqJmXmRkpFbuXBLjh+qAAAAAAAAVW1Ve/HoZ9Dfv4sbETtF29u61fUdG/R+fYvhf6nGpiy5qp8hf7JXp/LyofcipXPxZ8cn2gAAAAAAACKlfk0oW/Zoy/mRvOOoRE7c/b0ft6vt4Tb28Ee8mW/15pb3l8V8WuWPDN59HsZ+qAAAAAAAAABpRlgx6cdZ0rBpuOF+yxEXn3/UVyZcGZTLKY8tfWCOgAAAAAAAAAAABq7S+cNrz/iOWB9zeWJjZD0dIRoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//xABCEAACAQMCAwQDDQUIAwAAAAABAgMABBEFIQYSMUBBUWEQE3EVIiMyM0NSVHKBkZKxFGJworI1QmNzgoOh0qPR4v/aAAgBAQABPwD+HrMqgsxAA6knAq74q0a1yBOZ3HdCOepeOV+Y04/7sn/XNDja7+oW33zNUPGUp+U00H/KmB/qq34p0uXAmMts3+MmB+YZFRyxyoskbq6HoykEHtmscU2unF4LcCe4H5Eq/wBTv9TObucuv0OiD2LXn3DvNQ2l3Pj1NvK/2I2ahour4z+wXH5alsryD5W1mTzaNgKjuJUHvX2/EVZak9rJzwu1u5O5j+KftLWncRJLypeciE9JV+If+vauI+JmZnsdPkwvSWZf0WthWk8MXuo4ml+Ag+mw3P2RVjw7pViFKW4kkHzkvvmoAAYAwPR1q90TTL7JltUD/TT3jVqnCl3ZhpbUmeL/AMgqC4eBtt18K0bXRbhY5Wzbf8xf/NKwYAgggjII7PxZrZs4/wBgt3xNKmZGHVENbKO4bfcBXDnDShUvb+Pc7xQt+rU06Lsu9GaRu/HsrJPUn0AnxoSOO/PtoSjv2rX+HEvFe7s0An6sg6SVDK9vJ39cEVw7qgRo7GRvg3yYG8D1Kdmu7mOztprmU4SJCxq5uZbu4mupjl5HLHyJ7vurhfSkup3vbofAQHYHo8lPM8pPcvh/7oUPSPSrFa4s0pVI1GBdnIWceZ6NVnK+DGHKuDzRt3qw3BrTL0ahYw3HRmGHHg67MOy8a3ZjsYLVTvPJlvsJRDEoirlidh4k1YW62tpbW6/FjT8WO7MaHoHoHoHpnhjuYJYJBlJEKsPI1LFLZ3LxSfHifBrhW6xPd2pOzqs6f0t2QkKCSdhWq2dnqlwkswZvVoUQZwKttJsorlZkiw0fTc9aSrm8trOL1k8oRe7xPsFT8VAHFtak/vSNipOI9Ufo8SfZSvdnVT1v5f5R+gpdZ1HvvJfxpNYvvrcv4iotcvl+eDfaUVDxA3zsAI8UNW15b3a5ifJHVTsR6NU0qzuZVuZYstgKasLKztbmGeJWR0Vl2OxDUrBgCOx6nMUjWMdXO/sFDLHAqPYt7TTypDG8jnCopYnyFXl5Lf3DTSexV+ivhVtY3F0cQQu58hUmganGhY2rEeRBp42QkEYI9CAmrbSdSmUOls/KehOF/WprW8tPl4GQeJ6fiKt7h4pFkjbDKdqtbhbqCOZduYbjwNTjmiceVQKDkmrRzloyenY9VfN0F+igqJsOpqI5UGtXfGnXXmmK060a8uYoV25m3PgKAtNLte6OJKt9csriURKzKT05hgGuIdPjmtXu0UCSPd/NaK71w5pscnNdSrkK2EBq81a0snEcjMX+iozVtd2uowty4dDsysK1Sz9zr0ovybjmT2VoTE2jjwlNNupqBsMRULYuF8+x6mcXr+xaL4XNRfJr7K1n+z5/9P61oN1Da30bykBSpXPhmuI9Qhl9TBDIHCksxBpJSrAjqDkVdatZvpUrCRS0kRUJ35IonetB1C0isfVyTKjRlicnGQTmr26/abqeYdHckVoN9HbXeJXCpIvLk+NcSXsFxPCkTh/VoQzDxNcMSGSzuCe6fH8gpuhoN74+01bMTMhPj2PWEK3XN4oKY7VBvCh/drU4zJY3Sjr6on8N6Vq5q5q565q5zXNXPRYmuGY+TS1Y9ZJXamPvTSSZYmrIc0qdj1S2MyIyjcHH41LGyEhgQatATbJ5ZFOoOQRtVzA9pPJAw+IcDzHca5q5q565656565qjV5XWONcu5CqPEmrK3FpaQW4+bjC1cv6uCVvBTUW2K0yM7yH2DsZAIIIyDU9rDcJyyLkjoR1qKwkt0kBxyk5FSRkVf6dBfJhwVcfFcdRV3pl5Zkl0507pE3H3+FDfoc1vWDWD6LOwu75sW8LP+90UffWkaJDp3wrn1lwRjm7l8l9E9rLcxcqYxnfNQ6SwYGRgB5UiLGoVRgDspGRipbcNmpISudqaOpdOs5jmW2iY+JUV7i6Z9Sh/LXuLpv1OH8te4mm/U4vy1DpOnREMlnCD48gpAqgADAHdWajBkbApVCgAdpkhWQbVLbEd1MmKxQ9ANZqNHlbCj2mooljXA6957WcMNxUtupp7ciihFcppInc+9UmorI9ZD9wpEVBhRgduKKeor1ER/uChDEOiCgMfw/8A/8QAIxEAAgICAgEEAwAAAAAAAAAAAAECERIhMFEDMUFQYRATcf/aAAgBAgEBPwD4umzCQ4Nc8YdjkkXLpmXaNSQ448kFeyTIxIoxi/Yl4V6xGrVM9Hxx1EVtkYsujP6FJMnC9o8kHF3XFFWyXR4I2V1HQ43sx9krZKH1TLtE6lBrij6kjwyo/Z0OZmOaZloctPiWhtEZUKVlljkOQ5ciqX9NoyfZb/Dd82fZaL+f/8QAKREAAgIBAwMCBgMAAAAAAAAAAQIAAwQRIUESMDETYQUUIlBSkSNCU//aAAgBAwEBPwD7WFJ4nptCjDjvqmm5hedfvA5gZW8xl07iDkzIyFqG/wCo+Va/OgnUx5MWxx4YyrKPh4jB1h2PbPxKhX9JdSZaz2ueSYuFcfIAgwLPzWfI2jwRHosr8iV5Yx1LMCVG+0oy6csdVZ35B7WW/RjufaYi6uznzMUKiPYRDlWEkgbSm0OssyWDEIJTf6uquJkqA1qT4e4reojltD2s4a47THGhaY6Cyl1iUBU6ZVQKgd4mOEdm18wY4FnWDMk/y2zGVvmawPz7ToHUqeY2G1T6jcTGu9JiG8GBlYaggzabS/IrpU76ngQK9xbTyZiYJrfrfuW42upSa2V8kT1rv9G/cN1p/u37grexttSZRSKV9+89av5EOIddiIMMctErRB9I+/f/2Q==";
2232
+
2233
+ // admin/assets/icons/KeyIcon.tsx
2234
+ import { jsx as jsx19 } from "react/jsx-runtime";
2235
+ function KeyIcon(props) {
2236
+ return /* @__PURE__ */ jsx19(
2237
+ "svg",
2238
+ __spreadProps(__spreadValues({
2239
+ xmlns: "http://www.w3.org/2000/svg",
2240
+ width: "16",
2241
+ height: "16",
2242
+ viewBox: "0 0 16 16",
2243
+ fill: "none"
2244
+ }, props), {
2245
+ children: /* @__PURE__ */ jsx19(
2246
+ "path",
2247
+ {
2248
+ d: "M10.5 3.5C11.6046 3.5 12.5 4.39543 12.5 5.5M14.5 5.5C14.5 7.70914 12.7091 9.5 10.5 9.5C10.2662 9.5 10.037 9.47994 9.8142 9.44144C9.43885 9.37658 9.04134 9.45866 8.772 9.728L7 11.5H5.5V13H4V14.5H1.5V12.6213C1.5 12.2235 1.65804 11.842 1.93934 11.5607L6.272 7.228C6.54134 6.95866 6.62342 6.56115 6.55856 6.1858C6.52006 5.96297 6.5 5.73383 6.5 5.5C6.5 3.29086 8.29086 1.5 10.5 1.5C12.7091 1.5 14.5 3.29086 14.5 5.5Z",
2249
+ stroke: "currentColor",
2250
+ strokeLinecap: "round",
2251
+ strokeLinejoin: "round"
2252
+ }
2253
+ )
2254
+ })
2255
+ );
2256
+ }
2257
+
2258
+ // admin/views/audit-logs/actor-cell.tsx
2259
+ import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
2260
+ function ActorCell({
2261
+ size = "large",
2262
+ value,
2263
+ maxLength
2264
+ }) {
2265
+ var _a, _b;
2266
+ const name = getAuditLogActorName(value, maxLength);
2267
+ const isSystem = value.type === ACTOR_TYPES.SYSTEM;
2268
+ const isServiceUser = value.type === ACTOR_TYPES.SERVICE_USER;
2269
+ return /* @__PURE__ */ jsxs12(Flex13, { gap: size === "large" ? 4 : 3, align: "center", children: [
2270
+ /* @__PURE__ */ jsx20(
2271
+ Avatar,
2272
+ {
2273
+ size: size === "large" ? 3 : 1,
2274
+ fallback: isServiceUser ? /* @__PURE__ */ jsx20(KeyIcon, { width: 12, height: 12 }) : (_a = name == null ? void 0 : name[0]) == null ? void 0 : _a.toUpperCase(),
2275
+ color: isServiceUser ? "neutral" : getAvatarColor((_b = value == null ? void 0 : value.id) != null ? _b : ""),
2276
+ radius: "full",
2277
+ src: isSystem ? system_default : void 0
2278
+ }
2279
+ ),
2280
+ size === "large" ? /* @__PURE__ */ jsx20(Text8, { size: "regular", children: name }) : name
2281
+ ] });
2282
+ }
2283
+
2284
+ // admin/views/audit-logs/columns.tsx
2285
+ import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
2286
+ var getColumns5 = ({
2287
+ groupCountMap
2288
+ }) => {
2289
+ return [
2290
+ {
2291
+ accessorKey: "actor",
2292
+ header: "Actor",
2293
+ classNames: {
2294
+ cell: audit_logs_module_css_default3["name-column"],
2295
+ header: audit_logs_module_css_default3["name-column"]
2296
+ },
2297
+ enableColumnFilter: true,
2298
+ cell: ({ getValue }) => /* @__PURE__ */ jsx21(ActorCell, { value: getValue() })
2299
+ },
2300
+ {
2301
+ accessorKey: "actorType",
2302
+ header: "Actor Type",
2303
+ enableColumnFilter: true,
2304
+ defaultHidden: true,
2305
+ cell: () => null,
2306
+ filterType: "multiselect",
2307
+ filterOptions: [
2308
+ { label: "User", value: ACTOR_TYPES.USER },
2309
+ { label: "Service User", value: ACTOR_TYPES.SERVICE_USER },
2310
+ { label: "System", value: ACTOR_TYPES.SYSTEM }
2311
+ ]
2312
+ },
2313
+ {
2314
+ accessorKey: "orgName",
2315
+ header: "Organization",
2316
+ classNames: {
2317
+ cell: audit_logs_module_css_default3["org-column"],
2318
+ header: audit_logs_module_css_default3["org-column"]
2319
+ },
2320
+ cell: ({ getValue }) => {
2321
+ return /* @__PURE__ */ jsx21(Text9, { size: "regular", children: getValue() || "-" });
2322
+ },
2323
+ enableColumnFilter: true
2324
+ },
2325
+ {
2326
+ accessorKey: "event",
2327
+ header: "Action",
2328
+ cell: ({ getValue }) => {
2329
+ const value = getValue();
2330
+ const color = getActionBadgeColor(value);
2331
+ return /* @__PURE__ */ jsx21(Badge, { variant: color, children: value });
2332
+ },
2333
+ enableColumnFilter: true,
2334
+ enableSorting: true
2335
+ },
2336
+ {
2337
+ accessorKey: "resource",
2338
+ header: "Resource",
2339
+ enableColumnFilter: true,
2340
+ cell: ({ getValue }) => {
2341
+ var _a;
2342
+ const value = getValue();
2343
+ return /* @__PURE__ */ jsxs13(Flex14, { gap: 1, direction: "column", children: [
2344
+ /* @__PURE__ */ jsx21(Text9, { size: "small", weight: "medium", children: value.name || "-" }),
2345
+ /* @__PURE__ */ jsx21(Text9, { size: "small", variant: "secondary", children: (_a = value.type.toLowerCase()) != null ? _a : "-" })
2346
+ ] });
2347
+ }
2348
+ },
2349
+ {
2350
+ accessorKey: "resourceType",
2351
+ header: "Resource Type",
2352
+ enableColumnFilter: true,
2353
+ defaultHidden: true,
2354
+ cell: () => null
2355
+ },
2356
+ {
2357
+ accessorKey: "occurredAt",
2358
+ header: "Timestamp",
2359
+ filterType: "date",
2360
+ cell: ({ getValue }) => {
2361
+ const value = getValue();
2362
+ if (isNullTimestamp(value)) {
2363
+ return /* @__PURE__ */ jsx21(Text9, { children: "-" });
2364
+ }
2365
+ const date = dayjs2(timestampToDate(value));
2366
+ return /* @__PURE__ */ jsxs13(Flex14, { gap: 1, direction: "column", children: [
2367
+ /* @__PURE__ */ jsx21(Text9, { size: "small", weight: "medium", children: date.format("DD MMM YYYY") }),
2368
+ /* @__PURE__ */ jsx21(Text9, { size: "small", variant: "secondary", children: date.format("hh:mm A") })
2369
+ ] });
2370
+ },
2371
+ enableHiding: true,
2372
+ enableSorting: true
2373
+ }
2374
+ ];
2375
+ };
2376
+
2377
+ // admin/views/audit-logs/index.tsx
2378
+ import { useInfiniteQuery as useInfiniteQuery2 } from "@connectrpc/connect-query";
2379
+ import {
2380
+ AdminServiceQueries as AdminServiceQueries2
2381
+ } from "@raystack/proton/frontier";
2382
+
2383
+ // admin/views/audit-logs/sidepanel-details.tsx
2384
+ import { Flex as Flex16, IconButton as IconButton4, SidePanel } from "@raystack/apsara";
2385
+ import { List as List3 } from "@raystack/apsara";
2386
+
2387
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-lIFL5lHUWROY/lib/admin/views/audit-logs/audit-logs.module.css.js
2388
+ var digest13 = "a2d5ad33c6a1b2b7e338a85b32fff3dec39f0f81db28afbf6e8f99e083327e73";
2389
+ var css13 = `._navbar_sfza7_1 {
2390
+ padding: var(--rs-space-4) var(--rs-space-7);
2391
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2392
+ background: var(--rs-color-background-base-primary);
2393
+ display: flex;
2394
+ align-items: center;
2395
+ justify-content: space-between;
2396
+ }
2397
+
2398
+ ._table_sfza7_10 {
2399
+ height: auto;
2400
+ }
2401
+
2402
+ ._table-empty_sfza7_14 {
2403
+ height: 100%;
2404
+ }
2405
+
2406
+ ._empty-state_sfza7_18 {
2407
+ height: 100%;
2408
+ }
2409
+
2410
+ ._empty-state-subheading_sfza7_22 {
2411
+ max-width: 360px;
2412
+ text-wrap: auto;
2413
+ }
2414
+
2415
+ ._name-column_sfza7_27 {
2416
+ padding-left: var(--rs-space-7);
2417
+ min-width: 300px;
2418
+ }
2419
+ ._org-column_sfza7_31 {
2420
+ min-width: 300px;
2421
+ }
2422
+
2423
+ ._table-wrapper_sfza7_35 {
2424
+ flex: 1;
2425
+ height: 100%;
2426
+ }
2427
+
2428
+ ._table-header_sfza7_40 {
2429
+ z-index: 2;
2430
+ }
2431
+
2432
+ ._side-panel_sfza7_44 {
2433
+ position: sticky;
2434
+ top: 0;
2435
+ }
2436
+
2437
+ ._capitalize_sfza7_49 {
2438
+ text-transform: capitalize;
2439
+ }
2440
+
2441
+ ._table-content-container_sfza7_53 {
2442
+ width: 100%;
2443
+ height: 100%;
2444
+ height: calc(100vh - 90px);
2445
+ overflow: auto;
2446
+ position: relative;
2447
+ }
2448
+
2449
+ ._text-overflow_sfza7_61 {
2450
+ width: fit-content;
2451
+ max-width: 180px;
2452
+ overflow: hidden;
2453
+ text-overflow: ellipsis;
2454
+ white-space: nowrap;
2455
+ }
2456
+
2457
+ ._code-block-container_sfza7_69 {
2458
+ padding: 0;
2459
+ }
2460
+ ._code-block_sfza7_69 {
2461
+ max-height: 400px;
2462
+ overflow: auto;
2463
+ }
2464
+ ._sidepanel-link-trigger_sfza7_76 {
2465
+ width: 100%;
2466
+ justify-content: start;
2467
+ border-radius: var(--rs-radius-2);
2468
+ padding: 0 var(--rs-space-3);
2469
+ cursor: pointer;
2470
+ height: 32px;
2471
+ }
2472
+ ._sidepanel-list-link_sfza7_84 {
2473
+ padding: var(--rs-space-2) 0;
2474
+ display: flex;
2475
+ align-items: center;
2476
+ }
2477
+ ._sidepanel-list-link_sfza7_84 a {
2478
+ text-decoration: none;
2479
+ }
2480
+ `;
2481
+ (function() {
2482
+ if (typeof document === "undefined") {
2483
+ return;
2484
+ }
2485
+ if (!document.getElementById(digest13)) {
2486
+ var el = document.createElement("style");
2487
+ el.id = digest13;
2488
+ el.textContent = css13;
2489
+ document.head.appendChild(el);
2490
+ }
2491
+ })();
2492
+ var audit_logs_module_css_default4 = { "navbar": "_navbar_sfza7_1", "table": "_table_sfza7_10", "table-empty": "_table-empty_sfza7_14", "tableEmpty": "_table-empty_sfza7_14", "empty-state": "_empty-state_sfza7_18", "emptyState": "_empty-state_sfza7_18", "empty-state-subheading": "_empty-state-subheading_sfza7_22", "emptyStateSubheading": "_empty-state-subheading_sfza7_22", "name-column": "_name-column_sfza7_27", "nameColumn": "_name-column_sfza7_27", "org-column": "_org-column_sfza7_31", "orgColumn": "_org-column_sfza7_31", "table-wrapper": "_table-wrapper_sfza7_35", "tableWrapper": "_table-wrapper_sfza7_35", "table-header": "_table-header_sfza7_40", "tableHeader": "_table-header_sfza7_40", "side-panel": "_side-panel_sfza7_44", "sidePanel": "_side-panel_sfza7_44", "capitalize": "_capitalize_sfza7_49", "table-content-container": "_table-content-container_sfza7_53", "tableContentContainer": "_table-content-container_sfza7_53", "text-overflow": "_text-overflow_sfza7_61", "textOverflow": "_text-overflow_sfza7_61", "code-block-container": "_code-block-container_sfza7_69", "codeBlockContainer": "_code-block-container_sfza7_69", "code-block": "_code-block_sfza7_69", "codeBlock": "_code-block_sfza7_69", "sidepanel-link-trigger": "_sidepanel-link-trigger_sfza7_76", "sidepanelLinkTrigger": "_sidepanel-link-trigger_sfza7_76", "sidepanel-list-link": "_sidepanel-list-link_sfza7_84", "sidepanelListLink": "_sidepanel-list-link_sfza7_84" };
2493
+
2494
+ // admin/views/audit-logs/sidepanel-details.tsx
2495
+ import dayjs3 from "dayjs";
2496
+
2497
+ // admin/assets/icons/MapIcon.tsx
2498
+ import { jsx as jsx22 } from "react/jsx-runtime";
2499
+ function MapIcon(props) {
2500
+ return /* @__PURE__ */ jsx22(
2501
+ "svg",
2502
+ __spreadProps(__spreadValues({
2503
+ xmlns: "http://www.w3.org/2000/svg",
2504
+ width: "16",
2505
+ height: "16",
2506
+ viewBox: "0 0 16 16",
2507
+ fill: "none"
2508
+ }, props), {
2509
+ children: /* @__PURE__ */ jsx22(
2510
+ "path",
2511
+ {
2512
+ d: "M6 4.50001V10M10 6.00001V11.5M10.3353 13.832L13.5853 12.2073C13.8393 12.0807 14 11.8207 14 11.5367V3.21334C14 2.65601 13.4133 2.29334 12.9147 2.54267L10.3353 3.83201C10.124 3.93801 9.87533 3.93801 9.66467 3.83201L6.33533 2.16801C6.23121 2.11596 6.1164 2.08887 6 2.08887C5.8836 2.08887 5.76879 2.11596 5.66467 2.16801L2.41467 3.79268C2.16 3.92001 2 4.18001 2 4.46334V12.7867C2 13.344 2.58667 13.7067 3.08533 13.4573L5.66467 12.168C5.876 12.062 6.12467 12.062 6.33533 12.168L9.66467 13.8327C9.876 13.938 10.1247 13.938 10.3353 13.8327V13.832Z",
2513
+ stroke: "currentColor",
2514
+ strokeLinecap: "round",
2515
+ strokeLinejoin: "round"
2516
+ }
2517
+ )
2518
+ })
2519
+ );
2520
+ }
2521
+
2522
+ // admin/views/audit-logs/sidepanel-log-dialog.tsx
2523
+ import { Dialog, IconButton as IconButton3, CodeBlock } from "@raystack/apsara";
2524
+
2525
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-K9Qm1tyHqhY9/lib/admin/views/audit-logs/audit-logs.module.css.js
2526
+ var digest14 = "770d138f7627f857ec5d86c006a49e0d21adc87b6bb5e961720c146c976a559a";
2527
+ var css14 = `._navbar_sfza7_1 {
2528
+ padding: var(--rs-space-4) var(--rs-space-7);
2529
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2530
+ background: var(--rs-color-background-base-primary);
2531
+ display: flex;
2532
+ align-items: center;
2533
+ justify-content: space-between;
2534
+ }
2535
+
2536
+ ._table_sfza7_10 {
2537
+ height: auto;
2538
+ }
2539
+
2540
+ ._table-empty_sfza7_14 {
2541
+ height: 100%;
2542
+ }
2543
+
2544
+ ._empty-state_sfza7_18 {
2545
+ height: 100%;
2546
+ }
2547
+
2548
+ ._empty-state-subheading_sfza7_22 {
2549
+ max-width: 360px;
2550
+ text-wrap: auto;
2551
+ }
2552
+
2553
+ ._name-column_sfza7_27 {
2554
+ padding-left: var(--rs-space-7);
2555
+ min-width: 300px;
2556
+ }
2557
+ ._org-column_sfza7_31 {
2558
+ min-width: 300px;
2559
+ }
2560
+
2561
+ ._table-wrapper_sfza7_35 {
2562
+ flex: 1;
2563
+ height: 100%;
2564
+ }
2565
+
2566
+ ._table-header_sfza7_40 {
2567
+ z-index: 2;
2568
+ }
2569
+
2570
+ ._side-panel_sfza7_44 {
2571
+ position: sticky;
2572
+ top: 0;
2573
+ }
2574
+
2575
+ ._capitalize_sfza7_49 {
2576
+ text-transform: capitalize;
2577
+ }
2578
+
2579
+ ._table-content-container_sfza7_53 {
2580
+ width: 100%;
2581
+ height: 100%;
2582
+ height: calc(100vh - 90px);
2583
+ overflow: auto;
2584
+ position: relative;
2585
+ }
2586
+
2587
+ ._text-overflow_sfza7_61 {
2588
+ width: fit-content;
2589
+ max-width: 180px;
2590
+ overflow: hidden;
2591
+ text-overflow: ellipsis;
2592
+ white-space: nowrap;
2593
+ }
2594
+
2595
+ ._code-block-container_sfza7_69 {
2596
+ padding: 0;
2597
+ }
2598
+ ._code-block_sfza7_69 {
2599
+ max-height: 400px;
2600
+ overflow: auto;
2601
+ }
2602
+ ._sidepanel-link-trigger_sfza7_76 {
2603
+ width: 100%;
2604
+ justify-content: start;
2605
+ border-radius: var(--rs-radius-2);
2606
+ padding: 0 var(--rs-space-3);
2607
+ cursor: pointer;
2608
+ height: 32px;
2609
+ }
2610
+ ._sidepanel-list-link_sfza7_84 {
2611
+ padding: var(--rs-space-2) 0;
2612
+ display: flex;
2613
+ align-items: center;
2614
+ }
2615
+ ._sidepanel-list-link_sfza7_84 a {
2616
+ text-decoration: none;
2617
+ }
2618
+ `;
2619
+ (function() {
2620
+ if (typeof document === "undefined") {
2621
+ return;
2622
+ }
2623
+ if (!document.getElementById(digest14)) {
2624
+ var el = document.createElement("style");
2625
+ el.id = digest14;
2626
+ el.textContent = css14;
2627
+ document.head.appendChild(el);
2628
+ }
2629
+ })();
2630
+ var audit_logs_module_css_default5 = { "navbar": "_navbar_sfza7_1", "table": "_table_sfza7_10", "table-empty": "_table-empty_sfza7_14", "tableEmpty": "_table-empty_sfza7_14", "empty-state": "_empty-state_sfza7_18", "emptyState": "_empty-state_sfza7_18", "empty-state-subheading": "_empty-state-subheading_sfza7_22", "emptyStateSubheading": "_empty-state-subheading_sfza7_22", "name-column": "_name-column_sfza7_27", "nameColumn": "_name-column_sfza7_27", "org-column": "_org-column_sfza7_31", "orgColumn": "_org-column_sfza7_31", "table-wrapper": "_table-wrapper_sfza7_35", "tableWrapper": "_table-wrapper_sfza7_35", "table-header": "_table-header_sfza7_40", "tableHeader": "_table-header_sfza7_40", "side-panel": "_side-panel_sfza7_44", "sidePanel": "_side-panel_sfza7_44", "capitalize": "_capitalize_sfza7_49", "table-content-container": "_table-content-container_sfza7_53", "tableContentContainer": "_table-content-container_sfza7_53", "text-overflow": "_text-overflow_sfza7_61", "textOverflow": "_text-overflow_sfza7_61", "code-block-container": "_code-block-container_sfza7_69", "codeBlockContainer": "_code-block-container_sfza7_69", "code-block": "_code-block_sfza7_69", "codeBlock": "_code-block_sfza7_69", "sidepanel-link-trigger": "_sidepanel-link-trigger_sfza7_76", "sidepanelLinkTrigger": "_sidepanel-link-trigger_sfza7_76", "sidepanel-list-link": "_sidepanel-list-link_sfza7_84", "sidepanelListLink": "_sidepanel-list-link_sfza7_84" };
2631
+
2632
+ // admin/assets/icons/JsonIcon.tsx
2633
+ import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
2634
+ function JsonIcon(props) {
2635
+ return /* @__PURE__ */ jsxs14(
2636
+ "svg",
2637
+ __spreadProps(__spreadValues({
2638
+ xmlns: "http://www.w3.org/2000/svg",
2639
+ width: "16",
2640
+ height: "16",
2641
+ viewBox: "0 0 16 16",
2642
+ fill: "none"
2643
+ }, props), {
2644
+ children: [
2645
+ /* @__PURE__ */ jsx23(
2646
+ "path",
2647
+ {
2648
+ d: "M9.99996 1.33337H3.99996C3.64634 1.33337 3.3072 1.47385 3.05715 1.7239C2.8071 1.97395 2.66663 2.31309 2.66663 2.66671V13.3334C2.66663 13.687 2.8071 14.0261 3.05715 14.2762C3.3072 14.5262 3.64634 14.6667 3.99996 14.6667H12C12.3536 14.6667 12.6927 14.5262 12.9428 14.2762C13.1928 14.0261 13.3333 13.687 13.3333 13.3334V4.66671L9.99996 1.33337Z",
2649
+ stroke: "currentColor",
2650
+ strokeLinecap: "round",
2651
+ strokeLinejoin: "round"
2652
+ }
2653
+ ),
2654
+ /* @__PURE__ */ jsx23(
2655
+ "path",
2656
+ {
2657
+ d: "M9.33337 1.33337V4.00004C9.33337 4.35366 9.47385 4.6928 9.7239 4.94285C9.97395 5.1929 10.3131 5.33337 10.6667 5.33337H13.3334",
2658
+ stroke: "currentColor",
2659
+ strokeLinecap: "round",
2660
+ strokeLinejoin: "round"
2661
+ }
2662
+ ),
2663
+ /* @__PURE__ */ jsx23(
2664
+ "path",
2665
+ {
2666
+ d: "M6.66671 8C6.4899 8 6.32033 8.07024 6.1953 8.19526C6.07028 8.32029 6.00004 8.48986 6.00004 8.66667V9.33333C6.00004 9.51014 5.9298 9.67971 5.80478 9.80474C5.67975 9.92976 5.51019 10 5.33337 10C5.51019 10 5.67975 10.0702 5.80478 10.1953C5.9298 10.3203 6.00004 10.4899 6.00004 10.6667V11.3333C6.00004 11.5101 6.07028 11.6797 6.1953 11.8047C6.32033 11.9298 6.4899 12 6.66671 12",
2667
+ stroke: "currentColor",
2668
+ strokeLinecap: "round",
2669
+ strokeLinejoin: "round"
2670
+ }
2671
+ ),
2672
+ /* @__PURE__ */ jsx23(
2673
+ "path",
2674
+ {
2675
+ d: "M9.33337 12C9.51019 12 9.67975 11.9298 9.80478 11.8047C9.9298 11.6797 10 11.5101 10 11.3333V10.6667C10 10.4899 10.0703 10.3203 10.1953 10.1953C10.3203 10.0702 10.4899 10 10.6667 10C10.4899 10 10.3203 9.92976 10.1953 9.80474C10.0703 9.67971 10 9.51014 10 9.33333V8.66667C10 8.48986 9.9298 8.32029 9.80478 8.19526C9.67975 8.07024 9.51019 8 9.33337 8",
2676
+ stroke: "currentColor",
2677
+ strokeLinecap: "round",
2678
+ strokeLinejoin: "round"
2679
+ }
2680
+ )
2681
+ ]
2682
+ })
2683
+ );
2684
+ }
2685
+
2686
+ // admin/views/audit-logs/sidepanel-log-dialog.tsx
2687
+ import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
2688
+ function SidePanelLogDialog(props) {
2689
+ return /* @__PURE__ */ jsxs15(Dialog, { children: [
2690
+ /* @__PURE__ */ jsx24(Dialog.Trigger, { asChild: true, children: /* @__PURE__ */ jsx24(
2691
+ IconButton3,
2692
+ {
2693
+ size: 3,
2694
+ "data-test-id": "show-audit-json-icon",
2695
+ children: /* @__PURE__ */ jsx24(JsonIcon, {})
2696
+ },
2697
+ "show-audit-json-icon"
2698
+ ) }),
2699
+ /* @__PURE__ */ jsxs15(
2700
+ Dialog.Content,
2701
+ {
2702
+ width: 600,
2703
+ ariaLabel: "Basic Dialog",
2704
+ ariaDescription: "A simple dialog example",
2705
+ children: [
2706
+ /* @__PURE__ */ jsxs15(Dialog.Header, { children: [
2707
+ /* @__PURE__ */ jsx24(Dialog.Title, { children: "Log entry" }),
2708
+ /* @__PURE__ */ jsx24(Dialog.CloseButton, { "data-test-id": "close-audit-json-dialog-icon" })
2709
+ ] }),
2710
+ /* @__PURE__ */ jsx24(Dialog.Body, { className: audit_logs_module_css_default5["code-block-container"], children: /* @__PURE__ */ jsx24(CodeBlock, { children: /* @__PURE__ */ jsxs15(CodeBlock.Content, { children: [
2711
+ /* @__PURE__ */ jsx24(CodeBlock.Code, { language: "jsx", className: audit_logs_module_css_default5["code-block"], children: auditLogToJson(props) }),
2712
+ /* @__PURE__ */ jsx24(
2713
+ CodeBlock.CopyButton,
2714
+ {
2715
+ variant: "floating",
2716
+ "data-test-id": "copy-audit-json-button"
2717
+ }
2718
+ )
2719
+ ] }) }) })
2720
+ ]
2721
+ }
2722
+ )
2723
+ ] }, "show-audit-json-dialog");
2724
+ }
2725
+
2726
+ // admin/views/audit-logs/sidepanel-list-link.tsx
2727
+ import { Button, List } from "@raystack/apsara";
2728
+ import { Link as Link2 } from "react-router-dom";
2729
+
2730
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-yUD0HrwJU1NB/lib/admin/views/audit-logs/audit-logs.module.css.js
2731
+ var digest15 = "1371415a7c05b04538528d7f8ee075395bb466caecc50e13e8b1f3b4b029109f";
2732
+ var css15 = `._navbar_sfza7_1 {
2733
+ padding: var(--rs-space-4) var(--rs-space-7);
2734
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2735
+ background: var(--rs-color-background-base-primary);
2736
+ display: flex;
2737
+ align-items: center;
2738
+ justify-content: space-between;
2739
+ }
2740
+
2741
+ ._table_sfza7_10 {
2742
+ height: auto;
2743
+ }
2744
+
2745
+ ._table-empty_sfza7_14 {
2746
+ height: 100%;
2747
+ }
2748
+
2749
+ ._empty-state_sfza7_18 {
2750
+ height: 100%;
2751
+ }
2752
+
2753
+ ._empty-state-subheading_sfza7_22 {
2754
+ max-width: 360px;
2755
+ text-wrap: auto;
2756
+ }
2757
+
2758
+ ._name-column_sfza7_27 {
2759
+ padding-left: var(--rs-space-7);
2760
+ min-width: 300px;
2761
+ }
2762
+ ._org-column_sfza7_31 {
2763
+ min-width: 300px;
2764
+ }
2765
+
2766
+ ._table-wrapper_sfza7_35 {
2767
+ flex: 1;
2768
+ height: 100%;
2769
+ }
2770
+
2771
+ ._table-header_sfza7_40 {
2772
+ z-index: 2;
2773
+ }
2774
+
2775
+ ._side-panel_sfza7_44 {
2776
+ position: sticky;
2777
+ top: 0;
2778
+ }
2779
+
2780
+ ._capitalize_sfza7_49 {
2781
+ text-transform: capitalize;
2782
+ }
2783
+
2784
+ ._table-content-container_sfza7_53 {
2785
+ width: 100%;
2786
+ height: 100%;
2787
+ height: calc(100vh - 90px);
2788
+ overflow: auto;
2789
+ position: relative;
2790
+ }
2791
+
2792
+ ._text-overflow_sfza7_61 {
2793
+ width: fit-content;
2794
+ max-width: 180px;
2795
+ overflow: hidden;
2796
+ text-overflow: ellipsis;
2797
+ white-space: nowrap;
2798
+ }
2799
+
2800
+ ._code-block-container_sfza7_69 {
2801
+ padding: 0;
2802
+ }
2803
+ ._code-block_sfza7_69 {
2804
+ max-height: 400px;
2805
+ overflow: auto;
2806
+ }
2807
+ ._sidepanel-link-trigger_sfza7_76 {
2808
+ width: 100%;
2809
+ justify-content: start;
2810
+ border-radius: var(--rs-radius-2);
2811
+ padding: 0 var(--rs-space-3);
2812
+ cursor: pointer;
2813
+ height: 32px;
2814
+ }
2815
+ ._sidepanel-list-link_sfza7_84 {
2816
+ padding: var(--rs-space-2) 0;
2817
+ display: flex;
2818
+ align-items: center;
2819
+ }
2820
+ ._sidepanel-list-link_sfza7_84 a {
2821
+ text-decoration: none;
2822
+ }
2823
+ `;
2824
+ (function() {
2825
+ if (typeof document === "undefined") {
2826
+ return;
2827
+ }
2828
+ if (!document.getElementById(digest15)) {
2829
+ var el = document.createElement("style");
2830
+ el.id = digest15;
2831
+ el.textContent = css15;
2832
+ document.head.appendChild(el);
2833
+ }
2834
+ })();
2835
+ var audit_logs_module_css_default6 = { "navbar": "_navbar_sfza7_1", "table": "_table_sfza7_10", "table-empty": "_table-empty_sfza7_14", "tableEmpty": "_table-empty_sfza7_14", "empty-state": "_empty-state_sfza7_18", "emptyState": "_empty-state_sfza7_18", "empty-state-subheading": "_empty-state-subheading_sfza7_22", "emptyStateSubheading": "_empty-state-subheading_sfza7_22", "name-column": "_name-column_sfza7_27", "nameColumn": "_name-column_sfza7_27", "org-column": "_org-column_sfza7_31", "orgColumn": "_org-column_sfza7_31", "table-wrapper": "_table-wrapper_sfza7_35", "tableWrapper": "_table-wrapper_sfza7_35", "table-header": "_table-header_sfza7_40", "tableHeader": "_table-header_sfza7_40", "side-panel": "_side-panel_sfza7_44", "sidePanel": "_side-panel_sfza7_44", "capitalize": "_capitalize_sfza7_49", "table-content-container": "_table-content-container_sfza7_53", "tableContentContainer": "_table-content-container_sfza7_53", "text-overflow": "_text-overflow_sfza7_61", "textOverflow": "_text-overflow_sfza7_61", "code-block-container": "_code-block-container_sfza7_69", "codeBlockContainer": "_code-block-container_sfza7_69", "code-block": "_code-block_sfza7_69", "codeBlock": "_code-block_sfza7_69", "sidepanel-link-trigger": "_sidepanel-link-trigger_sfza7_76", "sidepanelLinkTrigger": "_sidepanel-link-trigger_sfza7_76", "sidepanel-list-link": "_sidepanel-list-link_sfza7_84", "sidepanelListLink": "_sidepanel-list-link_sfza7_84" };
2836
+
2837
+ // admin/views/audit-logs/sidepanel-list-link.tsx
2838
+ import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
2839
+ function SidepanelListItemLink({
2840
+ isLink,
2841
+ children,
2842
+ href,
2843
+ label
2844
+ }) {
2845
+ if (isLink) {
2846
+ return /* @__PURE__ */ jsxs16(List.Item, { className: audit_logs_module_css_default6["sidepanel-list-link"], children: [
2847
+ /* @__PURE__ */ jsx25(List.Label, { minWidth: "112px", children: label }),
2848
+ /* @__PURE__ */ jsx25(List.Value, { className: audit_logs_module_css_default6["text-overflow"], children: /* @__PURE__ */ jsx25(Link2, { to: href, children: /* @__PURE__ */ jsx25(
2849
+ Button,
2850
+ {
2851
+ variant: "text",
2852
+ color: "neutral",
2853
+ "data-test-id": "organization-link",
2854
+ className: audit_logs_module_css_default6["sidepanel-link-trigger"],
2855
+ children
2856
+ }
2857
+ ) }) })
2858
+ ] });
2859
+ }
2860
+ return /* @__PURE__ */ jsxs16(List.Item, { children: [
2861
+ /* @__PURE__ */ jsx25(List.Label, { minWidth: "120px", children: label }),
2862
+ /* @__PURE__ */ jsx25(List.Value, { children })
2863
+ ] });
2864
+ }
2865
+
2866
+ // admin/views/audit-logs/sidepanel-list-id.tsx
2867
+ import { CopyButton, Flex as Flex15, List as List2, Text as Text10, Tooltip } from "@raystack/apsara";
2868
+
2869
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-H1NYIfYfxHkm/lib/admin/views/audit-logs/audit-logs.module.css.js
2870
+ var digest16 = "fe3c668ee16d8c5564db69d276a6ab9f25d8e1c5ee407ffac51a91b2543b772f";
2871
+ var css16 = `._navbar_sfza7_1 {
2872
+ padding: var(--rs-space-4) var(--rs-space-7);
2873
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2874
+ background: var(--rs-color-background-base-primary);
2875
+ display: flex;
2876
+ align-items: center;
2877
+ justify-content: space-between;
2878
+ }
2879
+
2880
+ ._table_sfza7_10 {
2881
+ height: auto;
2882
+ }
2883
+
2884
+ ._table-empty_sfza7_14 {
2885
+ height: 100%;
2886
+ }
2887
+
2888
+ ._empty-state_sfza7_18 {
2889
+ height: 100%;
2890
+ }
2891
+
2892
+ ._empty-state-subheading_sfza7_22 {
2893
+ max-width: 360px;
2894
+ text-wrap: auto;
2895
+ }
2896
+
2897
+ ._name-column_sfza7_27 {
2898
+ padding-left: var(--rs-space-7);
2899
+ min-width: 300px;
2900
+ }
2901
+ ._org-column_sfza7_31 {
2902
+ min-width: 300px;
2903
+ }
2904
+
2905
+ ._table-wrapper_sfza7_35 {
2906
+ flex: 1;
2907
+ height: 100%;
2908
+ }
2909
+
2910
+ ._table-header_sfza7_40 {
2911
+ z-index: 2;
2912
+ }
2913
+
2914
+ ._side-panel_sfza7_44 {
2915
+ position: sticky;
2916
+ top: 0;
2917
+ }
2918
+
2919
+ ._capitalize_sfza7_49 {
2920
+ text-transform: capitalize;
2921
+ }
2922
+
2923
+ ._table-content-container_sfza7_53 {
2924
+ width: 100%;
2925
+ height: 100%;
2926
+ height: calc(100vh - 90px);
2927
+ overflow: auto;
2928
+ position: relative;
2929
+ }
2930
+
2931
+ ._text-overflow_sfza7_61 {
2932
+ width: fit-content;
2933
+ max-width: 180px;
2934
+ overflow: hidden;
2935
+ text-overflow: ellipsis;
2936
+ white-space: nowrap;
2937
+ }
2938
+
2939
+ ._code-block-container_sfza7_69 {
2940
+ padding: 0;
2941
+ }
2942
+ ._code-block_sfza7_69 {
2943
+ max-height: 400px;
2944
+ overflow: auto;
2945
+ }
2946
+ ._sidepanel-link-trigger_sfza7_76 {
2947
+ width: 100%;
2948
+ justify-content: start;
2949
+ border-radius: var(--rs-radius-2);
2950
+ padding: 0 var(--rs-space-3);
2951
+ cursor: pointer;
2952
+ height: 32px;
2953
+ }
2954
+ ._sidepanel-list-link_sfza7_84 {
2955
+ padding: var(--rs-space-2) 0;
2956
+ display: flex;
2957
+ align-items: center;
2958
+ }
2959
+ ._sidepanel-list-link_sfza7_84 a {
2960
+ text-decoration: none;
2961
+ }
2962
+ `;
2963
+ (function() {
2964
+ if (typeof document === "undefined") {
2965
+ return;
2966
+ }
2967
+ if (!document.getElementById(digest16)) {
2968
+ var el = document.createElement("style");
2969
+ el.id = digest16;
2970
+ el.textContent = css16;
2971
+ document.head.appendChild(el);
2972
+ }
2973
+ })();
2974
+ var audit_logs_module_css_default7 = { "navbar": "_navbar_sfza7_1", "table": "_table_sfza7_10", "table-empty": "_table-empty_sfza7_14", "tableEmpty": "_table-empty_sfza7_14", "empty-state": "_empty-state_sfza7_18", "emptyState": "_empty-state_sfza7_18", "empty-state-subheading": "_empty-state-subheading_sfza7_22", "emptyStateSubheading": "_empty-state-subheading_sfza7_22", "name-column": "_name-column_sfza7_27", "nameColumn": "_name-column_sfza7_27", "org-column": "_org-column_sfza7_31", "orgColumn": "_org-column_sfza7_31", "table-wrapper": "_table-wrapper_sfza7_35", "tableWrapper": "_table-wrapper_sfza7_35", "table-header": "_table-header_sfza7_40", "tableHeader": "_table-header_sfza7_40", "side-panel": "_side-panel_sfza7_44", "sidePanel": "_side-panel_sfza7_44", "capitalize": "_capitalize_sfza7_49", "table-content-container": "_table-content-container_sfza7_53", "tableContentContainer": "_table-content-container_sfza7_53", "text-overflow": "_text-overflow_sfza7_61", "textOverflow": "_text-overflow_sfza7_61", "code-block-container": "_code-block-container_sfza7_69", "codeBlockContainer": "_code-block-container_sfza7_69", "code-block": "_code-block_sfza7_69", "codeBlock": "_code-block_sfza7_69", "sidepanel-link-trigger": "_sidepanel-link-trigger_sfza7_76", "sidepanelLinkTrigger": "_sidepanel-link-trigger_sfza7_76", "sidepanel-list-link": "_sidepanel-list-link_sfza7_84", "sidepanelListLink": "_sidepanel-list-link_sfza7_84" };
2975
+
2976
+ // admin/views/audit-logs/sidepanel-list-id.tsx
2977
+ import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
2978
+ function SidepanelListId({ id = "-" }) {
2979
+ return /* @__PURE__ */ jsx26(List2.Value, { children: /* @__PURE__ */ jsxs17(Flex15, { gap: 3, width: "full", children: [
2980
+ /* @__PURE__ */ jsx26(CopyButton, { text: id || "", "data-test-id": "copy-button" }),
2981
+ /* @__PURE__ */ jsx26(Tooltip, { message: id || "", children: /* @__PURE__ */ jsx26(Text10, { className: audit_logs_module_css_default7["text-overflow"], weight: "medium", children: id }) })
2982
+ ] }) });
2983
+ }
2984
+
2985
+ // admin/views/audit-logs/sidepanel-details.tsx
2986
+ import { Fragment as Fragment4, jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
2987
+ function SidePanelDetails(_a) {
2988
+ var _b = _a, {
2989
+ onClose
2990
+ } = _b, rest = __objRest(_b, [
2991
+ "onClose"
2992
+ ]);
2993
+ var _a2;
2994
+ const { actor, event, resource, occurredAt, id, orgId, orgName, target } = rest;
2995
+ const date = dayjs3(timestampToDate(occurredAt));
2996
+ const session = (_a2 = actor == null ? void 0 : actor.metadata) == null ? void 0 : _a2.context;
2997
+ const location = session && `${session.Location.City}, ${session.Location.Country}` || "-";
2998
+ return /* @__PURE__ */ jsxs18(
2999
+ SidePanel,
3000
+ {
3001
+ "data-test-id": "admin-user-details-sidepanel",
3002
+ className: audit_logs_module_css_default4["side-panel"],
3003
+ children: [
3004
+ /* @__PURE__ */ jsx27(
3005
+ SidePanel.Header,
3006
+ {
3007
+ title: "Audit log details",
3008
+ actions: [
3009
+ /* @__PURE__ */ jsx27(SidePanelLogDialog, __spreadValues({}, rest), "show-audit-json-dialog"),
3010
+ /* @__PURE__ */ jsx27(
3011
+ IconButton4,
3012
+ {
3013
+ size: 3,
3014
+ "data-test-id": "close-sidepanel-icon",
3015
+ onClick: onClose,
3016
+ children: /* @__PURE__ */ jsx27(Cross2Icon, {})
3017
+ },
3018
+ "close-sidepanel-icon"
3019
+ )
3020
+ ]
3021
+ }
3022
+ ),
3023
+ /* @__PURE__ */ jsx27(SidePanel.Section, { children: /* @__PURE__ */ jsxs18(List3, { children: [
3024
+ /* @__PURE__ */ jsx27(List3.Header, { children: "Overview" }),
3025
+ /* @__PURE__ */ jsx27(
3026
+ SidepanelListItemLink,
3027
+ {
3028
+ isLink: (actor == null ? void 0 : actor.type) !== ACTOR_TYPES.SYSTEM,
3029
+ href: `/users/${actor == null ? void 0 : actor.id}`,
3030
+ label: "Actor",
3031
+ "data-test-id": "actor-link",
3032
+ children: /* @__PURE__ */ jsx27(ActorCell, { value: actor, size: "small", maxLength: 12 })
3033
+ }
3034
+ ),
3035
+ /* @__PURE__ */ jsx27(
3036
+ SidepanelListItemLink,
3037
+ {
3038
+ isLink: !!orgId && !isZeroUUID(orgId),
3039
+ href: `/organizations/${orgId}`,
3040
+ label: "Organization",
3041
+ "data-test-id": "actor-link",
3042
+ children: orgName || "-"
3043
+ }
3044
+ ),
3045
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3046
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "Action" }),
3047
+ /* @__PURE__ */ jsx27(List3.Value, { children: event })
3048
+ ] }),
3049
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3050
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "Resource" }),
3051
+ /* @__PURE__ */ jsx27(List3.Value, { children: (resource == null ? void 0 : resource.name) || "-" })
3052
+ ] }),
3053
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3054
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "Type" }),
3055
+ /* @__PURE__ */ jsx27(List3.Value, { children: (resource == null ? void 0 : resource.type) || "-" })
3056
+ ] }),
3057
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3058
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "Date" }),
3059
+ /* @__PURE__ */ jsx27(List3.Value, { children: date.format("DD MMM YYYY") })
3060
+ ] }),
3061
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3062
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "Time" }),
3063
+ /* @__PURE__ */ jsx27(List3.Value, { children: date.format("hh:mm A") })
3064
+ ] }),
3065
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3066
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "ID" }),
3067
+ /* @__PURE__ */ jsx27(SidepanelListId, { id })
3068
+ ] }),
3069
+ target && /* @__PURE__ */ jsxs18(Fragment4, { children: [
3070
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3071
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "Target ID" }),
3072
+ /* @__PURE__ */ jsx27(SidepanelListId, { id: target == null ? void 0 : target.id })
3073
+ ] }),
3074
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3075
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "Target Type" }),
3076
+ /* @__PURE__ */ jsx27(List3.Value, { children: (target == null ? void 0 : target.type) || "-" })
3077
+ ] })
3078
+ ] })
3079
+ ] }) }),
3080
+ session && /* @__PURE__ */ jsx27(SidePanel.Section, { children: /* @__PURE__ */ jsxs18(List3, { children: [
3081
+ /* @__PURE__ */ jsx27(List3.Header, { children: "Session" }),
3082
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3083
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "IP Address" }),
3084
+ /* @__PURE__ */ jsx27(List3.Value, { children: /* @__PURE__ */ jsxs18(Flex16, { gap: 3, align: "center", children: [
3085
+ /* @__PURE__ */ jsx27(GlobeIcon, { width: 16, height: 16 }),
3086
+ session.IpAddress.split(",")[0]
3087
+ ] }) })
3088
+ ] }),
3089
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3090
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "Location" }),
3091
+ /* @__PURE__ */ jsx27(List3.Value, { children: /* @__PURE__ */ jsxs18(Flex16, { gap: 3, align: "center", children: [
3092
+ /* @__PURE__ */ jsx27(MapIcon, { width: 16, height: 16 }),
3093
+ location.length > 2 ? location : "-"
3094
+ ] }) })
3095
+ ] }),
3096
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3097
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "Browser" }),
3098
+ /* @__PURE__ */ jsx27(List3.Value, { children: /* @__PURE__ */ jsxs18(Flex16, { gap: 3, align: "center", children: [
3099
+ /* @__PURE__ */ jsx27(DesktopIcon, { width: 16, height: 16 }),
3100
+ session.Browser
3101
+ ] }) })
3102
+ ] }),
3103
+ /* @__PURE__ */ jsxs18(List3.Item, { children: [
3104
+ /* @__PURE__ */ jsx27(List3.Label, { minWidth: "120px", children: "Operating System" }),
3105
+ /* @__PURE__ */ jsx27(List3.Value, { children: /* @__PURE__ */ jsxs18(Flex16, { gap: 3, align: "center", children: [
3106
+ /* @__PURE__ */ jsx27(TransformIcon, { width: 16, height: 16 }),
3107
+ session.OperatingSystem
3108
+ ] }) })
3109
+ ] })
3110
+ ] }) })
3111
+ ]
3112
+ }
3113
+ );
3114
+ }
3115
+
3116
+ // admin/views/audit-logs/index.tsx
3117
+ import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
3118
+ import { Fragment as Fragment5, jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
3119
+ var NoAuditLogs = () => {
3120
+ return /* @__PURE__ */ jsx28(
3121
+ EmptyState5,
3122
+ {
3123
+ classNames: {
3124
+ container: audit_logs_module_css_default2["empty-state"],
3125
+ subHeading: audit_logs_module_css_default2["empty-state-subheading"]
3126
+ },
3127
+ heading: "No activity logged yet",
3128
+ subHeading: "Once users start making changes, you'll see a detailed history of events here.",
3129
+ icon: /* @__PURE__ */ jsx28(CpuChipIcon, {})
3130
+ }
3131
+ );
3132
+ };
3133
+ var DEFAULT_SORT2 = { name: "occurredAt", order: "desc" };
3134
+ var INITIAL_QUERY2 = {
3135
+ offset: 0,
3136
+ limit: DEFAULT_PAGE_SIZE
3137
+ };
3138
+ var TRANSFORM_OPTIONS = {
3139
+ fieldNameMapping: {
3140
+ occurredAt: "occurred_at",
3141
+ orgId: "org_id",
3142
+ orgName: "org_name",
3143
+ actor: "actor_name",
3144
+ resource: "resource_name",
3145
+ resourceType: "resource_type",
3146
+ actorType: "actor_type"
3147
+ }
3148
+ };
3149
+ function AuditLogsView({ appName, onExportCsv } = {}) {
3150
+ var _a;
3151
+ const queryClient = useQueryClient2();
3152
+ const [tableQuery, setTableQuery] = useDebouncedState(
3153
+ {
3154
+ query: INITIAL_QUERY2,
3155
+ rqlRequest: transformDataTableQueryToRQLRequest(
3156
+ INITIAL_QUERY2,
3157
+ TRANSFORM_OPTIONS
3158
+ )
3159
+ },
3160
+ 200
3161
+ );
3162
+ const [sidePanelOpen, setSidePanelOpen] = useState5(false);
3163
+ const [selectedAuditLog, setSelectedAuditLog] = useState5(
3164
+ null
3165
+ );
3166
+ const {
3167
+ data: infiniteData,
3168
+ isLoading,
3169
+ isFetchingNextPage,
3170
+ fetchNextPage,
3171
+ error,
3172
+ isError,
3173
+ hasNextPage
3174
+ } = useInfiniteQuery2(
3175
+ AdminServiceQueries2.listAuditRecords,
3176
+ { query: tableQuery.rqlRequest },
3177
+ {
3178
+ pageParamKey: "query",
3179
+ getNextPageParam: (lastPage) => getConnectNextPageParam(
3180
+ lastPage,
3181
+ { query: tableQuery.rqlRequest },
3182
+ "auditRecords"
3183
+ ),
3184
+ staleTime: 0,
3185
+ refetchOnWindowFocus: false,
3186
+ retry: 1,
3187
+ retryDelay: 1e3
3188
+ }
3189
+ );
3190
+ const data = ((_a = infiniteData == null ? void 0 : infiniteData.pages) == null ? void 0 : _a.flatMap((page) => (page == null ? void 0 : page.auditRecords) || [])) || [];
3191
+ const onTableQueryChange = useCallback3(
3192
+ (query) => {
3193
+ const updatedQuery = __spreadProps(__spreadValues({}, query), {
3194
+ offset: 0,
3195
+ limit: query.limit || DEFAULT_PAGE_SIZE
3196
+ });
3197
+ const updatedRQLRequest = transformDataTableQueryToRQLRequest(
3198
+ updatedQuery,
3199
+ TRANSFORM_OPTIONS
3200
+ );
3201
+ queryClient.setQueryData(AUDIT_LOG_QUERY_KEY, updatedRQLRequest);
3202
+ setTableQuery({
3203
+ query: updatedQuery,
3204
+ rqlRequest: updatedRQLRequest
3205
+ });
3206
+ },
3207
+ [queryClient]
3208
+ );
3209
+ const handleLoadMore = () => __async(this, null, function* () {
3210
+ try {
3211
+ if (!hasNextPage)
3212
+ return;
3213
+ yield fetchNextPage();
3214
+ } catch (error2) {
3215
+ console.error("Error loading more audit logs:", error2);
3216
+ }
3217
+ });
3218
+ const columns = useMemo(
3219
+ () => getColumns5({
3220
+ groupCountMap: infiniteData ? getGroupCountMapFromFirstPage(infiniteData) : {}
3221
+ }),
3222
+ [infiniteData]
3223
+ );
3224
+ const loading = isLoading || isFetchingNextPage;
3225
+ const onRowClick = useCallback3((row) => {
3226
+ setSelectedAuditLog((_selectedLog) => {
3227
+ if ((_selectedLog == null ? void 0 : _selectedLog.id) === row.id)
3228
+ setSidePanelOpen((_value) => !_value);
3229
+ else
3230
+ setSidePanelOpen(true);
3231
+ return row;
3232
+ });
3233
+ }, []);
3234
+ if (isError) {
3235
+ console.error("ConnectRPC Error:", error);
3236
+ return /* @__PURE__ */ jsxs19(Fragment5, { children: [
3237
+ /* @__PURE__ */ jsx28(PageTitle, { title: "Audit Logs", appName }),
3238
+ /* @__PURE__ */ jsx28(
3239
+ EmptyState5,
3240
+ {
3241
+ icon: /* @__PURE__ */ jsx28(ExclamationTriangleIcon, {}),
3242
+ heading: "Error Loading Audit Logs",
3243
+ subHeading: (error == null ? void 0 : error.message) || "Something went wrong while loading audit logs. Please try again."
3244
+ }
3245
+ )
3246
+ ] });
3247
+ }
3248
+ const tableClassName = data.length || loading ? audit_logs_module_css_default2["table"] : audit_logs_module_css_default2["table-empty"];
3249
+ return /* @__PURE__ */ jsxs19(Fragment5, { children: [
3250
+ /* @__PURE__ */ jsx28(PageTitle, { title: "Audit Logs", appName }),
3251
+ /* @__PURE__ */ jsx28(
3252
+ DataTable9,
3253
+ {
3254
+ query: tableQuery.query,
3255
+ columns,
3256
+ data,
3257
+ isLoading: loading,
3258
+ defaultSort: DEFAULT_SORT2,
3259
+ onTableQueryChange,
3260
+ mode: "server",
3261
+ onLoadMore: handleLoadMore,
3262
+ onRowClick,
3263
+ children: /* @__PURE__ */ jsxs19(Flex17, { direction: "column", style: { width: "100%" }, children: [
3264
+ /* @__PURE__ */ jsx28(navbar_default, { searchQuery: tableQuery.query.search, onExportCsv }),
3265
+ /* @__PURE__ */ jsx28(DataTable9.Toolbar, {}),
3266
+ /* @__PURE__ */ jsxs19(Flex17, { className: audit_logs_module_css_default2["table-content-container"], children: [
3267
+ /* @__PURE__ */ jsx28(
3268
+ DataTable9.VirtualizedContent,
3269
+ {
3270
+ classNames: {
3271
+ root: audit_logs_module_css_default2["table-wrapper"],
3272
+ table: tableClassName,
3273
+ header: audit_logs_module_css_default2["table-header"]
3274
+ },
3275
+ emptyState: /* @__PURE__ */ jsx28(NoAuditLogs, {}),
3276
+ rowHeight: 60,
3277
+ groupHeaderHeight: 48
3278
+ }
3279
+ ),
3280
+ sidePanelOpen && /* @__PURE__ */ jsx28(
3281
+ SidePanelDetails,
3282
+ __spreadProps(__spreadValues({}, selectedAuditLog), {
3283
+ onClose: () => setSidePanelOpen(false)
3284
+ })
3285
+ )
3286
+ ] })
3287
+ ] })
3288
+ }
3289
+ )
3290
+ ] });
3291
+ }
3292
+ export {
3293
+ AuditLogsView,
3294
+ DEFAULT_PAGE_SIZE,
3295
+ InvoicesView,
3296
+ ProductPricesView,
3297
+ ProductsView,
3298
+ RolesView,
3299
+ getConnectNextPageParam,
3300
+ getGroupCountMapFromFirstPage,
3301
+ transformDataTableQueryToRQLRequest
3302
+ };