@bigbinary/neeto-molecules 4.1.51 → 4.1.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/ErrorPage.js +1 -1387
  2. package/dist/ErrorPage.js.map +1 -1
  3. package/dist/ShareViaLink.js +1 -0
  4. package/dist/ShareViaLink.js.map +1 -1
  5. package/dist/StatusDropdown.js +1 -0
  6. package/dist/StatusDropdown.js.map +1 -1
  7. package/dist/cjs/ErrorPage.js +5 -1409
  8. package/dist/cjs/ErrorPage.js.map +1 -1
  9. package/dist/cjs/ShareViaLink.js +1 -0
  10. package/dist/cjs/ShareViaLink.js.map +1 -1
  11. package/dist/cjs/StatusDropdown.js +1 -0
  12. package/dist/cjs/StatusDropdown.js.map +1 -1
  13. package/dist/cjs/unauthorized-CI14HDQo.js +1414 -0
  14. package/dist/cjs/unauthorized-CI14HDQo.js.map +1 -0
  15. package/dist/cjs/user-Ku5LVfLy.js +20 -0
  16. package/dist/cjs/user-Ku5LVfLy.js.map +1 -0
  17. package/dist/cjs/v2/AuditLogs.js +925 -0
  18. package/dist/cjs/v2/AuditLogs.js.map +1 -0
  19. package/dist/cjs/v2/CardLayout.js +52 -0
  20. package/dist/cjs/v2/CardLayout.js.map +1 -0
  21. package/dist/cjs/v2/ErrorPage.js +142 -0
  22. package/dist/cjs/v2/ErrorPage.js.map +1 -0
  23. package/dist/cjs/v2/FloatingActionMenu.js +20 -33
  24. package/dist/cjs/v2/FloatingActionMenu.js.map +1 -1
  25. package/dist/cjs/v2/Header.js +1 -1
  26. package/dist/cjs/v2/Header.js.map +1 -1
  27. package/dist/cjs/v2/KeyboardShortcuts.js +333 -0
  28. package/dist/cjs/v2/KeyboardShortcuts.js.map +1 -0
  29. package/dist/cjs/v2/LoginPage.js +233 -0
  30. package/dist/cjs/v2/LoginPage.js.map +1 -0
  31. package/dist/cjs/v2/MenuBar.js +3 -16
  32. package/dist/cjs/v2/MenuBar.js.map +1 -1
  33. package/dist/cjs/v2/Settings.js +302 -0
  34. package/dist/cjs/v2/Settings.js.map +1 -0
  35. package/dist/cjs/x-B38UX0_0.js +20 -0
  36. package/dist/cjs/x-B38UX0_0.js.map +1 -0
  37. package/dist/unauthorized-DLPyUaeK.js +1390 -0
  38. package/dist/unauthorized-DLPyUaeK.js.map +1 -0
  39. package/dist/user-A843PT-q.js +18 -0
  40. package/dist/user-A843PT-q.js.map +1 -0
  41. package/dist/v2/AuditLogs.js +923 -0
  42. package/dist/v2/AuditLogs.js.map +1 -0
  43. package/dist/v2/CardLayout.js +50 -0
  44. package/dist/v2/CardLayout.js.map +1 -0
  45. package/dist/v2/ErrorPage.js +140 -0
  46. package/dist/v2/ErrorPage.js.map +1 -0
  47. package/dist/v2/FloatingActionMenu.js +19 -32
  48. package/dist/v2/FloatingActionMenu.js.map +1 -1
  49. package/dist/v2/Header.js +1 -1
  50. package/dist/v2/Header.js.map +1 -1
  51. package/dist/v2/KeyboardShortcuts.js +331 -0
  52. package/dist/v2/KeyboardShortcuts.js.map +1 -0
  53. package/dist/v2/LoginPage.js +212 -0
  54. package/dist/v2/LoginPage.js.map +1 -0
  55. package/dist/v2/MenuBar.js +2 -15
  56. package/dist/v2/MenuBar.js.map +1 -1
  57. package/dist/v2/Settings.js +300 -0
  58. package/dist/v2/Settings.js.map +1 -0
  59. package/dist/x-B1Er0oV4.js +18 -0
  60. package/dist/x-B1Er0oV4.js.map +1 -0
  61. package/package.json +1 -1
  62. package/types/v2/AuditLogs.d.ts +11 -0
  63. package/types/v2/CardLayout.d.ts +13 -0
  64. package/types/v2/ErrorPage.d.ts +16 -0
  65. package/types/v2/KeyboardShortcuts.d.ts +24 -0
  66. package/types/v2/LoginPage.d.ts +12 -0
  67. package/types/v2/Settings.d.ts +32 -0
