@truedat/audit 7.5.9 → 7.5.11

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 (65) hide show
  1. package/package.json +45 -71
  2. package/src/components/ContentFilters.js +3 -1
  3. package/src/components/NotificationEvent.js +2 -2
  4. package/src/components/NotificationsMenu.js +2 -10
  5. package/src/components/ShareLinkForm.js +33 -32
  6. package/src/components/ShareLinkPopup.js +1 -1
  7. package/src/components/Subscription.js +0 -1
  8. package/src/components/SubscriptionActions.js +11 -7
  9. package/src/components/SubscriptionCrumbs.js +2 -3
  10. package/src/components/SubscriptionEdit.js +0 -1
  11. package/src/components/SubscriptionForm.js +305 -310
  12. package/src/components/SubscriptionLoader.js +2 -2
  13. package/src/components/SubscriptionNew.js +0 -1
  14. package/src/components/SubscriptionRoutes.js +58 -56
  15. package/src/components/SubscriptionWatchForm.js +0 -1
  16. package/src/components/Subscriptions.js +4 -7
  17. package/src/components/SubscriptionsLoader.js +1 -1
  18. package/src/components/__tests__/NotificationEvent.spec.js +1 -4
  19. package/src/components/__tests__/NotificationsMenu.spec.js +0 -1
  20. package/src/components/__tests__/ShareLinkForm.spec.js +23 -17
  21. package/src/components/__tests__/ShareLinkPopup.spec.js +0 -1
  22. package/src/components/__tests__/Subscription.spec.js +0 -1
  23. package/src/components/__tests__/SubscriptionActions.spec.js +0 -1
  24. package/src/components/__tests__/SubscriptionCrumbs.spec.js +5 -5
  25. package/src/components/__tests__/SubscriptionEdit.spec.js +9 -8
  26. package/src/components/__tests__/SubscriptionForm.spec.js +141 -125
  27. package/src/components/__tests__/SubscriptionLoader.spec.js +0 -1
  28. package/src/components/__tests__/SubscriptionNew.spec.js +5 -5
  29. package/src/components/__tests__/SubscriptionRoutes.spec.js +44 -6
  30. package/src/components/__tests__/SubscriptionWatchForm.spec.js +37 -34
  31. package/src/components/__tests__/Subscriptions.spec.js +0 -1
  32. package/src/components/__tests__/SubscriptionsLoader.spec.js +0 -1
  33. package/src/components/__tests__/__snapshots__/NotificationEvent.spec.js.snap +6 -6
  34. package/src/components/__tests__/__snapshots__/NotificationsMenu.spec.js.snap +7 -7
  35. package/src/components/__tests__/__snapshots__/ShareLinkForm.spec.js.snap +6 -6
  36. package/src/components/__tests__/__snapshots__/Subscription.spec.js.snap +4 -5
  37. package/src/components/__tests__/__snapshots__/SubscriptionActions.spec.js.snap +0 -1
  38. package/src/components/__tests__/__snapshots__/SubscriptionCrumbs.spec.js.snap +20 -30
  39. package/src/components/__tests__/__snapshots__/SubscriptionEdit.spec.js.snap +75 -25
  40. package/src/components/__tests__/__snapshots__/SubscriptionForm.spec.js.snap +23 -23
  41. package/src/components/__tests__/__snapshots__/SubscriptionNew.spec.js.snap +64 -25
  42. package/src/components/__tests__/__snapshots__/SubscriptionRoutes.spec.js.snap +710 -23
  43. package/src/components/__tests__/__snapshots__/SubscriptionWatchForm.spec.js.snap +83 -80
  44. package/src/components/__tests__/__snapshots__/Subscriptions.spec.js.snap +28 -37
  45. package/src/index.js +1 -2
  46. package/src/reducers/__tests__/auditMessage.spec.js +3 -3
  47. package/src/reducers/__tests__/auditRedirect.spec.js +2 -2
  48. package/src/reducers/__tests__/events.spec.js +1 -1
  49. package/src/reducers/__tests__/searchSubscription.spec.js +5 -5
  50. package/src/reducers/__tests__/subscription.spec.js +1 -1
  51. package/src/reducers/__tests__/subscriptionUpdating.spec.js +6 -6
  52. package/src/reducers/__tests__/subscriptions.spec.js +1 -1
  53. package/src/reducers/auditMessage.js +1 -1
  54. package/src/reducers/events.js +1 -1
  55. package/src/sagas/__tests__/deleteSubscription.spec.js +7 -7
  56. package/src/sagas/__tests__/fetchSubscription.spec.js +2 -2
  57. package/src/sagas/__tests__/readNotification.spec.js +2 -2
  58. package/src/sagas/__tests__/updateSubscription.spec.js +8 -8
  59. package/src/sagas/createSubscription.js +3 -3
  60. package/src/sagas/deleteSubscription.js +1 -1
  61. package/src/sagas/readNotification.js +1 -1
  62. package/src/sagas/updateSubscription.js +4 -4
  63. package/src/selectors/__tests__/getRecipients.spec.js +0 -32
  64. package/src/selectors/getRecipients.js +0 -34
  65. package/src/selectors/index.js +0 -1
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@truedat/audit",
3
- "version": "7.5.9",
3
+ "version": "7.5.11",
4
4
  "description": "Truedat Web Audit Module",
