@bigbinary/neeto-approvals-frontend 1.0.1 → 1.2.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.
package/dist/index.js CHANGED
@@ -1,1922 +1,51 @@
1
- import React, { useState, useEffect, useRef, createElement, useMemo } from 'react';
2
- import { useMutationWithInvalidation, useDebounce, withT, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
3
- import Container from '@bigbinary/neeto-molecules/Container';
4
- import { useLocation, useHistory, Switch, Route, Redirect, useParams } from 'react-router-dom';
5
- import i18next, { t as t$1 } from 'i18next';
6
- import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE, PLURAL, SINGULAR } from '@bigbinary/neeto-commons-frontend/constants';
7
- import Button from '@bigbinary/neetoui/Button';
8
- import { capitalize, isPresent, findBy, camelToSnakeCase, removeBy, noop } from '@bigbinary/neeto-cist';
9
- import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
10
- import Table$1 from '@bigbinary/neetoui/Table';
11
- import NoData from '@bigbinary/neetoui/NoData';
12
- import { isEmpty, keys } from 'ramda';
13
- import { useTranslation, Trans } from 'react-i18next';
14
- import { useQuery, keepPreviousData } from '@tanstack/react-query';
15
- import axios from 'axios';
16
- import Tag from '@bigbinary/neetoui/Tag';
17
- import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
18
- import { isEditorEmpty } from '@bigbinary/neeto-editor/utils';
19
- import * as yup from 'yup';
20
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
21
- import { dateFormat, withEventTargetValue, captureAnalyticsEvent } from '@bigbinary/neeto-commons-frontend/utils';
22
- import EditorContent from '@bigbinary/neeto-editor/EditorContent';
23
- import Label from '@bigbinary/neetoui/Label';
24
- import Pane from '@bigbinary/neetoui/Pane';
25
- import Textarea from '@bigbinary/neetoui/Textarea';
26
- import Typography from '@bigbinary/neetoui/Typography';
27
- import dayjs from 'dayjs';
28
- import timezone from 'dayjs/plugin/timezone';
29
- import utc from 'dayjs/plugin/utc';
30
- import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
31
- import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
32
- import Alert from '@bigbinary/neetoui/Alert';
33
- import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
34
- import FormikForm from '@bigbinary/neetoui/formik/Form';
35
- import { useFormikContext } from 'formik';
36
- import ToggleFeatureCard from '@bigbinary/neeto-molecules/ToggleFeatureCard';
37
- import Input from '@bigbinary/neetoui/formik/Input';
38
- import Textarea$1 from '@bigbinary/neetoui/formik/Textarea';
39
- import FormikEditor from '@bigbinary/neeto-editor/FormikEditor';
40
- import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
41
- import NeetoHeader from '@bigbinary/neeto-molecules/Header';
42
- import NeetoUITab from '@bigbinary/neetoui/Tab';
43
- import Select from '@bigbinary/neetoui/Select';
44
- import Callout from '@bigbinary/neetoui/Callout';
45
-
46
- function _typeof(o) {
47
- "@babel/helpers - typeof";
48
-
49
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
50
- return typeof o;
51
- } : function (o) {
52
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
53
- }, _typeof(o);
54
- }
55
-
56
- function _toPrimitive(input, hint) {
57
- if (_typeof(input) !== "object" || input === null) return input;
58
- var prim = input[Symbol.toPrimitive];
59
- if (prim !== undefined) {
60
- var res = prim.call(input, hint || "default");
61
- if (_typeof(res) !== "object") return res;
62
- throw new TypeError("@@toPrimitive must return a primitive value.");
63
- }
64
- return (hint === "string" ? String : Number)(input);
65
- }
66
-
67
- function _toPropertyKey(arg) {
68
- var key = _toPrimitive(arg, "string");
69
- return _typeof(key) === "symbol" ? key : String(key);
70
- }
71
-
72
- function _defineProperty(obj, key, value) {
73
- key = _toPropertyKey(key);
74
- if (key in obj) {
75
- Object.defineProperty(obj, key, {
76
- value: value,
77
- enumerable: true,
78
- configurable: true,
79
- writable: true
80
- });
81
- } else {
82
- obj[key] = value;
83
- }
84
- return obj;
85
- }
86
-
87
- function _arrayWithHoles(arr) {
88
- if (Array.isArray(arr)) return arr;
89
- }
90
-
91
- function _iterableToArrayLimit(r, l) {
92
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
93
- if (null != t) {
94
- var e,
95
- n,
96
- i,
97
- u,
98
- a = [],
99
- f = !0,
100
- o = !1;
101
- try {
102
- if (i = (t = t.call(r)).next, 0 === l) {
103
- if (Object(t) !== t) return;
104
- f = !1;
105
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
106
- } catch (r) {
107
- o = !0, n = r;
108
- } finally {
109
- try {
110
- if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
111
- } finally {
112
- if (o) throw n;
113
- }
114
- }
115
- return a;
116
- }
117
- }
118
-
119
- function _arrayLikeToArray(arr, len) {
120
- if (len == null || len > arr.length) len = arr.length;
121
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
122
- return arr2;
123
- }
124
-
125
- function _unsupportedIterableToArray(o, minLen) {
126
- if (!o) return;
127
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
128
- var n = Object.prototype.toString.call(o).slice(8, -1);
129
- if (n === "Object" && o.constructor) n = o.constructor.name;
130
- if (n === "Map" || n === "Set") return Array.from(o);
131
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
132
- }
133
-
134
- function _nonIterableRest() {
135
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
136
- }
137
-
138
- function _slicedToArray(arr, i) {
139
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
140
- }
141
-
142
- var routes = {
143
- home: "/",
144
- approvals: "/approvals/",
145
- pending: "pending",
146
- history: "history",
147
- templates: {
148
- index: "templates",
149
- "new": "templates/new",
150
- edit: "templates/:id/edit"
151
- },
152
- "public": "approvals/public/request/:id"
153
- };
154
-
155
- var handleEmptyPage = function handleEmptyPage(data, pageProperties, handlePageChange) {
156
- if (isEmpty(data) && pageProperties.page !== 1) {
157
- handlePageChange(pageProperties.page - 1, pageProperties.pageSize);
158
- }
159
- };
160
-
161
- var BASE_URL = "neeto_approvals";
162
- var TEMPLATE_URL = "".concat(BASE_URL, "/templates");
163
-
164
- var fetch$3 = function fetch(params, url) {
165
- return axios.get(url, {
166
- params: params
167
- });
168
- };
169
- var update$1 = function update(_ref) {
170
- var id = _ref.id,
171
- payload = _ref.payload;
172
- return axios.put("".concat(BASE_URL, "/requests/").concat(id), {
173
- request: payload
174
- });
175
- };
176
- var requestsApi = {
177
- fetch: fetch$3,
178
- update: update$1
179
- };
180
-
181
- var QUERY_KEYS = {
182
- APPROVERS: "neeto-approvals-approvers",
183
- TEMPLATES: "neeto-approvals-templates",
184
- REQUESTS: "neeto-approvals-requests",
185
- SHOW_TEMPLATE: "neeto-approvals-show-template",
186
- SHOW_PUBLIC_REQUEST: "neeto-approvals-show-public-request",
187
- VIEWS: "neeto-approvals-views"
188
- };
189
-
190
- function ownKeys$b(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; }
191
- function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
192
- var useFetchRequests = function useFetchRequests(_ref) {
193
- var requestUrl = _ref.requestUrl,
194
- _ref$params = _ref.params,
195
- params = _ref$params === void 0 ? {} : _ref$params,
196
- _ref$options = _ref.options,
197
- options = _ref$options === void 0 ? {} : _ref$options;
198
- return useQuery(_objectSpread$b({
199
- queryKey: [QUERY_KEYS.REQUESTS, params],
200
- queryFn: function queryFn() {
201
- return requestsApi.fetch(params, requestUrl);
202
- },
203
- select: function select(response) {
204
- return response.data || response;
205
- },
206
- placeholderData: keepPreviousData
207
- }, options));
208
- };
209
- var useUpdateRequest = function useUpdateRequest(options) {
210
- return useMutationWithInvalidation(requestsApi.update, _objectSpread$b({
211
- keysToInvalidate: [[QUERY_KEYS.REQUESTS], [QUERY_KEYS.VIEWS]]
212
- }, options));
213
- };
214
-
215
- var usePaginate = function usePaginate() {
216
- var _useState = useState({
217
- page: DEFAULT_PAGE_INDEX,
218
- pageSize: DEFAULT_PAGE_SIZE
219
- }),
220
- _useState2 = _slicedToArray(_useState, 2),
221
- pageProperties = _useState2[0],
222
- setPageProperties = _useState2[1];
223
- var resetPageProperties = function resetPageProperties() {
224
- return setPageProperties({
225
- page: DEFAULT_PAGE_INDEX,
226
- pageSize: DEFAULT_PAGE_SIZE
227
- });
228
- };
229
- var handlePageChange = function handlePageChange(page, pageSize) {
230
- setPageProperties({
231
- page: page,
232
- pageSize: pageSize
233
- });
234
- };
235
- return {
236
- pageProperties: pageProperties,
237
- resetPageProperties: resetPageProperties,
238
- handlePageChange: handlePageChange
239
- };
240
- };
241
-
242
- var DEFAULT_FILTER_VALUES = {
243
- searchTerm: "",
244
- sortBy: "",
245
- orderBy: ""
246
- };
247
- var SEARCH_DELAY = 750;
248
- var STATUSES = {
249
- approved: "approved",
250
- rejected: "rejected",
251
- pending: "pending",
252
- cancelled: "cancelled"
253
- };
254
- var STATUS_TAG_STYLE = {
255
- pending: "primary",
256
- approved: "success",
257
- rejected: "danger",
258
- cancelled: "warning"
259
- };
260
- var APPROVAL_REQUEST_FORM_INITIAL_VALUES = {
261
- message: "",
262
- approver: {}
263
- };
264
- var STATUS_UPDATED_BY = {
265
- rejected: t$1("neetoApprovals.common.rejectedBy"),
266
- approved: t$1("neetoApprovals.common.approvedBy"),
267
- cancelled: t$1("neetoApprovals.common.cancelledBy")
268
- };
269
- var DATA_CY_KEY = "data-cy";
270
- var SORT_ORDER = {
271
- ascend: "asc",
272
- descend: "desc"
273
- };
274
- var REQUEST_FORM_VALIDATION_SCHEMA = yup.object().shape({
275
- message: yup.string().test("message", t$1("neetoApprovals.validations.required", {
276
- what: t$1("neetoApprovals.inputs.labels.message")
277
- }), function (content) {
278
- return !isEditorEmpty(content);
279
- }),
280
- approver: yup.object().required(t$1("neetoApprovals.validations.approver"))
281
- });
282
- var EVENTS = {
283
- APPROVAL_TEMPLATE_CREATED: "approval_template_created"
284
- };
285
-
286
- var HISTORY_TABLE_COLUMNS = [{
287
- dataIndex: "approvalLabel",
288
- key: "approvalLabel",
289
- sorter: true,
290
- width: "25%",
291
- title: t$1("neetoApprovals.common.id"),
292
- render: function render(approvalLabel, _ref) {
293
- var requestableUrl = _ref.requestableUrl;
294
- var url = new URL(requestableUrl || window.location.origin);
295
- return /*#__PURE__*/jsx(Button, {
296
- label: approvalLabel,
297
- style: "link",
298
- to: url.pathname
299
- });
300
- }
301
- }, {
302
- dataIndex: "title",
303
- key: "title",
304
- sorter: true,
305
- width: "25%",
306
- title: t$1("neetoApprovals.common.title")
307
- }, {
308
- dataIndex: "status",
309
- key: "status",
310
- sorter: true,
311
- width: "25%",
312
- title: t$1("neetoApprovals.common.status"),
313
- render: function render(status) {
314
- return /*#__PURE__*/jsx(Tag, {
315
- label: capitalize(status),
316
- style: STATUS_TAG_STYLE[status]
317
- });
318
- }
319
- }, {
320
- dataIndex: "createdAt",
321
- key: "createdAt",
322
- sorter: true,
323
- width: "25%",
324
- title: t$1("neetoApprovals.common.created"),
325
- render: function render(createdAt) {
326
- return /*#__PURE__*/jsx(DateFormat.FromNow, {
327
- date: createdAt,
328
- typographyProps: {
329
- style: "body2"
330
- }
331
- });
332
- }
333
- }];
334
-
335
- var Footer = function Footer(_ref) {
336
- var isLoading = _ref.isLoading,
337
- handleSubmit = _ref.handleSubmit,
338
- isCurrentUserApprover = _ref.isCurrentUserApprover,
339
- isCurrentUserRequester = _ref.isCurrentUserRequester;
340
- var _useTranslation = useTranslation(),
341
- t = _useTranslation.t;
342
- if (!isCurrentUserApprover && !isCurrentUserRequester) return null;
343
- if (isCurrentUserApprover) {
344
- return /*#__PURE__*/jsxs(Pane.Footer, {
345
- className: "flex gap-x-2",
346
- children: [/*#__PURE__*/jsx(Button, {
347
- label: t("neetoApprovals.buttons.approve"),
348
- loading: isLoading,
349
- type: "submit",
350
- onClick: function onClick() {
351
- return handleSubmit(STATUSES.approved);
352
- }
353
- }), /*#__PURE__*/jsx(Button, {
354
- label: t("neetoApprovals.buttons.decline"),
355
- loading: isLoading,
356
- style: "text",
357
- onClick: function onClick() {
358
- return handleSubmit(STATUSES.rejected);
359
- }
360
- })]
361
- });
362
- }
363
- return /*#__PURE__*/jsx(Pane.Footer, {
364
- className: "flex gap-x-2",
365
- children: /*#__PURE__*/jsx(Button, {
366
- label: t("neetoApprovals.buttons.cancelRequest"),
367
- loading: isLoading,
368
- type: "submit",
369
- onClick: function onClick() {
370
- return handleSubmit(STATUSES.cancelled);
371
- }
372
- })
373
- });
374
- };
375
-
376
- dayjs.extend(utc);
377
- dayjs.extend(timezone);
378
- var updateApprovalDetails = function updateApprovalDetails(_ref) {
379
- var requestsData = _ref.requestsData,
380
- approvalDetails = _ref.approvalDetails;
381
- if (isPresent(requestsData === null || requestsData === void 0 ? void 0 : requestsData.requests) && isPresent(approvalDetails)) {
382
- var request = findBy({
383
- id: approvalDetails.id
384
- }, requestsData.requests) || {};
385
- return request;
386
- }
387
- return {};
388
- };
389
- var timeInZone = function timeInZone(time) {
390
- var _globalProps$user, _globalProps$user2;
391
- ((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.timeZone) && dayjs.tz.setDefault((_globalProps$user2 = globalProps.user) === null || _globalProps$user2 === void 0 ? void 0 : _globalProps$user2.timeZone);
392
- return dayjs(time).tz();
393
- };
394
- var getApprovalFilter = function getApprovalFilter() {
395
- return {
396
- PENDING: {
397
- label: t$1("neetoApprovals.common.pending"),
398
- value: "PENDING"
399
- },
400
- TEMPLATES: {
401
- label: t$1("neetoApprovals.common.template", PLURAL),
402
- value: "TEMPLATES"
403
- },
404
- HISTORY: {
405
- label: t$1("neetoApprovals.common.history"),
406
- value: "HISTORY"
407
- }
408
- };
409
- };
410
-
411
- var MemoizedEditorContent$1 = /*#__PURE__*/React.memo(EditorContent);
412
- var RequestDetailsPane = function RequestDetailsPane(_ref) {
413
- var _window$globalProps, _window$globalProps2;
414
- var isOpen = _ref.isOpen,
415
- onClose = _ref.onClose,
416
- approvalDetails = _ref.approvalDetails,
417
- _ref$isPending = _ref.isPending,
418
- isPending = _ref$isPending === void 0 ? false : _ref$isPending;
419
- var _useTranslation = useTranslation(),
420
- t = _useTranslation.t;
421
- var title = approvalDetails.title,
422
- _approvalDetails$stat = approvalDetails.status,
423
- status = _approvalDetails$stat === void 0 ? "" : _approvalDetails$stat,
424
- message = approvalDetails.message,
425
- createdAt = approvalDetails.createdAt,
426
- approverName = approvalDetails.approverName,
427
- approverEmail = approvalDetails.approverEmail,
428
- _approvalDetails$note = approvalDetails.note,
429
- initialNote = _approvalDetails$note === void 0 ? "" : _approvalDetails$note,
430
- requesterName = approvalDetails.requesterName,
431
- requesterEmail = approvalDetails.requesterEmail;
432
- var _useState = useState(initialNote),
433
- _useState2 = _slicedToArray(_useState, 2),
434
- note = _useState2[0],
435
- setNote = _useState2[1];
436
- var _useUpdateRequest = useUpdateRequest(),
437
- updatePendingRequest = _useUpdateRequest.mutate,
438
- isUpdateRequestPending = _useUpdateRequest.isPending;
439
- useEffect(function () {
440
- setNote(initialNote);
441
- }, [initialNote]);
442
- var requesterOrApproverDetails = status === STATUSES.cancelled ? "".concat(requesterName, " (").concat(requesterEmail, ")") : "".concat(approverName, " (").concat(approverEmail, ")");
443
- var isCurrentUserApprover = ((_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 || (_window$globalProps = _window$globalProps.user) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.email) === approverEmail;
444
- var isCurrentUserRequester = ((_window$globalProps2 = window.globalProps) === null || _window$globalProps2 === void 0 || (_window$globalProps2 = _window$globalProps2.user) === null || _window$globalProps2 === void 0 ? void 0 : _window$globalProps2.email) === requesterEmail;
445
- var getStatusLabel = function getStatusLabel() {
446
- if (isPending) {
447
- return t("neetoApprovals.common.waitingFor");
448
- }
449
- return STATUS_UPDATED_BY[status];
450
- };
451
- var handleOnClose = function handleOnClose() {
452
- setNote("");
453
- onClose();
454
- };
455
- var handleSubmit = function handleSubmit(status) {
456
- return updatePendingRequest({
457
- id: approvalDetails.id,
458
- payload: _defineProperty({
459
- status: status,
460
- note: note
461
- }, "".concat(status, "At"), new Date())
462
- }, {
463
- onSuccess: handleOnClose
464
- });
465
- };
466
- return /*#__PURE__*/jsxs(Pane, {
467
- isOpen: isOpen,
468
- size: "large",
469
- onClose: handleOnClose,
470
- children: [/*#__PURE__*/jsxs(Pane.Header, {
471
- className: "space-y-2",
472
- children: [/*#__PURE__*/jsx(Typography, {
473
- style: "h2",
474
- children: title
475
- }), /*#__PURE__*/jsx(Tag, {
476
- label: capitalize(status),
477
- style: STATUS_TAG_STYLE[status]
478
- })]
479
- }), /*#__PURE__*/jsxs(Pane.Body, {
480
- className: "space-y-6",
481
- children: [/*#__PURE__*/jsxs("div", {
482
- className: "w-full divide-y border px-3",
483
- children: [/*#__PURE__*/jsxs("div", {
484
- className: "flex space-x-3 p-2",
485
- children: [/*#__PURE__*/jsx(Label, {
486
- className: "font-normal",
487
- children: getStatusLabel()
488
- }), /*#__PURE__*/jsx(Typography, {
489
- style: "body2",
490
- weight: "medium",
491
- children: requesterOrApproverDetails
492
- })]
493
- }), /*#__PURE__*/jsxs("div", {
494
- className: "flex space-x-3 p-2",
495
- children: [/*#__PURE__*/jsx(Label, {
496
- className: "font-normal",
497
- children: t("neetoApprovals.common.created")
498
- }), /*#__PURE__*/jsx(Typography, {
499
- style: "body2",
500
- weight: "medium",
501
- children: dateFormat.defaultWithTime(timeInZone(createdAt))
502
- })]
503
- })]
504
- }), /*#__PURE__*/jsxs("div", {
505
- className: "w-full space-y-2",
506
- children: [/*#__PURE__*/jsx(Label, {
507
- children: t("neetoApprovals.inputs.labels.message")
508
- }), /*#__PURE__*/jsx(MemoizedEditorContent$1, {
509
- className: "neeto-ui-bg-gray-100 p-4",
510
- content: message
511
- })]
512
- }), isPending && isCurrentUserApprover && /*#__PURE__*/jsx(Textarea, {
513
- className: "w-full",
514
- disabled: !isPending,
515
- label: t("neetoApprovals.common.note"),
516
- value: note,
517
- placeholder: t("neetoApprovals.inputs.placeholders.add_", {
518
- what: t("neetoApprovals.common.note")
519
- }),
520
- onChange: withEventTargetValue(setNote)
521
- }), !isPending && note && /*#__PURE__*/jsxs("div", {
522
- className: "w-full space-y-2",
523
- children: [/*#__PURE__*/jsx(Label, {
524
- children: t("neetoApprovals.common.note")
525
- }), /*#__PURE__*/jsx("div", {
526
- className: "neeto-ui-bg-gray-100 p-4",
527
- children: note
528
- })]
529
- })]
530
- }), isPending && /*#__PURE__*/jsx(Footer, {
531
- handleSubmit: handleSubmit,
532
- isCurrentUserApprover: isCurrentUserApprover,
533
- isCurrentUserRequester: isCurrentUserRequester,
534
- isLoading: isUpdateRequestPending
535
- })]
536
- });
537
- };
538
-
539
- function ownKeys$a(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; }
540
- function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
541
- var History = function History(_ref) {
542
- var helpDocUrl = _ref.helpDocUrl,
543
- requestUrl = _ref.requestUrl;
544
- var _useState = useState(DEFAULT_FILTER_VALUES),
545
- _useState2 = _slicedToArray(_useState, 2),
546
- filters = _useState2[0],
547
- setFilters = _useState2[1];
548
- var debouncedSearchTerm = useDebounce(filters.searchTerm, SEARCH_DELAY);
549
- var _usePaginate = usePaginate(),
550
- pageProperties = _usePaginate.pageProperties,
551
- handlePageChange = _usePaginate.handlePageChange;
552
- var _useState3 = useState({}),
553
- _useState4 = _slicedToArray(_useState3, 2),
554
- approvalDetails = _useState4[0],
555
- setApprovalDetails = _useState4[1];
556
- var _useTranslation = useTranslation(),
557
- t = _useTranslation.t;
558
- var _useFetchRequests = useFetchRequests({
559
- params: _objectSpread$a(_objectSpread$a(_objectSpread$a({}, pageProperties), filters), {}, {
560
- searchTerm: debouncedSearchTerm.trim(),
561
- status: [STATUSES.approved, STATUSES.rejected, STATUSES.cancelled]
562
- }),
563
- requestUrl: requestUrl
564
- }),
565
- data = _useFetchRequests.data;
566
- var _ref2 = data || {},
567
- _ref2$requests = _ref2.requests,
568
- approvalHistories = _ref2$requests === void 0 ? {} : _ref2$requests,
569
- _ref2$totalCount = _ref2.totalCount,
570
- totalCount = _ref2$totalCount === void 0 ? 0 : _ref2$totalCount;
571
- useEffect(function () {
572
- if (!data) return;
573
- handleEmptyPage(data === null || data === void 0 ? void 0 : data.requests, pageProperties, handlePageChange);
574
- setApprovalDetails(function (approvalDetails) {
575
- return updateApprovalDetails({
576
- requestsData: data === null || data === void 0 ? void 0 : data.requests,
577
- approvalDetails: approvalDetails
578
- });
579
- });
580
- }, [data]);
581
- var handleTableChange = function handleTableChange(_, __, sorter) {
582
- setFilters(_objectSpread$a(_objectSpread$a({}, filters), {}, {
583
- sortBy: camelToSnakeCase(sorter.field || ""),
584
- orderBy: SORT_ORDER[sorter.order]
585
- }));
586
- };
587
- return /*#__PURE__*/jsxs(Fragment, {
588
- children: [!isEmpty(approvalHistories) ? /*#__PURE__*/jsx(TableWrapper, {
589
- className: "mt-6",
590
- hasPagination: totalCount > pageProperties.pageSize,
591
- children: /*#__PURE__*/jsx(Table$1, {
592
- handlePageChange: handlePageChange,
593
- totalCount: totalCount,
594
- allowRowClick: true,
595
- fixedHeight: true,
596
- columnData: HISTORY_TABLE_COLUMNS,
597
- currentPageNumber: pageProperties.page,
598
- defaultPageSize: pageProperties.pageSize,
599
- rowData: approvalHistories,
600
- paginationProps: {
601
- hideOnSinglePage: (approvalHistories === null || approvalHistories === void 0 ? void 0 : approvalHistories.length) < DEFAULT_PAGE_SIZE + 1
602
- },
603
- onChange: handleTableChange,
604
- onRowClick: function onRowClick(_, approvalDetails) {
605
- return setApprovalDetails(approvalDetails);
606
- }
607
- })
608
- }) : /*#__PURE__*/jsx("div", {
609
- className: "flex h-full w-full flex-grow items-center justify-center",
610
- children: /*#__PURE__*/jsx(NoData, {
611
- helpText: /*#__PURE__*/jsx(Trans, {
612
- i18nKey: "neetoApprovals.common.noDataHelpTextLearnMore",
613
- style: "link",
614
- values: {
615
- entity: t("neetoApprovals.common.history")
616
- },
617
- components: {
618
- a: /*#__PURE__*/jsx(Button, {
619
- style: "link",
620
- target: "_blank",
621
- to: {
622
- pathname: helpDocUrl
623
- }
624
- })
625
- }
626
- }),
627
- title: t("neetoApprovals.common.notFound_", {
628
- what: t("neetoApprovals.common.record", PLURAL)
629
- })
630
- })
631
- }), /*#__PURE__*/jsx(RequestDetailsPane, {
632
- approvalDetails: approvalDetails,
633
- isOpen: isPresent(approvalDetails),
634
- onClose: function onClose() {
635
- return setApprovalDetails({});
636
- }
637
- })]
638
- });
639
- };
640
-
641
- var PENDING_TABLE_COLUMNS = removeBy({
642
- key: "status"
643
- }, HISTORY_TABLE_COLUMNS);
644
-
645
- function ownKeys$9(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; }
646
- function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
647
- var PendingRequests = function PendingRequests(_ref) {
648
- var helpDocUrl = _ref.helpDocUrl,
649
- requestUrl = _ref.requestUrl;
650
- var _useState = useState(DEFAULT_FILTER_VALUES),
651
- _useState2 = _slicedToArray(_useState, 2),
652
- filters = _useState2[0],
653
- setFilters = _useState2[1];
654
- var _useState3 = useState({}),
655
- _useState4 = _slicedToArray(_useState3, 2),
656
- approvalDetails = _useState4[0],
657
- setApprovalDetails = _useState4[1];
658
- var debouncedSearchTerm = useDebounce(filters.searchTerm, SEARCH_DELAY);
659
- var _usePaginate = usePaginate(),
660
- pageProperties = _usePaginate.pageProperties,
661
- handlePageChange = _usePaginate.handlePageChange;
662
- var _useTranslation = useTranslation(),
663
- t = _useTranslation.t;
664
- var _useFetchRequests = useFetchRequests({
665
- params: _objectSpread$9(_objectSpread$9(_objectSpread$9({}, pageProperties), filters), {}, {
666
- searchTerm: debouncedSearchTerm.trim(),
667
- status: [STATUSES.pending]
668
- }),
669
- requestUrl: requestUrl
670
- }),
671
- data = _useFetchRequests.data;
672
- var _ref2 = data || {},
673
- _ref2$requests = _ref2.requests,
674
- pendingRequests = _ref2$requests === void 0 ? {} : _ref2$requests,
675
- _ref2$totalCount = _ref2.totalCount,
676
- totalCount = _ref2$totalCount === void 0 ? 0 : _ref2$totalCount;
677
- useEffect(function () {
678
- if (!data) return;
679
- handleEmptyPage(data === null || data === void 0 ? void 0 : data.requests, pageProperties, handlePageChange);
680
- }, [data]);
681
- var handleTableChange = function handleTableChange(_, __, sorter) {
682
- setFilters(_objectSpread$9(_objectSpread$9({}, filters), {}, {
683
- sortBy: camelToSnakeCase(sorter.field || ""),
684
- orderBy: SORT_ORDER[sorter.order]
685
- }));
686
- };
687
- return /*#__PURE__*/jsxs(Fragment, {
688
- children: [!isEmpty(pendingRequests) ? /*#__PURE__*/jsx(TableWrapper, {
689
- className: "mt-6",
690
- hasPagination: totalCount > pageProperties.pageSize,
691
- children: /*#__PURE__*/jsx(Table$1, {
692
- handlePageChange: handlePageChange,
693
- totalCount: totalCount,
694
- allowRowClick: true,
695
- fixedHeight: true,
696
- columnData: PENDING_TABLE_COLUMNS,
697
- currentPageNumber: pageProperties.page,
698
- defaultPageSize: pageProperties.pageSize,
699
- rowData: pendingRequests,
700
- paginationProps: {
701
- hideOnSinglePage: (pendingRequests === null || pendingRequests === void 0 ? void 0 : pendingRequests.length) < DEFAULT_PAGE_SIZE + 1
702
- },
703
- onChange: handleTableChange,
704
- onRowClick: function onRowClick(_, approvalDetails) {
705
- return setApprovalDetails(approvalDetails);
706
- }
707
- })
708
- }) : /*#__PURE__*/jsx("div", {
709
- className: "flex h-full w-full flex-grow items-center justify-center",
710
- children: /*#__PURE__*/jsx(NoData, {
711
- helpText: /*#__PURE__*/jsx(Trans, {
712
- i18nKey: "neetoApprovals.common.noDataHelpTextLearnMore",
713
- style: "link",
714
- components: {
715
- a: /*#__PURE__*/jsx(Button, {
716
- style: "link",
717
- target: "_blank",
718
- to: {
719
- pathname: helpDocUrl
720
- }
721
- })
722
- },
723
- values: {
724
- entity: t("neetoApprovals.common.pendingApproval", PLURAL)
725
- }
726
- }),
727
- title: t("neetoApprovals.common.notFound_", {
728
- what: t("neetoApprovals.common.pendingApproval", PLURAL)
729
- })
730
- })
731
- }), /*#__PURE__*/jsx(RequestDetailsPane, {
732
- approvalDetails: approvalDetails,
733
- isPending: true,
734
- isOpen: isPresent(approvalDetails),
735
- onClose: function onClose() {
736
- return setApprovalDetails({});
737
- }
738
- })]
739
- });
740
- };
741
-
742
- function _objectWithoutPropertiesLoose(source, excluded) {
743
- if (source == null) return {};
744
- var target = {};
745
- var sourceKeys = Object.keys(source);
746
- var key, i;
747
- for (i = 0; i < sourceKeys.length; i++) {
748
- key = sourceKeys[i];
749
- if (excluded.indexOf(key) >= 0) continue;
750
- target[key] = source[key];
751
- }
752
- return target;
753
- }
754
-
755
- function _objectWithoutProperties(source, excluded) {
756
- if (source == null) return {};
757
- var target = _objectWithoutPropertiesLoose(source, excluded);
758
- var key, i;
759
- if (Object.getOwnPropertySymbols) {
760
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
761
- for (i = 0; i < sourceSymbolKeys.length; i++) {
762
- key = sourceSymbolKeys[i];
763
- if (excluded.indexOf(key) >= 0) continue;
764
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
765
- target[key] = source[key];
766
- }
767
- }
768
- return target;
769
- }
770
-
771
- var fetch$2 = function fetch(params) {
772
- return axios.get(TEMPLATE_URL, {
773
- params: params
774
- });
775
- };
776
- var show$1 = function show(_ref) {
777
- var id = _ref.id,
778
- params = _ref.params;
779
- return axios.get("".concat(TEMPLATE_URL, "/").concat(id), {
780
- params: params
781
- });
782
- };
783
- var create = function create(_ref2) {
784
- var _ref2$url = _ref2.url,
785
- url = _ref2$url === void 0 ? TEMPLATE_URL : _ref2$url,
786
- payload = _ref2.payload;
787
- return axios.post(url, payload);
788
- };
789
- var update = function update(_ref3) {
790
- var id = _ref3.id,
791
- payload = _ref3.payload,
792
- _ref3$url = _ref3.url,
793
- url = _ref3$url === void 0 ? BASE_URL : _ref3$url;
794
- return axios.put("".concat(url, "/").concat(id), payload);
795
- };
796
- var destroy = function destroy(_ref4) {
797
- var templateId = _ref4.templateId;
798
- return axios["delete"]("".concat(TEMPLATE_URL, "/").concat(templateId));
799
- };
800
- var templatesApi = {
801
- create: create,
802
- fetch: fetch$2,
803
- update: update,
804
- destroy: destroy,
805
- show: show$1
806
- };
807
-
808
- function ownKeys$8(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; }
809
- function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
810
- var useFetchTemplates = function useFetchTemplates() {
811
- var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
812
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
813
- return useQuery(_objectSpread$8({
814
- queryKey: [QUERY_KEYS.TEMPLATES, params],
815
- queryFn: function queryFn() {
816
- return templatesApi.fetch(params);
817
- },
818
- select: function select(response) {
819
- return response.data || response;
820
- },
821
- placeholderData: keepPreviousData
822
- }, options));
823
- };
824
- var useFetchTemplate = function useFetchTemplate(_ref) {
825
- var id = _ref.id,
826
- params = _ref.params;
827
- return useQuery({
828
- queryKey: [QUERY_KEYS.SHOW_TEMPLATE, id, params],
829
- queryFn: function queryFn() {
830
- return templatesApi.show({
831
- id: id,
832
- params: params
833
- });
834
- },
835
- enabled: !!id
836
- });
837
- };
838
- var useCreateTemplate = function useCreateTemplate() {
839
- return useMutationWithInvalidation(templatesApi.create, {
840
- keysToInvalidate: [[QUERY_KEYS.TEMPLATES], [QUERY_KEYS.VIEWS]],
841
- onSuccess: function onSuccess() {
842
- return captureAnalyticsEvent(EVENTS.APPROVAL_TEMPLATE_CREATED);
843
- }
844
- });
845
- };
846
- var useUpdateTemplate = function useUpdateTemplate(options) {
847
- return useMutationWithInvalidation(templatesApi.update, _objectSpread$8({
848
- keysToInvalidate: [[QUERY_KEYS.TEMPLATES], function (_, _ref2) {
849
- var id = _ref2.id;
850
- return [QUERY_KEYS.SHOW_TEMPLATE, id];
851
- }]
852
- }, options));
853
- };
854
- var useDeleteTemplate = function useDeleteTemplate(options) {
855
- return useMutationWithInvalidation(templatesApi.destroy, _objectSpread$8({
856
- keysToInvalidate: [[QUERY_KEYS.TEMPLATES], [QUERY_KEYS.VIEWS]]
857
- }, options));
858
- };
859
-
860
- var TEMPLATE_FORM_INITIAL_VALUES = {
861
- name: "",
862
- description: "",
863
- message: ""
864
- };
865
- var TEMPLATE_FORM_VALIDATION_SCHEMA = yup.object().shape({
866
- name: yup.string().trim().required(t$1("neetoApprovals.validations.required", {
867
- what: t$1("neetoApprovals.common.name")
868
- })),
869
- message: yup.string().test("message", t$1("neetoApprovals.validations.required", {
870
- what: t$1("neetoApprovals.inputs.labels.message")
871
- }), function (content) {
872
- return !isEditorEmpty(content);
873
- })
874
- });
875
-
876
- var MessageEditor = withT(function (_ref) {
877
- var t = _ref.t,
878
- _ref$placeholders = _ref.placeholders,
879
- placeholders = _ref$placeholders === void 0 ? [] : _ref$placeholders,
880
- _ref$initialValue = _ref.initialValue,
881
- initialValue = _ref$initialValue === void 0 ? "" : _ref$initialValue;
882
- return /*#__PURE__*/jsx(FormikEditor, {
883
- initialValue: initialValue,
884
- required: true,
885
- label: t("neetoApprovals.inputs.labels.message"),
886
- name: "message",
887
- rows: 3,
888
- variables: placeholders,
889
- placeholder: t("neetoApprovals.inputs.placeholders.enter_", {
890
- what: t("neetoApprovals.inputs.labels.message")
891
- })
892
- });
893
- });
894
-
895
- var TemplateForm = function TemplateForm(_ref) {
896
- var placeholders = _ref.placeholders,
897
- initialData = _ref.initialData;
898
- var _useTranslation = useTranslation(),
899
- t = _useTranslation.t;
900
- var _useFormikContext = useFormikContext(),
901
- values = _useFormikContext.values,
902
- setFieldValue = _useFormikContext.setFieldValue;
903
- var handleDescriptionToggle = function handleDescriptionToggle(_ref2) {
904
- var checked = _ref2.target.checked;
905
- setFieldValue("descriptionEnabled", checked);
906
- if (!checked) {
907
- setFieldValue("description", "");
908
- }
909
- };
910
- return /*#__PURE__*/jsxs("div", {
911
- className: "flex w-full flex-col space-y-6",
912
- children: [/*#__PURE__*/jsx(Input, {
913
- autoFocus: true,
914
- required: true,
915
- label: t("neetoApprovals.common.name"),
916
- name: "name",
917
- placeholder: t("neetoApprovals.inputs.placeholders.name")
918
- }), /*#__PURE__*/jsx(ToggleFeatureCard, {
919
- switchName: "descriptionEnabled",
920
- title: t("neetoApprovals.inputs.labels.description"),
921
- switchProps: {
922
- onChange: handleDescriptionToggle,
923
- tooltipProps: {
924
- enabledSwitchText: t("neetoApprovals.templates.descriptionToggle.enable"),
925
- disabledSwitchText: t("neetoApprovals.templates.descriptionToggle.disable")
926
- }
927
- },
928
- children: values.descriptionEnabled && /*#__PURE__*/jsx(Textarea$1, {
929
- className: "w-full",
930
- name: "description",
931
- placeholder: t("neetoApprovals.inputs.placeholders.description")
932
- })
933
- }), /*#__PURE__*/jsx(MessageEditor, {
934
- placeholders: placeholders,
935
- initialValue: initialData.message
936
- })]
937
- });
938
- };
939
-
940
- var Form$2 = function Form(_ref) {
941
- var isOpen = _ref.isOpen,
942
- onClose = _ref.onClose,
943
- _ref$initialData = _ref.initialData,
944
- initialData = _ref$initialData === void 0 ? {} : _ref$initialData,
945
- _ref$onSubmit = _ref.onSubmit,
946
- onSubmit = _ref$onSubmit === void 0 ? noop : _ref$onSubmit,
947
- _ref$isLoading = _ref.isLoading,
948
- isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
949
- placeholders = _ref.placeholders;
950
- var inputReference = useRef(null);
951
- var _useTranslation = useTranslation(),
952
- t = _useTranslation.t;
953
- var header = isEmpty(initialData) ? t("neetoApprovals.common.addNew_", {
954
- what: t("neetoApprovals.common.template", SINGULAR)
955
- }) : t("neetoApprovals.common.edit_", {
956
- what: t("neetoApprovals.common.template", SINGULAR)
957
- });
958
- return /*#__PURE__*/jsxs(Pane, {
959
- isOpen: isOpen,
960
- onClose: onClose,
961
- initialFocusRef: inputReference,
962
- size: "large",
963
- children: [/*#__PURE__*/jsx(Pane.Header, {
964
- children: /*#__PURE__*/jsx(Typography, {
965
- style: "h2",
966
- children: header
967
- })
968
- }), /*#__PURE__*/jsxs(FormikForm, {
969
- formikProps: {
970
- enableReinitialize: true,
971
- initialValues: isPresent(initialData) ? initialData : TEMPLATE_FORM_INITIAL_VALUES,
972
- validationSchema: TEMPLATE_FORM_VALIDATION_SCHEMA,
973
- onSubmit: onSubmit
974
- },
975
- children: [/*#__PURE__*/jsx(Pane.Body, {
976
- children: /*#__PURE__*/jsx(TemplateForm, {
977
- initialData: initialData,
978
- placeholders: placeholders
979
- })
980
- }), /*#__PURE__*/jsx(Pane.Footer, {
981
- children: /*#__PURE__*/jsx(ActionBlock, {
982
- isSubmitting: isLoading,
983
- cancelButtonProps: {
984
- "data-cy": "neeto-approvals-templates-close-template-form-btn",
985
- onClick: onClose
986
- },
987
- submitButtonProps: {
988
- "data-cy": "neeto-approvals-templates-save-template-btn"
989
- }
990
- })
991
- })]
992
- })]
993
- });
994
- };
995
-
996
- var Create = function Create(_ref) {
997
- var templateUrl = _ref.templateUrl,
998
- isOpen = _ref.isOpen,
999
- onClose = _ref.onClose,
1000
- templatePlaceholders = _ref.templatePlaceholders;
1001
- var _useCreateTemplate = useCreateTemplate(),
1002
- createTemplate = _useCreateTemplate.mutate,
1003
- isPending = _useCreateTemplate.isPending;
1004
- var onSubmit = function onSubmit(template) {
1005
- var payload = {
1006
- template: template
1007
- };
1008
- createTemplate({
1009
- url: templateUrl,
1010
- payload: payload
1011
- }, {
1012
- onSuccess: onClose
1013
- });
1014
- };
1015
- return /*#__PURE__*/jsx(Form$2, {
1016
- isOpen: isOpen,
1017
- onClose: onClose,
1018
- onSubmit: onSubmit,
1019
- isLoading: isPending,
1020
- placeholders: templatePlaceholders
1021
- });
1022
- };
1023
-
1024
- function ownKeys$7(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; }
1025
- function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1026
- var Edit = function Edit(_ref) {
1027
- var templateUrl = _ref.templateUrl,
1028
- template = _ref.template,
1029
- setTemplate = _ref.setTemplate,
1030
- isOpen = _ref.isOpen,
1031
- onClose = _ref.onClose,
1032
- templatePlaceholders = _ref.templatePlaceholders;
1033
- var _useUpdateTemplate = useUpdateTemplate({
1034
- onSuccess: function onSuccess() {
1035
- return setTemplate({});
1036
- }
1037
- }),
1038
- updateTemplate = _useUpdateTemplate.mutate,
1039
- isUpdating = _useUpdateTemplate.isPending;
1040
- var onSubmit = function onSubmit(template) {
1041
- var payload = {
1042
- template: template
1043
- };
1044
- updateTemplate({
1045
- id: template.id,
1046
- payload: payload,
1047
- url: templateUrl
1048
- });
1049
- };
1050
- var initialData = _objectSpread$7(_objectSpread$7({}, template), {}, {
1051
- descriptionEnabled: !!template.description
1052
- });
1053
- return /*#__PURE__*/jsx(Form$2, {
1054
- initialData: initialData,
1055
- isOpen: isOpen,
1056
- onClose: onClose,
1057
- onSubmit: onSubmit,
1058
- isLoading: isUpdating,
1059
- placeholders: templatePlaceholders
1060
- });
1061
- };
1062
-
1063
- var Field = function Field(_ref) {
1064
- var label = _ref.label,
1065
- value = _ref.value;
1066
- return /*#__PURE__*/jsxs("div", {
1067
- className: "flex flex-col items-start justify-center",
1068
- children: [/*#__PURE__*/jsx(Label, {
1069
- className: "mb-1 font-normal",
1070
- children: label
1071
- }), /*#__PURE__*/jsx(Typography, {
1072
- style: "body1",
1073
- weight: "medium",
1074
- children: value
1075
- })]
1076
- });
1077
- };
1078
- var Field$1 = /*#__PURE__*/React.memo(Field);
1079
-
1080
- var MemoizedEditorContent = /*#__PURE__*/React.memo(EditorContent);
1081
- var TemplateDetails = function TemplateDetails(_ref) {
1082
- var isOpen = _ref.isOpen,
1083
- onClose = _ref.onClose,
1084
- template = _ref.template;
1085
- var _useTranslation = useTranslation(),
1086
- t = _useTranslation.t;
1087
- var name = template.name,
1088
- description = template.description,
1089
- message = template.message;
1090
- return /*#__PURE__*/jsxs(Pane, {
1091
- isOpen: isOpen,
1092
- onClose: onClose,
1093
- children: [/*#__PURE__*/jsx(Pane.Header, {
1094
- className: "space-y-2",
1095
- children: /*#__PURE__*/jsx(Typography, {
1096
- style: "h2",
1097
- children: t("neetoApprovals.common.templateDetails")
1098
- })
1099
- }), /*#__PURE__*/jsxs(Pane.Body, {
1100
- className: "space-y-6",
1101
- children: [/*#__PURE__*/jsx(Field$1, {
1102
- label: t("neetoApprovals.common.name"),
1103
- value: name
1104
- }), /*#__PURE__*/jsx(Field$1, {
1105
- label: t("neetoApprovals.inputs.labels.description"),
1106
- value: description
1107
- }), /*#__PURE__*/jsxs("div", {
1108
- className: "flex w-full flex-col space-y-4",
1109
- children: [/*#__PURE__*/jsx(Label, {
1110
- className: "mb-1 font-normal",
1111
- children: t("neetoApprovals.inputs.labels.message")
1112
- }), /*#__PURE__*/jsx(MemoizedEditorContent, {
1113
- className: "neeto-ui-bg-gray-100 neeto-ui-rounded-lg p-3",
1114
- content: message
1115
- })]
1116
- })]
1117
- })]
1118
- });
1119
- };
1120
-
1121
- var renderNoDataHelpText = function renderNoDataHelpText(_ref) {
1122
- var entity = _ref.entity,
1123
- url = _ref.url;
1124
- return /*#__PURE__*/jsx(Trans, {
1125
- i18nKey: "neetoApprovals.common.noDataHelpText",
1126
- style: "link",
1127
- values: {
1128
- entity: entity.toLocaleLowerCase()
1129
- },
1130
- components: {
1131
- a: /*#__PURE__*/jsx(Button, {
1132
- style: "link",
1133
- target: "_blank",
1134
- to: {
1135
- pathname: url
1136
- }
1137
- })
1138
- }
1139
- });
1140
- };
1141
-
1142
- var _excluded$1 = ["entity", "columnData", "rowData", "totalCount", "filters", "setFilters", "setIsPaneOpen", "helpDocUrl", "onEditClick", "onDeleteClick", "pageProperties"];
1143
- function ownKeys$6(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; }
1144
- function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1145
- var Table = function Table(_ref) {
1146
- var _t;
1147
- var entity = _ref.entity,
1148
- columnData = _ref.columnData,
1149
- rowData = _ref.rowData,
1150
- totalCount = _ref.totalCount,
1151
- filters = _ref.filters,
1152
- setFilters = _ref.setFilters,
1153
- setIsPaneOpen = _ref.setIsPaneOpen,
1154
- helpDocUrl = _ref.helpDocUrl,
1155
- onEditClick = _ref.onEditClick,
1156
- onDeleteClick = _ref.onDeleteClick,
1157
- pageProperties = _ref.pageProperties,
1158
- otherProps = _objectWithoutProperties(_ref, _excluded$1);
1159
- var _useTranslation = useTranslation(),
1160
- t = _useTranslation.t;
1161
- var columns = columnData({
1162
- onEditClick: onEditClick,
1163
- onDeleteClick: onDeleteClick
1164
- });
1165
- var handleTableChange = function handleTableChange(_, __, sorter) {
1166
- setFilters(_objectSpread$6(_objectSpread$6({}, filters), {}, {
1167
- sortBy: sorter.field,
1168
- orderBy: SORT_ORDER[sorter.order]
1169
- }));
1170
- };
1171
- var noDataProps = {
1172
- primaryButtonProps: {
1173
- label: t("neetoApprovals.common.addNew_", {
1174
- what: (_t = t("neetoApprovals.common.template", SINGULAR)) === null || _t === void 0 ? void 0 : _t.toLocaleLowerCase()
1175
- }),
1176
- onClick: function onClick() {
1177
- return setIsPaneOpen(true);
1178
- }
1179
- },
1180
- helpText: renderNoDataHelpText({
1181
- entity: entity,
1182
- url: helpDocUrl
1183
- })
1184
- };
1185
- if (isEmpty(rowData)) {
1186
- return /*#__PURE__*/jsx("div", {
1187
- className: "flex h-full w-full flex-grow items-center justify-center",
1188
- children: /*#__PURE__*/jsx(NoData, _objectSpread$6({
1189
- title: t("neetoApprovals.common.notFound_", {
1190
- what: entity
1191
- })
1192
- }, !filters.searchTerm && noDataProps))
1193
- });
1194
- }
1195
- return /*#__PURE__*/jsx(TableWrapper, {
1196
- className: "mt-6",
1197
- hasPagination: totalCount > pageProperties.pageSize,
1198
- children: /*#__PURE__*/jsx(Table$1, _objectSpread$6({
1199
- fixedHeight: true,
1200
- columnData: columns,
1201
- currentPageNumber: pageProperties.page,
1202
- defaultPageSize: pageProperties.pageSize,
1203
- scroll: {
1204
- x: 0
1205
- },
1206
- tableLayout: "fixed",
1207
- paginationProps: {
1208
- hideOnSinglePage: (rowData === null || rowData === void 0 ? void 0 : rowData.length) < DEFAULT_PAGE_SIZE + 1
1209
- },
1210
- onChange: handleTableChange
1211
- }, _objectSpread$6({
1212
- rowData: rowData,
1213
- totalCount: totalCount
1214
- }, otherProps)))
1215
- });
1216
- };
1217
-
1218
- var columnData = function columnData(_ref) {
1219
- var onEditClick = _ref.onEditClick,
1220
- onDeleteClick = _ref.onDeleteClick;
1221
- return [{
1222
- dataIndex: "name",
1223
- key: "name",
1224
- sorter: true,
1225
- title: i18next.t("neetoApprovals.common.name"),
1226
- ellipsis: true,
1227
- render: function render(_, template) {
1228
- return /*#__PURE__*/jsxs("div", {
1229
- className: "flex items-center justify-between gap-x-3",
1230
- children: [/*#__PURE__*/jsx(Typography, {
1231
- className: "truncate",
1232
- style: "body2",
1233
- children: template.name
1234
- }), /*#__PURE__*/jsx(MoreDropdown, {
1235
- dropdownProps: {
1236
- strategy: "fixed",
1237
- onClick: function onClick(e) {
1238
- return e.stopPropagation();
1239
- }
1240
- },
1241
- menuItems: [_defineProperty({
1242
- key: "edit",
1243
- label: i18next.t("neetoApprovals.common.edit"),
1244
- onClick: function onClick(event) {
1245
- return onEditClick(event, template);
1246
- }
1247
- }, DATA_CY_KEY, "neeto-approvals-templates-edit-template-btn"), _defineProperty({
1248
- key: "delete",
1249
- label: i18next.t("neetoApprovals.common.delete"),
1250
- onClick: function onClick(event) {
1251
- return onDeleteClick(event, template);
1252
- }
1253
- }, DATA_CY_KEY, "neeto-approvals-templates-delete-template-btn")]
1254
- })]
1255
- });
1256
- }
1257
- }, {
1258
- dataIndex: "description",
1259
- key: "description",
1260
- title: i18next.t("neetoApprovals.inputs.labels.description")
1261
- }];
1262
- };
1263
-
1264
- var _excluded = ["searchTerm", "isNewTemplatePaneOpen", "setIsNewTemplatePaneOpen", "helpDocUrl"];
1265
- function ownKeys$5(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; }
1266
- function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1267
- var Templates = function Templates(_ref) {
1268
- var searchTerm = _ref.searchTerm,
1269
- isNewTemplatePaneOpen = _ref.isNewTemplatePaneOpen,
1270
- setIsNewTemplatePaneOpen = _ref.setIsNewTemplatePaneOpen,
1271
- helpDocUrl = _ref.helpDocUrl,
1272
- otherProps = _objectWithoutProperties(_ref, _excluded);
1273
- var _useState = useState(DEFAULT_FILTER_VALUES),
1274
- _useState2 = _slicedToArray(_useState, 2),
1275
- filters = _useState2[0],
1276
- setFilters = _useState2[1];
1277
- var _useState3 = useState({}),
1278
- _useState4 = _slicedToArray(_useState3, 2),
1279
- selectedTemplate = _useState4[0],
1280
- setSelectedTemplate = _useState4[1];
1281
- var _useState5 = useState(false),
1282
- _useState6 = _slicedToArray(_useState5, 2),
1283
- isDeleteAlertOpen = _useState6[0],
1284
- setIsDeleteAlertOpen = _useState6[1];
1285
- var _useState7 = useState(false),
1286
- _useState8 = _slicedToArray(_useState7, 2),
1287
- isEditPaneOpen = _useState8[0],
1288
- setIsEditPaneOpen = _useState8[1];
1289
- var _useState9 = useState(false),
1290
- _useState10 = _slicedToArray(_useState9, 2),
1291
- isShowPaneOpen = _useState10[0],
1292
- setIsShowPaneOpen = _useState10[1];
1293
- var _usePaginate = usePaginate(),
1294
- pageProperties = _usePaginate.pageProperties,
1295
- handlePageChange = _usePaginate.handlePageChange,
1296
- resetPageProperties = _usePaginate.resetPageProperties;
1297
- var _useTranslation = useTranslation(),
1298
- t = _useTranslation.t;
1299
- var debouncedSearchTerm = useDebounce(searchTerm, SEARCH_DELAY);
1300
- useEffect(function () {
1301
- resetPageProperties();
1302
- }, [searchTerm]);
1303
- var _useFetchTemplates = useFetchTemplates(_objectSpread$5(_objectSpread$5(_objectSpread$5({}, pageProperties), filters), {}, {
1304
- searchTerm: debouncedSearchTerm.trim()
1305
- })),
1306
- data = _useFetchTemplates.data,
1307
- isTemplateLoading = _useFetchTemplates.isLoading;
1308
- var _ref2 = data || {},
1309
- _ref2$templates = _ref2.templates,
1310
- templates = _ref2$templates === void 0 ? [] : _ref2$templates,
1311
- _ref2$totalCount = _ref2.totalCount,
1312
- totalCount = _ref2$totalCount === void 0 ? 0 : _ref2$totalCount;
1313
- useEffect(function () {
1314
- if (data) {
1315
- handleEmptyPage(data === null || data === void 0 ? void 0 : data.templates, pageProperties, handlePageChange);
1316
- }
1317
- }, [data]);
1318
- var _useDeleteTemplate = useDeleteTemplate(),
1319
- deleteTemplate = _useDeleteTemplate.mutate,
1320
- isDeleting = _useDeleteTemplate.isPending;
1321
- useEffect(function () {
1322
- if (!isEmpty(selectedTemplate)) return;
1323
- setIsDeleteAlertOpen(false);
1324
- setIsEditPaneOpen(false);
1325
- setIsShowPaneOpen(false);
1326
- }, [selectedTemplate]);
1327
- var onEditClick = function onEditClick(event, template) {
1328
- event.stopPropagation();
1329
- setSelectedTemplate(template);
1330
- setIsEditPaneOpen(true);
1331
- };
1332
- var onRowClick = function onRowClick(_, templateDetails) {
1333
- setSelectedTemplate(templateDetails);
1334
- setIsShowPaneOpen(true);
1335
- };
1336
- var onDeleteClick = function onDeleteClick(event, template) {
1337
- event.stopPropagation();
1338
- setSelectedTemplate(template);
1339
- setIsDeleteAlertOpen(true);
1340
- };
1341
- var handleDelete = function handleDelete(templateId) {
1342
- deleteTemplate({
1343
- templateId: templateId
1344
- });
1345
- setSelectedTemplate({});
1346
- };
1347
- var entity = t("neetoApprovals.common.template", PLURAL);
1348
- return /*#__PURE__*/jsxs(Fragment, {
1349
- children: [isTemplateLoading ? /*#__PURE__*/jsx(PageLoader, {}) : /*#__PURE__*/jsx(Table, {
1350
- columnData: columnData,
1351
- entity: entity,
1352
- filters: filters,
1353
- handlePageChange: handlePageChange,
1354
- helpDocUrl: helpDocUrl,
1355
- onDeleteClick: onDeleteClick,
1356
- onEditClick: onEditClick,
1357
- onRowClick: onRowClick,
1358
- pageProperties: pageProperties,
1359
- searchTerm: searchTerm,
1360
- setFilters: setFilters,
1361
- totalCount: totalCount,
1362
- rowData: templates,
1363
- setIsPaneOpen: setIsNewTemplatePaneOpen
1364
- }), /*#__PURE__*/jsx(Create, _objectSpread$5({
1365
- isOpen: isNewTemplatePaneOpen,
1366
- onClose: function onClose() {
1367
- return setIsNewTemplatePaneOpen(false);
1368
- }
1369
- }, otherProps)), /*#__PURE__*/jsx(Edit, _objectSpread$5(_objectSpread$5({
1370
- isOpen: isEditPaneOpen,
1371
- setTemplate: setSelectedTemplate,
1372
- template: selectedTemplate
1373
- }, otherProps), {}, {
1374
- onClose: function onClose() {
1375
- return setIsEditPaneOpen(false);
1376
- }
1377
- })), /*#__PURE__*/jsx(Alert, {
1378
- isOpen: isDeleteAlertOpen,
1379
- isSubmitting: isDeleting,
1380
- submitButtonLabel: t("neetoApprovals.buttons.delete"),
1381
- message: /*#__PURE__*/jsx(Trans, {
1382
- i18nKey: "neetoApprovals.alerts.deleting_",
1383
- values: {
1384
- what: t("neetoApprovals.common.template", SINGULAR),
1385
- name: selectedTemplate === null || selectedTemplate === void 0 ? void 0 : selectedTemplate.name
1386
- }
1387
- }),
1388
- title: t("neetoApprovals.common.delete_", {
1389
- what: t("neetoApprovals.common.template", SINGULAR)
1390
- }),
1391
- onClose: function onClose() {
1392
- return setSelectedTemplate({});
1393
- },
1394
- onSubmit: function onSubmit() {
1395
- return handleDelete(selectedTemplate === null || selectedTemplate === void 0 ? void 0 : selectedTemplate.id);
1396
- }
1397
- }), /*#__PURE__*/jsx(TemplateDetails, {
1398
- isOpen: isShowPaneOpen,
1399
- template: selectedTemplate,
1400
- onClose: function onClose() {
1401
- return setSelectedTemplate({});
1402
- }
1403
- })]
1404
- });
1405
- };
1406
-
1407
- 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; }
1408
- 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), !0).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; }
1409
- var createRoutes = function createRoutes(_ref) {
1410
- var config = _ref.config,
1411
- isNewTemplatePaneOpen = _ref.isNewTemplatePaneOpen,
1412
- searchTerm = _ref.searchTerm,
1413
- setIsNewTemplatePaneOpen = _ref.setIsNewTemplatePaneOpen;
1414
- return [{
1415
- component: function component() {
1416
- return /*#__PURE__*/jsx(Templates, _objectSpread$4({}, _objectSpread$4({
1417
- isNewTemplatePaneOpen: isNewTemplatePaneOpen,
1418
- searchTerm: searchTerm,
1419
- setIsNewTemplatePaneOpen: setIsNewTemplatePaneOpen
1420
- }, config)));
1421
- },
1422
- path: "".concat(config.approvalsPath).concat(routes.templates.index),
1423
- actionBlock: function actionBlock() {
1424
- var _t;
1425
- return /*#__PURE__*/jsx(Button, {
1426
- "data-cy": "neeto-approvals-templates-add-new-button",
1427
- label: t$1("neetoApprovals.common.addNew_", {
1428
- what: (_t = t$1("neetoApprovals.common.template", SINGULAR)) === null || _t === void 0 ? void 0 : _t.toLocaleLowerCase()
1429
- }),
1430
- onClick: function onClick() {
1431
- return setIsNewTemplatePaneOpen(true);
1432
- }
1433
- });
1434
- },
1435
- searchPlaceholder: t$1("neetoApprovals.inputs.placeholders.search_", {
1436
- what: t$1("neetoApprovals.common.template", PLURAL).toLocaleLowerCase()
1437
- })
1438
- }, {
1439
- component: function component() {
1440
- return /*#__PURE__*/jsx(PendingRequests, _objectSpread$4({}, config));
1441
- },
1442
- path: "".concat(config.approvalsPath).concat(routes.pending)
1443
- }, {
1444
- component: function component() {
1445
- return /*#__PURE__*/jsx(History, _objectSpread$4({}, config));
1446
- },
1447
- path: "".concat(config.approvalsPath).concat(routes.history)
1448
- }];
1449
- };
1450
-
1451
- var Header = function Header(_ref) {
1452
- var _currentTab$actionBlo;
1453
- var appRoutes = _ref.appRoutes,
1454
- breadcrumbs = _ref.breadcrumbs;
1455
- var _useTranslation = useTranslation(),
1456
- t = _useTranslation.t;
1457
- var _useLocation = useLocation(),
1458
- pathname = _useLocation.pathname;
1459
- var currentTab = findBy({
1460
- path: pathname
1461
- }, appRoutes);
1462
- return /*#__PURE__*/jsx(NeetoHeader, {
1463
- actionBlock: currentTab === null || currentTab === void 0 || (_currentTab$actionBlo = currentTab.actionBlock) === null || _currentTab$actionBlo === void 0 ? void 0 : _currentTab$actionBlo.call(currentTab),
1464
- title: t("neetoApprovals.common.approval", PLURAL),
1465
- searchProps: (currentTab === null || currentTab === void 0 ? void 0 : currentTab.searchPlaceholder) && {
1466
- placeholder: currentTab === null || currentTab === void 0 ? void 0 : currentTab.searchPlaceholder
1467
- },
1468
- breadcrumbs: breadcrumbs
1469
- });
1470
- };
1471
-
1472
- var fetch$1 = function fetch() {
1473
- return axios.get("".concat(BASE_URL, "/views"));
1474
- };
1475
- var viewsApi = {
1476
- fetch: fetch$1
1477
- };
1478
-
1479
- 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; }
1480
- 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), !0).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; }
1481
- var useFetchViews = function useFetchViews() {
1482
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1483
- return useQuery(_objectSpread$3({
1484
- queryKey: [QUERY_KEYS.VIEWS],
1485
- queryFn: viewsApi.fetch,
1486
- select: function select(response) {
1487
- return response.data || response;
1488
- }
1489
- }, options));
1490
- };
1491
-
1492
- var Tab = function Tab(_ref) {
1493
- var _pathname$split$;
1494
- var approvalsPath = _ref.approvalsPath;
1495
- var _useLocation = useLocation(),
1496
- pathname = _useLocation.pathname;
1497
- var history = useHistory();
1498
- var approvalFilter = getApprovalFilter();
1499
- var approvalFilterKeys = keys(approvalFilter);
1500
- var category = (_pathname$split$ = pathname.split(routes.approvals)[1]) === null || _pathname$split$ === void 0 ? void 0 : _pathname$split$.toLocaleUpperCase();
1501
- var isActive = function isActive(filter) {
1502
- return category.includes(filter);
1503
- };
1504
- var getRoute = function getRoute(filter) {
1505
- return "".concat(approvalsPath).concat(filter.toLowerCase());
1506
- };
1507
- var _useFetchViews = useFetchViews(),
1508
- _useFetchViews$data = _useFetchViews.data,
1509
- _useFetchViews$data2 = _useFetchViews$data === void 0 ? {} : _useFetchViews$data,
1510
- _useFetchViews$data2$ = _useFetchViews$data2.views,
1511
- views = _useFetchViews$data2$ === void 0 ? {} : _useFetchViews$data2$;
1512
- return /*#__PURE__*/jsx(NeetoUITab, {
1513
- children: approvalFilterKeys.map(function (filter) {
1514
- return /*#__PURE__*/jsxs(NeetoUITab.Item, {
1515
- active: isActive(filter),
1516
- count: views[filter === null || filter === void 0 ? void 0 : filter.toLocaleLowerCase()],
1517
- label: approvalFilter[filter].label,
1518
- onClick: function onClick() {
1519
- return history.push(getRoute(filter));
1520
- },
1521
- children: [approvalFilter[filter].label, " (", views[filter === null || filter === void 0 ? void 0 : filter.toLocaleLowerCase()] || 0, ")"]
1522
- }, filter);
1523
- })
1524
- });
1525
- };
1526
-
1527
- 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; }
1528
- 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), !0).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; }
1529
- var Approvals = function Approvals(_ref) {
1530
- var config = _ref.config;
1531
- var _useQueryParams = useQueryParams(),
1532
- _useQueryParams$searc = _useQueryParams.searchTerm,
1533
- searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
1534
- var _useState = useState(false),
1535
- _useState2 = _slicedToArray(_useState, 2),
1536
- isNewTemplatePaneOpen = _useState2[0],
1537
- setIsNewTemplatePaneOpen = _useState2[1];
1538
- var appRoutes = createRoutes({
1539
- config: config,
1540
- searchTerm: searchTerm,
1541
- isNewTemplatePaneOpen: isNewTemplatePaneOpen,
1542
- setIsNewTemplatePaneOpen: setIsNewTemplatePaneOpen
1543
- });
1544
- return /*#__PURE__*/jsx("div", {
1545
- className: "w-full overflow-y-auto",
1546
- children: /*#__PURE__*/jsxs(Container, {
1547
- children: [/*#__PURE__*/jsx(Header, _objectSpread$2({}, _objectSpread$2({
1548
- appRoutes: appRoutes
1549
- }, config))), /*#__PURE__*/jsx(Tab, {
1550
- approvalsPath: config.approvalsPath
1551
- }), /*#__PURE__*/jsxs(Switch, {
1552
- children: [appRoutes.map(function (_ref2) {
1553
- var path = _ref2.path,
1554
- component = _ref2.component;
1555
- return /*#__PURE__*/createElement(Route, {
1556
- exact: true,
1557
- component: component,
1558
- path: path,
1559
- key: path
1560
- });
1561
- }), /*#__PURE__*/jsx(Redirect, {
1562
- exact: true,
1563
- from: config.approvalsPath
1564
- // eslint-disable-next-line @bigbinary/neeto/use-common-routes
1565
- ,
1566
- to: "".concat(config.approvalsPath).concat(routes.pending)
1567
- })]
1568
- })]
1569
- })
1570
- });
1571
- };
1572
-
1573
- var fetch = function fetch(params) {
1574
- return axios.get("".concat(BASE_URL, "/approvers"), {
1575
- params: params
1576
- });
1577
- };
1578
- var approversApi = {
1579
- fetch: fetch
1580
- };
1581
-
1582
- 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; }
1583
- 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), !0).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; }
1584
- var useFetchApprovers = function useFetchApprovers() {
1585
- var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1586
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1587
- return useQuery(_objectSpread$1({
1588
- queryKey: [QUERY_KEYS.APPROVERS, params],
1589
- queryFn: function queryFn() {
1590
- return approversApi.fetch(params);
1591
- },
1592
- select: function select(response) {
1593
- return response.data || response;
1594
- }
1595
- }, options));
1596
- };
1597
-
1598
- var Form$1 = function Form(_ref) {
1599
- var _globalProps$user;
1600
- var _ref$requestableId = _ref.requestableId,
1601
- requestableId = _ref$requestableId === void 0 ? "" : _ref$requestableId,
1602
- selectedTemplateData = _ref.selectedTemplateData,
1603
- setSelectedTemplateData = _ref.setSelectedTemplateData;
1604
- var _useTranslation = useTranslation(),
1605
- t = _useTranslation.t;
1606
- var _useFormikContext = useFormikContext(),
1607
- setFieldValue = _useFormikContext.setFieldValue;
1608
- var inputRef = useRef(null);
1609
- var _useState = useState(null),
1610
- _useState2 = _slicedToArray(_useState, 2),
1611
- approverId = _useState2[0],
1612
- setApproverId = _useState2[1];
1613
- var _useState3 = useState(null),
1614
- _useState4 = _slicedToArray(_useState3, 2),
1615
- templateId = _useState4[0],
1616
- setTemplateId = _useState4[1];
1617
- var params = {
1618
- requestableId: requestableId,
1619
- approverId: approverId,
1620
- approvalRequestorId: (_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.id
1621
- };
1622
- var _useFetchTemplates = useFetchTemplates(),
1623
- _useFetchTemplates$da = _useFetchTemplates.data,
1624
- _useFetchTemplates$da2 = _useFetchTemplates$da === void 0 ? {} : _useFetchTemplates$da,
1625
- _useFetchTemplates$da3 = _useFetchTemplates$da2.templates,
1626
- templates = _useFetchTemplates$da3 === void 0 ? [] : _useFetchTemplates$da3;
1627
- var _useFetchTemplate = useFetchTemplate({
1628
- id: templateId,
1629
- params: params
1630
- }),
1631
- _useFetchTemplate$dat = _useFetchTemplate.data,
1632
- _useFetchTemplate$dat2 = _useFetchTemplate$dat === void 0 ? {} : _useFetchTemplate$dat,
1633
- _useFetchTemplate$dat3 = _useFetchTemplate$dat2.template,
1634
- template = _useFetchTemplate$dat3 === void 0 ? {} : _useFetchTemplate$dat3;
1635
- var _useFetchApprovers = useFetchApprovers(),
1636
- _useFetchApprovers$da = _useFetchApprovers.data,
1637
- _useFetchApprovers$da2 = _useFetchApprovers$da === void 0 ? {} : _useFetchApprovers$da,
1638
- _useFetchApprovers$da3 = _useFetchApprovers$da2.approvers,
1639
- approvers = _useFetchApprovers$da3 === void 0 ? [] : _useFetchApprovers$da3;
1640
- var approverOptions = useMemo(function () {
1641
- return approvers.map(function (approver) {
1642
- return {
1643
- label: approver.name,
1644
- value: approver.id
1645
- };
1646
- });
1647
- }, [approvers]);
1648
- var templateOptions = templates.map(function (template) {
1649
- return {
1650
- label: template.name,
1651
- value: template.id
1652
- };
1653
- });
1654
- var updateMessage = function updateMessage() {
1655
- var _inputRef$current;
1656
- var message = template.parsedMessage || template.message;
1657
- setFieldValue("message", message);
1658
- inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || (_inputRef$current = _inputRef$current.editor) === null || _inputRef$current === void 0 || (_inputRef$current = _inputRef$current.commands) === null || _inputRef$current === void 0 || _inputRef$current.setContent(message);
1659
- };
1660
- var handleTemplateChange = function handleTemplateChange(selectedTemplate) {
1661
- setTemplateId(selectedTemplate.value);
1662
- };
1663
- var handleApproverChange = function handleApproverChange(approver) {
1664
- setApproverId(approver.value);
1665
- setFieldValue("approver", approver);
1666
- };
1667
- useEffect(function () {
1668
- if (isEmpty(template)) return;
1669
- setSelectedTemplateData(template);
1670
- updateMessage();
1671
- }, [template]);
1672
- return /*#__PURE__*/jsxs("div", {
1673
- className: "w-full space-y-6",
1674
- children: [/*#__PURE__*/jsx(Select, {
1675
- label: t("neetoApprovals.select.approval"),
1676
- options: templateOptions,
1677
- onChange: function onChange(selectedTemplate) {
1678
- return handleTemplateChange(selectedTemplate);
1679
- }
1680
- }), (selectedTemplateData === null || selectedTemplateData === void 0 ? void 0 : selectedTemplateData.message) && /*#__PURE__*/jsxs(Fragment, {
1681
- children: [/*#__PURE__*/jsx("div", {
1682
- className: "flex space-x-6",
1683
- children: /*#__PURE__*/jsx(Select, {
1684
- required: true,
1685
- label: t("neetoApprovals.inputs.labels.approver"),
1686
- name: "approver",
1687
- options: approverOptions,
1688
- placeholder: t("neetoApprovals.inputs.placeholders.select_", {
1689
- what: t("neetoApprovals.common.approver", SINGULAR)
1690
- }),
1691
- onChange: handleApproverChange
1692
- })
1693
- }), /*#__PURE__*/jsx("div", {
1694
- className: "space-y-2",
1695
- children: /*#__PURE__*/jsx(FormikEditor, {
1696
- required: true,
1697
- label: t("neetoApprovals.inputs.labels.message"),
1698
- name: "message",
1699
- ref: inputRef,
1700
- rows: 3,
1701
- placeholder: t("neetoApprovals.inputs.placeholders.enter_", {
1702
- what: t("neetoApprovals.inputs.labels.message")
1703
- })
1704
- })
1705
- })]
1706
- })]
1707
- });
1708
- };
1709
-
1710
- var Form = function Form(_ref) {
1711
- var isOpen = _ref.isOpen,
1712
- setIsPaneOpen = _ref.setIsPaneOpen,
1713
- onSubmit = _ref.onSubmit,
1714
- isLoading = _ref.isLoading,
1715
- _ref$requestableId = _ref.requestableId,
1716
- requestableId = _ref$requestableId === void 0 ? "" : _ref$requestableId;
1717
- var _useState = useState({}),
1718
- _useState2 = _slicedToArray(_useState, 2),
1719
- selectedTemplateData = _useState2[0],
1720
- setSelectedTemplateData = _useState2[1];
1721
- var _useTranslation = useTranslation(),
1722
- t = _useTranslation.t;
1723
- var onClose = function onClose() {
1724
- setIsPaneOpen(false);
1725
- setSelectedTemplateData({});
1726
- };
1727
- var handleSubmit = function handleSubmit(values) {
1728
- onSubmit({
1729
- message: values.message,
1730
- approverId: values.approver.value
1731
- }, selectedTemplateData, onClose);
1732
- };
1733
- return /*#__PURE__*/jsxs(Pane, {
1734
- isOpen: isOpen,
1735
- onClose: onClose,
1736
- children: [/*#__PURE__*/jsx(Pane.Header, {
1737
- children: /*#__PURE__*/jsx(Typography, {
1738
- style: "h2",
1739
- children: t("neetoApprovals.common.add_", {
1740
- what: t("neetoApprovals.common.approval", SINGULAR)
1741
- })
1742
- })
1743
- }), /*#__PURE__*/jsxs(FormikForm, {
1744
- formikProps: {
1745
- onSubmit: handleSubmit,
1746
- initialValues: APPROVAL_REQUEST_FORM_INITIAL_VALUES,
1747
- validationSchema: REQUEST_FORM_VALIDATION_SCHEMA
1748
- },
1749
- children: [/*#__PURE__*/jsx(Pane.Body, {
1750
- children: /*#__PURE__*/jsx(Form$1, {
1751
- requestableId: requestableId,
1752
- selectedTemplateData: selectedTemplateData,
1753
- setSelectedTemplateData: setSelectedTemplateData
1754
- })
1755
- }), /*#__PURE__*/jsx(Pane.Footer, {
1756
- children: /*#__PURE__*/jsx(ActionBlock, {
1757
- cancelButtonProps: {
1758
- onClick: onClose
1759
- },
1760
- isSubmitting: isLoading
1761
- })
1762
- })]
1763
- })]
1764
- });
1765
- };
1766
-
1767
- var show = function show(id) {
1768
- return axios.get("".concat(BASE_URL, "/public/requests/").concat(id));
1769
- };
1770
- var accept = function accept(_ref) {
1771
- var id = _ref.id,
1772
- note = _ref.note;
1773
- return axios.patch("".concat(BASE_URL, "/public/requests/").concat(id, "/accept"), {
1774
- note: note
1775
- });
1776
- };
1777
- var decline = function decline(_ref2) {
1778
- var id = _ref2.id,
1779
- note = _ref2.note;
1780
- return axios.patch("".concat(BASE_URL, "/public/requests/").concat(id, "/decline"), {
1781
- note: note
1782
- });
1783
- };
1784
- var publicRequestsApi = {
1785
- show: show,
1786
- accept: accept,
1787
- decline: decline
1788
- };
1789
-
1790
- 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; }
1791
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).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; }
1792
- var useFetchPublicRequest = function useFetchPublicRequest(_ref, options) {
1793
- var requestId = _ref.requestId;
1794
- return useQuery(_objectSpread({
1795
- queryKey: [QUERY_KEYS.SHOW_PUBLIC_REQUEST, requestId],
1796
- queryFn: function queryFn() {
1797
- return publicRequestsApi.show(requestId);
1798
- }
1799
- }, options));
1800
- };
1801
- var useAcceptPendingRequest = function useAcceptPendingRequest(options) {
1802
- return useMutationWithInvalidation(publicRequestsApi.accept, _objectSpread({
1803
- keysToInvalidate: [[QUERY_KEYS.SHOW_PUBLIC_REQUEST], [QUERY_KEYS.REQUESTS], [QUERY_KEYS.VIEWS]]
1804
- }, options));
1805
- };
1806
- var useDeclinePendingRequest = function useDeclinePendingRequest(options) {
1807
- return useMutationWithInvalidation(publicRequestsApi.decline, _objectSpread({
1808
- keysToInvalidate: [[QUERY_KEYS.SHOW_PUBLIC_REQUEST], [QUERY_KEYS.REQUESTS], [QUERY_KEYS.VIEWS]]
1809
- }, options));
1810
- };
1811
-
1812
- var Public = function Public() {
1813
- var _t;
1814
- var _useState = useState(""),
1815
- _useState2 = _slicedToArray(_useState, 2),
1816
- note = _useState2[0],
1817
- setNote = _useState2[1];
1818
- var _useParams = useParams(),
1819
- id = _useParams.id;
1820
- var _useTranslation = useTranslation(),
1821
- t = _useTranslation.t;
1822
- var _useFetchPublicReques = useFetchPublicRequest({
1823
- requestId: id
1824
- }),
1825
- data = _useFetchPublicReques.data,
1826
- isLoading = _useFetchPublicReques.isLoading;
1827
- var _ref = data || {},
1828
- _ref$approvalRequest = _ref.approvalRequest,
1829
- approvalRequest = _ref$approvalRequest === void 0 ? {} : _ref$approvalRequest;
1830
- useEffect(function () {
1831
- var _data$approvalRequest;
1832
- if (data !== null && data !== void 0 && (_data$approvalRequest = data.approvalRequest) !== null && _data$approvalRequest !== void 0 && _data$approvalRequest.note) {
1833
- setNote(data.approvalRequest.note);
1834
- }
1835
- }, [data]);
1836
- var _useAcceptPendingRequ = useAcceptPendingRequest(),
1837
- acceptPendingRequest = _useAcceptPendingRequ.mutate,
1838
- isAccepting = _useAcceptPendingRequ.isPending;
1839
- var _useDeclinePendingReq = useDeclinePendingRequest(),
1840
- declinePendingRequest = _useDeclinePendingReq.mutate,
1841
- isDeclining = _useDeclinePendingReq.isPending;
1842
- var calloutStyle = approvalRequest.status === STATUSES.approved ? "success" : "danger";
1843
- var hideTextArea = approvalRequest.status !== STATUSES.pending && isEmpty(note);
1844
- if (isLoading) {
1845
- return /*#__PURE__*/jsx("div", {
1846
- className: "h-screen items-center justify-center",
1847
- children: /*#__PURE__*/jsx(PageLoader, {})
1848
- });
1849
- }
1850
- return /*#__PURE__*/jsxs(Container, {
1851
- children: [/*#__PURE__*/jsx(NeetoHeader, {
1852
- title: t("neetoApprovals.common.approval", PLURAL)
1853
- }), /*#__PURE__*/jsx("div", {
1854
- className: "flex h-screen w-full flex-col items-center",
1855
- children: /*#__PURE__*/jsx("div", {
1856
- className: "neeto-ui-shadow-s w-2/5 rounded border p-6",
1857
- children: approvalRequest ? /*#__PURE__*/jsxs("div", {
1858
- className: "flex w-full flex-col space-y-6",
1859
- children: [/*#__PURE__*/jsx(Typography, {
1860
- style: "h2",
1861
- children: approvalRequest.title
1862
- }), /*#__PURE__*/jsx(EditorContent, {
1863
- content: approvalRequest.message
1864
- }), !hideTextArea && /*#__PURE__*/jsx(Textarea, {
1865
- label: t("neetoApprovals.common.note"),
1866
- placeholder: t("neetoApprovals.inputs.placeholders.add_", {
1867
- what: (_t = t("neetoApprovals.common.note")) === null || _t === void 0 ? void 0 : _t.toLocaleLowerCase()
1868
- }),
1869
- value: note,
1870
- disabled: approvalRequest.status !== STATUSES.pending,
1871
- onChange: withEventTargetValue(setNote)
1872
- }), approvalRequest.status === STATUSES.pending ? /*#__PURE__*/jsxs("div", {
1873
- className: "mx-auto mt-8 flex space-x-6",
1874
- children: [/*#__PURE__*/jsx(Button, {
1875
- label: t("neetoApprovals.buttons.approve"),
1876
- onClick: function onClick() {
1877
- return acceptPendingRequest({
1878
- id: approvalRequest.id,
1879
- note: note
1880
- });
1881
- },
1882
- loading: isAccepting
1883
- }), /*#__PURE__*/jsx(Button, {
1884
- label: t("neetoApprovals.buttons.decline"),
1885
- onClick: function onClick() {
1886
- return declinePendingRequest({
1887
- id: approvalRequest.id,
1888
- note: note
1889
- });
1890
- },
1891
- style: "secondary",
1892
- loading: isDeclining
1893
- })]
1894
- }) : /*#__PURE__*/jsx(Callout, {
1895
- style: calloutStyle,
1896
- children: /*#__PURE__*/jsx(Typography, {
1897
- style: "body1",
1898
- children: /*#__PURE__*/jsx(Trans, {
1899
- i18nKey: "neetoApprovals.typography.approvalRequest",
1900
- values: {
1901
- status: approvalRequest.status
1902
- }
1903
- })
1904
- })
1905
- })]
1906
- }) : /*#__PURE__*/jsx(Typography, {
1907
- style: "h4",
1908
- className: "text-center",
1909
- children: t("neetoApprovals.common.notFound")
1910
- })
1911
- })
1912
- })]
1913
- });
1914
- };
1915
-
1916
- var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
1917
-
1918
- var css = ".neeto-approvals-dropdown__button{border-radius:0!important;font-weight:var(--neeto-ui-font-normal);min-height:34px;min-width:150px;text-align:left;width:100%}.neeto-approvals-scrollbar__inner{height:200px;width:100%}.neeto-approvals-scrollbar__outer{height:150px;left:0;overflow:\"hidden\";position:\"absolute\";top:0;visibility:\"hidden\";width:200px}.neeto-ui-subheader .neeto-ui-subheader__left-wrapper .neeto-ui-subheader__left{max-width:none}td.ant-table-column-sort{background:transparent}.neeto-approvals-empty-state{align-items:center;display:flex;height:100%;justify-content:center;width:100%}.neeto-approvals-empty-state__image{align-items:center;display:flex;justify-content:center;margin-bottom:2rem}.neeto-approvals-empty-state__title--with-action-block{margin-bottom:1rem}.neeto-approvals-empty-state__action-block{display:flex;justify-content:center}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9iYXNlL19iYXNlLnNjc3MiLCJhcHAvamF2YXNjcmlwdC9zcmMvc3R5bGVzaGVldHMvYXBwbGljYXRpb24uc2NzcyIsImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9iYXNlL19vdmVycmlkZXMuc2NzcyIsImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9jb21wb25lbnRzL19lbXB0eS1zdGF0ZS5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGtDQUNFLHlCQUFBLENBQ0EsdUNBQUEsQ0FDQSxlQUFBLENBQ0EsZUFBQSxDQUNBLGVBQUEsQ0FDQSxVQ0NGLENER0Usa0NBRUUsWUFBQSxDQURBLFVDQ0osQ0RHRSxrQ0FLRSxZQUFBLENBRkEsTUFBQSxDQUdBLGlCQUFBLENBTEEsbUJBQUEsQ0FDQSxLQUFBLENBS0EsbUJBQUEsQ0FIQSxXQ0VKLENDbkJJLGdGQUNFLGNEc0JOLENDaEJBLHlCQUNFLHNCRG1CRixDRTdCQSw2QkFDRSxrQkFBQSxDQUNBLFlBQUEsQ0FDQSxXQUFBLENBQ0Esc0JBQUEsQ0FDQSxVRmdDRixDRTlCRSxvQ0FHRSxrQkFBQSxDQUZBLFlBQUEsQ0FDQSxzQkFBQSxDQUVBLGtCRmdDSixDRTVCSSx1REFDRSxrQkY4Qk4sQ0UxQkUsMkNBQ0UsWUFBQSxDQUNBLHNCRjRCSiIsInNvdXJjZXNDb250ZW50IjpbIi5uZWV0by1hcHByb3ZhbHMtZHJvcGRvd25fX2J1dHRvbiB7XG4gIGJvcmRlci1yYWRpdXM6IDAgIWltcG9ydGFudDtcbiAgZm9udC13ZWlnaHQ6IHZhcigtLW5lZXRvLXVpLWZvbnQtbm9ybWFsKTtcbiAgbWluLWhlaWdodDogMzRweDtcbiAgbWluLXdpZHRoOiAxNTBweDtcbiAgdGV4dC1hbGlnbjogbGVmdDtcbiAgd2lkdGg6IDEwMCU7XG59XG5cbi5uZWV0by1hcHByb3ZhbHMtc2Nyb2xsYmFyIHtcbiAgJl9faW5uZXIge1xuICAgIHdpZHRoOiAxMDAlO1xuICAgIGhlaWdodDogMjAwcHg7XG4gIH1cblxuICAmX19vdXRlciB7XG4gICAgcG9zaXRpb246IFwiYWJzb2x1dGVcIjtcbiAgICB0b3A6IDBweDtcbiAgICBsZWZ0OiAwcHg7XG4gICAgd2lkdGg6IDIwMHB4O1xuICAgIGhlaWdodDogMTUwcHg7XG4gICAgb3ZlcmZsb3c6IFwiaGlkZGVuXCI7XG4gICAgdmlzaWJpbGl0eTogXCJoaWRkZW5cIjtcbiAgfVxufVxuIiwiLm5lZXRvLWFwcHJvdmFscy1kcm9wZG93bl9fYnV0dG9uIHtcbiAgYm9yZGVyLXJhZGl1czogMCAhaW1wb3J0YW50O1xuICBmb250LXdlaWdodDogdmFyKC0tbmVldG8tdWktZm9udC1ub3JtYWwpO1xuICBtaW4taGVpZ2h0OiAzNHB4O1xuICBtaW4td2lkdGg6IDE1MHB4O1xuICB0ZXh0LWFsaWduOiBsZWZ0O1xuICB3aWR0aDogMTAwJTtcbn1cblxuLm5lZXRvLWFwcHJvdmFscy1zY3JvbGxiYXJfX2lubmVyIHtcbiAgd2lkdGg6IDEwMCU7XG4gIGhlaWdodDogMjAwcHg7XG59XG4ubmVldG8tYXBwcm92YWxzLXNjcm9sbGJhcl9fb3V0ZXIge1xuICBwb3NpdGlvbjogXCJhYnNvbHV0ZVwiO1xuICB0b3A6IDBweDtcbiAgbGVmdDogMHB4O1xuICB3aWR0aDogMjAwcHg7XG4gIGhlaWdodDogMTUwcHg7XG4gIG92ZXJmbG93OiBcImhpZGRlblwiO1xuICB2aXNpYmlsaXR5OiBcImhpZGRlblwiO1xufVxuXG4ubmVldG8tdWktc3ViaGVhZGVyIC5uZWV0by11aS1zdWJoZWFkZXJfX2xlZnQtd3JhcHBlciAubmVldG8tdWktc3ViaGVhZGVyX19sZWZ0IHtcbiAgbWF4LXdpZHRoOiBub25lO1xufVxuXG50ZC5hbnQtdGFibGUtY29sdW1uLXNvcnQge1xuICBiYWNrZ3JvdW5kOiB0cmFuc3BhcmVudDtcbn1cblxuLm5lZXRvLWFwcHJvdmFscy1lbXB0eS1zdGF0ZSB7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGhlaWdodDogMTAwJTtcbiAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gIHdpZHRoOiAxMDAlO1xufVxuLm5lZXRvLWFwcHJvdmFscy1lbXB0eS1zdGF0ZV9faW1hZ2Uge1xuICBkaXNwbGF5OiBmbGV4O1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgbWFyZ2luLWJvdHRvbTogMnJlbTtcbn1cbi5uZWV0by1hcHByb3ZhbHMtZW1wdHktc3RhdGVfX3RpdGxlLS13aXRoLWFjdGlvbi1ibG9jayB7XG4gIG1hcmdpbi1ib3R0b206IDFyZW07XG59XG4ubmVldG8tYXBwcm92YWxzLWVtcHR5LXN0YXRlX19hY3Rpb24tYmxvY2sge1xuICBkaXNwbGF5OiBmbGV4O1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbn0iLCIubmVldG8tdWktc3ViaGVhZGVyIHtcbiAgLm5lZXRvLXVpLXN1YmhlYWRlcl9fbGVmdC13cmFwcGVyIHtcbiAgICAubmVldG8tdWktc3ViaGVhZGVyX19sZWZ0IHtcbiAgICAgIG1heC13aWR0aDogbm9uZTtcbiAgICB9XG4gIH1cbn1cblxuLy8gQW50IERlc2lnbiBPdmVycmlkZXNcbnRkLmFudC10YWJsZS1jb2x1bW4tc29ydCB7XG4gIGJhY2tncm91bmQ6IHRyYW5zcGFyZW50O1xufVxuIiwiLm5lZXRvLWFwcHJvdmFscy1lbXB0eS1zdGF0ZSB7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGhlaWdodDogMTAwJTtcbiAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gIHdpZHRoOiAxMDAlO1xuXG4gICZfX2ltYWdlIHtcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAgbWFyZ2luLWJvdHRvbTogMnJlbTtcbiAgfVxuXG4gICZfX3RpdGxlIHtcbiAgICAmLS13aXRoLWFjdGlvbi1ibG9jayB7XG4gICAgICBtYXJnaW4tYm90dG9tOiAxcmVtO1xuICAgIH1cbiAgfVxuXG4gICZfX2FjdGlvbi1ibG9jayB7XG4gICAgZGlzcGxheTogZmxleDtcbiAgICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgfVxufVxuIl19 */";
1919
- n(css,{});
1920
-
1921
- export { Approvals, Form, Public, RequestDetailsPane };
1
+ export { default as Approvals } from './Approvals.js';
2
+ export { default as Form } from './Form.js';
3
+ export { default as Public } from './Public.js';
4
+ export { R as RequestDetailsPane } from './index-458211fe.js';
5
+ import './constants-752da2ba.js';
6
+ import 'i18next';
7
+ import '@bigbinary/neeto-editor/utils';
8
+ import 'yup';
9
+ import 'react';
10
+ import '@bigbinary/neeto-commons-frontend/react-utils';
11
+ import '@bigbinary/neeto-molecules/Container';
12
+ import 'react-router-dom';
13
+ import '@bigbinary/neeto-commons-frontend/constants';
14
+ import '@bigbinary/neetoui/Button';
15
+ import '@bigbinary/neeto-cist';
16
+ import '@bigbinary/neeto-molecules/TableWrapper';
17
+ import '@bigbinary/neetoui/Table';
18
+ import '@bigbinary/neetoui/NoData';
19
+ import 'ramda';
20
+ import 'react-i18next';
21
+ import '@bigbinary/neeto-molecules/DateFormat';
22
+ import '@bigbinary/neetoui/Tag';
23
+ import 'react/jsx-runtime';
24
+ import '@bigbinary/neeto-molecules/PageLoader';
25
+ import '@bigbinary/neetoui/Alert';
26
+ import './useTemplatesApi-dc60dcdd.js';
27
+ import '@tanstack/react-query';
28
+ import '@bigbinary/neeto-commons-frontend/utils';
29
+ import 'axios';
30
+ import '@bigbinary/neetoui/Pane';
31
+ import '@bigbinary/neetoui/Typography';
32
+ import '@bigbinary/neetoui/formik/ActionBlock';
33
+ import '@bigbinary/neetoui/formik/Form';
34
+ import 'formik';
35
+ import '@bigbinary/neeto-molecules/ToggleFeatureCard';
36
+ import '@bigbinary/neetoui/formik/Input';
37
+ import '@bigbinary/neetoui/formik/Textarea';
38
+ import '@bigbinary/neeto-editor/FormikEditor';
39
+ import '@bigbinary/neeto-editor/EditorContent';
40
+ import '@bigbinary/neetoui/Label';
41
+ import '@bigbinary/neeto-molecules/MoreDropdown';
42
+ import '@bigbinary/neeto-molecules/Header';
43
+ import '@bigbinary/neetoui/Tab';
44
+ import '@bigbinary/neeto-commons-frontend/initializers';
45
+ import '@bigbinary/neetoui/Select';
46
+ import '@bigbinary/neetoui/Callout';
47
+ import '@bigbinary/neetoui/Textarea';
48
+ import 'dayjs';
49
+ import 'dayjs/plugin/timezone';
50
+ import 'dayjs/plugin/utc';
1922
51
  //# sourceMappingURL=index.js.map