@raystack/frontier 0.89.3-test3 → 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,3332 @@
1
+ 'use client'
2
+ "use strict";
3
+ "use client";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __defProps = Object.defineProperties;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11
+ var __getProtoOf = Object.getPrototypeOf;
12
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
13
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
14
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15
+ var __spreadValues = (a, b) => {
16
+ for (var prop in b || (b = {}))
17
+ if (__hasOwnProp.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ if (__getOwnPropSymbols)
20
+ for (var prop of __getOwnPropSymbols(b)) {
21
+ if (__propIsEnum.call(b, prop))
22
+ __defNormalProp(a, prop, b[prop]);
23
+ }
24
+ return a;
25
+ };
26
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27
+ var __objRest = (source, exclude) => {
28
+ var target = {};
29
+ for (var prop in source)
30
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
31
+ target[prop] = source[prop];
32
+ if (source != null && __getOwnPropSymbols)
33
+ for (var prop of __getOwnPropSymbols(source)) {
34
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
35
+ target[prop] = source[prop];
36
+ }
37
+ return target;
38
+ };
39
+ var __export = (target, all) => {
40
+ for (var name in all)
41
+ __defProp(target, name, { get: all[name], enumerable: true });
42
+ };
43
+ var __copyProps = (to, from, except, desc) => {
44
+ if (from && typeof from === "object" || typeof from === "function") {
45
+ for (let key of __getOwnPropNames(from))
46
+ if (!__hasOwnProp.call(to, key) && key !== except)
47
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
48
+ }
49
+ return to;
50
+ };
51
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
52
+ // If the importer is in node compatibility mode or this is not an ESM
53
+ // file that has been converted to a CommonJS file using a Babel-
54
+ // compatible transform (i.e. "__esModule" has not been set), then set
55
+ // "default" to the CommonJS "module.exports" for node compatibility.
56
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
57
+ mod
58
+ ));
59
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
60
+ var __async = (__this, __arguments, generator) => {
61
+ return new Promise((resolve, reject) => {
62
+ var fulfilled = (value) => {
63
+ try {
64
+ step(generator.next(value));
65
+ } catch (e) {
66
+ reject(e);
67
+ }
68
+ };
69
+ var rejected = (value) => {
70
+ try {
71
+ step(generator.throw(value));
72
+ } catch (e) {
73
+ reject(e);
74
+ }
75
+ };
76
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
77
+ step((generator = generator.apply(__this, __arguments)).next());
78
+ });
79
+ };
80
+
81
+ // admin/index.ts
82
+ var admin_exports = {};
83
+ __export(admin_exports, {
84
+ AuditLogsView: () => AuditLogsView,
85
+ DEFAULT_PAGE_SIZE: () => DEFAULT_PAGE_SIZE,
86
+ InvoicesView: () => InvoicesView,
87
+ ProductPricesView: () => ProductPricesView,
88
+ ProductsView: () => ProductsView,
89
+ RolesView: () => RolesView,
90
+ getConnectNextPageParam: () => getConnectNextPageParam,
91
+ getGroupCountMapFromFirstPage: () => getGroupCountMapFromFirstPage,
92
+ transformDataTableQueryToRQLRequest: () => transformDataTableQueryToRQLRequest
93
+ });
94
+ module.exports = __toCommonJS(admin_exports);
95
+
96
+ // admin/views/roles/index.tsx
97
+ var import_apsara6 = require("@raystack/apsara");
98
+ var import_react3 = require("react");
99
+
100
+ // admin/utils/helper.ts
101
+ function reduceByKey(data, key) {
102
+ return data.reduce(
103
+ (acc, value) => __spreadProps(__spreadValues({}, acc), {
104
+ [String(value[key])]: value
105
+ }),
106
+ {}
107
+ );
108
+ }
109
+ var ZERO_UUID = "00000000-0000-0000-0000-000000000000";
110
+ function isZeroUUID(uuid) {
111
+ if (typeof uuid !== "string")
112
+ return false;
113
+ return uuid.toLowerCase() === ZERO_UUID;
114
+ }
115
+
116
+ // admin/views/roles/columns.tsx
117
+ var import_apsara = require("@raystack/apsara");
118
+
119
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-VheMFInhxO1h/lib/admin/views/roles/roles.module.css.js
120
+ var digest = "ad3e12e089ab78434bfbb6b41146996bd4d7d0791471697cdb8714ca74e87078";
121
+ var css = `._tableRoot_4yb15_1 {
122
+ width: 100%;
123
+ }
124
+
125
+ ._tableWrapper_4yb15_5 {
126
+ width: 100%;
127
+ }
128
+
129
+ ._table_4yb15_1 {
130
+ table-layout: fixed;
131
+ }
132
+
133
+ ._header_4yb15_13 {
134
+ background-color: var(--rs-color-background-base-primary);
135
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
136
+ }
137
+
138
+ ._permissionsColumn_4yb15_18 {
139
+ max-width: 500px;
140
+ text-wrap: wrap;
141
+ }
142
+
143
+ ._sheetContent_4yb15_23 {
144
+ width: 400px;
145
+ padding: 0;
146
+ }
147
+
148
+ ._sheetContentBody_4yb15_28 {
149
+ padding: var(--rs-space-5);
150
+ }`;
151
+ (function() {
152
+ if (typeof document === "undefined") {
153
+ return;
154
+ }
155
+ if (!document.getElementById(digest)) {
156
+ var el = document.createElement("style");
157
+ el.id = digest;
158
+ el.textContent = css;
159
+ document.head.appendChild(el);
160
+ }
161
+ })();
162
+ 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" };
163
+
164
+ // admin/views/roles/columns.tsx
165
+ var import_jsx_runtime = require("react/jsx-runtime");
166
+ var getColumns = () => {
167
+ return [
168
+ {
169
+ accessorKey: "id",
170
+ header: "ID",
171
+ filterVariant: "text",
172
+ cell: ({ getValue }) => getValue()
173
+ },
174
+ {
175
+ header: "Title",
176
+ accessorKey: "title",
177
+ filterVariant: "text",
178
+ cell: (info) => info.getValue()
179
+ },
180
+ {
181
+ header: "Name",
182
+ accessorKey: "name",
183
+ filterVariant: "text",
184
+ cell: (info) => info.getValue()
185
+ },
186
+ {
187
+ header: "Permissions",
188
+ accessorKey: "permissions",
189
+ enableColumnFilter: false,
190
+ classNames: {
191
+ cell: roles_module_css_default.permissionsColumn
192
+ },
193
+ cell: (info) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_apsara.Flex, { direction: "column", gap: 1, className: roles_module_css_default.permissionsColumn, children: (info.getValue() || []).map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: p }, i)) }),
194
+ footer: (props) => props.column.id
195
+ }
196
+ ];
197
+ };
198
+
199
+ // admin/views/roles/header.tsx
200
+ var import_apsara3 = require("@raystack/apsara");
201
+
202
+ // admin/components/PageHeader.tsx
203
+ var import_apsara2 = require("@raystack/apsara");
204
+
205
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-NIvc4wkfj7JH/lib/admin/components/page-header.module.css.js
206
+ var digest2 = "a5be13bc7acf0148bb5f84444cf7e36386bfa727235e91ea23659a99b5e38eeb";
207
+ var css2 = `._breadcrumb_1kaun_1 {
208
+ list-style: none;
209
+ padding: 0;
210
+ margin: 0;
211
+ display: flex;
212
+ font-size: 14px;
213
+ }
214
+
215
+ ._breadcrumb_1kaun_1 a {
216
+ text-decoration: none;
217
+ color: #007bff;
218
+ display: inline-block;
219
+ margin-right: 5px;
220
+ }
221
+
222
+ ._breadcrumb_1kaun_1 a::before {
223
+ content: ">";
224
+ color: #666;
225
+ }
226
+
227
+ ._breadcrumb_1kaun_1 a:first-child::before {
228
+ content: "";
229
+ }
230
+
231
+ ._breadcrumb_1kaun_1 a:last-child {
232
+ margin-right: 0;
233
+ }
234
+
235
+ ._breadcrumbItem_1kaun_29 {
236
+ margin-right: 5px;
237
+ }
238
+
239
+ ._breadcrumbItem_1kaun_29::before {
240
+ content: ">";
241
+ color: #666;
242
+ margin-right: 5px;
243
+ }
244
+
245
+ ._breadcrumbItem_1kaun_29:first-of-type::before {
246
+ content: "";
247
+ margin-right: 0;
248
+ }`;
249
+ (function() {
250
+ if (typeof document === "undefined") {
251
+ return;
252
+ }
253
+ if (!document.getElementById(digest2)) {
254
+ var el = document.createElement("style");
255
+ el.id = digest2;
256
+ el.textContent = css2;
257
+ document.head.appendChild(el);
258
+ }
259
+ })();
260
+ var page_header_module_css_default = { "breadcrumb": "_breadcrumb_1kaun_1", "breadcrumbItem": "_breadcrumbItem_1kaun_29" };
261
+
262
+ // admin/components/PageHeader.tsx
263
+ var import_jsx_runtime2 = require("react/jsx-runtime");
264
+ function PageHeader(_a) {
265
+ var _b = _a, {
266
+ title,
267
+ breadcrumb,
268
+ onBreadcrumbClick,
269
+ children,
270
+ className,
271
+ style = {}
272
+ } = _b, props = __objRest(_b, [
273
+ "title",
274
+ "breadcrumb",
275
+ "onBreadcrumbClick",
276
+ "children",
277
+ "className",
278
+ "style"
279
+ ]);
280
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
281
+ import_apsara2.Flex,
282
+ __spreadProps(__spreadValues({
283
+ align: "center",
284
+ justify: "between",
285
+ className,
286
+ style: __spreadValues({ padding: "16px 24px" }, style)
287
+ }, props), {
288
+ children: [
289
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_apsara2.Flex, { align: "center", gap: "medium", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_apsara2.Flex, { align: "center", gap: "small", className: page_header_module_css_default.breadcrumb, children: [
290
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_apsara2.Text, { style: { fontSize: "14px", fontWeight: "500" }, children: title }),
291
+ breadcrumb.map(
292
+ (item) => item.href && onBreadcrumbClick ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
293
+ "span",
294
+ {
295
+ role: "button",
296
+ tabIndex: 0,
297
+ className: page_header_module_css_default.breadcrumbItem,
298
+ "data-test-id": "page-header-breadcrumb-link",
299
+ onClick: () => onBreadcrumbClick == null ? void 0 : onBreadcrumbClick(item),
300
+ onKeyDown: (e) => {
301
+ if (e.key === "Enter" || e.key === " ") {
302
+ e.preventDefault();
303
+ onBreadcrumbClick == null ? void 0 : onBreadcrumbClick(item);
304
+ }
305
+ },
306
+ style: { cursor: "pointer" },
307
+ children: item.name
308
+ },
309
+ item.name
310
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: page_header_module_css_default.breadcrumbItem, children: item.name }, item.name)
311
+ )
312
+ ] }) }),
313
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_apsara2.Flex, { gap: "small", children })
314
+ ]
315
+ })
316
+ );
317
+ }
318
+
319
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-Jnenqcqor0YL/lib/admin/views/roles/roles.module.css.js
320
+ var digest3 = "c91dde51c8df4674f73cd1445ea639c88f51adfc04350ea6263fd2ed20acb2b8";
321
+ var css3 = `._tableRoot_4yb15_1 {
322
+ width: 100%;
323
+ }
324
+
325
+ ._tableWrapper_4yb15_5 {
326
+ width: 100%;
327
+ }
328
+
329
+ ._table_4yb15_1 {
330
+ table-layout: fixed;
331
+ }
332
+
333
+ ._header_4yb15_13 {
334
+ background-color: var(--rs-color-background-base-primary);
335
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
336
+ }
337
+
338
+ ._permissionsColumn_4yb15_18 {
339
+ max-width: 500px;
340
+ text-wrap: wrap;
341
+ }
342
+
343
+ ._sheetContent_4yb15_23 {
344
+ width: 400px;
345
+ padding: 0;
346
+ }
347
+
348
+ ._sheetContentBody_4yb15_28 {
349
+ padding: var(--rs-space-5);
350
+ }`;
351
+ (function() {
352
+ if (typeof document === "undefined") {
353
+ return;
354
+ }
355
+ if (!document.getElementById(digest3)) {
356
+ var el = document.createElement("style");
357
+ el.id = digest3;
358
+ el.textContent = css3;
359
+ document.head.appendChild(el);
360
+ }
361
+ })();
362
+ 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" };
363
+
364
+ // admin/views/roles/header.tsx
365
+ var import_jsx_runtime3 = require("react/jsx-runtime");
366
+ var pageHeader = {
367
+ title: "Roles",
368
+ breadcrumb: []
369
+ };
370
+ var RolesHeader = () => {
371
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
372
+ PageHeader,
373
+ {
374
+ title: pageHeader.title,
375
+ breadcrumb: pageHeader.breadcrumb,
376
+ className: roles_module_css_default2.header,
377
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_apsara3.DataTable.Search, { size: "small", placeholder: "Search roles..." })
378
+ }
379
+ );
380
+ };
381
+
382
+ // ../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
383
+ var import_react = require("react");
384
+ function _objectWithoutPropertiesLoose(source, excluded) {
385
+ if (source == null)
386
+ return {};
387
+ var target = {};
388
+ var sourceKeys = Object.keys(source);
389
+ var key, i;
390
+ for (i = 0; i < sourceKeys.length; i++) {
391
+ key = sourceKeys[i];
392
+ if (excluded.indexOf(key) >= 0)
393
+ continue;
394
+ target[key] = source[key];
395
+ }
396
+ return target;
397
+ }
398
+ var _excluded$1q = ["color"];
399
+ var Cross1Icon = /* @__PURE__ */ (0, import_react.forwardRef)(function(_ref, forwardedRef) {
400
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$1q);
401
+ return (0, import_react.createElement)("svg", Object.assign({
402
+ width: "15",
403
+ height: "15",
404
+ viewBox: "0 0 15 15",
405
+ fill: "none",
406
+ xmlns: "http://www.w3.org/2000/svg"
407
+ }, props, {
408
+ ref: forwardedRef
409
+ }), (0, import_react.createElement)("path", {
410
+ 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",
411
+ fill: color,
412
+ fillRule: "evenodd",
413
+ clipRule: "evenodd"
414
+ }));
415
+ });
416
+ var _excluded$1r = ["color"];
417
+ var Cross2Icon = /* @__PURE__ */ (0, import_react.forwardRef)(function(_ref, forwardedRef) {
418
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$1r);
419
+ return (0, import_react.createElement)("svg", Object.assign({
420
+ width: "15",
421
+ height: "15",
422
+ viewBox: "0 0 15 15",
423
+ fill: "none",
424
+ xmlns: "http://www.w3.org/2000/svg"
425
+ }, props, {
426
+ ref: forwardedRef
427
+ }), (0, import_react.createElement)("path", {
428
+ 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",
429
+ fill: color,
430
+ fillRule: "evenodd",
431
+ clipRule: "evenodd"
432
+ }));
433
+ });
434
+ var _excluded$1B = ["color"];
435
+ var DesktopIcon = /* @__PURE__ */ (0, import_react.forwardRef)(function(_ref, forwardedRef) {
436
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$1B);
437
+ return (0, import_react.createElement)("svg", Object.assign({
438
+ width: "15",
439
+ height: "15",
440
+ viewBox: "0 0 15 15",
441
+ fill: "none",
442
+ xmlns: "http://www.w3.org/2000/svg"
443
+ }, props, {
444
+ ref: forwardedRef
445
+ }), (0, import_react.createElement)("path", {
446
+ 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",
447
+ fill: color,
448
+ fillRule: "evenodd",
449
+ clipRule: "evenodd"
450
+ }));
451
+ });
452
+ var _excluded$1P = ["color"];
453
+ var DownloadIcon = /* @__PURE__ */ (0, import_react.forwardRef)(function(_ref, forwardedRef) {
454
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$1P);
455
+ return (0, import_react.createElement)("svg", Object.assign({
456
+ width: "15",
457
+ height: "15",
458
+ viewBox: "0 0 15 15",
459
+ fill: "none",
460
+ xmlns: "http://www.w3.org/2000/svg"
461
+ }, props, {
462
+ ref: forwardedRef
463
+ }), (0, import_react.createElement)("path", {
464
+ 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",
465
+ fill: color,
466
+ fillRule: "evenodd",
467
+ clipRule: "evenodd"
468
+ }));
469
+ });
470
+ var _excluded$20 = ["color"];
471
+ var ExclamationTriangleIcon = /* @__PURE__ */ (0, import_react.forwardRef)(function(_ref, forwardedRef) {
472
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$20);
473
+ return (0, import_react.createElement)("svg", Object.assign({
474
+ width: "15",
475
+ height: "15",
476
+ viewBox: "0 0 15 15",
477
+ fill: "none",
478
+ xmlns: "http://www.w3.org/2000/svg"
479
+ }, props, {
480
+ ref: forwardedRef
481
+ }), (0, import_react.createElement)("path", {
482
+ 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",
483
+ fill: color,
484
+ fillRule: "evenodd",
485
+ clipRule: "evenodd"
486
+ }));
487
+ });
488
+ var _excluded$2n = ["color"];
489
+ var GlobeIcon = /* @__PURE__ */ (0, import_react.forwardRef)(function(_ref, forwardedRef) {
490
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$2n);
491
+ return (0, import_react.createElement)("svg", Object.assign({
492
+ width: "15",
493
+ height: "15",
494
+ viewBox: "0 0 15 15",
495
+ fill: "none",
496
+ xmlns: "http://www.w3.org/2000/svg"
497
+ }, props, {
498
+ ref: forwardedRef
499
+ }), (0, import_react.createElement)("path", {
500
+ 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",
501
+ fill: color,
502
+ fillRule: "evenodd",
503
+ clipRule: "evenodd"
504
+ }), (0, import_react.createElement)("path", {
505
+ d: "M13.4999 7.89998H1.49994V7.09998H13.4999V7.89998Z",
506
+ fill: color,
507
+ fillRule: "evenodd",
508
+ clipRule: "evenodd"
509
+ }), (0, import_react.createElement)("path", {
510
+ 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",
511
+ fill: color,
512
+ fillRule: "evenodd",
513
+ clipRule: "evenodd"
514
+ }), (0, import_react.createElement)("path", {
515
+ 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",
516
+ fill: color,
517
+ fillRule: "evenodd",
518
+ clipRule: "evenodd"
519
+ }));
520
+ });
521
+ var _excluded$33 = ["color"];
522
+ var MagnifyingGlassIcon = /* @__PURE__ */ (0, import_react.forwardRef)(function(_ref, forwardedRef) {
523
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$33);
524
+ return (0, import_react.createElement)("svg", Object.assign({
525
+ width: "15",
526
+ height: "15",
527
+ viewBox: "0 0 15 15",
528
+ fill: "none",
529
+ xmlns: "http://www.w3.org/2000/svg"
530
+ }, props, {
531
+ ref: forwardedRef
532
+ }), (0, import_react.createElement)("path", {
533
+ 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",
534
+ fill: color,
535
+ fillRule: "evenodd",
536
+ clipRule: "evenodd"
537
+ }));
538
+ });
539
+ var _excluded$4E = ["color"];
540
+ var TransformIcon = /* @__PURE__ */ (0, import_react.forwardRef)(function(_ref, forwardedRef) {
541
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$4E);
542
+ return (0, import_react.createElement)("svg", Object.assign({
543
+ width: "15",
544
+ height: "15",
545
+ viewBox: "0 0 15 15",
546
+ fill: "none",
547
+ xmlns: "http://www.w3.org/2000/svg"
548
+ }, props, {
549
+ ref: forwardedRef
550
+ }), (0, import_react.createElement)("path", {
551
+ 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",
552
+ fill: color,
553
+ fillRule: "evenodd",
554
+ clipRule: "evenodd"
555
+ }));
556
+ });
557
+
558
+ // admin/components/PageTitle.tsx
559
+ var import_react2 = require("react");
560
+ function PageTitle({ title, appName }) {
561
+ var _a;
562
+ const fullTitle = title && appName ? `${title} | ${appName}` : (_a = title != null ? title : appName) != null ? _a : "";
563
+ (0, import_react2.useEffect)(() => {
564
+ if (fullTitle)
565
+ document.title = fullTitle;
566
+ return () => {
567
+ document.title = appName != null ? appName : "";
568
+ };
569
+ }, [fullTitle, appName]);
570
+ return null;
571
+ }
572
+
573
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-UQs0XjdYDB1Q/lib/admin/views/roles/roles.module.css.js
574
+ var digest4 = "12b2d95471b9caedb11dd887e445b9246ad39697ee4827e73332b019ebec6148";
575
+ var css4 = `._tableRoot_4yb15_1 {
576
+ width: 100%;
577
+ }
578
+
579
+ ._tableWrapper_4yb15_5 {
580
+ width: 100%;
581
+ }
582
+
583
+ ._table_4yb15_1 {
584
+ table-layout: fixed;
585
+ }
586
+
587
+ ._header_4yb15_13 {
588
+ background-color: var(--rs-color-background-base-primary);
589
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
590
+ }
591
+
592
+ ._permissionsColumn_4yb15_18 {
593
+ max-width: 500px;
594
+ text-wrap: wrap;
595
+ }
596
+
597
+ ._sheetContent_4yb15_23 {
598
+ width: 400px;
599
+ padding: 0;
600
+ }
601
+
602
+ ._sheetContentBody_4yb15_28 {
603
+ padding: var(--rs-space-5);
604
+ }`;
605
+ (function() {
606
+ if (typeof document === "undefined") {
607
+ return;
608
+ }
609
+ if (!document.getElementById(digest4)) {
610
+ var el = document.createElement("style");
611
+ el.id = digest4;
612
+ el.textContent = css4;
613
+ document.head.appendChild(el);
614
+ }
615
+ })();
616
+ 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" };
617
+
618
+ // admin/components/SheetHeader.tsx
619
+ var import_apsara4 = require("@raystack/apsara");
620
+ var import_jsx_runtime4 = require("react/jsx-runtime");
621
+ function SheetHeader({ title, onClick, "data-testid": dataTestId }) {
622
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_apsara4.Flex, { justify: "between", style: styles.header, children: [
623
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_apsara4.Text, { size: 4, style: { fontWeight: "500" }, children: title }),
624
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
625
+ Cross1Icon,
626
+ {
627
+ onClick,
628
+ style: { cursor: "pointer" },
629
+ "data-testid": dataTestId != null ? dataTestId : "admin-close-btn"
630
+ }
631
+ )
632
+ ] });
633
+ }
634
+ var styles = {
635
+ header: {
636
+ padding: "18px 32px",
637
+ borderBottom: "1px solid var(--rs-color-border-base-primary)"
638
+ }
639
+ };
640
+
641
+ // admin/views/roles/index.tsx
642
+ var import_frontier = require("@raystack/proton/frontier");
643
+ var import_connect_query = require("@connectrpc/connect-query");
644
+
645
+ // admin/views/roles/details.tsx
646
+ var import_apsara5 = require("@raystack/apsara");
647
+ var import_jsx_runtime5 = require("react/jsx-runtime");
648
+ function RoleDetails({ role }) {
649
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_apsara5.Flex, { direction: "column", gap: 9, children: [
650
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_apsara5.Text, { size: 4, children: role == null ? void 0 : role.name }),
651
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_apsara5.Flex, { direction: "column", gap: 9, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_apsara5.Grid, { columns: 2, gap: "small", children: [
652
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_apsara5.Text, { size: 1, children: "Name" }),
653
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_apsara5.Text, { size: 1, children: role == null ? void 0 : role.name })
654
+ ] }) })
655
+ ] });
656
+ }
657
+
658
+ // admin/views/roles/index.tsx
659
+ var import_jsx_runtime6 = require("react/jsx-runtime");
660
+ function RolesView({
661
+ selectedRoleId: controlledRoleId,
662
+ onSelectRole,
663
+ onCloseDetail,
664
+ appName
665
+ } = {}) {
666
+ var _a;
667
+ const [internalRoleId, setInternalRoleId] = (0, import_react3.useState)();
668
+ const selectedRoleId = controlledRoleId != null ? controlledRoleId : internalRoleId;
669
+ const handleClose = (0, import_react3.useCallback)(
670
+ () => onCloseDetail ? onCloseDetail() : setInternalRoleId(void 0),
671
+ [onCloseDetail]
672
+ );
673
+ const handleRowClick = (0, import_react3.useCallback)(
674
+ (role) => {
675
+ var _a2, _b;
676
+ return onSelectRole ? onSelectRole((_a2 = role.id) != null ? _a2 : "") : setInternalRoleId((_b = role.id) != null ? _b : void 0);
677
+ },
678
+ [onSelectRole]
679
+ );
680
+ const {
681
+ data: roles = [],
682
+ isLoading,
683
+ error,
684
+ isError
685
+ } = (0, import_connect_query.useQuery)(
686
+ import_frontier.FrontierServiceQueries.listRoles,
687
+ {},
688
+ {
689
+ select: (data) => {
690
+ var _a2;
691
+ return (_a2 = data == null ? void 0 : data.roles) != null ? _a2 : [];
692
+ }
693
+ }
694
+ );
695
+ const roleMapByName = reduceByKey(roles != null ? roles : [], "id");
696
+ if (isError) {
697
+ console.error("ConnectRPC Error:", error);
698
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
699
+ import_apsara6.EmptyState,
700
+ {
701
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ExclamationTriangleIcon, {}),
702
+ heading: "Error Loading Roles",
703
+ subHeading: (error == null ? void 0 : error.message) || "Something went wrong while loading roles. Please try again."
704
+ }
705
+ );
706
+ }
707
+ const columns = getColumns();
708
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
709
+ import_apsara6.DataTable,
710
+ {
711
+ onRowClick: handleRowClick,
712
+ data: roles,
713
+ columns,
714
+ mode: "client",
715
+ defaultSort: { name: "title", order: "asc" },
716
+ isLoading,
717
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_apsara6.Flex, { direction: "column", children: [
718
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PageTitle, { title: "Roles", appName }),
719
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RolesHeader, {}),
720
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
721
+ import_apsara6.DataTable.Content,
722
+ {
723
+ emptyState: noDataChildren,
724
+ classNames: {
725
+ root: roles_module_css_default3.tableRoot,
726
+ table: roles_module_css_default3.table
727
+ }
728
+ }
729
+ ),
730
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_apsara6.Sheet, { open: selectedRoleId !== void 0, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_apsara6.Sheet.Content, { className: roles_module_css_default3.sheetContent, children: [
731
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
732
+ SheetHeader,
733
+ {
734
+ title: "Role Details",
735
+ onClick: handleClose,
736
+ "data-testid": "role-details-header"
737
+ }
738
+ ),
739
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_apsara6.Flex, { className: roles_module_css_default3.sheetContentBody, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
740
+ RoleDetails,
741
+ {
742
+ role: selectedRoleId ? (_a = roleMapByName[selectedRoleId]) != null ? _a : null : null
743
+ }
744
+ ) })
745
+ ] }) })
746
+ ] })
747
+ }
748
+ );
749
+ }
750
+ var noDataChildren = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_apsara6.EmptyState, { icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ExclamationTriangleIcon, {}), heading: "0 role created" });
751
+
752
+ // admin/views/invoices/index.tsx
753
+ var import_apsara9 = require("@raystack/apsara");
754
+ var import_react5 = require("react");
755
+
756
+ // admin/views/invoices/navbar.tsx
757
+ var import_apsara7 = require("@raystack/apsara");
758
+
759
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-eI9SsEtYKgKj/lib/admin/views/invoices/invoices.module.css.js
760
+ var digest5 = "faf408d732f8dc0cf170ce6f2c9c251e727c7bbb2bbfa8833c7578782932dbff";
761
+ var css5 = `._navbar_9c4wr_1 {
762
+ padding: var(--rs-space-4) var(--rs-space-7);
763
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
764
+ background: var(--rs-color-background-base-primary);
765
+ display: flex;
766
+ align-items: center;
767
+ justify-content: space-between;
768
+ }
769
+
770
+ ._table_9c4wr_10 {
771
+ height: auto;
772
+ }
773
+
774
+ ._table-empty_9c4wr_14 {
775
+ height: 100%;
776
+ }
777
+
778
+ ._empty-state_9c4wr_18 {
779
+ height: 100%;
780
+ }
781
+
782
+ ._table-wrapper_9c4wr_22 {
783
+ /* Navbar Height + Toolbar height */
784
+ height: calc(100vh - 90px);
785
+ overflow: auto;
786
+ }
787
+
788
+ ._table-header_9c4wr_28 {
789
+ /* position: relative; */
790
+ z-index: 2;
791
+ }
792
+
793
+ ._table_9c4wr_10 th:first-child,
794
+ ._table_9c4wr_10 td:first-child {
795
+ padding-left: var(--rs-space-7);
796
+ max-width: 200px;
797
+ }
798
+ `;
799
+ (function() {
800
+ if (typeof document === "undefined") {
801
+ return;
802
+ }
803
+ if (!document.getElementById(digest5)) {
804
+ var el = document.createElement("style");
805
+ el.id = digest5;
806
+ el.textContent = css5;
807
+ document.head.appendChild(el);
808
+ }
809
+ })();
810
+ 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" };
811
+
812
+ // admin/assets/icons/InvoicesIcon.tsx
813
+ var import_jsx_runtime7 = require("react/jsx-runtime");
814
+ function InvoicesIcon(props) {
815
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
816
+ "svg",
817
+ __spreadProps(__spreadValues({
818
+ width: "16",
819
+ height: "16",
820
+ viewBox: "0 0 16 16",
821
+ fill: "none",
822
+ xmlns: "http://www.w3.org/2000/svg"
823
+ }, props), {
824
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("g", { id: "compass", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
825
+ "path",
826
+ {
827
+ id: "Subtract",
828
+ fillRule: "evenodd",
829
+ clipRule: "evenodd",
830
+ 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",
831
+ fill: "currentColor"
832
+ }
833
+ ) })
834
+ })
835
+ );
836
+ }
837
+
838
+ // admin/views/invoices/navbar.tsx
839
+ var import_react4 = require("react");
840
+ var import_jsx_runtime8 = require("react/jsx-runtime");
841
+ var InvoicesNavabar = ({ searchQuery }) => {
842
+ const [showSearch, setShowSearch] = (0, import_react4.useState)(searchQuery ? true : false);
843
+ function toggleSearch() {
844
+ setShowSearch((prev) => !prev);
845
+ }
846
+ function onSearchBlur(e) {
847
+ const value = e.target.value;
848
+ if (!value) {
849
+ setShowSearch(false);
850
+ }
851
+ }
852
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("nav", { className: invoices_module_css_default.navbar, children: [
853
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_apsara7.Flex, { gap: 2, children: [
854
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(InvoicesIcon, {}),
855
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_apsara7.Text, { size: 2, weight: 500, children: "Invoices" })
856
+ ] }),
857
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_apsara7.Flex, { align: "center", children: showSearch ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
858
+ import_apsara7.DataTable.Search,
859
+ {
860
+ showClearButton: true,
861
+ size: "small",
862
+ onBlur: onSearchBlur,
863
+ autoFocus: true
864
+ }
865
+ ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
866
+ import_apsara7.IconButton,
867
+ {
868
+ size: 3,
869
+ "aria-label": "Search",
870
+ "data-test-id": "admin-search-invoices-btn",
871
+ onClick: toggleSearch,
872
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MagnifyingGlassIcon, {})
873
+ }
874
+ ) })
875
+ ] });
876
+ };
877
+
878
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-yfZGlc5lvFus/lib/admin/views/invoices/invoices.module.css.js
879
+ var digest6 = "fde7cb61b25e2c8cbcd34619b2d3021cd08e148c9cfcc1b307e211761e41953a";
880
+ var css6 = `._navbar_9c4wr_1 {
881
+ padding: var(--rs-space-4) var(--rs-space-7);
882
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
883
+ background: var(--rs-color-background-base-primary);
884
+ display: flex;
885
+ align-items: center;
886
+ justify-content: space-between;
887
+ }
888
+
889
+ ._table_9c4wr_10 {
890
+ height: auto;
891
+ }
892
+
893
+ ._table-empty_9c4wr_14 {
894
+ height: 100%;
895
+ }
896
+
897
+ ._empty-state_9c4wr_18 {
898
+ height: 100%;
899
+ }
900
+
901
+ ._table-wrapper_9c4wr_22 {
902
+ /* Navbar Height + Toolbar height */
903
+ height: calc(100vh - 90px);
904
+ overflow: auto;
905
+ }
906
+
907
+ ._table-header_9c4wr_28 {
908
+ /* position: relative; */
909
+ z-index: 2;
910
+ }
911
+
912
+ ._table_9c4wr_10 th:first-child,
913
+ ._table_9c4wr_10 td:first-child {
914
+ padding-left: var(--rs-space-7);
915
+ max-width: 200px;
916
+ }
917
+ `;
918
+ (function() {
919
+ if (typeof document === "undefined") {
920
+ return;
921
+ }
922
+ if (!document.getElementById(digest6)) {
923
+ var el = document.createElement("style");
924
+ el.id = digest6;
925
+ el.textContent = css6;
926
+ document.head.appendChild(el);
927
+ }
928
+ })();
929
+ 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" };
930
+
931
+ // admin/views/invoices/columns.tsx
932
+ var import_apsara8 = require("@raystack/apsara");
933
+ var import_dayjs = __toESM(require("dayjs"));
934
+
935
+ // admin/utils/connect-timestamp.ts
936
+ var import_wkt = require("@bufbuild/protobuf/wkt");
937
+ function timestampToDate(timestamp) {
938
+ if (!timestamp)
939
+ return null;
940
+ return (0, import_wkt.timestampDate)(timestamp);
941
+ }
942
+ function isNullTimestamp(timestamp) {
943
+ if (!timestamp)
944
+ return true;
945
+ return Number(timestamp.seconds) <= 0;
946
+ }
947
+
948
+ // admin/views/invoices/columns.tsx
949
+ var import_jsx_runtime9 = require("react/jsx-runtime");
950
+ var getColumns2 = () => {
951
+ return [
952
+ {
953
+ accessorKey: "createdAt",
954
+ header: "Billed on",
955
+ filterType: "date",
956
+ enableColumnFilter: true,
957
+ cell: ({ getValue }) => {
958
+ const value = getValue();
959
+ const date = isNullTimestamp(value) ? "-" : (0, import_dayjs.default)(timestampToDate(value)).format("YYYY-MM-DD");
960
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_apsara8.Text, { children: date });
961
+ },
962
+ enableHiding: true,
963
+ enableSorting: true
964
+ },
965
+ {
966
+ enableColumnFilter: true,
967
+ accessorKey: "state",
968
+ filterOptions: ["paid", "open", "draft"].map((value) => ({
969
+ value,
970
+ label: value
971
+ })),
972
+ filterType: "select",
973
+ header: "State",
974
+ cell: ({ row, getValue }) => {
975
+ return getValue();
976
+ }
977
+ },
978
+ {
979
+ accessorKey: "orgTitle",
980
+ header: "Organization",
981
+ cell: ({ row, getValue }) => {
982
+ return getValue();
983
+ }
984
+ },
985
+ {
986
+ header: "Amount",
987
+ accessorKey: "amount",
988
+ cell: ({ row, getValue }) => {
989
+ const value = Number(getValue());
990
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_apsara8.Amount, { value, currency: row.original.currency });
991
+ }
992
+ },
993
+ {
994
+ accessorKey: "invoiceLink",
995
+ header: "",
996
+ cell: ({ row, getValue }) => {
997
+ const link = getValue();
998
+ return link ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_apsara8.Link, { href: link, external: true, children: "Link" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_apsara8.Text, { children: "-" });
999
+ }
1000
+ }
1001
+ ];
1002
+ };
1003
+
1004
+ // admin/views/invoices/index.tsx
1005
+ var import_connect_query2 = require("@connectrpc/connect-query");
1006
+ var import_frontier3 = require("@raystack/proton/frontier");
1007
+
1008
+ // admin/utils/connect-pagination.ts
1009
+ var DEFAULT_PAGE_SIZE = 50;
1010
+ function getConnectNextPageParam(lastPage, queryParams, itemsKey = "organizations") {
1011
+ const pagination = lastPage.pagination;
1012
+ const currentOffset = (pagination == null ? void 0 : pagination.offset) || 0;
1013
+ const limit = (pagination == null ? void 0 : pagination.limit) || DEFAULT_PAGE_SIZE;
1014
+ const items = Array.isArray(lastPage[itemsKey]) ? lastPage[itemsKey] : [];
1015
+ const hasMorePages = items && items.length !== 0 && items.length === limit;
1016
+ if (!hasMorePages) {
1017
+ return void 0;
1018
+ }
1019
+ const nextOffset = currentOffset + limit;
1020
+ const nextParams = __spreadProps(__spreadValues({}, queryParams.query), {
1021
+ offset: nextOffset
1022
+ });
1023
+ return nextParams;
1024
+ }
1025
+ function getGroupCountMapFromFirstPage(infiniteData) {
1026
+ var _a;
1027
+ if (!((_a = infiniteData == null ? void 0 : infiniteData.pages) == null ? void 0 : _a[0])) {
1028
+ return {};
1029
+ }
1030
+ const firstPage = infiniteData.pages[0];
1031
+ const group = firstPage.group;
1032
+ if (!(group == null ? void 0 : group.data) || !group.name) {
1033
+ return {};
1034
+ }
1035
+ const groupCount = group.data.reduce(
1036
+ (acc, groupItem) => {
1037
+ acc[groupItem.name || ""] = groupItem.count || 0;
1038
+ return acc;
1039
+ },
1040
+ {}
1041
+ );
1042
+ const groupKey = group.name;
1043
+ return { [groupKey]: groupCount };
1044
+ }
1045
+
1046
+ // admin/utils/transform-query.ts
1047
+ var import_frontier2 = require("@raystack/proton/frontier");
1048
+ var import_protobuf = require("@bufbuild/protobuf");
1049
+ function convertFilterValue(value) {
1050
+ switch (typeof value) {
1051
+ case "boolean":
1052
+ return { case: "boolValue", value };
1053
+ case "number":
1054
+ return { case: "numberValue", value };
1055
+ case "string":
1056
+ return { case: "stringValue", value };
1057
+ default:
1058
+ return { case: "stringValue", value: value != null ? value : "" };
1059
+ }
1060
+ }
1061
+ function transformFilter(filter, fieldNameMapping) {
1062
+ var _a;
1063
+ let value;
1064
+ if (filter.boolValue !== void 0) {
1065
+ value = { case: "boolValue", value: filter.boolValue };
1066
+ } else if (filter.numberValue !== void 0) {
1067
+ value = { case: "numberValue", value: filter.numberValue };
1068
+ } else if (filter.stringValue !== void 0) {
1069
+ value = { case: "stringValue", value: filter.stringValue };
1070
+ } else {
1071
+ value = convertFilterValue(filter.value);
1072
+ }
1073
+ const operator = filter.operator === "ilike" && value.case === "stringValue" ? "like" : filter.operator;
1074
+ const fieldName = (_a = fieldNameMapping == null ? void 0 : fieldNameMapping[filter.name]) != null ? _a : filter.name;
1075
+ return (0, import_protobuf.create)(import_frontier2.RQLFilterSchema, {
1076
+ name: fieldName,
1077
+ operator,
1078
+ value
1079
+ });
1080
+ }
1081
+ function transformSort(sort, fieldNameMapping) {
1082
+ if (!sort || sort.length === 0) {
1083
+ return void 0;
1084
+ }
1085
+ return sort.map((s) => {
1086
+ var _a;
1087
+ return (0, import_protobuf.create)(import_frontier2.RQLSortSchema, __spreadProps(__spreadValues({}, s), {
1088
+ name: (_a = fieldNameMapping == null ? void 0 : fieldNameMapping[s.name]) != null ? _a : s.name
1089
+ }));
1090
+ });
1091
+ }
1092
+ function transformDataTableQueryToRQLRequest(query, options = {}) {
1093
+ var _a;
1094
+ const { defaultLimit = 50, fieldNameMapping } = options;
1095
+ const filters = ((_a = query.filters) == null ? void 0 : _a.length) ? query.filters.map((filter) => transformFilter(filter, fieldNameMapping)) : [];
1096
+ const rqlRequest = (0, import_protobuf.create)(import_frontier2.RQLRequestSchema, {
1097
+ filters,
1098
+ groupBy: query.group_by || [],
1099
+ offset: query.offset || 0,
1100
+ limit: query.limit || defaultLimit,
1101
+ sort: transformSort(query.sort || [], fieldNameMapping) || [],
1102
+ search: query.search || ""
1103
+ });
1104
+ return rqlRequest;
1105
+ }
1106
+
1107
+ // admin/views/invoices/index.tsx
1108
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1109
+ var NoInvoices = () => {
1110
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1111
+ import_apsara9.EmptyState,
1112
+ {
1113
+ classNames: {
1114
+ container: invoices_module_css_default2["empty-state"],
1115
+ subHeading: invoices_module_css_default2["empty-state-subheading"]
1116
+ },
1117
+ heading: "No invoices found",
1118
+ subHeading: "Start billing to organizations to populate the table",
1119
+ icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InvoicesIcon, {})
1120
+ }
1121
+ );
1122
+ };
1123
+ var DEFAULT_SORT = { name: "createdAt", order: "desc" };
1124
+ var INITIAL_QUERY = {
1125
+ offset: 0,
1126
+ limit: DEFAULT_PAGE_SIZE
1127
+ };
1128
+ function InvoicesView({ appName } = {}) {
1129
+ var _a;
1130
+ const [tableQuery, setTableQuery] = (0, import_react5.useState)(INITIAL_QUERY);
1131
+ const query = transformDataTableQueryToRQLRequest(tableQuery, {
1132
+ fieldNameMapping: {
1133
+ createdAt: "created_at"
1134
+ }
1135
+ });
1136
+ const {
1137
+ data: infiniteData,
1138
+ isLoading,
1139
+ isFetchingNextPage,
1140
+ fetchNextPage,
1141
+ error,
1142
+ isError,
1143
+ hasNextPage
1144
+ } = (0, import_connect_query2.useInfiniteQuery)(
1145
+ import_frontier3.AdminServiceQueries.searchInvoices,
1146
+ { query },
1147
+ {
1148
+ pageParamKey: "query",
1149
+ getNextPageParam: (lastPage) => getConnectNextPageParam(lastPage, { query }, "invoices"),
1150
+ staleTime: 0,
1151
+ refetchOnWindowFocus: false,
1152
+ retry: 1,
1153
+ retryDelay: 1e3
1154
+ }
1155
+ );
1156
+ const data = ((_a = infiniteData == null ? void 0 : infiniteData.pages) == null ? void 0 : _a.flatMap((page) => (page == null ? void 0 : page.invoices) || [])) || [];
1157
+ const onTableQueryChange = (newQuery) => {
1158
+ setTableQuery(__spreadProps(__spreadValues({}, newQuery), {
1159
+ offset: 0,
1160
+ limit: newQuery.limit || DEFAULT_PAGE_SIZE
1161
+ }));
1162
+ };
1163
+ const handleLoadMore = () => __async(this, null, function* () {
1164
+ try {
1165
+ if (!hasNextPage)
1166
+ return;
1167
+ yield fetchNextPage();
1168
+ } catch (error2) {
1169
+ console.error("Error loading more invoices:", error2);
1170
+ }
1171
+ });
1172
+ const columns = getColumns2();
1173
+ const loading = isLoading || isFetchingNextPage;
1174
+ if (isError) {
1175
+ console.error("ConnectRPC Error:", error);
1176
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1177
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PageTitle, { title: "Invoices", appName }),
1178
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1179
+ import_apsara9.EmptyState,
1180
+ {
1181
+ icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ExclamationTriangleIcon, {}),
1182
+ heading: "Error Loading Invoices",
1183
+ subHeading: (error == null ? void 0 : error.message) || "Something went wrong while loading invoices. Please try again."
1184
+ }
1185
+ )
1186
+ ] });
1187
+ }
1188
+ const tableClassName = data.length || loading ? invoices_module_css_default2["table"] : invoices_module_css_default2["table-empty"];
1189
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1190
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PageTitle, { title: "Invoices", appName }),
1191
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1192
+ import_apsara9.DataTable,
1193
+ {
1194
+ query: tableQuery,
1195
+ columns,
1196
+ data,
1197
+ isLoading: loading,
1198
+ defaultSort: DEFAULT_SORT,
1199
+ onTableQueryChange,
1200
+ mode: "server",
1201
+ onLoadMore: handleLoadMore,
1202
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_apsara9.Flex, { direction: "column", style: { width: "100%" }, children: [
1203
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InvoicesNavabar, { searchQuery: tableQuery.search || "" }),
1204
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_apsara9.DataTable.Toolbar, {}),
1205
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1206
+ import_apsara9.DataTable.VirtualizedContent,
1207
+ {
1208
+ classNames: {
1209
+ root: invoices_module_css_default2["table-wrapper"],
1210
+ table: tableClassName,
1211
+ header: invoices_module_css_default2["table-header"]
1212
+ },
1213
+ emptyState: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NoInvoices, {}),
1214
+ rowHeight: 48,
1215
+ groupHeaderHeight: 48
1216
+ }
1217
+ )
1218
+ ] })
1219
+ }
1220
+ )
1221
+ ] });
1222
+ }
1223
+
1224
+ // admin/views/products/index.tsx
1225
+ var import_apsara13 = require("@raystack/apsara");
1226
+ var import_connect_query3 = require("@connectrpc/connect-query");
1227
+ var import_frontier4 = require("@raystack/proton/frontier");
1228
+
1229
+ // admin/views/products/columns.tsx
1230
+ var import_apsara10 = require("@raystack/apsara");
1231
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1232
+ var getColumns3 = (onNavigateToPrices) => {
1233
+ return [
1234
+ {
1235
+ accessorKey: "id",
1236
+ header: "",
1237
+ cell: (info) => {
1238
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1239
+ import_apsara10.Image,
1240
+ {
1241
+ src: "/product.svg",
1242
+ alt: "product-icon",
1243
+ width: 24,
1244
+ height: 24,
1245
+ style: {
1246
+ backgroundColor: "var(--rs-color-background-neutral-secondary)",
1247
+ borderRadius: "var(--rs-radius-3)",
1248
+ border: "1px solid var(--rs-color-border-base-primary)",
1249
+ margin: "var(--rs-space-3)"
1250
+ }
1251
+ }
1252
+ );
1253
+ }
1254
+ },
1255
+ {
1256
+ header: "Name",
1257
+ accessorKey: "title",
1258
+ cell: ({ row }) => {
1259
+ var _a, _b, _c, _d, _e;
1260
+ const prices = (_a = row == null ? void 0 : row.original) == null ? void 0 : _a.prices;
1261
+ const productId = (_b = row == null ? void 0 : row.original) == null ? void 0 : _b.id;
1262
+ const priceComp = (prices == null ? void 0 : prices.length) === 1 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1263
+ import_apsara10.Amount,
1264
+ {
1265
+ value: Number((_c = prices[0].amount) != null ? _c : 0),
1266
+ currency: prices[0].currency
1267
+ }
1268
+ ) : onNavigateToPrices && productId ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1269
+ "button",
1270
+ {
1271
+ "data-test-id": "products-table-prices-link",
1272
+ type: "button",
1273
+ onClick: (e) => {
1274
+ e.stopPropagation();
1275
+ onNavigateToPrices(productId);
1276
+ },
1277
+ style: {
1278
+ background: "none",
1279
+ border: "none",
1280
+ padding: 0,
1281
+ cursor: "pointer",
1282
+ textDecoration: "underline",
1283
+ font: "inherit",
1284
+ color: "inherit"
1285
+ },
1286
+ children: [
1287
+ prices == null ? void 0 : prices.length,
1288
+ " prices"
1289
+ ]
1290
+ }
1291
+ ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
1292
+ (_d = prices == null ? void 0 : prices.length) != null ? _d : 0,
1293
+ " prices"
1294
+ ] });
1295
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_apsara10.Flex, { direction: "column", gap: "extra-small", children: [
1296
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_apsara10.Flex, { children: (_e = row == null ? void 0 : row.original) == null ? void 0 : _e.title }),
1297
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_apsara10.Flex, { children: priceComp })
1298
+ ] });
1299
+ }
1300
+ },
1301
+ {
1302
+ header: "Product Id",
1303
+ accessorKey: "id",
1304
+ filterVariant: "text",
1305
+ cell: (info) => info.getValue()
1306
+ },
1307
+ {
1308
+ header: "Created on",
1309
+ accessorKey: "createdAt",
1310
+ cell: ({ getValue }) => {
1311
+ const timestamp = getValue();
1312
+ const date = timestampToDate(timestamp);
1313
+ if (!date)
1314
+ return "-";
1315
+ return date.toLocaleString("en", {
1316
+ month: "long",
1317
+ day: "numeric",
1318
+ year: "numeric"
1319
+ });
1320
+ },
1321
+ filterVariant: "date"
1322
+ },
1323
+ {
1324
+ header: "Updated on",
1325
+ accessorKey: "updatedAt",
1326
+ cell: ({ getValue }) => {
1327
+ const timestamp = getValue();
1328
+ const date = timestampToDate(timestamp);
1329
+ if (!date)
1330
+ return "-";
1331
+ return date.toLocaleString("en", {
1332
+ month: "long",
1333
+ day: "numeric",
1334
+ year: "numeric"
1335
+ });
1336
+ },
1337
+ filterVariant: "date"
1338
+ }
1339
+ ];
1340
+ };
1341
+
1342
+ // admin/views/products/header.tsx
1343
+ var import_apsara11 = require("@raystack/apsara");
1344
+
1345
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-fa5cEaZagxLb/lib/admin/views/products/products.module.css.js
1346
+ var digest7 = "cfcc4508db80ffa378a245e164e681046c24cedc9d3c1b7348e92f63941cbffa";
1347
+ var css7 = `._tableRoot_1lzjd_1 {
1348
+ width: 100%;
1349
+ }
1350
+
1351
+ ._tableWrapper_1lzjd_5 {
1352
+ width: 100%;
1353
+ }
1354
+
1355
+ ._table_1lzjd_1 {
1356
+ table-layout: fixed;
1357
+ }
1358
+
1359
+ ._header_1lzjd_13 {
1360
+ background-color: var(--rs-color-background-base-primary);
1361
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
1362
+ }
1363
+
1364
+ ._sheetContent_1lzjd_18 {
1365
+ width: 400px;
1366
+ padding: 0;
1367
+ }
1368
+
1369
+ ._sheetContentBody_1lzjd_23 {
1370
+ padding: var(--rs-space-5);
1371
+ }
1372
+
1373
+ ._linkButton_1lzjd_27 {
1374
+ background: none;
1375
+ border: none;
1376
+ padding: 0;
1377
+ cursor: pointer;
1378
+ text-decoration: underline;
1379
+ font: inherit;
1380
+ color: inherit;
1381
+ }`;
1382
+ (function() {
1383
+ if (typeof document === "undefined") {
1384
+ return;
1385
+ }
1386
+ if (!document.getElementById(digest7)) {
1387
+ var el = document.createElement("style");
1388
+ el.id = digest7;
1389
+ el.textContent = css7;
1390
+ document.head.appendChild(el);
1391
+ }
1392
+ })();
1393
+ 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" };
1394
+
1395
+ // admin/views/products/header.tsx
1396
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1397
+ var defaultPageHeader = {
1398
+ title: "Products",
1399
+ breadcrumb: []
1400
+ };
1401
+ var ProductsHeader = ({
1402
+ header = defaultPageHeader,
1403
+ onBreadcrumbClick
1404
+ }) => {
1405
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1406
+ PageHeader,
1407
+ {
1408
+ title: header.title,
1409
+ breadcrumb: header.breadcrumb,
1410
+ onBreadcrumbClick,
1411
+ className: products_module_css_default.header,
1412
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_apsara11.DataTable.Search, { placeholder: "Search products...", size: "small" })
1413
+ }
1414
+ );
1415
+ };
1416
+
1417
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-LIvetXoHpyap/lib/admin/views/products/products.module.css.js
1418
+ var digest8 = "783585af72f020ea3123a9326b707ac7231655fe874614b2b2be1ad762f83aa8";
1419
+ var css8 = `._tableRoot_1lzjd_1 {
1420
+ width: 100%;
1421
+ }
1422
+
1423
+ ._tableWrapper_1lzjd_5 {
1424
+ width: 100%;
1425
+ }
1426
+
1427
+ ._table_1lzjd_1 {
1428
+ table-layout: fixed;
1429
+ }
1430
+
1431
+ ._header_1lzjd_13 {
1432
+ background-color: var(--rs-color-background-base-primary);
1433
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
1434
+ }
1435
+
1436
+ ._sheetContent_1lzjd_18 {
1437
+ width: 400px;
1438
+ padding: 0;
1439
+ }
1440
+
1441
+ ._sheetContentBody_1lzjd_23 {
1442
+ padding: var(--rs-space-5);
1443
+ }
1444
+
1445
+ ._linkButton_1lzjd_27 {
1446
+ background: none;
1447
+ border: none;
1448
+ padding: 0;
1449
+ cursor: pointer;
1450
+ text-decoration: underline;
1451
+ font: inherit;
1452
+ color: inherit;
1453
+ }`;
1454
+ (function() {
1455
+ if (typeof document === "undefined") {
1456
+ return;
1457
+ }
1458
+ if (!document.getElementById(digest8)) {
1459
+ var el = document.createElement("style");
1460
+ el.id = digest8;
1461
+ el.textContent = css8;
1462
+ document.head.appendChild(el);
1463
+ }
1464
+ })();
1465
+ 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" };
1466
+
1467
+ // admin/views/products/details.tsx
1468
+ var import_apsara12 = require("@raystack/apsara");
1469
+
1470
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-MSh5YFx35vZg/lib/admin/views/products/products.module.css.js
1471
+ var digest9 = "a623d910b785cd5b5aa670f6b99f42f149be0e74c4d32f195dfa640824b39e28";
1472
+ var css9 = `._tableRoot_1lzjd_1 {
1473
+ width: 100%;
1474
+ }
1475
+
1476
+ ._tableWrapper_1lzjd_5 {
1477
+ width: 100%;
1478
+ }
1479
+
1480
+ ._table_1lzjd_1 {
1481
+ table-layout: fixed;
1482
+ }
1483
+
1484
+ ._header_1lzjd_13 {
1485
+ background-color: var(--rs-color-background-base-primary);
1486
+ border-bottom: 1px solid var(--rs-color-border-base-primary);
1487
+ }
1488
+
1489
+ ._sheetContent_1lzjd_18 {
1490
+ width: 400px;
1491
+ padding: 0;
1492
+ }
1493
+
1494
+ ._sheetContentBody_1lzjd_23 {
1495
+ padding: var(--rs-space-5);
1496
+ }
1497
+
1498
+ ._linkButton_1lzjd_27 {
1499
+ background: none;
1500
+ border: none;
1501
+ padding: 0;
1502
+ cursor: pointer;
1503
+ text-decoration: underline;
1504
+ font: inherit;
1505
+ color: inherit;
1506
+ }`;
1507
+ (function() {
1508
+ if (typeof document === "undefined") {
1509
+ return;
1510
+ }
1511
+ if (!document.getElementById(digest9)) {
1512
+ var el = document.createElement("style");
1513
+ el.id = digest9;
1514
+ el.textContent = css9;
1515
+ document.head.appendChild(el);
1516
+ }
1517
+ })();
1518
+ 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" };
1519
+
1520
+ // admin/views/products/details.tsx
1521
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1522
+ function ProductDetails({
1523
+ product,
1524
+ onClose,
1525
+ onNavigateToPrices
1526
+ }) {
1527
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_apsara12.Sheet, { open: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_apsara12.Sheet.Content, { className: products_module_css_default3.sheetContent, children: [
1528
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SheetHeader, { title: "Product Details", onClick: onClose }),
1529
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_apsara12.Flex, { className: products_module_css_default3.sheetContentBody, direction: "column", gap: 9, children: [
1530
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_apsara12.Text, { size: 4, children: product == null ? void 0 : product.title }),
1531
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_apsara12.Flex, { direction: "column", gap: 9, children: [
1532
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_apsara12.Grid, { columns: 2, gap: "small", children: [
1533
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_apsara12.Text, { size: 1, children: "Name" }),
1534
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_apsara12.Text, { size: 1, children: product == null ? void 0 : product.title })
1535
+ ] }),
1536
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_apsara12.Grid, { columns: 2, gap: "small", children: [
1537
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_apsara12.Text, { size: 1, children: "Prices" }),
1538
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_apsara12.Text, { size: 1, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1539
+ "button",
1540
+ {
1541
+ type: "button",
1542
+ className: products_module_css_default3.linkButton,
1543
+ "data-test-id": "product-details-prices-link",
1544
+ onClick: () => (product == null ? void 0 : product.id) && onNavigateToPrices(product.id),
1545
+ children: "Go to prices"
1546
+ }
1547
+ ) })
1548
+ ] })
1549
+ ] })
1550
+ ] })
1551
+ ] }) });
1552
+ }
1553
+
1554
+ // admin/views/products/index.tsx
1555
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1556
+ function ProductsView({
1557
+ selectedProductId,
1558
+ onSelectProduct,
1559
+ onCloseDetail,
1560
+ onNavigateToPrices,
1561
+ appName
1562
+ } = {}) {
1563
+ var _a;
1564
+ const {
1565
+ data: productsResponse,
1566
+ isLoading: isProductsLoading,
1567
+ error,
1568
+ isError
1569
+ } = (0, import_connect_query3.useQuery)(import_frontier4.FrontierServiceQueries.listProducts, {}, {
1570
+ staleTime: Infinity
1571
+ });
1572
+ const products = (productsResponse == null ? void 0 : productsResponse.products) || [];
1573
+ const productMapById = reduceByKey(products != null ? products : [], "id");
1574
+ const product = selectedProductId ? (_a = productMapById[selectedProductId]) != null ? _a : null : null;
1575
+ const columns = getColumns3(onNavigateToPrices);
1576
+ const handleRowClick = (p) => {
1577
+ var _a2;
1578
+ onSelectProduct == null ? void 0 : onSelectProduct((_a2 = p.id) != null ? _a2 : "");
1579
+ };
1580
+ if (isError) {
1581
+ console.error("ConnectRPC Error:", error);
1582
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1583
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PageTitle, { title: "Products", appName }),
1584
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1585
+ import_apsara13.EmptyState,
1586
+ {
1587
+ icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ExclamationTriangleIcon, {}),
1588
+ heading: "Error Loading Products",
1589
+ subHeading: (error == null ? void 0 : error.message) || "Something went wrong while loading products. Please try again."
1590
+ }
1591
+ )
1592
+ ] });
1593
+ }
1594
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1595
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PageTitle, { title: "Products", appName }),
1596
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1597
+ import_apsara13.DataTable,
1598
+ {
1599
+ data: products,
1600
+ columns,
1601
+ isLoading: isProductsLoading,
1602
+ mode: "client",
1603
+ defaultSort: { name: "title", order: "asc" },
1604
+ onRowClick: handleRowClick,
1605
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_apsara13.Flex, { direction: "column", className: products_module_css_default2.tableWrapper, children: [
1606
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ProductsHeader, {}),
1607
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1608
+ import_apsara13.DataTable.Content,
1609
+ {
1610
+ emptyState: noDataChildren2,
1611
+ classNames: { root: products_module_css_default2.tableRoot }
1612
+ }
1613
+ ),
1614
+ product && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1615
+ ProductDetails,
1616
+ {
1617
+ product,
1618
+ onClose: onCloseDetail != null ? onCloseDetail : () => {
1619
+ },
1620
+ onNavigateToPrices: onNavigateToPrices != null ? onNavigateToPrices : () => {
1621
+ }
1622
+ }
1623
+ )
1624
+ ] })
1625
+ }
1626
+ )
1627
+ ] });
1628
+ }
1629
+ var noDataChildren2 = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1630
+ import_apsara13.EmptyState,
1631
+ {
1632
+ icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ExclamationTriangleIcon, {}),
1633
+ heading: "0 product created",
1634
+ subHeading: "Try creating a new product."
1635
+ }
1636
+ );
1637
+
1638
+ // admin/views/products/prices/index.tsx
1639
+ var import_apsara15 = require("@raystack/apsara");
1640
+ var import_connect_query4 = require("@connectrpc/connect-query");
1641
+ var import_frontier5 = require("@raystack/proton/frontier");
1642
+
1643
+ // admin/views/products/prices/columns.tsx
1644
+ var import_apsara14 = require("@raystack/apsara");
1645
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1646
+ var getColumns4 = (prices) => {
1647
+ return [
1648
+ {
1649
+ header: "Id",
1650
+ accessorKey: "id",
1651
+ cell: (info) => info.getValue(),
1652
+ filterVariant: "text"
1653
+ },
1654
+ {
1655
+ header: "name",
1656
+ accessorKey: "name",
1657
+ cell: (info) => info.getValue(),
1658
+ filterVariant: "text"
1659
+ },
1660
+ {
1661
+ header: "interval",
1662
+ accessorKey: "interval",
1663
+ cell: (info) => info.getValue(),
1664
+ filterVariant: "text"
1665
+ },
1666
+ {
1667
+ header: "Usage Type",
1668
+ accessorKey: "usageType",
1669
+ cell: (info) => info.getValue(),
1670
+ filterVariant: "text"
1671
+ },
1672
+ {
1673
+ header: "billing_scheme",
1674
+ accessorKey: "billingScheme",
1675
+ cell: (info) => info.getValue(),
1676
+ filterVariant: "text"
1677
+ },
1678
+ {
1679
+ header: "Amount",
1680
+ accessorKey: "amount",
1681
+ cell: ({ row }) => {
1682
+ var _a;
1683
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1684
+ import_apsara14.Amount,
1685
+ {
1686
+ value: Number((_a = row.original.amount) != null ? _a : 0),
1687
+ currency: row.original.currency
1688
+ }
1689
+ );
1690
+ },
1691
+ filterVariant: "text"
1692
+ },
1693
+ {
1694
+ header: "creation date",
1695
+ accessorKey: "createdAt",
1696
+ cell: ({ getValue }) => {
1697
+ const timestamp = getValue();
1698
+ const date = timestampToDate(timestamp);
1699
+ if (!date)
1700
+ return "-";
1701
+ return date.toLocaleString("en", {
1702
+ month: "long",
1703
+ day: "numeric",
1704
+ year: "numeric"
1705
+ });
1706
+ }
1707
+ },
1708
+ {
1709
+ header: "Updated date",
1710
+ accessorKey: "updatedAt",
1711
+ enableColumnFilter: false,
1712
+ cell: ({ getValue }) => {
1713
+ const timestamp = getValue();
1714
+ const date = timestampToDate(timestamp);
1715
+ if (!date)
1716
+ return "-";
1717
+ return date.toLocaleString("en", {
1718
+ month: "long",
1719
+ day: "numeric",
1720
+ year: "numeric"
1721
+ });
1722
+ }
1723
+ }
1724
+ ];
1725
+ };
1726
+
1727
+ // admin/views/products/prices/index.tsx
1728
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1729
+ function ProductPricesView({
1730
+ productId,
1731
+ appName,
1732
+ onBreadcrumbClick
1733
+ }) {
1734
+ const {
1735
+ data: productResponse,
1736
+ isLoading: isProductLoading,
1737
+ error,
1738
+ isError
1739
+ } = (0, import_connect_query4.useQuery)(
1740
+ import_frontier5.FrontierServiceQueries.getProduct,
1741
+ { id: productId != null ? productId : "" },
1742
+ { staleTime: Infinity }
1743
+ );
1744
+ const product = productResponse == null ? void 0 : productResponse.product;
1745
+ const pageHeader2 = {
1746
+ title: "Products",
1747
+ breadcrumb: [
1748
+ { href: `/products`, name: "Product list" },
1749
+ { href: `/products/${productId}`, name: `${productId}` },
1750
+ { href: "", name: "Prices" }
1751
+ ]
1752
+ };
1753
+ if (isError) {
1754
+ console.error("ConnectRPC Error:", error);
1755
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1756
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PageTitle, { title: "Product Prices", appName }),
1757
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1758
+ import_apsara15.EmptyState,
1759
+ {
1760
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ExclamationTriangleIcon, {}),
1761
+ heading: "Error Loading Product",
1762
+ subHeading: (error == null ? void 0 : error.message) || "Something went wrong while loading product. Please try again."
1763
+ }
1764
+ )
1765
+ ] });
1766
+ }
1767
+ const prices = (product == null ? void 0 : product.prices) || [];
1768
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1769
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PageTitle, { title: "Product Prices", appName }),
1770
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_apsara15.Flex, { direction: "row", style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1771
+ import_apsara15.DataTable,
1772
+ {
1773
+ data: prices,
1774
+ columns: getColumns4(prices),
1775
+ mode: "client",
1776
+ isLoading: isProductLoading,
1777
+ defaultSort: { name: "createdAt", order: "desc" },
1778
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_apsara15.Flex, { direction: "column", width: "full", children: [
1779
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ProductsHeader, { header: pageHeader2, onBreadcrumbClick }),
1780
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_apsara15.DataTable.Content, { emptyState: noDataChildren3 })
1781
+ ] })
1782
+ }
1783
+ ) })
1784
+ ] });
1785
+ }
1786
+ var noDataChildren3 = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_apsara15.EmptyState, { icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ExclamationTriangleIcon, {}), heading: "0 prices found" });
1787
+
1788
+ // admin/views/audit-logs/index.tsx
1789
+ var import_apsara24 = require("@raystack/apsara");
1790
+ var import_hooks = require("@raystack/apsara/hooks");
1791
+ var import_react7 = require("react");
1792
+
1793
+ // admin/views/audit-logs/navbar.tsx
1794
+ var import_apsara16 = require("@raystack/apsara");
1795
+
1796
+ // admin/assets/icons/CpuChipIcon.tsx
1797
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1798
+ function CpuChipIcon(props) {
1799
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1800
+ "svg",
1801
+ __spreadProps(__spreadValues({
1802
+ xmlns: "http://www.w3.org/2000/svg",
1803
+ width: "16",
1804
+ height: "16",
1805
+ viewBox: "0 0 16 16",
1806
+ fill: "none"
1807
+ }, props), {
1808
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1809
+ "path",
1810
+ {
1811
+ 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",
1812
+ stroke: "currentColor",
1813
+ strokeWidth: "1.5",
1814
+ strokeLinecap: "round",
1815
+ strokeLinejoin: "round"
1816
+ }
1817
+ )
1818
+ })
1819
+ );
1820
+ }
1821
+
1822
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-sj02n4nNx79m/lib/admin/views/audit-logs/audit-logs.module.css.js
1823
+ var digest10 = "8e52b868370de765174a8ea69ac562877e3681205b22de94bc927f0f6fd978b9";
1824
+ var css10 = `._navbar_sfza7_1 {
1825
+ padding: var(--rs-space-4) var(--rs-space-7);
1826
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
1827
+ background: var(--rs-color-background-base-primary);
1828
+ display: flex;
1829
+ align-items: center;
1830
+ justify-content: space-between;
1831
+ }
1832
+
1833
+ ._table_sfza7_10 {
1834
+ height: auto;
1835
+ }
1836
+
1837
+ ._table-empty_sfza7_14 {
1838
+ height: 100%;
1839
+ }
1840
+
1841
+ ._empty-state_sfza7_18 {
1842
+ height: 100%;
1843
+ }
1844
+
1845
+ ._empty-state-subheading_sfza7_22 {
1846
+ max-width: 360px;
1847
+ text-wrap: auto;
1848
+ }
1849
+
1850
+ ._name-column_sfza7_27 {
1851
+ padding-left: var(--rs-space-7);
1852
+ min-width: 300px;
1853
+ }
1854
+ ._org-column_sfza7_31 {
1855
+ min-width: 300px;
1856
+ }
1857
+
1858
+ ._table-wrapper_sfza7_35 {
1859
+ flex: 1;
1860
+ height: 100%;
1861
+ }
1862
+
1863
+ ._table-header_sfza7_40 {
1864
+ z-index: 2;
1865
+ }
1866
+
1867
+ ._side-panel_sfza7_44 {
1868
+ position: sticky;
1869
+ top: 0;
1870
+ }
1871
+
1872
+ ._capitalize_sfza7_49 {
1873
+ text-transform: capitalize;
1874
+ }
1875
+
1876
+ ._table-content-container_sfza7_53 {
1877
+ width: 100%;
1878
+ height: 100%;
1879
+ height: calc(100vh - 90px);
1880
+ overflow: auto;
1881
+ position: relative;
1882
+ }
1883
+
1884
+ ._text-overflow_sfza7_61 {
1885
+ width: fit-content;
1886
+ max-width: 180px;
1887
+ overflow: hidden;
1888
+ text-overflow: ellipsis;
1889
+ white-space: nowrap;
1890
+ }
1891
+
1892
+ ._code-block-container_sfza7_69 {
1893
+ padding: 0;
1894
+ }
1895
+ ._code-block_sfza7_69 {
1896
+ max-height: 400px;
1897
+ overflow: auto;
1898
+ }
1899
+ ._sidepanel-link-trigger_sfza7_76 {
1900
+ width: 100%;
1901
+ justify-content: start;
1902
+ border-radius: var(--rs-radius-2);
1903
+ padding: 0 var(--rs-space-3);
1904
+ cursor: pointer;
1905
+ height: 32px;
1906
+ }
1907
+ ._sidepanel-list-link_sfza7_84 {
1908
+ padding: var(--rs-space-2) 0;
1909
+ display: flex;
1910
+ align-items: center;
1911
+ }
1912
+ ._sidepanel-list-link_sfza7_84 a {
1913
+ text-decoration: none;
1914
+ }
1915
+ `;
1916
+ (function() {
1917
+ if (typeof document === "undefined") {
1918
+ return;
1919
+ }
1920
+ if (!document.getElementById(digest10)) {
1921
+ var el = document.createElement("style");
1922
+ el.id = digest10;
1923
+ el.textContent = css10;
1924
+ document.head.appendChild(el);
1925
+ }
1926
+ })();
1927
+ 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" };
1928
+
1929
+ // admin/views/audit-logs/navbar.tsx
1930
+ var import_react6 = require("react");
1931
+ var import_react_query = require("@tanstack/react-query");
1932
+
1933
+ // admin/views/audit-logs/util.ts
1934
+ var import_protobuf2 = require("@bufbuild/protobuf");
1935
+ var import_frontier6 = require("@raystack/proton/frontier");
1936
+ var getAuditLogActorName = (actor, maxLength = 15) => {
1937
+ var _a;
1938
+ if ((actor == null ? void 0 : actor.type) === ACTOR_TYPES.SYSTEM)
1939
+ return "System";
1940
+ const name = (actor == null ? void 0 : actor.title) || (actor == null ? void 0 : actor.name) || "-";
1941
+ if (((_a = actor == null ? void 0 : actor.metadata) == null ? void 0 : _a["is_super_user"]) === true)
1942
+ if (name.length > maxLength)
1943
+ return name.substring(0, maxLength) + "... (Admin)";
1944
+ else
1945
+ return name + " (Admin)";
1946
+ return name;
1947
+ };
1948
+ var actionBadgeColorPatterns = {
1949
+ warning: /invite|unverify|unverified/i,
1950
+ success: /success|create|verify|verified/i,
1951
+ danger: /error|delete|revoke|remove|disable/i
1952
+ };
1953
+ var getActionBadgeColor = (action) => {
1954
+ for (const [color, pattern] of Object.entries(actionBadgeColorPatterns)) {
1955
+ if (pattern.test(action))
1956
+ return color;
1957
+ }
1958
+ return "accent";
1959
+ };
1960
+ var ACTOR_TYPES = {
1961
+ USER: "app/user",
1962
+ SERVICE_USER: "app/serviceuser",
1963
+ SYSTEM: "system"
1964
+ };
1965
+ var AUDIT_LOG_QUERY_KEY = ["audit-logs", "table-query"];
1966
+ var auditLogToJson = (auditLog) => {
1967
+ return (0, import_protobuf2.toJsonString)(import_frontier6.AuditRecordSchema, auditLog, { prettySpaces: 2 });
1968
+ };
1969
+
1970
+ // admin/views/audit-logs/navbar.tsx
1971
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1972
+ var Navbar = ({ searchQuery, onExportCsv }) => {
1973
+ const [showSearch, setShowSearch] = (0, import_react6.useState)(searchQuery ? true : false);
1974
+ const [isDownloading, setIsDownloading] = (0, import_react6.useState)(false);
1975
+ const queryClient = (0, import_react_query.useQueryClient)();
1976
+ const toggleSearch = (0, import_react6.useCallback)(() => {
1977
+ setShowSearch((prev) => !prev);
1978
+ }, []);
1979
+ const onSearchBlur = (0, import_react6.useCallback)((e) => {
1980
+ const value = e.target.value;
1981
+ if (!value) {
1982
+ setShowSearch(false);
1983
+ }
1984
+ }, []);
1985
+ const onDownloadClick = (0, import_react6.useCallback)(() => __async(void 0, null, function* () {
1986
+ if (!onExportCsv)
1987
+ return;
1988
+ try {
1989
+ setIsDownloading(true);
1990
+ const query = queryClient.getQueryData(
1991
+ AUDIT_LOG_QUERY_KEY
1992
+ );
1993
+ yield onExportCsv(query);
1994
+ } catch (error) {
1995
+ console.error(error);
1996
+ } finally {
1997
+ setIsDownloading(false);
1998
+ }
1999
+ }), [queryClient, onExportCsv]);
2000
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("nav", { className: audit_logs_module_css_default.navbar, children: [
2001
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_apsara16.Flex, { gap: 2, children: [
2002
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CpuChipIcon, {}),
2003
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_apsara16.Text, { size: 2, weight: 500, children: "Audit Logs" })
2004
+ ] }),
2005
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_apsara16.Flex, { align: "center", gap: 4, children: [
2006
+ showSearch ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2007
+ import_apsara16.DataTable.Search,
2008
+ {
2009
+ autoFocus: true,
2010
+ showClearButton: true,
2011
+ size: "small",
2012
+ onBlur: onSearchBlur
2013
+ }
2014
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2015
+ import_apsara16.IconButton,
2016
+ {
2017
+ size: 3,
2018
+ "aria-label": "Search",
2019
+ "data-test-id": "admin-search-audit-logs-btn",
2020
+ onClick: toggleSearch,
2021
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MagnifyingGlassIcon, {})
2022
+ }
2023
+ ),
2024
+ onExportCsv && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2025
+ import_apsara16.IconButton,
2026
+ {
2027
+ size: 3,
2028
+ "aria-label": "Download",
2029
+ "data-test-id": "admin-download-audit-logs-list-btn",
2030
+ onClick: onDownloadClick,
2031
+ disabled: isDownloading,
2032
+ children: isDownloading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_apsara16.Spinner, {}) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DownloadIcon, {})
2033
+ }
2034
+ )
2035
+ ] })
2036
+ ] });
2037
+ };
2038
+ var navbar_default = Navbar;
2039
+
2040
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-wjdJplrpgK1f/lib/admin/views/audit-logs/audit-logs.module.css.js
2041
+ var digest11 = "f346fee1f6a9a82ac3c094fa5bc6c8ee574fe827e549ab3287924bb0f3a4c418";
2042
+ var css11 = `._navbar_sfza7_1 {
2043
+ padding: var(--rs-space-4) var(--rs-space-7);
2044
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2045
+ background: var(--rs-color-background-base-primary);
2046
+ display: flex;
2047
+ align-items: center;
2048
+ justify-content: space-between;
2049
+ }
2050
+
2051
+ ._table_sfza7_10 {
2052
+ height: auto;
2053
+ }
2054
+
2055
+ ._table-empty_sfza7_14 {
2056
+ height: 100%;
2057
+ }
2058
+
2059
+ ._empty-state_sfza7_18 {
2060
+ height: 100%;
2061
+ }
2062
+
2063
+ ._empty-state-subheading_sfza7_22 {
2064
+ max-width: 360px;
2065
+ text-wrap: auto;
2066
+ }
2067
+
2068
+ ._name-column_sfza7_27 {
2069
+ padding-left: var(--rs-space-7);
2070
+ min-width: 300px;
2071
+ }
2072
+ ._org-column_sfza7_31 {
2073
+ min-width: 300px;
2074
+ }
2075
+
2076
+ ._table-wrapper_sfza7_35 {
2077
+ flex: 1;
2078
+ height: 100%;
2079
+ }
2080
+
2081
+ ._table-header_sfza7_40 {
2082
+ z-index: 2;
2083
+ }
2084
+
2085
+ ._side-panel_sfza7_44 {
2086
+ position: sticky;
2087
+ top: 0;
2088
+ }
2089
+
2090
+ ._capitalize_sfza7_49 {
2091
+ text-transform: capitalize;
2092
+ }
2093
+
2094
+ ._table-content-container_sfza7_53 {
2095
+ width: 100%;
2096
+ height: 100%;
2097
+ height: calc(100vh - 90px);
2098
+ overflow: auto;
2099
+ position: relative;
2100
+ }
2101
+
2102
+ ._text-overflow_sfza7_61 {
2103
+ width: fit-content;
2104
+ max-width: 180px;
2105
+ overflow: hidden;
2106
+ text-overflow: ellipsis;
2107
+ white-space: nowrap;
2108
+ }
2109
+
2110
+ ._code-block-container_sfza7_69 {
2111
+ padding: 0;
2112
+ }
2113
+ ._code-block_sfza7_69 {
2114
+ max-height: 400px;
2115
+ overflow: auto;
2116
+ }
2117
+ ._sidepanel-link-trigger_sfza7_76 {
2118
+ width: 100%;
2119
+ justify-content: start;
2120
+ border-radius: var(--rs-radius-2);
2121
+ padding: 0 var(--rs-space-3);
2122
+ cursor: pointer;
2123
+ height: 32px;
2124
+ }
2125
+ ._sidepanel-list-link_sfza7_84 {
2126
+ padding: var(--rs-space-2) 0;
2127
+ display: flex;
2128
+ align-items: center;
2129
+ }
2130
+ ._sidepanel-list-link_sfza7_84 a {
2131
+ text-decoration: none;
2132
+ }
2133
+ `;
2134
+ (function() {
2135
+ if (typeof document === "undefined") {
2136
+ return;
2137
+ }
2138
+ if (!document.getElementById(digest11)) {
2139
+ var el = document.createElement("style");
2140
+ el.id = digest11;
2141
+ el.textContent = css11;
2142
+ document.head.appendChild(el);
2143
+ }
2144
+ })();
2145
+ 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" };
2146
+
2147
+ // admin/views/audit-logs/columns.tsx
2148
+ var import_apsara18 = require("@raystack/apsara");
2149
+ var import_dayjs2 = __toESM(require("dayjs"));
2150
+
2151
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-t9Bs6duLgXBW/lib/admin/views/audit-logs/audit-logs.module.css.js
2152
+ var digest12 = "0f34d56a9a981119bca2814f9cfeaa68865fb8cb1b6a23d2d511441e0ad14668";
2153
+ var css12 = `._navbar_sfza7_1 {
2154
+ padding: var(--rs-space-4) var(--rs-space-7);
2155
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2156
+ background: var(--rs-color-background-base-primary);
2157
+ display: flex;
2158
+ align-items: center;
2159
+ justify-content: space-between;
2160
+ }
2161
+
2162
+ ._table_sfza7_10 {
2163
+ height: auto;
2164
+ }
2165
+
2166
+ ._table-empty_sfza7_14 {
2167
+ height: 100%;
2168
+ }
2169
+
2170
+ ._empty-state_sfza7_18 {
2171
+ height: 100%;
2172
+ }
2173
+
2174
+ ._empty-state-subheading_sfza7_22 {
2175
+ max-width: 360px;
2176
+ text-wrap: auto;
2177
+ }
2178
+
2179
+ ._name-column_sfza7_27 {
2180
+ padding-left: var(--rs-space-7);
2181
+ min-width: 300px;
2182
+ }
2183
+ ._org-column_sfza7_31 {
2184
+ min-width: 300px;
2185
+ }
2186
+
2187
+ ._table-wrapper_sfza7_35 {
2188
+ flex: 1;
2189
+ height: 100%;
2190
+ }
2191
+
2192
+ ._table-header_sfza7_40 {
2193
+ z-index: 2;
2194
+ }
2195
+
2196
+ ._side-panel_sfza7_44 {
2197
+ position: sticky;
2198
+ top: 0;
2199
+ }
2200
+
2201
+ ._capitalize_sfza7_49 {
2202
+ text-transform: capitalize;
2203
+ }
2204
+
2205
+ ._table-content-container_sfza7_53 {
2206
+ width: 100%;
2207
+ height: 100%;
2208
+ height: calc(100vh - 90px);
2209
+ overflow: auto;
2210
+ position: relative;
2211
+ }
2212
+
2213
+ ._text-overflow_sfza7_61 {
2214
+ width: fit-content;
2215
+ max-width: 180px;
2216
+ overflow: hidden;
2217
+ text-overflow: ellipsis;
2218
+ white-space: nowrap;
2219
+ }
2220
+
2221
+ ._code-block-container_sfza7_69 {
2222
+ padding: 0;
2223
+ }
2224
+ ._code-block_sfza7_69 {
2225
+ max-height: 400px;
2226
+ overflow: auto;
2227
+ }
2228
+ ._sidepanel-link-trigger_sfza7_76 {
2229
+ width: 100%;
2230
+ justify-content: start;
2231
+ border-radius: var(--rs-radius-2);
2232
+ padding: 0 var(--rs-space-3);
2233
+ cursor: pointer;
2234
+ height: 32px;
2235
+ }
2236
+ ._sidepanel-list-link_sfza7_84 {
2237
+ padding: var(--rs-space-2) 0;
2238
+ display: flex;
2239
+ align-items: center;
2240
+ }
2241
+ ._sidepanel-list-link_sfza7_84 a {
2242
+ text-decoration: none;
2243
+ }
2244
+ `;
2245
+ (function() {
2246
+ if (typeof document === "undefined") {
2247
+ return;
2248
+ }
2249
+ if (!document.getElementById(digest12)) {
2250
+ var el = document.createElement("style");
2251
+ el.id = digest12;
2252
+ el.textContent = css12;
2253
+ document.head.appendChild(el);
2254
+ }
2255
+ })();
2256
+ 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" };
2257
+
2258
+ // admin/views/audit-logs/actor-cell.tsx
2259
+ var import_apsara17 = require("@raystack/apsara");
2260
+
2261
+ // admin/assets/images/system.jpg
2262
+ 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==";
2263
+
2264
+ // admin/assets/icons/KeyIcon.tsx
2265
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2266
+ function KeyIcon(props) {
2267
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2268
+ "svg",
2269
+ __spreadProps(__spreadValues({
2270
+ xmlns: "http://www.w3.org/2000/svg",
2271
+ width: "16",
2272
+ height: "16",
2273
+ viewBox: "0 0 16 16",
2274
+ fill: "none"
2275
+ }, props), {
2276
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2277
+ "path",
2278
+ {
2279
+ 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",
2280
+ stroke: "currentColor",
2281
+ strokeLinecap: "round",
2282
+ strokeLinejoin: "round"
2283
+ }
2284
+ )
2285
+ })
2286
+ );
2287
+ }
2288
+
2289
+ // admin/views/audit-logs/actor-cell.tsx
2290
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2291
+ function ActorCell({
2292
+ size = "large",
2293
+ value,
2294
+ maxLength
2295
+ }) {
2296
+ var _a, _b;
2297
+ const name = getAuditLogActorName(value, maxLength);
2298
+ const isSystem = value.type === ACTOR_TYPES.SYSTEM;
2299
+ const isServiceUser = value.type === ACTOR_TYPES.SERVICE_USER;
2300
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_apsara17.Flex, { gap: size === "large" ? 4 : 3, align: "center", children: [
2301
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2302
+ import_apsara17.Avatar,
2303
+ {
2304
+ size: size === "large" ? 3 : 1,
2305
+ fallback: isServiceUser ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(KeyIcon, { width: 12, height: 12 }) : (_a = name == null ? void 0 : name[0]) == null ? void 0 : _a.toUpperCase(),
2306
+ color: isServiceUser ? "neutral" : (0, import_apsara17.getAvatarColor)((_b = value == null ? void 0 : value.id) != null ? _b : ""),
2307
+ radius: "full",
2308
+ src: isSystem ? system_default : void 0
2309
+ }
2310
+ ),
2311
+ size === "large" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_apsara17.Text, { size: "regular", children: name }) : name
2312
+ ] });
2313
+ }
2314
+
2315
+ // admin/views/audit-logs/columns.tsx
2316
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2317
+ var getColumns5 = ({
2318
+ groupCountMap
2319
+ }) => {
2320
+ return [
2321
+ {
2322
+ accessorKey: "actor",
2323
+ header: "Actor",
2324
+ classNames: {
2325
+ cell: audit_logs_module_css_default3["name-column"],
2326
+ header: audit_logs_module_css_default3["name-column"]
2327
+ },
2328
+ enableColumnFilter: true,
2329
+ cell: ({ getValue }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActorCell, { value: getValue() })
2330
+ },
2331
+ {
2332
+ accessorKey: "actorType",
2333
+ header: "Actor Type",
2334
+ enableColumnFilter: true,
2335
+ defaultHidden: true,
2336
+ cell: () => null,
2337
+ filterType: "multiselect",
2338
+ filterOptions: [
2339
+ { label: "User", value: ACTOR_TYPES.USER },
2340
+ { label: "Service User", value: ACTOR_TYPES.SERVICE_USER },
2341
+ { label: "System", value: ACTOR_TYPES.SYSTEM }
2342
+ ]
2343
+ },
2344
+ {
2345
+ accessorKey: "orgName",
2346
+ header: "Organization",
2347
+ classNames: {
2348
+ cell: audit_logs_module_css_default3["org-column"],
2349
+ header: audit_logs_module_css_default3["org-column"]
2350
+ },
2351
+ cell: ({ getValue }) => {
2352
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_apsara18.Text, { size: "regular", children: getValue() || "-" });
2353
+ },
2354
+ enableColumnFilter: true
2355
+ },
2356
+ {
2357
+ accessorKey: "event",
2358
+ header: "Action",
2359
+ cell: ({ getValue }) => {
2360
+ const value = getValue();
2361
+ const color = getActionBadgeColor(value);
2362
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_apsara18.Badge, { variant: color, children: value });
2363
+ },
2364
+ enableColumnFilter: true,
2365
+ enableSorting: true
2366
+ },
2367
+ {
2368
+ accessorKey: "resource",
2369
+ header: "Resource",
2370
+ enableColumnFilter: true,
2371
+ cell: ({ getValue }) => {
2372
+ var _a;
2373
+ const value = getValue();
2374
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_apsara18.Flex, { gap: 1, direction: "column", children: [
2375
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_apsara18.Text, { size: "small", weight: "medium", children: value.name || "-" }),
2376
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_apsara18.Text, { size: "small", variant: "secondary", children: (_a = value.type.toLowerCase()) != null ? _a : "-" })
2377
+ ] });
2378
+ }
2379
+ },
2380
+ {
2381
+ accessorKey: "resourceType",
2382
+ header: "Resource Type",
2383
+ enableColumnFilter: true,
2384
+ defaultHidden: true,
2385
+ cell: () => null
2386
+ },
2387
+ {
2388
+ accessorKey: "occurredAt",
2389
+ header: "Timestamp",
2390
+ filterType: "date",
2391
+ cell: ({ getValue }) => {
2392
+ const value = getValue();
2393
+ if (isNullTimestamp(value)) {
2394
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_apsara18.Text, { children: "-" });
2395
+ }
2396
+ const date = (0, import_dayjs2.default)(timestampToDate(value));
2397
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_apsara18.Flex, { gap: 1, direction: "column", children: [
2398
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_apsara18.Text, { size: "small", weight: "medium", children: date.format("DD MMM YYYY") }),
2399
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_apsara18.Text, { size: "small", variant: "secondary", children: date.format("hh:mm A") })
2400
+ ] });
2401
+ },
2402
+ enableHiding: true,
2403
+ enableSorting: true
2404
+ }
2405
+ ];
2406
+ };
2407
+
2408
+ // admin/views/audit-logs/index.tsx
2409
+ var import_connect_query5 = require("@connectrpc/connect-query");
2410
+ var import_frontier7 = require("@raystack/proton/frontier");
2411
+
2412
+ // admin/views/audit-logs/sidepanel-details.tsx
2413
+ var import_apsara22 = require("@raystack/apsara");
2414
+ var import_apsara23 = require("@raystack/apsara");
2415
+
2416
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-iUkU3XrB8kJ0/lib/admin/views/audit-logs/audit-logs.module.css.js
2417
+ var digest13 = "ccbc5f041c7871324ba63dd69217ace8fd2bf5a1186dd9b0440fca686efa8f2f";
2418
+ var css13 = `._navbar_sfza7_1 {
2419
+ padding: var(--rs-space-4) var(--rs-space-7);
2420
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2421
+ background: var(--rs-color-background-base-primary);
2422
+ display: flex;
2423
+ align-items: center;
2424
+ justify-content: space-between;
2425
+ }
2426
+
2427
+ ._table_sfza7_10 {
2428
+ height: auto;
2429
+ }
2430
+
2431
+ ._table-empty_sfza7_14 {
2432
+ height: 100%;
2433
+ }
2434
+
2435
+ ._empty-state_sfza7_18 {
2436
+ height: 100%;
2437
+ }
2438
+
2439
+ ._empty-state-subheading_sfza7_22 {
2440
+ max-width: 360px;
2441
+ text-wrap: auto;
2442
+ }
2443
+
2444
+ ._name-column_sfza7_27 {
2445
+ padding-left: var(--rs-space-7);
2446
+ min-width: 300px;
2447
+ }
2448
+ ._org-column_sfza7_31 {
2449
+ min-width: 300px;
2450
+ }
2451
+
2452
+ ._table-wrapper_sfza7_35 {
2453
+ flex: 1;
2454
+ height: 100%;
2455
+ }
2456
+
2457
+ ._table-header_sfza7_40 {
2458
+ z-index: 2;
2459
+ }
2460
+
2461
+ ._side-panel_sfza7_44 {
2462
+ position: sticky;
2463
+ top: 0;
2464
+ }
2465
+
2466
+ ._capitalize_sfza7_49 {
2467
+ text-transform: capitalize;
2468
+ }
2469
+
2470
+ ._table-content-container_sfza7_53 {
2471
+ width: 100%;
2472
+ height: 100%;
2473
+ height: calc(100vh - 90px);
2474
+ overflow: auto;
2475
+ position: relative;
2476
+ }
2477
+
2478
+ ._text-overflow_sfza7_61 {
2479
+ width: fit-content;
2480
+ max-width: 180px;
2481
+ overflow: hidden;
2482
+ text-overflow: ellipsis;
2483
+ white-space: nowrap;
2484
+ }
2485
+
2486
+ ._code-block-container_sfza7_69 {
2487
+ padding: 0;
2488
+ }
2489
+ ._code-block_sfza7_69 {
2490
+ max-height: 400px;
2491
+ overflow: auto;
2492
+ }
2493
+ ._sidepanel-link-trigger_sfza7_76 {
2494
+ width: 100%;
2495
+ justify-content: start;
2496
+ border-radius: var(--rs-radius-2);
2497
+ padding: 0 var(--rs-space-3);
2498
+ cursor: pointer;
2499
+ height: 32px;
2500
+ }
2501
+ ._sidepanel-list-link_sfza7_84 {
2502
+ padding: var(--rs-space-2) 0;
2503
+ display: flex;
2504
+ align-items: center;
2505
+ }
2506
+ ._sidepanel-list-link_sfza7_84 a {
2507
+ text-decoration: none;
2508
+ }
2509
+ `;
2510
+ (function() {
2511
+ if (typeof document === "undefined") {
2512
+ return;
2513
+ }
2514
+ if (!document.getElementById(digest13)) {
2515
+ var el = document.createElement("style");
2516
+ el.id = digest13;
2517
+ el.textContent = css13;
2518
+ document.head.appendChild(el);
2519
+ }
2520
+ })();
2521
+ 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" };
2522
+
2523
+ // admin/views/audit-logs/sidepanel-details.tsx
2524
+ var import_dayjs3 = __toESM(require("dayjs"));
2525
+
2526
+ // admin/assets/icons/MapIcon.tsx
2527
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2528
+ function MapIcon(props) {
2529
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2530
+ "svg",
2531
+ __spreadProps(__spreadValues({
2532
+ xmlns: "http://www.w3.org/2000/svg",
2533
+ width: "16",
2534
+ height: "16",
2535
+ viewBox: "0 0 16 16",
2536
+ fill: "none"
2537
+ }, props), {
2538
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2539
+ "path",
2540
+ {
2541
+ 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",
2542
+ stroke: "currentColor",
2543
+ strokeLinecap: "round",
2544
+ strokeLinejoin: "round"
2545
+ }
2546
+ )
2547
+ })
2548
+ );
2549
+ }
2550
+
2551
+ // admin/views/audit-logs/sidepanel-log-dialog.tsx
2552
+ var import_apsara19 = require("@raystack/apsara");
2553
+
2554
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-dugEaSNoBS57/lib/admin/views/audit-logs/audit-logs.module.css.js
2555
+ var digest14 = "32f9ddeb378a381011ec7474a6f6465c4586ea320cf3830e2cdb3fc573fc95d6";
2556
+ var css14 = `._navbar_sfza7_1 {
2557
+ padding: var(--rs-space-4) var(--rs-space-7);
2558
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2559
+ background: var(--rs-color-background-base-primary);
2560
+ display: flex;
2561
+ align-items: center;
2562
+ justify-content: space-between;
2563
+ }
2564
+
2565
+ ._table_sfza7_10 {
2566
+ height: auto;
2567
+ }
2568
+
2569
+ ._table-empty_sfza7_14 {
2570
+ height: 100%;
2571
+ }
2572
+
2573
+ ._empty-state_sfza7_18 {
2574
+ height: 100%;
2575
+ }
2576
+
2577
+ ._empty-state-subheading_sfza7_22 {
2578
+ max-width: 360px;
2579
+ text-wrap: auto;
2580
+ }
2581
+
2582
+ ._name-column_sfza7_27 {
2583
+ padding-left: var(--rs-space-7);
2584
+ min-width: 300px;
2585
+ }
2586
+ ._org-column_sfza7_31 {
2587
+ min-width: 300px;
2588
+ }
2589
+
2590
+ ._table-wrapper_sfza7_35 {
2591
+ flex: 1;
2592
+ height: 100%;
2593
+ }
2594
+
2595
+ ._table-header_sfza7_40 {
2596
+ z-index: 2;
2597
+ }
2598
+
2599
+ ._side-panel_sfza7_44 {
2600
+ position: sticky;
2601
+ top: 0;
2602
+ }
2603
+
2604
+ ._capitalize_sfza7_49 {
2605
+ text-transform: capitalize;
2606
+ }
2607
+
2608
+ ._table-content-container_sfza7_53 {
2609
+ width: 100%;
2610
+ height: 100%;
2611
+ height: calc(100vh - 90px);
2612
+ overflow: auto;
2613
+ position: relative;
2614
+ }
2615
+
2616
+ ._text-overflow_sfza7_61 {
2617
+ width: fit-content;
2618
+ max-width: 180px;
2619
+ overflow: hidden;
2620
+ text-overflow: ellipsis;
2621
+ white-space: nowrap;
2622
+ }
2623
+
2624
+ ._code-block-container_sfza7_69 {
2625
+ padding: 0;
2626
+ }
2627
+ ._code-block_sfza7_69 {
2628
+ max-height: 400px;
2629
+ overflow: auto;
2630
+ }
2631
+ ._sidepanel-link-trigger_sfza7_76 {
2632
+ width: 100%;
2633
+ justify-content: start;
2634
+ border-radius: var(--rs-radius-2);
2635
+ padding: 0 var(--rs-space-3);
2636
+ cursor: pointer;
2637
+ height: 32px;
2638
+ }
2639
+ ._sidepanel-list-link_sfza7_84 {
2640
+ padding: var(--rs-space-2) 0;
2641
+ display: flex;
2642
+ align-items: center;
2643
+ }
2644
+ ._sidepanel-list-link_sfza7_84 a {
2645
+ text-decoration: none;
2646
+ }
2647
+ `;
2648
+ (function() {
2649
+ if (typeof document === "undefined") {
2650
+ return;
2651
+ }
2652
+ if (!document.getElementById(digest14)) {
2653
+ var el = document.createElement("style");
2654
+ el.id = digest14;
2655
+ el.textContent = css14;
2656
+ document.head.appendChild(el);
2657
+ }
2658
+ })();
2659
+ 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" };
2660
+
2661
+ // admin/assets/icons/JsonIcon.tsx
2662
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2663
+ function JsonIcon(props) {
2664
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2665
+ "svg",
2666
+ __spreadProps(__spreadValues({
2667
+ xmlns: "http://www.w3.org/2000/svg",
2668
+ width: "16",
2669
+ height: "16",
2670
+ viewBox: "0 0 16 16",
2671
+ fill: "none"
2672
+ }, props), {
2673
+ children: [
2674
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2675
+ "path",
2676
+ {
2677
+ 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",
2678
+ stroke: "currentColor",
2679
+ strokeLinecap: "round",
2680
+ strokeLinejoin: "round"
2681
+ }
2682
+ ),
2683
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2684
+ "path",
2685
+ {
2686
+ 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",
2687
+ stroke: "currentColor",
2688
+ strokeLinecap: "round",
2689
+ strokeLinejoin: "round"
2690
+ }
2691
+ ),
2692
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2693
+ "path",
2694
+ {
2695
+ 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",
2696
+ stroke: "currentColor",
2697
+ strokeLinecap: "round",
2698
+ strokeLinejoin: "round"
2699
+ }
2700
+ ),
2701
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2702
+ "path",
2703
+ {
2704
+ 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",
2705
+ stroke: "currentColor",
2706
+ strokeLinecap: "round",
2707
+ strokeLinejoin: "round"
2708
+ }
2709
+ )
2710
+ ]
2711
+ })
2712
+ );
2713
+ }
2714
+
2715
+ // admin/views/audit-logs/sidepanel-log-dialog.tsx
2716
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2717
+ function SidePanelLogDialog(props) {
2718
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_apsara19.Dialog, { children: [
2719
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_apsara19.Dialog.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2720
+ import_apsara19.IconButton,
2721
+ {
2722
+ size: 3,
2723
+ "data-test-id": "show-audit-json-icon",
2724
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(JsonIcon, {})
2725
+ },
2726
+ "show-audit-json-icon"
2727
+ ) }),
2728
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2729
+ import_apsara19.Dialog.Content,
2730
+ {
2731
+ width: 600,
2732
+ ariaLabel: "Basic Dialog",
2733
+ ariaDescription: "A simple dialog example",
2734
+ children: [
2735
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_apsara19.Dialog.Header, { children: [
2736
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_apsara19.Dialog.Title, { children: "Log entry" }),
2737
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_apsara19.Dialog.CloseButton, { "data-test-id": "close-audit-json-dialog-icon" })
2738
+ ] }),
2739
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_apsara19.Dialog.Body, { className: audit_logs_module_css_default5["code-block-container"], children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_apsara19.CodeBlock, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_apsara19.CodeBlock.Content, { children: [
2740
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_apsara19.CodeBlock.Code, { language: "jsx", className: audit_logs_module_css_default5["code-block"], children: auditLogToJson(props) }),
2741
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2742
+ import_apsara19.CodeBlock.CopyButton,
2743
+ {
2744
+ variant: "floating",
2745
+ "data-test-id": "copy-audit-json-button"
2746
+ }
2747
+ )
2748
+ ] }) }) })
2749
+ ]
2750
+ }
2751
+ )
2752
+ ] }, "show-audit-json-dialog");
2753
+ }
2754
+
2755
+ // admin/views/audit-logs/sidepanel-list-link.tsx
2756
+ var import_apsara20 = require("@raystack/apsara");
2757
+ var import_react_router_dom = require("react-router-dom");
2758
+
2759
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-00BybrFFEdWa/lib/admin/views/audit-logs/audit-logs.module.css.js
2760
+ var digest15 = "4ffaebc8d5617f778fa4e8e64d928043df35299c436b6da7943f169797d9791f";
2761
+ var css15 = `._navbar_sfza7_1 {
2762
+ padding: var(--rs-space-4) var(--rs-space-7);
2763
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2764
+ background: var(--rs-color-background-base-primary);
2765
+ display: flex;
2766
+ align-items: center;
2767
+ justify-content: space-between;
2768
+ }
2769
+
2770
+ ._table_sfza7_10 {
2771
+ height: auto;
2772
+ }
2773
+
2774
+ ._table-empty_sfza7_14 {
2775
+ height: 100%;
2776
+ }
2777
+
2778
+ ._empty-state_sfza7_18 {
2779
+ height: 100%;
2780
+ }
2781
+
2782
+ ._empty-state-subheading_sfza7_22 {
2783
+ max-width: 360px;
2784
+ text-wrap: auto;
2785
+ }
2786
+
2787
+ ._name-column_sfza7_27 {
2788
+ padding-left: var(--rs-space-7);
2789
+ min-width: 300px;
2790
+ }
2791
+ ._org-column_sfza7_31 {
2792
+ min-width: 300px;
2793
+ }
2794
+
2795
+ ._table-wrapper_sfza7_35 {
2796
+ flex: 1;
2797
+ height: 100%;
2798
+ }
2799
+
2800
+ ._table-header_sfza7_40 {
2801
+ z-index: 2;
2802
+ }
2803
+
2804
+ ._side-panel_sfza7_44 {
2805
+ position: sticky;
2806
+ top: 0;
2807
+ }
2808
+
2809
+ ._capitalize_sfza7_49 {
2810
+ text-transform: capitalize;
2811
+ }
2812
+
2813
+ ._table-content-container_sfza7_53 {
2814
+ width: 100%;
2815
+ height: 100%;
2816
+ height: calc(100vh - 90px);
2817
+ overflow: auto;
2818
+ position: relative;
2819
+ }
2820
+
2821
+ ._text-overflow_sfza7_61 {
2822
+ width: fit-content;
2823
+ max-width: 180px;
2824
+ overflow: hidden;
2825
+ text-overflow: ellipsis;
2826
+ white-space: nowrap;
2827
+ }
2828
+
2829
+ ._code-block-container_sfza7_69 {
2830
+ padding: 0;
2831
+ }
2832
+ ._code-block_sfza7_69 {
2833
+ max-height: 400px;
2834
+ overflow: auto;
2835
+ }
2836
+ ._sidepanel-link-trigger_sfza7_76 {
2837
+ width: 100%;
2838
+ justify-content: start;
2839
+ border-radius: var(--rs-radius-2);
2840
+ padding: 0 var(--rs-space-3);
2841
+ cursor: pointer;
2842
+ height: 32px;
2843
+ }
2844
+ ._sidepanel-list-link_sfza7_84 {
2845
+ padding: var(--rs-space-2) 0;
2846
+ display: flex;
2847
+ align-items: center;
2848
+ }
2849
+ ._sidepanel-list-link_sfza7_84 a {
2850
+ text-decoration: none;
2851
+ }
2852
+ `;
2853
+ (function() {
2854
+ if (typeof document === "undefined") {
2855
+ return;
2856
+ }
2857
+ if (!document.getElementById(digest15)) {
2858
+ var el = document.createElement("style");
2859
+ el.id = digest15;
2860
+ el.textContent = css15;
2861
+ document.head.appendChild(el);
2862
+ }
2863
+ })();
2864
+ 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" };
2865
+
2866
+ // admin/views/audit-logs/sidepanel-list-link.tsx
2867
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2868
+ function SidepanelListItemLink({
2869
+ isLink,
2870
+ children,
2871
+ href,
2872
+ label
2873
+ }) {
2874
+ if (isLink) {
2875
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_apsara20.List.Item, { className: audit_logs_module_css_default6["sidepanel-list-link"], children: [
2876
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_apsara20.List.Label, { minWidth: "112px", children: label }),
2877
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_apsara20.List.Value, { className: audit_logs_module_css_default6["text-overflow"], children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_router_dom.Link, { to: href, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2878
+ import_apsara20.Button,
2879
+ {
2880
+ variant: "text",
2881
+ color: "neutral",
2882
+ "data-test-id": "organization-link",
2883
+ className: audit_logs_module_css_default6["sidepanel-link-trigger"],
2884
+ children
2885
+ }
2886
+ ) }) })
2887
+ ] });
2888
+ }
2889
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_apsara20.List.Item, { children: [
2890
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_apsara20.List.Label, { minWidth: "120px", children: label }),
2891
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_apsara20.List.Value, { children })
2892
+ ] });
2893
+ }
2894
+
2895
+ // admin/views/audit-logs/sidepanel-list-id.tsx
2896
+ var import_apsara21 = require("@raystack/apsara");
2897
+
2898
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2412-o1Djrb3lY9SW/lib/admin/views/audit-logs/audit-logs.module.css.js
2899
+ var digest16 = "8402f9aaed4e1cff0039c6fd02e693e569faa20eb2198ba66c421c5a935079f2";
2900
+ var css16 = `._navbar_sfza7_1 {
2901
+ padding: var(--rs-space-4) var(--rs-space-7);
2902
+ border-bottom: 0.5px solid var(--rs-color-border-base-primary);
2903
+ background: var(--rs-color-background-base-primary);
2904
+ display: flex;
2905
+ align-items: center;
2906
+ justify-content: space-between;
2907
+ }
2908
+
2909
+ ._table_sfza7_10 {
2910
+ height: auto;
2911
+ }
2912
+
2913
+ ._table-empty_sfza7_14 {
2914
+ height: 100%;
2915
+ }
2916
+
2917
+ ._empty-state_sfza7_18 {
2918
+ height: 100%;
2919
+ }
2920
+
2921
+ ._empty-state-subheading_sfza7_22 {
2922
+ max-width: 360px;
2923
+ text-wrap: auto;
2924
+ }
2925
+
2926
+ ._name-column_sfza7_27 {
2927
+ padding-left: var(--rs-space-7);
2928
+ min-width: 300px;
2929
+ }
2930
+ ._org-column_sfza7_31 {
2931
+ min-width: 300px;
2932
+ }
2933
+
2934
+ ._table-wrapper_sfza7_35 {
2935
+ flex: 1;
2936
+ height: 100%;
2937
+ }
2938
+
2939
+ ._table-header_sfza7_40 {
2940
+ z-index: 2;
2941
+ }
2942
+
2943
+ ._side-panel_sfza7_44 {
2944
+ position: sticky;
2945
+ top: 0;
2946
+ }
2947
+
2948
+ ._capitalize_sfza7_49 {
2949
+ text-transform: capitalize;
2950
+ }
2951
+
2952
+ ._table-content-container_sfza7_53 {
2953
+ width: 100%;
2954
+ height: 100%;
2955
+ height: calc(100vh - 90px);
2956
+ overflow: auto;
2957
+ position: relative;
2958
+ }
2959
+
2960
+ ._text-overflow_sfza7_61 {
2961
+ width: fit-content;
2962
+ max-width: 180px;
2963
+ overflow: hidden;
2964
+ text-overflow: ellipsis;
2965
+ white-space: nowrap;
2966
+ }
2967
+
2968
+ ._code-block-container_sfza7_69 {
2969
+ padding: 0;
2970
+ }
2971
+ ._code-block_sfza7_69 {
2972
+ max-height: 400px;
2973
+ overflow: auto;
2974
+ }
2975
+ ._sidepanel-link-trigger_sfza7_76 {
2976
+ width: 100%;
2977
+ justify-content: start;
2978
+ border-radius: var(--rs-radius-2);
2979
+ padding: 0 var(--rs-space-3);
2980
+ cursor: pointer;
2981
+ height: 32px;
2982
+ }
2983
+ ._sidepanel-list-link_sfza7_84 {
2984
+ padding: var(--rs-space-2) 0;
2985
+ display: flex;
2986
+ align-items: center;
2987
+ }
2988
+ ._sidepanel-list-link_sfza7_84 a {
2989
+ text-decoration: none;
2990
+ }
2991
+ `;
2992
+ (function() {
2993
+ if (typeof document === "undefined") {
2994
+ return;
2995
+ }
2996
+ if (!document.getElementById(digest16)) {
2997
+ var el = document.createElement("style");
2998
+ el.id = digest16;
2999
+ el.textContent = css16;
3000
+ document.head.appendChild(el);
3001
+ }
3002
+ })();
3003
+ 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" };
3004
+
3005
+ // admin/views/audit-logs/sidepanel-list-id.tsx
3006
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3007
+ function SidepanelListId({ id = "-" }) {
3008
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_apsara21.List.Value, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_apsara21.Flex, { gap: 3, width: "full", children: [
3009
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_apsara21.CopyButton, { text: id || "", "data-test-id": "copy-button" }),
3010
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_apsara21.Tooltip, { message: id || "", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_apsara21.Text, { className: audit_logs_module_css_default7["text-overflow"], weight: "medium", children: id }) })
3011
+ ] }) });
3012
+ }
3013
+
3014
+ // admin/views/audit-logs/sidepanel-details.tsx
3015
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3016
+ function SidePanelDetails(_a) {
3017
+ var _b = _a, {
3018
+ onClose
3019
+ } = _b, rest = __objRest(_b, [
3020
+ "onClose"
3021
+ ]);
3022
+ var _a2;
3023
+ const { actor, event, resource, occurredAt, id, orgId, orgName, target } = rest;
3024
+ const date = (0, import_dayjs3.default)(timestampToDate(occurredAt));
3025
+ const session = (_a2 = actor == null ? void 0 : actor.metadata) == null ? void 0 : _a2.context;
3026
+ const location = session && `${session.Location.City}, ${session.Location.Country}` || "-";
3027
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3028
+ import_apsara22.SidePanel,
3029
+ {
3030
+ "data-test-id": "admin-user-details-sidepanel",
3031
+ className: audit_logs_module_css_default4["side-panel"],
3032
+ children: [
3033
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3034
+ import_apsara22.SidePanel.Header,
3035
+ {
3036
+ title: "Audit log details",
3037
+ actions: [
3038
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SidePanelLogDialog, __spreadValues({}, rest), "show-audit-json-dialog"),
3039
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3040
+ import_apsara22.IconButton,
3041
+ {
3042
+ size: 3,
3043
+ "data-test-id": "close-sidepanel-icon",
3044
+ onClick: onClose,
3045
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Cross2Icon, {})
3046
+ },
3047
+ "close-sidepanel-icon"
3048
+ )
3049
+ ]
3050
+ }
3051
+ ),
3052
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara22.SidePanel.Section, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List, { children: [
3053
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Header, { children: "Overview" }),
3054
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3055
+ SidepanelListItemLink,
3056
+ {
3057
+ isLink: (actor == null ? void 0 : actor.type) !== ACTOR_TYPES.SYSTEM,
3058
+ href: `/users/${actor == null ? void 0 : actor.id}`,
3059
+ label: "Actor",
3060
+ "data-test-id": "actor-link",
3061
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ActorCell, { value: actor, size: "small", maxLength: 12 })
3062
+ }
3063
+ ),
3064
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3065
+ SidepanelListItemLink,
3066
+ {
3067
+ isLink: !!orgId && !isZeroUUID(orgId),
3068
+ href: `/organizations/${orgId}`,
3069
+ label: "Organization",
3070
+ "data-test-id": "actor-link",
3071
+ children: orgName || "-"
3072
+ }
3073
+ ),
3074
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3075
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "Action" }),
3076
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Value, { children: event })
3077
+ ] }),
3078
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3079
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "Resource" }),
3080
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Value, { children: (resource == null ? void 0 : resource.name) || "-" })
3081
+ ] }),
3082
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3083
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "Type" }),
3084
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Value, { children: (resource == null ? void 0 : resource.type) || "-" })
3085
+ ] }),
3086
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3087
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "Date" }),
3088
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Value, { children: date.format("DD MMM YYYY") })
3089
+ ] }),
3090
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3091
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "Time" }),
3092
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Value, { children: date.format("hh:mm A") })
3093
+ ] }),
3094
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3095
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "ID" }),
3096
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SidepanelListId, { id })
3097
+ ] }),
3098
+ target && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
3099
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3100
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "Target ID" }),
3101
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SidepanelListId, { id: target == null ? void 0 : target.id })
3102
+ ] }),
3103
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3104
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "Target Type" }),
3105
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Value, { children: (target == null ? void 0 : target.type) || "-" })
3106
+ ] })
3107
+ ] })
3108
+ ] }) }),
3109
+ session && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara22.SidePanel.Section, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List, { children: [
3110
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Header, { children: "Session" }),
3111
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3112
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "IP Address" }),
3113
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Value, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara22.Flex, { gap: 3, align: "center", children: [
3114
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GlobeIcon, { width: 16, height: 16 }),
3115
+ session.IpAddress.split(",")[0]
3116
+ ] }) })
3117
+ ] }),
3118
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3119
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "Location" }),
3120
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Value, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara22.Flex, { gap: 3, align: "center", children: [
3121
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MapIcon, { width: 16, height: 16 }),
3122
+ location.length > 2 ? location : "-"
3123
+ ] }) })
3124
+ ] }),
3125
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3126
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "Browser" }),
3127
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Value, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara22.Flex, { gap: 3, align: "center", children: [
3128
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DesktopIcon, { width: 16, height: 16 }),
3129
+ session.Browser
3130
+ ] }) })
3131
+ ] }),
3132
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara23.List.Item, { children: [
3133
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Label, { minWidth: "120px", children: "Operating System" }),
3134
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_apsara23.List.Value, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_apsara22.Flex, { gap: 3, align: "center", children: [
3135
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TransformIcon, { width: 16, height: 16 }),
3136
+ session.OperatingSystem
3137
+ ] }) })
3138
+ ] })
3139
+ ] }) })
3140
+ ]
3141
+ }
3142
+ );
3143
+ }
3144
+
3145
+ // admin/views/audit-logs/index.tsx
3146
+ var import_react_query2 = require("@tanstack/react-query");
3147
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3148
+ var NoAuditLogs = () => {
3149
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3150
+ import_apsara24.EmptyState,
3151
+ {
3152
+ classNames: {
3153
+ container: audit_logs_module_css_default2["empty-state"],
3154
+ subHeading: audit_logs_module_css_default2["empty-state-subheading"]
3155
+ },
3156
+ heading: "No activity logged yet",
3157
+ subHeading: "Once users start making changes, you'll see a detailed history of events here.",
3158
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CpuChipIcon, {})
3159
+ }
3160
+ );
3161
+ };
3162
+ var DEFAULT_SORT2 = { name: "occurredAt", order: "desc" };
3163
+ var INITIAL_QUERY2 = {
3164
+ offset: 0,
3165
+ limit: DEFAULT_PAGE_SIZE
3166
+ };
3167
+ var TRANSFORM_OPTIONS = {
3168
+ fieldNameMapping: {
3169
+ occurredAt: "occurred_at",
3170
+ orgId: "org_id",
3171
+ orgName: "org_name",
3172
+ actor: "actor_name",
3173
+ resource: "resource_name",
3174
+ resourceType: "resource_type",
3175
+ actorType: "actor_type"
3176
+ }
3177
+ };
3178
+ function AuditLogsView({ appName, onExportCsv } = {}) {
3179
+ var _a;
3180
+ const queryClient = (0, import_react_query2.useQueryClient)();
3181
+ const [tableQuery, setTableQuery] = (0, import_hooks.useDebouncedState)(
3182
+ {
3183
+ query: INITIAL_QUERY2,
3184
+ rqlRequest: transformDataTableQueryToRQLRequest(
3185
+ INITIAL_QUERY2,
3186
+ TRANSFORM_OPTIONS
3187
+ )
3188
+ },
3189
+ 200
3190
+ );
3191
+ const [sidePanelOpen, setSidePanelOpen] = (0, import_react7.useState)(false);
3192
+ const [selectedAuditLog, setSelectedAuditLog] = (0, import_react7.useState)(
3193
+ null
3194
+ );
3195
+ const {
3196
+ data: infiniteData,
3197
+ isLoading,
3198
+ isFetchingNextPage,
3199
+ fetchNextPage,
3200
+ error,
3201
+ isError,
3202
+ hasNextPage
3203
+ } = (0, import_connect_query5.useInfiniteQuery)(
3204
+ import_frontier7.AdminServiceQueries.listAuditRecords,
3205
+ { query: tableQuery.rqlRequest },
3206
+ {
3207
+ pageParamKey: "query",
3208
+ getNextPageParam: (lastPage) => getConnectNextPageParam(
3209
+ lastPage,
3210
+ { query: tableQuery.rqlRequest },
3211
+ "auditRecords"
3212
+ ),
3213
+ staleTime: 0,
3214
+ refetchOnWindowFocus: false,
3215
+ retry: 1,
3216
+ retryDelay: 1e3
3217
+ }
3218
+ );
3219
+ const data = ((_a = infiniteData == null ? void 0 : infiniteData.pages) == null ? void 0 : _a.flatMap((page) => (page == null ? void 0 : page.auditRecords) || [])) || [];
3220
+ const onTableQueryChange = (0, import_react7.useCallback)(
3221
+ (query) => {
3222
+ const updatedQuery = __spreadProps(__spreadValues({}, query), {
3223
+ offset: 0,
3224
+ limit: query.limit || DEFAULT_PAGE_SIZE
3225
+ });
3226
+ const updatedRQLRequest = transformDataTableQueryToRQLRequest(
3227
+ updatedQuery,
3228
+ TRANSFORM_OPTIONS
3229
+ );
3230
+ queryClient.setQueryData(AUDIT_LOG_QUERY_KEY, updatedRQLRequest);
3231
+ setTableQuery({
3232
+ query: updatedQuery,
3233
+ rqlRequest: updatedRQLRequest
3234
+ });
3235
+ },
3236
+ [queryClient]
3237
+ );
3238
+ const handleLoadMore = () => __async(this, null, function* () {
3239
+ try {
3240
+ if (!hasNextPage)
3241
+ return;
3242
+ yield fetchNextPage();
3243
+ } catch (error2) {
3244
+ console.error("Error loading more audit logs:", error2);
3245
+ }
3246
+ });
3247
+ const columns = (0, import_react7.useMemo)(
3248
+ () => getColumns5({
3249
+ groupCountMap: infiniteData ? getGroupCountMapFromFirstPage(infiniteData) : {}
3250
+ }),
3251
+ [infiniteData]
3252
+ );
3253
+ const loading = isLoading || isFetchingNextPage;
3254
+ const onRowClick = (0, import_react7.useCallback)((row) => {
3255
+ setSelectedAuditLog((_selectedLog) => {
3256
+ if ((_selectedLog == null ? void 0 : _selectedLog.id) === row.id)
3257
+ setSidePanelOpen((_value) => !_value);
3258
+ else
3259
+ setSidePanelOpen(true);
3260
+ return row;
3261
+ });
3262
+ }, []);
3263
+ if (isError) {
3264
+ console.error("ConnectRPC Error:", error);
3265
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
3266
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PageTitle, { title: "Audit Logs", appName }),
3267
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3268
+ import_apsara24.EmptyState,
3269
+ {
3270
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ExclamationTriangleIcon, {}),
3271
+ heading: "Error Loading Audit Logs",
3272
+ subHeading: (error == null ? void 0 : error.message) || "Something went wrong while loading audit logs. Please try again."
3273
+ }
3274
+ )
3275
+ ] });
3276
+ }
3277
+ const tableClassName = data.length || loading ? audit_logs_module_css_default2["table"] : audit_logs_module_css_default2["table-empty"];
3278
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
3279
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PageTitle, { title: "Audit Logs", appName }),
3280
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3281
+ import_apsara24.DataTable,
3282
+ {
3283
+ query: tableQuery.query,
3284
+ columns,
3285
+ data,
3286
+ isLoading: loading,
3287
+ defaultSort: DEFAULT_SORT2,
3288
+ onTableQueryChange,
3289
+ mode: "server",
3290
+ onLoadMore: handleLoadMore,
3291
+ onRowClick,
3292
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_apsara24.Flex, { direction: "column", style: { width: "100%" }, children: [
3293
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(navbar_default, { searchQuery: tableQuery.query.search, onExportCsv }),
3294
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_apsara24.DataTable.Toolbar, {}),
3295
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_apsara24.Flex, { className: audit_logs_module_css_default2["table-content-container"], children: [
3296
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3297
+ import_apsara24.DataTable.VirtualizedContent,
3298
+ {
3299
+ classNames: {
3300
+ root: audit_logs_module_css_default2["table-wrapper"],
3301
+ table: tableClassName,
3302
+ header: audit_logs_module_css_default2["table-header"]
3303
+ },
3304
+ emptyState: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(NoAuditLogs, {}),
3305
+ rowHeight: 60,
3306
+ groupHeaderHeight: 48
3307
+ }
3308
+ ),
3309
+ sidePanelOpen && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3310
+ SidePanelDetails,
3311
+ __spreadProps(__spreadValues({}, selectedAuditLog), {
3312
+ onClose: () => setSidePanelOpen(false)
3313
+ })
3314
+ )
3315
+ ] })
3316
+ ] })
3317
+ }
3318
+ )
3319
+ ] });
3320
+ }
3321
+ // Annotate the CommonJS export names for ESM import in node:
3322
+ 0 && (module.exports = {
3323
+ AuditLogsView,
3324
+ DEFAULT_PAGE_SIZE,
3325
+ InvoicesView,
3326
+ ProductPricesView,
3327
+ ProductsView,
3328
+ RolesView,
3329
+ getConnectNextPageParam,
3330
+ getGroupCountMapFromFirstPage,
3331
+ transformDataTableQueryToRQLRequest
3332
+ });