5
5
  "sideEffects": false,
6
- "jsnext:main": "src/index.js",
7
6
  "module": "src/index.js",
8
7
  "files": [
9
- "src"
8
+ "src",
9
+ "index.js"
10
10
  ],
11
11
  "author": "Bluetab Solutions",
12
12
  "license": "GPL-3.0",
@@ -15,62 +15,25 @@
15
15
  },
16
16
  "scripts": {
17
17
  "clean": "rimraf yarn-error.log",
18
- "debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
19
18
  "test": "TZ=UTC jest --coverage",
20
- "test:watch": "TZ=UTC jest --watch",
21
19
  "eslint": "eslint src/**",
22
20
  "eslint:fix": "eslint --fix src/**"
23
21
  },
24
- "devDependencies": {
25
- "@babel/cli": "^7.19.3",
26
- "@babel/core": "^7.20.5",
27
- "@babel/plugin-proposal-class-properties": "^7.18.6",
28
- "@babel/plugin-proposal-object-rest-spread": "^7.20.2",
29
- "@babel/plugin-proposal-optional-chaining": "^7.18.9",
30
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
31
- "@babel/plugin-transform-modules-commonjs": "^7.19.6",
32
- "@babel/preset-env": "^7.20.2",
33
- "@babel/preset-react": "^7.18.6",
34
- "@testing-library/jest-dom": "^5.16.5",
35
- "@testing-library/react": "^12.0.0",
36
- "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "7.5.9",
38
- "babel-jest": "^28.1.0",
39
- "babel-plugin-dynamic-import-node": "^2.3.3",
40
- "babel-plugin-lodash": "^3.3.4",
41
- "babel-plugin-react-intl": "^5.1.18",
42
- "babel-plugin-transform-semantic-ui-react-imports": "^1.4.1",
43
- "enzyme": "^3.11.0",
44
- "enzyme-to-json": "^3.6.2",
45
- "identity-obj-proxy": "^3.0.0",
46
- "jest": "^29.0.0",
47
- "jest-environment-jsdom": "^29.0.0",
48
- "react": "^16.14.0",
49
- "react-dom": "^16.14.0",
50
- "redux-saga-test-plan": "^4.0.4",
51
- "rimraf": "^3.0.2",
52
- "semantic-ui-react": "^2.1.4"
53
- },
54
22
  "jest": {
23
+ "maxWorkers": "50%",
24
+ "testTimeout": 10000,
55
25
  "moduleDirectories": [
56
- "<rootDir>/src",
57
- "../../node_modules"
58
- ],
59
- "setupFilesAfterEnv": [
60
- "@truedat/test/setup"
26
+ "<rootDir>/src"
61
27
  ],
62
28
  "moduleNameMapper": {
63
- "\\.(css|less)$": "identity-obj-proxy",
29
+ "\\.(css|less|png)$": "identity-obj-proxy",
64
30
  "^@truedat/([^/]+)$": "<rootDir>/../$1/src/index",
65
31
  "^@truedat/([^/]+)/(.*)$": "<rootDir>/../$1/src/$2"
66
32
  },
67
- "snapshotSerializers": [
68
- "enzyme-to-json/serializer"
33
+ "setupFilesAfterEnv": [
34
+ "@truedat/test/setup"
69
35
  ],
70
36
  "testEnvironment": "jsdom",
71
- "testPathIgnorePatterns": [
72
- "<rootDir>/node_modules/"
73
- ],
74
37
  "transform": {
75
38
  "\\.js$": [
76
39
  "babel-jest",
@@ -78,34 +41,45 @@
78
41
  "rootMode": "upward"
79
42
  }
80
43
  ]
81
- },
82
- "transformIgnorePatterns": [
83
- "/node_modules/(?!@truedat).*"
84
- ]
44
+ }
45
+ },
46
+ "devDependencies": {
47
+ "@testing-library/dom": "^10.4.0",
48
+ "@testing-library/jest-dom": "^6.6.3",
49
+ "@testing-library/react": "^16.2.0",
50
+ "@testing-library/user-event": "^14.6.1",
51
+ "@truedat/test": "7.5.11",
52
+ "identity-obj-proxy": "^3.0.0",
53
+ "jest": "^29.7.0",
54
+ "redux-saga-test-plan": "^4.0.6"
85
55
  },