@@ -0,0 +1,923 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import { useMemo, createElement } from 'react';
3
+ import { Typography, Avatar, AvatarFallback, Spinner, Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationEllipsis, PaginationLink, PaginationNext } from '@bigbinary/neeto-atoms';
4
+ import classnames from 'classnames';
5
+ import { snakeToCamelCase, humanize, isPresent, isNotEmpty } from '@bigbinary/neeto-cist';
6
+ import { LANGUAGE_OPTIONS, DEFAULT_STALE_TIME, DEFAULT_PAGE_INDEX } from '@bigbinary/neeto-commons-frontend/constants';
7
+ import { useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
8
+ import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils/general';
9
+ import { indexBy, prop, omit, isEmpty, identity, mergeLeft } from 'ramda';
10
+ import { Trans as Trans$1, useTranslation } from 'react-i18next';
11
+ import { useHistory, useLocation } from 'react-router-dom';
12
+ import { dateFormat } from '@bigbinary/neeto-commons-frontend/utils';
13
+ import Apple from '@bigbinary/neeto-icons/misc/Apple';
14
+ import GoogleCalendar from '@bigbinary/neeto-icons/misc/GoogleCalendar';
15
+ import GoogleMeet from '@bigbinary/neeto-icons/misc/GoogleMeet';
16
+ import Outlook from '@bigbinary/neeto-icons/misc/Outlook';
17
+ import Slack from '@bigbinary/neeto-icons/misc/Slack';
18
+ import Stripe from '@bigbinary/neeto-icons/misc/Stripe';
19
+ import StripeTypeface from '@bigbinary/neeto-icons/misc/StripeTypeface';
20
+ import Teams from '@bigbinary/neeto-icons/misc/Teams';
21
+ import Twilio from '@bigbinary/neeto-icons/misc/Twilio';
22
+ import Zoom from '@bigbinary/neeto-icons/misc/Zoom';
23
+ import { c as createLucideIcon } from '../createLucideIcon-mNMhCCpf.js';
24
+ import { U as User } from '../user-A843PT-q.js';
25
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
26
+ import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
27
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
28
+ import { useQuery } from '@tanstack/react-query';
29
+ import axios from 'axios';
30
+ import Container from './Container.js';
31
+ import Header from './Header.js';
32
+ import '../index-DAYCJu79.js';
33
+ import '../_commonjsHelpers-BFTU3MAI.js';
34
+ import './Breadcrumbs.js';
35
+ import './HelpPopover.js';
36
+ import '../circle-question-mark-Dib48f5Z.js';
37
+ import './MoreDropdown.js';
38
+ import '../ellipsis-DpI9xqUK.js';
39
+ import './Search.js';
40
+ import '@babel/runtime/helpers/slicedToArray';
41
+ import '@bigbinary/neeto-commons-frontend/react-utils/useFuncDebounce';
42
+ import '@bigbinary/neeto-commons-frontend/react-utils/useQueryParams';
43
+ import '@bigbinary/neeto-commons-frontend/react-utils/useUpdateEffect';
44
+ import '../search-DCgpNjip.js';
45
+
46
+ /**
47
+ * @license lucide-react v1.7.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */
52
+
53
+
54
+ const __iconNode$5 = [
55
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
56
+ ["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }],
57
+ ["path", { d: "M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662", key: "154egf" }]
58
+ ];
59
+ const CircleUser = createLucideIcon("circle-user", __iconNode$5);
60
+
61
+ /**
62
+ * @license lucide-react v1.7.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */
67
+
68
+
69
+ const __iconNode$4 = [
70
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
71
+ ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
72
+ ["path", { d: "M2 12h20", key: "9i4pu4" }]
73
+ ];
74
+ const Globe = createLucideIcon("globe", __iconNode$4);
75
+
76
+ /**
77
+ * @license lucide-react v1.7.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */
82
+
83
+
84
+ const __iconNode$3 = [
85
+ ["path", { d: "m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4", key: "g0fldk" }],
86
+ ["path", { d: "m21 2-9.6 9.6", key: "1j0ho8" }],
87
+ ["circle", { cx: "7.5", cy: "15.5", r: "5.5", key: "yqb3hr" }]
88
+ ];
89
+ const Key = createLucideIcon("key", __iconNode$3);
90
+
91
+ /**
92
+ * @license lucide-react v1.7.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */
97
+
98
+
99
+ const __iconNode$2 = [
100
+ ["path", { d: "M10 15H6a4 4 0 0 0-4 4v2", key: "1nfge6" }],
101
+ ["path", { d: "m14.305 16.53.923-.382", key: "1itpsq" }],
102
+ ["path", { d: "m15.228 13.852-.923-.383", key: "eplpkm" }],
103
+ ["path", { d: "m16.852 12.228-.383-.923", key: "13v3q0" }],
104
+ ["path", { d: "m16.852 17.772-.383.924", key: "1i8mnm" }],
105
+ ["path", { d: "m19.148 12.228.383-.923", key: "1q8j1v" }],
106
+ ["path", { d: "m19.53 18.696-.382-.924", key: "vk1qj3" }],
107
+ ["path", { d: "m20.772 13.852.924-.383", key: "n880s0" }],
108
+ ["path", { d: "m20.772 16.148.924.383", key: "1g6xey" }],
109
+ ["circle", { cx: "18", cy: "15", r: "3", key: "gjjjvw" }],
110
+ ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }]
111
+ ];
112
+ const UserCog = createLucideIcon("user-cog", __iconNode$2);
113
+
114
+ /**
115
+ * @license lucide-react v1.7.0 - ISC
116
+ *
117
+ * This source code is licensed under the ISC license.
118
+ * See the LICENSE file in the root directory of this source tree.
119
+ */
120
+
121
+
122
+ const __iconNode$1 = [
123
+ ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
124
+ ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
125
+ ["line", { x1: "22", x2: "16", y1: "11", y2: "11", key: "1shjgl" }]
126
+ ];
127
+ const UserMinus = createLucideIcon("user-minus", __iconNode$1);
128
+
129
+ /**
130
+ * @license lucide-react v1.7.0 - ISC
131
+ *
132
+ * This source code is licensed under the ISC license.
133
+ * See the LICENSE file in the root directory of this source tree.
134
+ */
135
+
136
+
137
+ const __iconNode = [
138
+ ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
139
+ ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
140
+ ["line", { x1: "19", x2: "19", y1: "8", y2: "14", key: "1bvyxn" }],
141
+ ["line", { x1: "22", x2: "16", y1: "11", y2: "11", key: "1shjgl" }]
142
+ ];
143
+ const UserPlus = createLucideIcon("user-plus", __iconNode);
144
+
145
+ var _AUDIT_ICON_MAP;
146
+ var AUDIT_LOGS_QUERY_KEY = "audit-logs";
147
+ var COUNTRIES_LIST_QUERY_KEY = "countries-list"; // Same key as that used in "neeto-team-members" for cache reuse.
148
+ var PERMISSIONS_LIST_QUERY_KEY = "neeto-team-members-permissions"; // Same key as that used in "neeto-team-members" for cache reuse.
149
+
150
+ var ACTIONS = {
151
+ INVITED_USERS: "invitedUsers",
152
+ USER_SIGNED_UP: "userSignedUp",
153
+ UPDATED_USER: "updatedUser",
154
+ BULK_UPDATE_USERS: "bulkUpdateUsers",
155
+ UPDATED_USER_PROFILE: "updatedUserProfile",
156
+ CREATED_ROLE: "createdRole",
157
+ UPDATED_ROLE: "updatedRole",
158
+ DELETED_ROLE: "deletedRole",
159
+ INTEGRATION_CONNECTED: "integration.connected",
160
+ INTEGRATION_DISCONNECTED: "integration.disconnected",
161
+ INTEGRATION_DISCONNECTED_BY_PROVIDER: "integration.disconnectedByProvider",
162
+ CONNECTED_STRIPE_ACCOUNT: "connectedStripeAccount",
163
+ DISCONNECTED_STRIPE_ACCOUNT: "disconnectedStripeAccount",
164
+ CONNECTED_ZOOM_INTEGRATION: "connectedZoomIntegration",
165
+ DISCONNECTED_ZOOM_INTEGRATION: "disconnectedZoomIntegration",
166
+ CONNECTED_CUSTOM_DOMAIN: "connectedCustomDomain",
167
+ CREATED_API_KEY: "createdApiKey",
168
+ DELETED_API_KEY: "deletedApiKey",
169
+ UPDATED_API_KEY: "updatedApiKey"
170
+ };
171
+ var AUDIT_ICON_MAP = (_AUDIT_ICON_MAP = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_AUDIT_ICON_MAP, ACTIONS.INVITED_USERS, CircleUser), ACTIONS.USER_SIGNED_UP, UserPlus), ACTIONS.UPDATED_USER, User), ACTIONS.BULK_UPDATE_USERS, User), ACTIONS.UPDATED_USER_PROFILE, UserCog), ACTIONS.CREATED_ROLE, UserPlus), ACTIONS.UPDATED_ROLE, UserCog), ACTIONS.DELETED_ROLE, UserMinus), ACTIONS.INTEGRATION_CONNECTED, UserCog), ACTIONS.INTEGRATION_DISCONNECTED, UserCog), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_AUDIT_ICON_MAP, ACTIONS.INTEGRATION_DISCONNECTED_BY_PROVIDER, UserCog), ACTIONS.CONNECTED_STRIPE_ACCOUNT, StripeTypeface), ACTIONS.DISCONNECTED_STRIPE_ACCOUNT, Stripe), ACTIONS.CONNECTED_ZOOM_INTEGRATION, Zoom), ACTIONS.DISCONNECTED_ZOOM_INTEGRATION, Zoom), ACTIONS.CONNECTED_CUSTOM_DOMAIN, Globe), ACTIONS.CREATED_API_KEY, Key), ACTIONS.DELETED_API_KEY, Key), ACTIONS.UPDATED_API_KEY, Key));
172
+ var AUDIT_LOGS_PAGE_SIZE = 12;
173
+ var LANGUAGE_OPTIONS_MAP = indexBy(prop("value"), LANGUAGE_OPTIONS);
174
+ var DATE_FORMAT_OPTIONS_MAP = {
175
+ "%m/%d/%Y": "MM/DD/YYYY",
176
+ "%d/%m/%Y": "DD/MM/YYYY",
177
+ "%Y/%m/%d": "YYYY/MM/DD"
178
+ };
179
+ var FIELD_NAME_MAP = {
180
+ organizationRole: "role"
181
+ };
182
+ var INTEGRATION_ICON_MAP = {
183
+ google_calendar: GoogleCalendar,
184
+ google_meet: GoogleMeet,
185
+ icloud_calendar: Apple,
186
+ outlook: Outlook,
187
+ slack: Slack,
188
+ teams: Teams,
189
+ twilio: Twilio,
190
+ zoom: Zoom
191
+ };
192
+ var INTEGRATION_DISPLAY_NAME_MAP = {
193
+ google_calendar: "Google Calendar",
194
+ google_meet: "Google Meet",
195
+ icloud_calendar: "iCloud Calendar",
196
+ outlook: "Outlook",
197
+ slack: "Slack",
198
+ teams: "Microsoft Teams",
199
+ twilio: "Twilio",
200
+ zoom: "Zoom"
201
+ };
202
+
203
+ function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
204
+ function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
205
+ var Trans = function Trans(_ref) {
206
+ var i18nKey = _ref.i18nKey,
207
+ _ref$additionalValues = _ref.additionalValues,
208
+ additionalValues = _ref$additionalValues === void 0 ? {} : _ref$additionalValues,
209
+ _ref$additionalCompon = _ref.additionalComponents,
210
+ additionalComponents = _ref$additionalCompon === void 0 ? {} : _ref$additionalCompon;
211
+ return /*#__PURE__*/jsx(Trans$1, {
212
+ i18nKey: i18nKey,
213
+ components: _objectSpread$4({
214
+ Code: /*#__PURE__*/jsx(Typography, {
215
+ asChild: true,
216
+ variant: "body3",
217
+ children: /*#__PURE__*/jsx("code", {
218
+ className: "bg-muted rounded-md px-1.5 py-0.5"
219
+ })
220
+ }),
221
+ Semibold: /*#__PURE__*/jsx(Typography, {
222
+ asChild: true,
223
+ variant: "body2",
224
+ weight: "medium",
225
+ children: /*#__PURE__*/jsx("span", {
226
+ className: "inline"
227
+ })
228
+ })
229
+ }, additionalComponents),
230
+ values: _objectSpread$4({
231
+ productSuffix: globalProps.appName
232
+ }, additionalValues)
233
+ });
234
+ };
235
+
236
+ var _excluded = ["countriesMap", "permissionsMap", "action", "performedBy", "emails", "firstName", "lastName", "organizationRole", "email", "changes", "status", "message", "errorMessage"];
237
+ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
238
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
239
+ var formatFieldName = function formatFieldName(field) {
240
+ return FIELD_NAME_MAP[field] || humanize(field);
241
+ };
242
+ var createFieldValueFormatter = function createFieldValueFormatter(_ref) {
243
+ var field = _ref.field,
244
+ countriesMap = _ref.countriesMap;
245
+ switch (field) {
246
+ case "language":
247
+ return function (value) {
248
+ var _LANGUAGE_OPTIONS_MAP;
249
+ return ((_LANGUAGE_OPTIONS_MAP = LANGUAGE_OPTIONS_MAP[value]) === null || _LANGUAGE_OPTIONS_MAP === void 0 ? void 0 : _LANGUAGE_OPTIONS_MAP.label) || value;
250
+ };
251
+ case "dateFormat":
252
+ return function (value) {
253
+ return DATE_FORMAT_OPTIONS_MAP[value] || value;
254
+ };
255
+ case "countryIdentifier":
256
+ return function (value) {
257
+ var _countriesMap$value;
258
+ return ((_countriesMap$value = countriesMap[value]) === null || _countriesMap$value === void 0 ? void 0 : _countriesMap$value.name) || value;
259
+ };
260
+ default:
261
+ return identity;
262
+ }
263
+ };
264
+ var formatChangedFields = function formatChangedFields(_ref2) {
265
+ var changes = _ref2.changes,
266
+ countriesMap = _ref2.countriesMap;
267
+ var fields = Object.keys(changes).map(function (field, index) {
268
+ var change = changes[field];
269
+ var valueFormatter = createFieldValueFormatter({
270
+ field: field,
271
+ countriesMap: countriesMap
272
+ });
273
+ var element;
274
+ if (field === "profileImage") {
275
+ element = /*#__PURE__*/jsx("span", {
276
+ children: /*#__PURE__*/jsx(Trans, {
277
+ additionalValues: {
278
+ field: formatFieldName(field)
279
+ },
280
+ i18nKey: "neetoMolecules.auditLogs.text.updatedFields"
281
+ })
282
+ }, field);
283
+ } else if (change && isPresent(change.from)) {
284
+ element = /*#__PURE__*/jsx("span", {
285
+ children: /*#__PURE__*/jsx(Trans, {
286
+ i18nKey: "neetoMolecules.auditLogs.text.updatedFieldsWithPreviousValue",
287
+ additionalValues: {
288
+ field: formatFieldName(field),
289
+ from: valueFormatter(change.from),
290
+ to: valueFormatter(change.to)
291
+ }
292
+ })
293
+ }, field);
294
+ } else {
295
+ element = /*#__PURE__*/jsx("span", {
296
+ children: /*#__PURE__*/jsx(Trans, {
297
+ i18nKey: "neetoMolecules.auditLogs.text.updatedFieldsWithNewValue",
298
+ additionalValues: {
299
+ field: formatFieldName(field),
300
+ to: valueFormatter(change.to)
301
+ }
302
+ })
303
+ }, field);
304
+ }
305
+ return index > 0 ? [/*#__PURE__*/jsx("span", {
306
+ children: ", "
307
+ }, "sep-".concat(field)), element] : element;
308
+ });
309
+ return fields.flat();
310
+ };
311
+ var transformAction = function transformAction(action) {
312
+ return snakeToCamelCase(action.replace("audit_logs.organization.", ""));
313
+ };
314
+ var constructAuditLogText = function constructAuditLogText(_ref3) {
315
+ var _ref3$countriesMap = _ref3.countriesMap,
316
+ countriesMap = _ref3$countriesMap === void 0 ? {} : _ref3$countriesMap,
317
+ _ref3$permissionsMap = _ref3.permissionsMap,
318
+ permissionsMap = _ref3$permissionsMap === void 0 ? {} : _ref3$permissionsMap,
319
+ action = _ref3.action,
320
+ performedBy = _ref3.performedBy,
321
+ emailsProp = _ref3.emails,
322
+ firstName = _ref3.firstName,
323
+ lastName = _ref3.lastName,
324
+ organizationRole = _ref3.organizationRole,
325
+ email = _ref3.email,
326
+ _ref3$changes = _ref3.changes,
327
+ changes = _ref3$changes === void 0 ? {} : _ref3$changes,
328
+ status = _ref3.status,
329
+ message = _ref3.message,
330
+ errorMessage = _ref3.errorMessage,
331
+ rest = _objectWithoutProperties(_ref3, _excluded);
332
+ var emails = emailsProp !== null && emailsProp !== void 0 ? emailsProp : [];
333
+ switch (action) {
334
+ case ACTIONS.INVITED_USERS:
335
+ {
336
+ if (status === "success" && isNotEmpty(emails)) {
337
+ var emailList = emails.join(", ");
338
+ return /*#__PURE__*/jsx(Trans, {
339
+ additionalValues: {
340
+ performedBy: performedBy,
341
+ emailList: emailList
342
+ },
343
+ i18nKey: "neetoMolecules.auditLogs.text.invitedUsers"
344
+ });
345
+ }
346
+ return /*#__PURE__*/jsx(Trans, {
347
+ additionalValues: {
348
+ performedBy: performedBy,
349
+ errorMessage: errorMessage
350
+ },
351
+ i18nKey: "neetoMolecules.auditLogs.text.invitedUsersFailed"
352
+ });
353
+ }
354
+ case ACTIONS.USER_SIGNED_UP:
355
+ {
356
+ var name = [firstName, lastName].filter(Boolean).join(" ");
357
+ var userIdentifier = name || organizationRole || email || "User";
358
+ return /*#__PURE__*/jsx(Trans, {
359
+ additionalValues: {
360
+ userIdentifier: userIdentifier
361
+ },
362
+ i18nKey: "neetoMolecules.auditLogs.text.userSignedUp"
363
+ });
364
+ }
365
+ case ACTIONS.UPDATED_USER:
366
+ {
367
+ var _changes$active;
368
+ var affectedUser = email || "user";
369
+ var isUserDeactivated = (changes === null || changes === void 0 || (_changes$active = changes.active) === null || _changes$active === void 0 ? void 0 : _changes$active.to) === false;
370
+ var otherChanges = isUserDeactivated ? omit(["active"], changes) : changes;
371
+ var removedText = isUserDeactivated ? /*#__PURE__*/jsx(Trans, {
372
+ additionalValues: {
373
+ performedBy: performedBy,
374
+ affectedUser: affectedUser
375
+ },
376
+ i18nKey: "neetoMolecules.auditLogs.text.removedUser"
377
+ }) : null;
378
+ if (isUserDeactivated && isEmpty(otherChanges)) return removedText;
379
+ var changedFields = formatChangedFields({
380
+ changes: otherChanges,
381
+ countriesMap: countriesMap
382
+ });
383
+ var updatedUserText = /*#__PURE__*/jsx(Trans, {
384
+ additionalComponents: {
385
+ ChangedFields: /*#__PURE__*/jsx(Fragment, {
386
+ children: changedFields
387
+ })
388
+ },
389
+ additionalValues: {
390
+ performedBy: performedBy,
391
+ affectedUser: affectedUser
392
+ },
393
+ i18nKey: "neetoMolecules.auditLogs.text.updatedUser"
394
+ });
395
+ return removedText ? /*#__PURE__*/jsxs(Fragment, {
396
+ children: [removedText, " ", updatedUserText]
397
+ }) : updatedUserText;
398
+ }
399
+ case ACTIONS.BULK_UPDATE_USERS:
400
+ {
401
+ if (status === "success" && isNotEmpty(emails)) {
402
+ var _emailList = emails.join(", ");
403
+ return /*#__PURE__*/jsx(Trans, {
404
+ additionalValues: {
405
+ performedBy: performedBy,
406
+ emailList: _emailList,
407
+ message: message
408
+ },
409
+ i18nKey: "neetoMolecules.auditLogs.text.bulkUpdateUsers"
410
+ });
411
+ }
412
+ return /*#__PURE__*/jsx(Trans, {
413
+ additionalValues: {
414
+ performedBy: performedBy,
415
+ errorMessage: errorMessage
416
+ },
417
+ i18nKey: "neetoMolecules.auditLogs.text.bulkUpdateUsersFailed"
418
+ });
419
+ }
420
+ case ACTIONS.UPDATED_USER_PROFILE:
421
+ {
422
+ var _changedFields = formatChangedFields({
423
+ changes: changes,
424
+ countriesMap: countriesMap
425
+ });
426
+ return /*#__PURE__*/jsx(Trans, {
427
+ additionalComponents: {
428
+ ChangedFields: /*#__PURE__*/jsx(Fragment, {
429
+ children: _changedFields
430
+ })
431
+ },
432
+ additionalValues: {
433
+ performedBy: performedBy
434
+ },
435
+ i18nKey: "neetoMolecules.auditLogs.text.updatedUserProfile"
436
+ });
437
+ }
438
+ case ACTIONS.CREATED_ROLE:
439
+ {
440
+ var roleName = organizationRole || "role";
441
+ return /*#__PURE__*/jsx(Trans, {
442
+ additionalValues: {
443
+ performedBy: performedBy,
444
+ roleName: roleName
445
+ },
446
+ i18nKey: "neetoMolecules.auditLogs.text.createdRole"
447
+ });
448
+ }
449
+ case ACTIONS.UPDATED_ROLE:
450
+ {
451
+ var _rest$addedPermission = rest.addedPermissions,
452
+ addedPermissions = _rest$addedPermission === void 0 ? [] : _rest$addedPermission,
453
+ _rest$removedPermissi = rest.removedPermissions,
454
+ removedPermissions = _rest$removedPermissi === void 0 ? [] : _rest$removedPermissi,
455
+ _name = rest.name;
456
+ var permissionsToText = function permissionsToText(permissions) {
457
+ return permissions.map(function (permission) {
458
+ var _permissionsMap$permi;
459
+ return ((_permissionsMap$permi = permissionsMap[permission]) === null || _permissionsMap$permi === void 0 ? void 0 : _permissionsMap$permi.description) || humanize(permission.split(".")[1]);
460
+ }).join(", ");
461
+ };
462
+ var i18nKey = "neetoMolecules.auditLogs.text.updatedRole";
463
+ if (_name) {
464
+ i18nKey = "neetoMolecules.auditLogs.text.updatedRoleName";
465
+ } else if (isPresent(addedPermissions) && isPresent(removedPermissions)) {
466
+ i18nKey = "neetoMolecules.auditLogs.text.modifiedRolePermission";
467
+ } else if (isPresent(addedPermissions)) {
468
+ i18nKey = "neetoMolecules.auditLogs.text.addedRolePermission";
469
+ } else if (isPresent(removedPermissions)) {
470
+ i18nKey = "neetoMolecules.auditLogs.text.removedRolePermission";
471
+ }
472
+ return /*#__PURE__*/jsx(Trans, {
473
+ i18nKey: i18nKey,
474
+ additionalValues: {
475
+ performedBy: performedBy,
476
+ roleName: organizationRole || "role",
477
+ name: _name,
478
+ addedPermissionsText: permissionsToText(addedPermissions),
479
+ removedPermissionsText: permissionsToText(removedPermissions),
480
+ addedPermissionsCount: addedPermissions.length,
481
+ removedPermissionsCount: removedPermissions.length
482
+ }
483
+ });
484
+ }
485
+ case ACTIONS.INTEGRATION_CONNECTED:
486
+ {
487
+ var rawName = rest.integrationName,
488
+ integrationOwner = rest.integrationOwner;
489
+ var integrationName = INTEGRATION_DISPLAY_NAME_MAP[rawName] || humanize(rawName);
490
+ var detail = changes === null || changes === void 0 ? void 0 : changes.detail;
491
+ var _i18nKey;
492
+ if (integrationOwner && detail) {
493
+ _i18nKey = "neetoMolecules.auditLogs.text.integrationConnectedOnBehalf";
494
+ } else if (integrationOwner) {
495
+ _i18nKey = "neetoMolecules.auditLogs.text.integrationConnectedOnBehalfWithoutDetail";
496
+ } else if (detail) {
497
+ _i18nKey = "neetoMolecules.auditLogs.text.integrationConnected";
498
+ } else {
499
+ _i18nKey = "neetoMolecules.auditLogs.text.integrationConnectedWithoutDetail";
500
+ }
501
+ return /*#__PURE__*/jsx(Trans, {
502
+ i18nKey: _i18nKey,
503
+ additionalValues: {
504
+ performedBy: performedBy,
505
+ integrationName: integrationName,
506
+ detail: detail,
507
+ integrationOwner: integrationOwner
508
+ }
509
+ });
510
+ }
511
+ case ACTIONS.INTEGRATION_DISCONNECTED:
512
+ {
513
+ var _rawName = rest.integrationName,
514
+ _integrationOwner = rest.integrationOwner;
515
+ var _integrationName = INTEGRATION_DISPLAY_NAME_MAP[_rawName] || humanize(_rawName);
516
+ var _detail = changes === null || changes === void 0 ? void 0 : changes.detail;
517
+ var _i18nKey2;
518
+ if (_integrationOwner && _detail) {
519
+ _i18nKey2 = "neetoMolecules.auditLogs.text.integrationDisconnectedOnBehalf";
520
+ } else if (_integrationOwner) {
521
+ _i18nKey2 = "neetoMolecules.auditLogs.text.integrationDisconnectedOnBehalfWithoutDetail";
522
+ } else if (_detail) {
523
+ _i18nKey2 = "neetoMolecules.auditLogs.text.integrationDisconnected";
524
+ } else {
525
+ _i18nKey2 = "neetoMolecules.auditLogs.text.integrationDisconnectedWithoutDetail";
526
+ }
527
+ return /*#__PURE__*/jsx(Trans, {
528
+ i18nKey: _i18nKey2,
529
+ additionalValues: {
530
+ performedBy: performedBy,
531
+ integrationName: _integrationName,
532
+ detail: _detail,
533
+ integrationOwner: _integrationOwner
534
+ }
535
+ });
536
+ }
537
+ case ACTIONS.INTEGRATION_DISCONNECTED_BY_PROVIDER:
538
+ {
539
+ var _rawName2 = rest.integrationName;
540
+ var _integrationName2 = INTEGRATION_DISPLAY_NAME_MAP[_rawName2] || humanize(_rawName2);
541
+ var _detail2 = changes === null || changes === void 0 ? void 0 : changes.detail;
542
+ var _i18nKey3 = _detail2 ? "neetoMolecules.auditLogs.text.integrationDisconnectedByProvider" : "neetoMolecules.auditLogs.text.integrationDisconnectedByProviderWithoutDetail";
543
+ return /*#__PURE__*/jsx(Trans, {
544
+ i18nKey: _i18nKey3,
545
+ additionalValues: {
546
+ performedBy: performedBy,
547
+ integrationName: _integrationName2,
548
+ detail: _detail2
549
+ }
550
+ });
551
+ }
552
+ case ACTIONS.CONNECTED_STRIPE_ACCOUNT:
553
+ {
554
+ return /*#__PURE__*/jsx(Trans, {
555
+ i18nKey: "neetoMolecules.auditLogs.text.connectedStripeAccount",
556
+ additionalValues: {
557
+ performedBy: performedBy,
558
+ stripeAccountId: changes.stripeAccountId
559
+ }
560
+ });
561
+ }
562
+ case ACTIONS.DISCONNECTED_STRIPE_ACCOUNT:
563
+ {
564
+ return /*#__PURE__*/jsx(Trans, {
565
+ additionalValues: {
566
+ performedBy: performedBy
567
+ },
568
+ i18nKey: "neetoMolecules.auditLogs.text.disconnectedStripeAccount"
569
+ });
570
+ }
571
+ case ACTIONS.CONNECTED_ZOOM_INTEGRATION:
572
+ {
573
+ return /*#__PURE__*/jsx(Trans, {
574
+ i18nKey: "neetoMolecules.auditLogs.text.connectedZoomAccount",
575
+ additionalValues: {
576
+ performedBy: performedBy,
577
+ zoomAccountId: changes.zoomAccountId
578
+ }
579
+ });
580
+ }
581
+ case ACTIONS.DISCONNECTED_ZOOM_INTEGRATION:
582
+ {
583
+ return /*#__PURE__*/jsx(Trans, {
584
+ additionalValues: {
585
+ performedBy: performedBy
586
+ },
587
+ i18nKey: "neetoMolecules.auditLogs.text.disconnectedZoomAccount"
588
+ });
589
+ }
590
+ case ACTIONS.CONNECTED_CUSTOM_DOMAIN:
591
+ {
592
+ return /*#__PURE__*/jsx(Trans, {
593
+ additionalValues: {
594
+ performedBy: performedBy,
595
+ hostname: changes.hostname
596
+ },
597
+ i18nKey: "neetoMolecules.auditLogs.text.connectedCustomDomain"
598
+ });
599
+ }
600
+ case ACTIONS.DELETED_ROLE:
601
+ {
602
+ var _roleName = organizationRole || "role";
603
+ return /*#__PURE__*/jsx(Trans, {
604
+ additionalValues: {
605
+ performedBy: performedBy,
606
+ roleName: _roleName
607
+ },
608
+ i18nKey: "neetoMolecules.auditLogs.text.deletedRole"
609
+ });
610
+ }
611
+ case ACTIONS.CREATED_API_KEY:
612
+ {
613
+ return /*#__PURE__*/jsx(Trans, {
614
+ additionalValues: _objectSpread$3({
615
+ performedBy: performedBy
616
+ }, rest),
617
+ i18nKey: "neetoMolecules.auditLogs.text.createdApiKey"
618
+ });
619
+ }
620
+ case ACTIONS.DELETED_API_KEY:
621
+ {
622
+ return /*#__PURE__*/jsx(Trans, {
623
+ additionalValues: _objectSpread$3({
624
+ performedBy: performedBy
625
+ }, rest),
626
+ i18nKey: "neetoMolecules.auditLogs.text.deletedApiKey"
627
+ });
628
+ }
629
+ case ACTIONS.UPDATED_API_KEY:
630
+ {
631
+ return /*#__PURE__*/jsx(Trans, {
632
+ additionalValues: _objectSpread$3({
633
+ performedBy: performedBy
634
+ }, rest),
635
+ i18nKey: "neetoMolecules.auditLogs.text.updatedApiKey"
636
+ });
637
+ }
638
+ default:
639
+ {
640
+ return /*#__PURE__*/jsx(Trans, {
641
+ additionalValues: {
642
+ performedBy: performedBy
643
+ },
644
+ i18nKey: "neetoMolecules.auditLogs.text.performedAction"
645
+ });
646
+ }
647
+ }
648
+ };
649
+ var indexById = indexBy(prop("id"));
650
+ var indexByPermissionName = indexBy(prop("name"));
651
+
652
+ function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
653
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
654
+ var Card = function Card(_ref) {
655
+ var auditLog = _ref.auditLog,
656
+ countriesMap = _ref.countriesMap,
657
+ index = _ref.index,
658
+ permissionsMap = _ref.permissionsMap,
659
+ totalCount = _ref.totalCount;
660
+ var key = auditLog.key,
661
+ metadata = auditLog.metadata,
662
+ performer = auditLog.performer,
663
+ updatedAt = auditLog.updatedAt;
664
+ var action = transformAction(key);
665
+ var performedBy = (performer === null || performer === void 0 ? void 0 : performer.name) || "";
666
+ var performedAt = dateFormat.dateTime(updatedAt);
667
+ var auditText = constructAuditLogText(_objectSpread$2({
668
+ countriesMap: countriesMap,
669
+ action: action,
670
+ performedBy: performedBy,
671
+ permissionsMap: permissionsMap
672
+ }, metadata));
673
+ var isIntegrationAction = action === ACTIONS.INTEGRATION_CONNECTED || action === ACTIONS.INTEGRATION_DISCONNECTED || action === ACTIONS.INTEGRATION_DISCONNECTED_BY_PROVIDER;
674
+ var Icon = isIntegrationAction ? INTEGRATION_ICON_MAP[metadata === null || metadata === void 0 ? void 0 : metadata.integrationName] || AUDIT_ICON_MAP[action] : AUDIT_ICON_MAP[action];
675
+ return /*#__PURE__*/jsxs("div", {
676
+ "data-testid": "audit-log-card",
677
+ className: classnames("border-border flex w-full items-start gap-x-3 border-r border-b border-l px-4 py-3", {
678
+ "rounded-t-md border-t": index === 0,
679
+ "rounded-b-md": index === totalCount - 1
680
+ }),
681
+ children: [/*#__PURE__*/jsx(Avatar, {
682
+ className: "mt-0.5 size-9 shrink-0",
683
+ children: /*#__PURE__*/jsx(AvatarFallback, {
684
+ className: "bg-muted",
685
+ children: /*#__PURE__*/jsx(Icon, {
686
+ className: "text-muted-foreground",
687
+ size: 18
688
+ })
689
+ })
690
+ }), /*#__PURE__*/jsxs("div", {
691
+ className: "flex min-w-0 flex-col gap-y-1",
692
+ "data-testid": "audit-log-content",
693
+ children: [/*#__PURE__*/jsx(Typography, {
694
+ asChild: true,
695
+ variant: "body2",
696
+ children: /*#__PURE__*/jsx("span", {
697
+ className: "leading-snug",
698
+ "data-testid": "audit-log-text",
699
+ children: auditText
700
+ })
701
+ }), /*#__PURE__*/jsx("span", {
702
+ className: "text-muted-foreground text-xs",
703
+ "data-testid": "audit-log-timestamp",
704
+ children: performedAt
705
+ })]
706
+ })]
707
+ });
708
+ };
709
+
710
+ var fetchAuditLogs = function fetchAuditLogs(params) {
711
+ return axios.get("api/v1/audit_logs", {
712
+ params: params
713
+ });
714
+ };
715
+ var fetchCountries = function fetchCountries() {
716
+ return axios.get("neeto_team_members/profile/countries");
717
+ };
718
+ var fetchPermissions = function fetchPermissions() {
719
+ return axios.get("neeto_team_members/permissions");
720
+ };
721
+ var auditLogsApi = {
722
+ fetchAuditLogs: fetchAuditLogs,
723
+ fetchCountries: fetchCountries,
724
+ fetchPermissions: fetchPermissions
725
+ };
726
+
727
+ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
728
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
729
+ var useFetchAuditLogs = function useFetchAuditLogs(_ref) {
730
+ var params = _ref.params,
731
+ _ref$options = _ref.options,
732
+ options = _ref$options === void 0 ? {} : _ref$options;
733
+ return useQuery(_objectSpread$1({
734
+ queryKey: [AUDIT_LOGS_QUERY_KEY, params],
735
+ queryFn: function queryFn() {
736
+ return auditLogsApi.fetchAuditLogs(params);
737
+ }
738
+ }, options));
739
+ };
740
+
741
+ var useFetchCountries = function useFetchCountries() {
742
+ return useQuery({
743
+ queryKey: [COUNTRIES_LIST_QUERY_KEY],
744
+ queryFn: auditLogsApi.fetchCountries,
745
+ staleTime: DEFAULT_STALE_TIME
746
+ });
747
+ };
748
+
749
+ var useFetchPermissions = function useFetchPermissions() {
750
+ return useQuery({
751
+ queryKey: [PERMISSIONS_LIST_QUERY_KEY],
752
+ queryFn: auditLogsApi.fetchPermissions,
753
+ staleTime: DEFAULT_STALE_TIME
754
+ });
755
+ };
756
+
757
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
758
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
759
+ var getPageNumbers = function getPageNumbers(_ref) {
760
+ var currentPage = _ref.currentPage,
761
+ totalPages = _ref.totalPages;
762
+ var pages = [];
763
+ if (totalPages <= 7) {
764
+ for (var i = 1; i <= totalPages; i++) pages.push(i);
765
+ return pages;
766
+ }
767
+ pages.push(1);
768
+ if (currentPage > 3) {
769
+ pages.push("ellipsis-start");
770
+ }
771
+ var start = Math.max(2, currentPage - 1);
772
+ var end = Math.min(totalPages - 1, currentPage + 1);
773
+ for (var _i = start; _i <= end; _i++) pages.push(_i);
774
+ if (currentPage < totalPages - 2) {
775
+ pages.push("ellipsis-end");
776
+ }
777
+ pages.push(totalPages);
778
+ return pages;
779
+ };
780
+ var AuditLogsPagination = function AuditLogsPagination(_ref2) {
781
+ var count = _ref2.count,
782
+ pageNo = _ref2.pageNo,
783
+ pageSize = _ref2.pageSize;
784
+ var history = useHistory();
785
+ var _useLocation = useLocation(),
786
+ pathname = _useLocation.pathname;
787
+ var queryParams = useQueryParams();
788
+ var totalPages = Math.ceil(count / pageSize);
789
+ if (totalPages <= 1) return null;
790
+ var pages = getPageNumbers({
791
+ currentPage: pageNo,
792
+ totalPages: totalPages
793
+ });
794
+ var navigateToPage = function navigateToPage(page) {
795
+ history.push(buildUrl(pathname, mergeLeft({
796
+ page: page
797
+ }, queryParams)));
798
+ };
799
+ return /*#__PURE__*/jsx(Pagination, {
800
+ children: /*#__PURE__*/jsxs(PaginationContent, {
801
+ children: [/*#__PURE__*/jsx(PaginationItem, {
802
+ children: /*#__PURE__*/jsx(PaginationPrevious, {
803
+ className: classnames({
804
+ "pointer-events-none opacity-50": pageNo <= 1,
805
+ "cursor-pointer": !(pageNo <= 1)
806
+ }),
807
+ onClick: function onClick() {
808
+ return pageNo > 1 && navigateToPage(pageNo - 1);
809
+ }
810
+ })
811
+ }), pages.map(function (page) {
812
+ return typeof page === "string" ? /*#__PURE__*/jsx(PaginationItem, {
813
+ children: /*#__PURE__*/jsx(PaginationEllipsis, {})
814
+ }, page) : /*#__PURE__*/jsx(PaginationItem, {
815
+ children: /*#__PURE__*/jsx(PaginationLink, {
816
+ className: "cursor-pointer",
817
+ isActive: page === pageNo,
818
+ onClick: function onClick() {
819
+ return navigateToPage(page);
820
+ },
821
+ children: page
822
+ })
823
+ }, page);
824
+ }), /*#__PURE__*/jsx(PaginationItem, {
825
+ children: /*#__PURE__*/jsx(PaginationNext, {
826
+ className: classnames({
827
+ "pointer-events-none opacity-50": pageNo >= totalPages,
828
+ "cursor-pointer": !(pageNo >= totalPages)
829
+ }),
830
+ onClick: function onClick() {
831
+ return pageNo < totalPages && navigateToPage(pageNo + 1);
832
+ }
833
+ })
834
+ })]
835
+ })
836
+ });
837
+ };
838
+ var AuditLogs = function AuditLogs(_ref3) {
839
+ var headerProps = _ref3.headerProps,
840
+ noDataHelpText = _ref3.noDataHelpText,
841
+ noDataTitle = _ref3.noDataTitle;
842
+ var _useTranslation = useTranslation(),
843
+ t = _useTranslation.t;
844
+ var _useQueryParams = useQueryParams(),
845
+ _useQueryParams$page = _useQueryParams.page,
846
+ page = _useQueryParams$page === void 0 ? DEFAULT_PAGE_INDEX : _useQueryParams$page;
847
+ var _useFetchAuditLogs = useFetchAuditLogs({
848
+ params: {
849
+ page: page,
850
+ pageSize: AUDIT_LOGS_PAGE_SIZE
851
+ }
852
+ }),
853
+ _useFetchAuditLogs$da = _useFetchAuditLogs.data,
854
+ _useFetchAuditLogs$da2 = _useFetchAuditLogs$da === void 0 ? {} : _useFetchAuditLogs$da,
855
+ _useFetchAuditLogs$da3 = _useFetchAuditLogs$da2.auditLogs,
856
+ auditLogs = _useFetchAuditLogs$da3 === void 0 ? [] : _useFetchAuditLogs$da3,
857
+ _useFetchAuditLogs$da4 = _useFetchAuditLogs$da2.totalCount,
858
+ totalCount = _useFetchAuditLogs$da4 === void 0 ? 0 : _useFetchAuditLogs$da4,
859
+ isLoading = _useFetchAuditLogs.isLoading,
860
+ isFetching = _useFetchAuditLogs.isFetching;
861
+ var _useFetchCountries = useFetchCountries(),
862
+ countriesData = _useFetchCountries.data;
863
+ var _useFetchPermissions = useFetchPermissions(),
864
+ permissionsData = _useFetchPermissions.data;
865
+ var countriesList = countriesData === null || countriesData === void 0 ? void 0 : countriesData.countries;
866
+ var permissionsList = permissionsData === null || permissionsData === void 0 ? void 0 : permissionsData.permissions;
867
+ var permissionsMap = useMemo(function () {
868
+ return permissionsList ? indexByPermissionName(permissionsList) : {};
869
+ }, [permissionsList]);
870
+ var countriesMap = useMemo(function () {
871
+ return countriesList ? indexById(countriesList) : {};
872
+ }, [countriesList]);
873
+ if (isLoading || isFetching) {
874
+ return /*#__PURE__*/jsx("div", {
875
+ className: "flex h-full w-full items-center justify-center",
876
+ children: /*#__PURE__*/jsx(Spinner, {})
877
+ });
878
+ }
879
+ return /*#__PURE__*/jsxs(Container, {
880
+ isHeaderFixed: true,
881
+ className: "overflow-hidden",
882
+ children: [/*#__PURE__*/jsx(Header, _objectSpread({
883
+ className: "px-5 md:px-10",
884
+ title: t("neetoMolecules.auditLogs.title")
885
+ }, headerProps)), isPresent(auditLogs) ? /*#__PURE__*/jsx("div", {
886
+ className: "w-full grow overflow-y-auto px-5 md:px-10",
887
+ children: auditLogs.map(function (auditLog, index) {
888
+ return /*#__PURE__*/createElement(Card, {
889
+ auditLog: auditLog,
890
+ countriesMap: countriesMap,
891
+ index: index,
892
+ permissionsMap: permissionsMap,
893
+ key: auditLog.id,
894
+ totalCount: auditLogs.length
895
+ });
896
+ })
897
+ }) : /*#__PURE__*/jsxs("div", {
898
+ className: "flex h-full w-full flex-col items-center justify-center gap-1 text-center",
899
+ children: [/*#__PURE__*/jsx(Typography, {
900
+ variant: "h3",
901
+ weight: "semibold",
902
+ children: noDataTitle || t("neetoMolecules.auditLogs.noData")
903
+ }), noDataHelpText && /*#__PURE__*/jsx(Typography, {
904
+ asChild: true,
905
+ variant: "body2",
906
+ children: /*#__PURE__*/jsx("p", {
907
+ className: "text-muted-foreground",
908
+ children: noDataHelpText
909
+ })
910
+ })]
911
+ }), totalCount > 0 && /*#__PURE__*/jsx("div", {
912
+ className: "flex w-full justify-end px-5 py-4 md:px-10",
913
+ children: /*#__PURE__*/jsx(AuditLogsPagination, {
914
+ count: totalCount,
915
+ pageNo: parseInt(page),
916
+ pageSize: AUDIT_LOGS_PAGE_SIZE
917
+ })
918
+ })]
919
+ });
920
+ };
921
+
922
+ export { AuditLogs as default };
923
+ //# sourceMappingURL=AuditLogs.js.map