@truedat/audit 4.47.5 → 4.47.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/audit",
3
- "version": "4.47.5",
3
+ "version": "4.47.8",
4
4
  "description": "Truedat Web Audit Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.4",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.47.5",
37
+ "@truedat/test": "4.47.8",
38
38
  "babel-jest": "^28.1.0",
39
39
  "babel-plugin-dynamic-import-node": "^2.3.3",
40
40
  "babel-plugin-lodash": "^3.3.4",
@@ -85,8 +85,8 @@
85
85
  ]
86
86
  },
87
87
  "dependencies": {
88
- "@truedat/auth": "4.47.5",
89
- "@truedat/core": "4.47.5",
88
+ "@truedat/auth": "4.47.8",
89
+ "@truedat/core": "4.47.8",
90
90
  "axios": "^0.19.2",
91
91
  "path-to-regexp": "^1.7.0",
92
92
  "prop-types": "^15.8.1",
@@ -107,5 +107,5 @@
107
107
  "react-dom": ">= 16.8.6 < 17",
108
108
  "semantic-ui-react": ">= 0.88.2 < 2.1"
109
109
  },
110
- "gitHead": "1265272aa7b8fcb415592916f0e557ae226befe3"
110
+ "gitHead": "dccc0d92c419a5ee257a8e15b64c1b98d909809a"
111
111
  }
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React, { Suspense, useState } from "react";
2
+ import React, { Suspense, useState, useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { useIntl } from "react-intl";
5
5
  import { useForm, useWatch, Controller } from "react-hook-form";
@@ -122,18 +122,23 @@ export const SubscriptionForm = ({
122
122
  });
123
123
 
124
124
  const isEditForm = !!subscription?.id;
125
- const isEmptyEvents = _.isEmpty(events);
126
- const isRuleEvent = _.isEqual(["rule_result_created"])(events);
127
- const eventsForType = _.flow(
128
- _.getOr([], resourceType),
129
- _.filter(
130
- (event) =>
131
- isEmptyEvents ||
132
- (isRuleEvent
133
- ? event === "rule_result_created"
134
- : event !== "rule_result_created")
135
- )
136
- )(EVENTS_BY_TYPE);
125
+
126
+ const [eventsForType, setEventsForType] = useState([]);
127
+
128
+ useEffect(() => {
129
+ const exclusiveEvents = [
130
+ "rule_result_created",
131
+ "implementation_status_updated",
132
+ ];
133
+ const eventsbytype = _.getOr([], resourceType)(EVENTS_BY_TYPE);
134
+ setEventsForType(
135
+ !_.isEmpty(_.intersection(exclusiveEvents)(events))
136
+ ? events
137
+ : !_.isEmpty(events)
138
+ ? _.difference(eventsbytype)(exclusiveEvents)
139
+ : eventsbytype
140
+ );
141
+ }, [resourceType, events]);
137
142
 
138
143
  const statuses = _.flow(
139
144
  _.pick(events),
@@ -3,7 +3,9 @@ import { render } from "@truedat/test/render";
3
3
  import NotificationEvent from "../NotificationEvent";
4
4
 
5
5
  jest.mock("@truedat/core/hooks", () => ({ useOnScreen: jest.fn() }));
6
-
6
+ jest
7
+ .spyOn(global.Date, "now")
8
+ .mockImplementation(() => new Date("2022-01-01T11:01:58.135Z").valueOf());
7
9
  describe("<NotificationEvent />", () => {
8
10
  it("matches the latest snapshot", () => {
9
11
  const event = {