86
56
  "dependencies": {
87
- "@truedat/auth": "7.5.9",
88
- "@truedat/core": "7.5.9",
89
- "moment": "^2.29.4",
90
- "path-to-regexp": "^1.7.0",
57
+ "@apollo/client": "^3.13.5",
58
+ "axios": "^1.8.4",
59
+ "graphql": "^16.10.0",
60
+ "is-hotkey": "^0.2.0",
61
+ "is-url": "^1.2.4",
62
+ "lodash": "^4.17.21",
63
+ "moment": "^2.30.1",
64
+ "path-to-regexp": "^8.2.0",
91
65
  "prop-types": "^15.8.1",
92
- "react-color": "^2.17.3",
93
- "react-hook-form": "^7.30.0",
94
- "react-intl": "^5.20.10",
95
- "react-moment": "^1.1.2",
96
- "react-redux": "^7.2.4",
97
- "react-router-dom": "^5.2.0",
98
- "react-sortable-hoc": "^1.11.0",
99
- "redux": "^4.1.1",
100
- "redux-saga": "^1.2.1",
66
+ "query-string": "^7.1.2",
67
+ "react": "^19.0.0",
68
+ "react-csv": "^2.2.2",
69
+ "react-dom": "^19.0.0",
70
+ "react-dropzone": "^14.3.8",
71
+ "react-hook-form": "^7.54.2",
72
+ "react-intl": "^7.1.10",
73
+ "react-moment": "^1.1.3",
74
+ "react-redux": "^9.2.0",
75
+ "react-router": "^7.4.0",
76
+ "redux": "^5.0.1",
77
+ "redux-saga": "^1.3.0",
101
78
  "redux-saga-routines": "^3.2.3",
102
- "reselect": "^4.1.7",
103
- "semantic-ui-react": "^2.1.4"
104
- },
105
- "peerDependencies": {
106
- "react": ">= 16.8.6 < 17",
107
- "react-dom": ">= 16.8.6 < 17",
108
- "semantic-ui-react": ">= 2.0.3 < 2.2"
79
+ "reselect": "^5.1.1",
80
+ "semantic-ui-calendar-react": "^0.15.3",
81
+ "semantic-ui-react": "^3.0.0-beta.2",
82
+ "swr": "^2.3.3"
109
83
  },
