@bigbinary/neeto-molecules 4.1.52 → 4.1.54

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