110
- "gitHead": "03770e3241daa955de2e6e40fdaea91e3d147860"
84
+ "gitHead": "cbb92d5206752fe2add4195432b0401da17a0f23"
111
85
  }
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useEffect } from "react";
2
+ import { useEffect } from "react";
3
3
  import { Controller, useWatch } from "react-hook-form";
4
4
  import PropTypes from "prop-types";
5
5
  import { Form } from "semantic-ui-react";
@@ -47,6 +47,7 @@ const renderFixed = (formatMessage, fieldName) =>
47
47
  value,
48
48
  }))
49
49
  );
50
+
50
51
  const renderFixedTuple = (formatMessage, fieldName) =>
51
52
  _.flow(
52
53
  _.propOr([], "fixed_tuple"),
@@ -104,6 +105,7 @@ export const ContentFilters = ({
104
105
  shouldDirty: true,
105
106
  });
106
107
  };
108
+
107
109
  const fields = _.flow(
108
110
  _.find({ id: templateId }),
109
111
  fieldsFromTemplate
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useEffect, useRef, useState } from "react";
2
+ import { useEffect, useRef, useState } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { FormattedMessage, useIntl } from "react-intl";
5
5
  import { Label } from "semantic-ui-react";
@@ -50,7 +50,7 @@ export const NotificationEvent = ({
50
50
  } else if (isRead && !isVisible && isVisibleUnreadLabel) {
51
51
  setUnreadLabelVisibility(false);
52
52
  }
53
- }, [isVisible]);
53
+ }, [isVisible, isRead, isVisibleUnreadLabel, readNotification]);
54
54
 
55
55
  const template = TEMPLATES[event.event] || "default";
56
56
  const eventsWithStatus = ["implementation_status", "grant_approval"];
@@ -1,5 +1,4 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import { connect } from "react-redux";
5
4
  import { FormattedMessage } from "react-intl";
@@ -19,6 +18,7 @@ export const NotificationsMenu = ({
19
18
  useEffect(() => {
20
19
  fetchNotifications();
21
20
  }, []);
21
+
22
22
  return (
23
23
  <>
24
24
  {unread_counter > 0 && (
@@ -43,15 +43,7 @@ export const NotificationsMenu = ({
43
43
  </Dropdown.Item>
44
44
  ) : notifications && notifications.length > 0 ? (
45
45
  notifications.map(
46
- (
47
- {
48
- events,
49
- inserted_at,
50
- id: notificationId,
51
- read_mark: read_mark,
52
- },
53
- i
54
- ) =>
46
+ ({ events, inserted_at, id: notificationId, read_mark }, i) =>
55
47
  events.map((event, j) => (
56
48
  <Dropdown.Item
57
49
  className="item"
@@ -1,19 +1,19 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useRef, useState } from "react";
3
- import { Button, Container, Form, Header, Ref } from "semantic-ui-react";
2
+ import { lazy, useRef, useState } from "react";
3
+ import { Button, Container, Form, Header } from "semantic-ui-react";
4
4
  import PropTypes from "prop-types";
5
5
  import { useIntl } from "react-intl";
6
6
  import { connect } from "react-redux";
7
7
  import { lowerDeburrTrim } from "@truedat/core/services/sort";
8
+ import { getRecipients } from "@truedat/core/selectors";
8
9
  import { createNotification } from "../routines";
9
- import { getRecipients } from "../selectors";
10
10
 
11
- const UsersSearchLoader = React.lazy(() =>
12
- import("@truedat/auth/users/components/UsersSearchLoader")
11
+ const UsersSearchLoader = lazy(
12
+ () => import("@truedat/auth/users/components/UsersSearchLoader")
13
13
  );
14
14
 
15
- const GroupsSearchLoader = React.lazy(() =>
16
- import("@truedat/auth/groups/components/GroupsSearchLoader")
15
+ const GroupsSearchLoader = lazy(
16
+ () => import("@truedat/auth/groups/components/GroupsSearchLoader")
17
17
  );
18
18
 
19
19
  const MIN_SEARCH_CHARACTERS = 2;
@@ -25,7 +25,7 @@ export const ShareLinkForm = ({
25
25
  name,
26
26
  url,
27
27
  saving,
28
- createNotification
28
+ createNotification,
29
29
  }) => {
30
30
  const inputRef = useRef(null);
31
31
  const { formatMessage } = useIntl();
@@ -37,7 +37,7 @@ export const ShareLinkForm = ({
37
37
  const onChange = (_e, { name, value }) => {
38
38
  name === "shareDropdown" &&
39
39
  _.flow(
40
- _.filter(o => value.includes(_.prop("value")(o))),
40
+ _.filter((o) => value.includes(_.prop("value")(o))),
41
41
  setSelected
42
42
  )(dropdownOptions);
43
43
  name === "shareTextarea" && setMessage(value);
@@ -52,21 +52,23 @@ export const ShareLinkForm = ({
52
52
  subject: formatMessage({ id: "share.headers.subject" }),
53
53
  message_header: formatMessage({ id: "share.headers.message" }),
54
54
  description_header: formatMessage({
55
- id: "share.headers.description"
56
- })
55
+ id: "share.headers.description",
56
+ }),
57
57
  };
58
58
  createNotification({
59
59
  headers,
60
60
  message,
61
61
  resource: { name, description },
62
62
  uri: defaultValue,
63
- recipients
63
+ recipients,
64
64
  });
65
65
  };
66
66
 
67
67
  const copy = () => {
68
- inputRef.current.lastChild.firstChild.select();
69
- document.execCommand("copy");
68
+ if (inputRef.current) {
69
+ inputRef.current.select();
70
+ document.execCommand("copy");
71
+ }
70
72
  };
71
73
 
72
74
  return (
@@ -75,20 +77,19 @@ export const ShareLinkForm = ({
75
77
  <Form onSubmit={onSubmit}>
76
78
  <Form.Group>
77
79
  <Form.Field width={16}>
78
- <Ref innerRef={inputRef}>
79
- <Form.Input
80
- label={formatMessage({ id: "share.link.label" })}
81
- defaultValue={defaultValue}
82
- action={{
83
- as: "a",
84
- content: "Copy",
85
- labelPosition: "right",
86
- icon: "copy outline",
87
- onClick: copy
88
- }}
89
- readOnly
90
- />
91
- </Ref>
80
+ <Form.Input
81
+ label={formatMessage({ id: "share.link.label" })}
82
+ defaultValue={defaultValue}
83
+ action={{
84
+ as: "a",
85
+ content: "Copy",
86
+ labelPosition: "right",
87
+ icon: "copy outline",
88
+ onClick: copy,
89
+ }}
90
+ readOnly
91
+ input={{ ref: inputRef }}
92
+ />
92
93
  </Form.Field>
93
94
  </Form.Group>
94
95
  {_.size(usersGroupsQuery) >= MIN_SEARCH_CHARACTERS && (
@@ -100,7 +101,7 @@ export const ShareLinkForm = ({
100
101
  <Form.Dropdown
101
102
  name="shareDropdown"
102
103
  placeholder={formatMessage({
103
- id: "share.add_recipients.placeholder"
104
+ id: "share.add_recipients.placeholder",
104
105
  })}
105
106
  label={formatMessage({ id: "share.add_recipients.label" })}
106
107
  clearable
@@ -140,12 +141,12 @@ ShareLinkForm.propTypes = {
140
141
  name: PropTypes.string,
141
142
  description: PropTypes.string,
142
143
  options: PropTypes.array,
143
- saving: PropTypes.bool
144
+ saving: PropTypes.bool,
144
145
  };
145
146
 
146
- export const mapStateToProps = state => ({
147
+ export const mapStateToProps = (state) => ({
147
148
  options: getRecipients(state),
148
- saving: state?.notificationSaving
149
+ saving: state?.notificationSaving,
149
150
  });
150
151
 
151
152
  export default connect(mapStateToProps, { createNotification })(ShareLinkForm);
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from "react";
1
+ import { useState, useEffect } from "react";
2
2
  import { connect } from "react-redux";
3
3
  import { Button, Icon, Popup } from "semantic-ui-react";
4
4
  import PropTypes from "prop-types";
@@ -1,5 +1,4 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import {
5
4
  Header,
@@ -1,6 +1,5 @@
1
- import React from "react";
2
1
  import PropTypes from "prop-types";
3
- import { Link } from "react-router-dom";
2
+ import { Link, useNavigate } from "react-router";
4
3
  import { connect } from "react-redux";
5
4
  import { Button, Icon } from "semantic-ui-react";
6
5
  import { useIntl } from "react-intl";
@@ -8,7 +7,7 @@ import { ConfirmModal, GroupActions } from "@truedat/core/components";
8
7
  import { SUBSCRIPTIONS, linkTo } from "@truedat/core/routes";
9
8
  import { deleteSubscription } from "@truedat/core/routines";
10
9
 
11
- export const ModalDelete = ({ deleteSubscription, id }) => {
10
+ export const ModalDelete = ({ handleDelete, id }) => {
12
11
  const { formatMessage } = useIntl();
13
12
  return (
14
13
  <ConfirmModal
@@ -26,9 +25,7 @@ export const ModalDelete = ({ deleteSubscription, id }) => {
26
25
  content={formatMessage({
27
26
  id: "subscription.actions.delete.confirmation.content",
28
27
  })}
29
- onConfirm={() =>
30
- deleteSubscription({ subscription: { id }, redirect: SUBSCRIPTIONS })
31
- }
28
+ onConfirm={() => handleDelete({ id })}
32
29
  />
33
30
  );
34
31
  };
@@ -40,7 +37,14 @@ ModalDelete.propTypes = {
40
37
 
41
38
  export const SubscriptionActions = ({ deleteSubscription, subscription }) => {
42
39
  const { formatMessage } = useIntl();
40
+ const navigate = useNavigate();
43
41
  const id = subscription?.id;
42
+
43
+ const onConfirmDelete = async ({ id }) => {
44
+ await deleteSubscription({ subscription: { id } });
45
+ navigate(SUBSCRIPTIONS);
46
+ };
47
+
44
48
  const actions = id
45
49
  ? [
46
50
  {
@@ -56,7 +60,7 @@ export const SubscriptionActions = ({ deleteSubscription, subscription }) => {
56
60
  icon: "trash",
57
61
  value: "delete",
58
62
  as: ModalDelete,
59
- deleteSubscription,
63
+ handleDelete: onConfirmDelete,
60
64
  id,
61
65
  },
62
66
  ]
@@ -1,7 +1,6 @@
1
- import React from "react";
2
1
  import PropTypes from "prop-types";
3
2
  import { Breadcrumb } from "semantic-ui-react";
4
- import { Link } from "react-router-dom";
3
+ import { Link } from "react-router";
5
4
  import { FormattedMessage } from "react-intl";
6
5
  import { SUBSCRIPTIONS } from "@truedat/core/routes";
7
6
 
@@ -20,7 +19,7 @@ export const SubscriptionCrumbs = ({ title }) => {
20
19
  };
21
20
 
22
21
  SubscriptionCrumbs.propTypes = {
23
- title: PropTypes.string
22
+ title: PropTypes.string,
24
23
  };
25
24
 
26
25
  export default SubscriptionCrumbs;
@@ -1,5 +1,4 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import { useIntl } from "react-intl";
5
4
  import { connect } from "react-redux";