@truedat/auth 8.12.5 → 8.12.7

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 (34) hide show
  1. package/package.json +4 -4
  2. package/src/groups/components/Group.js +2 -1
  3. package/src/groups/components/GroupCard.js +1 -1
  4. package/src/groups/components/GroupForm.js +1 -1
  5. package/src/groups/components/GroupLoader.js +1 -1
  6. package/src/groups/components/GroupUsers.js +1 -1
  7. package/src/groups/components/GroupUsersTable.js +1 -1
  8. package/src/groups/components/GroupsLoader.js +1 -1
  9. package/src/groups/components/__tests__/GroupUsersTable.spec.js +3 -2
  10. package/src/roles/components/RoleCards.js +1 -1
  11. package/src/roles/components/RoleForm.js +1 -1
  12. package/src/roles/components/RoleLoader.js +1 -1
  13. package/src/roles/components/RolesLoader.js +1 -1
  14. package/src/roles/components/__tests__/PermissionGroup.spec.js +2 -1
  15. package/src/sessions/components/Auth0Callback.js +1 -1
  16. package/src/sessions/components/NonceCallback.js +1 -1
  17. package/src/sessions/components/OpenIDConnect.js +1 -1
  18. package/src/sessions/components/__tests__/Auth0LoginButton.spec.js +1 -1
  19. package/src/sessions/components/__tests__/LoginButtons.spec.js +1 -1
  20. package/src/sessions/components/__tests__/OidcLoginButton.spec.js +1 -1
  21. package/src/users/components/AdminUserRoutes.js +1 -1
  22. package/src/users/components/Password.js +1 -1
  23. package/src/users/components/UserActions.js +2 -1
  24. package/src/users/components/UserCards.js +1 -1
  25. package/src/users/components/UserDomainsFilter.js +1 -1
  26. package/src/users/components/UserForm.js +1 -1
  27. package/src/users/components/UserLoader.js +1 -1
  28. package/src/users/components/UsersLoader.js +1 -1
  29. package/src/users/components/__tests__/CanInitLoader.spec.js +2 -1
  30. package/src/users/components/__tests__/Password.spec.js +5 -1
  31. package/src/users/components/__tests__/UserAclRow.spec.js +1 -1
  32. package/src/users/components/__tests__/UserForm.spec.js +10 -24
  33. package/src/users/components/__tests__/UserGroupAclRow.spec.js +1 -1
  34. package/src/users/components/__tests__/UserRoutes.spec.js +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/auth",
3
- "version": "8.12.5",
3
+ "version": "8.12.7",
4
4
  "description": "Truedat Web Auth",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -54,14 +54,14 @@
54
54
  "@testing-library/jest-dom": "^6.6.3",
55
55
  "@testing-library/react": "^16.3.0",
56
56
  "@testing-library/user-event": "^14.6.1",
57
- "@truedat/test": "8.12.5",
57
+ "@truedat/test": "8.12.7",
58
58
  "identity-obj-proxy": "^3.0.0",
59
59
  "jest": "^29.7.0",
60
60
  "redux-saga-test-plan": "^4.0.6"
61
61
  },
62
62
  "dependencies": {
63
63
  "@apollo/client": "^3.13.8",
64
- "@truedat/core": "8.12.5",
64
+ "@truedat/core": "8.12.7",
65
65
  "auth0-js": "^10.2.0",
66
66
  "axios": "^1.15.0",
67
67
  "graphql": "^16.11.0",
@@ -90,5 +90,5 @@
90
90
  "swr": "^2.3.3"
91
91
  },
92
92
  "overrides": {},
93
- "gitHead": "71dd08262e6c26dd25466154c49fadb7b3449bd7"
93
+ "gitHead": "dae06fd2f915163d5f1e7e3f26c414c8ee9bf055"
94
94
  }
@@ -2,7 +2,8 @@ import PropTypes from "prop-types";
2
2
  import { connect } from "react-redux";
3
3
  import { Header, Button, Icon, Grid } from "semantic-ui-react";
4
4
  import { FormattedMessage, useIntl } from "react-intl";
5
- import { ConfirmModal, GroupActions } from "@truedat/core/components";
5
+ import ConfirmModal from "@truedat/core/components/ConfirmModal";
6
+ import GroupActions from "@truedat/core/components/GroupActions";
6
7
  import { deleteGroup } from "../routines";
7
8
 
8
9
  const ModalDelete = ({ group: { id, name }, deleteGroup }) => {
@@ -3,7 +3,7 @@ import { connect } from "react-redux";
3
3
  import { Button, Card, Icon } from "semantic-ui-react";
4
4
  import { Link } from "react-router";
5
5
  import { FormattedMessage } from "react-intl";
6
- import { ConfirmModal } from "@truedat/core/components";
6
+ import ConfirmModal from "@truedat/core/components/ConfirmModal";
7
7
  import { linkTo } from "@truedat/core/routes";
8
8
  import { deleteGroup } from "../routines";
9
9
 
@@ -4,7 +4,7 @@ import { useForm, Controller } from "react-hook-form";
4
4
  import { useIntl } from "react-intl";
5
5
  import { connect } from "react-redux";
6
6
  import { Button, Form, Header } from "semantic-ui-react";
7
- import { HistoryBackButton } from "@truedat/core/components";
7
+ import HistoryBackButton from "@truedat/core/components/HistoryBackButton";
8
8
  import { accentInsensitivePathOrder } from "@truedat/core/services/sort";
9
9
 
10
10
  const toOption = ({ id, full_name, user_name }) => ({
@@ -1,7 +1,7 @@
1
1
  import { useEffect } from "react";
2
2
  import { useParams } from "react-router";
3
3
  import { useDispatch, useSelector } from "react-redux";
4
- import { Loading } from "@truedat/core/components";
4
+ import Loading from "@truedat/core/components/Loading";
5
5
  import { clearGroup, fetchGroup } from "../routines";
6
6
 
7
7
  const GroupLoader = () => {
@@ -5,7 +5,7 @@ import { Link } from "react-router";
5
5
  import { connect } from "react-redux";
6
6
  import { Segment, Button, Divider } from "semantic-ui-react";
7
7
  import { FormattedMessage, useIntl } from "react-intl";
8
- import { SearchInput } from "@truedat/core/components";
8
+ import SearchInput from "@truedat/core/components/SearchInput";
9
9
  import { linkTo } from "@truedat/core/routes";
10
10
  import GroupUsersTable from "./GroupUsersTable";
11
11
 
@@ -5,7 +5,7 @@ import { useIntl } from "react-intl";
5
5
  import { connect } from "react-redux";
6
6
  import { useNavigate } from "react-router";
7
7
  import { Table, Header, Icon, Button } from "semantic-ui-react";
8
- import { ConfirmModal } from "@truedat/core/components";
8
+ import ConfirmModal from "@truedat/core/components/ConfirmModal";
9
9
  import { linkTo } from "@truedat/core/routes";
10
10
  import { columnDecorator } from "@truedat/core/services";
11
11
  import { accentInsensitivePathOrder } from "@truedat/core/services/sort";
@@ -1,7 +1,7 @@
1
1
  import { Component } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { connect } from "react-redux";
4
- import { Loading } from "@truedat/core/components";
4
+ import Loading from "@truedat/core/components/Loading";
5
5
  import { fetchGroups } from "../routines";
6
6
 
7
7
  class GroupsLoader extends Component {
@@ -1,5 +1,6 @@
1
1
  import userEvent from "@testing-library/user-event";
2
- import { render, waitForLoad } from "@truedat/test/render";
2
+ import { renderWithIntl as render } from "@truedat/test/renderWithIntl";
3
+ import { waitForLoad } from "@truedat/test/waitForLoad";
3
4
  import { GroupUsersTable } from "../GroupUsersTable";
4
5
 
5
6
  jest.mock("react-router", () => ({
@@ -53,7 +54,7 @@ describe("<GroupUsersTable />", () => {
53
54
 
54
55
  // Click on the username column header to sort
55
56
  const usernameHeader = rendered.getByText(/user_name/i);
56
- userEvent.click(usernameHeader);
57
+ await userEvent.click(usernameHeader);
57
58
 
58
59
  // First row should now contain "auser_3" after sorting
59
60
  const firstRowCells = rendered.container.querySelectorAll(
@@ -3,7 +3,7 @@ import { Button, Card, Label, Icon } from "semantic-ui-react";
3
3
  import { connect } from "react-redux";
4
4
  import { Link } from "react-router";
5
5
  import { FormattedMessage } from "react-intl";
6
- import { ConfirmModal } from "@truedat/core/components";
6
+ import ConfirmModal from "@truedat/core/components/ConfirmModal";
7
7
  import { linkTo } from "@truedat/core/routes";
8
8
  import { deleteRole } from "../routines";
9
9
 
@@ -4,7 +4,7 @@ import { useForm, Controller } from "react-hook-form";
4
4
  import { Button, Form } from "semantic-ui-react";
5
5
  import { useIntl } from "react-intl";
6
6
  import { connect } from "react-redux";
7
- import { HistoryBackButton } from "@truedat/core/components";
7
+ import HistoryBackButton from "@truedat/core/components/HistoryBackButton";
8
8
 
9
9
  export const RoleForm = ({ role, isSubmitting, onSubmit }) => {
10
10
  const { formatMessage } = useIntl();
@@ -2,7 +2,7 @@ import { useEffect } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { useParams } from "react-router";
4
4
  import { useDispatch, useSelector } from "react-redux";
5
- import { Loading } from "@truedat/core/components";
5
+ import Loading from "@truedat/core/components/Loading";
6
6
  import {
7
7
  fetchPermissions,
8
8
  fetchRole,
@@ -1,7 +1,7 @@
1
1
  import { Component } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { connect } from "react-redux";
4
- import { Loading } from "@truedat/core/components";
4
+ import Loading from "@truedat/core/components/Loading";
5
5
  import { fetchRoles, clearRoles } from "../routines";
6
6
 
7
7
  class RolesLoader extends Component {
@@ -1,4 +1,5 @@
1
- import { render, waitForLoad } from "@truedat/test/render";
1
+ import { renderWithIntl as render } from "@truedat/test/renderWithIntl";
2
+ import { waitForLoad } from "@truedat/test/waitForLoad";
2
3
  import { PermissionGroup } from "../PermissionGroup";
3
4
 
4
5
  describe("<PermissionGroup />", () => {
@@ -5,7 +5,7 @@ import { connect } from "react-redux";
5
5
  import { useLocation } from "react-router";
6
6
  import { Navigate } from "react-router";
7
7
  import auth0 from "auth0-js";
8
- import { Loading } from "@truedat/core/components";
8
+ import Loading from "@truedat/core/components/Loading";
9
9
  import queryString from "query-string";
10
10
  import { SEARCH } from "@truedat/core/routes";
11
11
  import { auth0Login } from "../routines";
@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
3
3
  import { useLocation, Navigate } from "react-router";
4
4
  import { useDispatch, useSelector } from "react-redux";
5
5
  import queryString from "query-string";
6
- import { Loading } from "@truedat/core/components";
6
+ import Loading from "@truedat/core/components/Loading";
7
7
  import { nonceLogin } from "../routines";
8
8
 
9
9
  export default function NonceCallback({ authMethod }) {
@@ -5,7 +5,7 @@ import queryString from "query-string";
5
5
  import { connect } from "react-redux";
6
6
  import { useLocation } from "react-router";
7
7
  import { Navigate } from "react-router";
8
- import { Loading } from "@truedat/core/components";
8
+ import Loading from "@truedat/core/components/Loading";
9
9
  import { SEARCH } from "@truedat/core/routes";
10
10
  import { openIdLogin } from "../routines";
11
11
 
@@ -1,4 +1,4 @@
1
- import { render } from "@truedat/test/render";
1
+ import { renderWithIntl as render } from "@truedat/test/renderWithIntl";
2
2
  import { Auth0LoginButton } from "../Auth0LoginButton";
3
3
 
4
4
  describe("<Auth0LoginButton />", () => {
@@ -1,4 +1,4 @@
1
- import { render } from "@truedat/test/render";
1
+ import { renderWithIntl as render } from "@truedat/test/renderWithIntl";
2
2
  import { LoginButtons } from "../LoginButtons";
3
3
 
4
4
  describe("<LoginButtons />", () => {
@@ -1,4 +1,4 @@
1
- import { render } from "@truedat/test/render";
1
+ import { renderWithIntl as render } from "@truedat/test/renderWithIntl";
2
2
  import { OidcLoginButton } from "../OidcLoginButton";
3
3
 
4
4
  describe("<OidcLoginButton />", () => {
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { Route, Routes } from "react-router";
3
3
  import { Divider, Segment } from "semantic-ui-react";
4
- import { Unauthorized } from "@truedat/core/components";
4
+ import Unauthorized from "@truedat/core/components/Unauthorized";
5
5
  import { useActiveRoute, useAuthorized } from "@truedat/core/hooks";
6
6
  import { ProtectedRoute, Loader } from "@truedat/core/router";
7
7
  import {
@@ -5,7 +5,7 @@ import { FormattedMessage, useIntl } from "react-intl";
5
5
  import { connect } from "react-redux";
6
6
  import { useForm, Controller } from "react-hook-form";
7
7
  import { Button, Form } from "semantic-ui-react";
8
- import { HistoryBackButton } from "@truedat/core/components";
8
+ import HistoryBackButton from "@truedat/core/components/HistoryBackButton";
9
9
  import { updatePassword } from "../routines";
10
10
 
11
11
  const MIN_LENGTH = 6;
@@ -3,7 +3,8 @@ import { connect, useDispatch } from "react-redux";
3
3
  import PropTypes from "prop-types";
4
4
  import { Button, Icon } from "semantic-ui-react";
5
5
  import { FormattedMessage } from "react-intl";
6
- import { ConfirmModal, GroupActions } from "@truedat/core/components";
6
+ import ConfirmModal from "@truedat/core/components/ConfirmModal";
7
+ import GroupActions from "@truedat/core/components/GroupActions";
7
8
  import { linkTo, USERS } from "@truedat/core/routes";
8
9
  import { Link, useNavigate } from "react-router";
9
10
  import { deleteUser, fetchUsers } from "../routines";
@@ -5,7 +5,7 @@ import { connect } from "react-redux";
5
5
  import { Link } from "react-router";
6
6
  import { Button, Card, Header, Icon, Message } from "semantic-ui-react";
7
7
  import { FormattedMessage, useIntl } from "react-intl";
8
- import { SearchInput } from "@truedat/core/components";
8
+ import SearchInput from "@truedat/core/components/SearchInput";
9
9
  import { USERS_NEW } from "@truedat/core/routes";
10
10
  import { filterUsers } from "../selectors/filterUsers";
11
11
  import UserCard from "./UserCard";
@@ -5,7 +5,7 @@ import { Form } from "semantic-ui-react";
5
5
  import { setDashboardDomains } from "@truedat/core/routines";
6
6
  import { useIntl } from "react-intl";
7
7
  import PropTypes from "prop-types";
8
- import { DomainSelector } from "@truedat/core/components";
8
+ import DomainSelector from "@truedat/core/components/DomainSelector";
9
9
 
10
10
  export const UserDomainsFilter = ({
11
11
  action = "viewDomain",
@@ -4,7 +4,7 @@ import { useIntl } from "react-intl";
4
4
  import { useForm, useWatch, Controller } from "react-hook-form";
5
5
  import { Button, Form } from "semantic-ui-react";
6
6
  import { connect } from "react-redux";
7
- import { HistoryBackButton } from "@truedat/core/components";
7
+ import HistoryBackButton from "@truedat/core/components/HistoryBackButton";
8
8
 
9
9
  const groupOptions = (groups = [], values) => {
10
10
  const groupOpts = _.map.convert({ cap: false })((g, i) => {
@@ -2,7 +2,7 @@ import { useEffect } from "react";
2
2
  import { useParams } from "react-router";
3
3
  import PropTypes from "prop-types";
4
4
  import { useDispatch, useSelector } from "react-redux";
5
- import { Loading } from "@truedat/core/components";
5
+ import Loading from "@truedat/core/components/Loading";
6
6
  import { clearUser, fetchUser } from "../routines";
7
7
 
8
8
  function UserLoader() {
@@ -1,7 +1,7 @@
1
1
  import { Component } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { connect } from "react-redux";
4
- import { Loading } from "@truedat/core/components";
4
+ import Loading from "@truedat/core/components/Loading";
5
5
  import { fetchUsers } from "../routines";
6
6
 
7
7
  class UsersLoader extends Component {
@@ -1,4 +1,5 @@
1
- import { render, waitForLoad } from "@truedat/test/render";
1
+ import { renderWithIntl as render } from "@truedat/test/renderWithIntl";
2
+ import { waitForLoad } from "@truedat/test/waitForLoad";
2
3
  import { CanInitLoader } from "../CanInitLoader";
3
4
 
4
5
  describe("<CanInitLoader />", () => {
@@ -1,8 +1,12 @@
1
1
  import { waitFor } from "@testing-library/react";
2
2
  import userEvent from "@testing-library/user-event";
3
- import { render } from "@truedat/test/render";
3
+ import { MemoryRouter } from "react-router";
4
+ import { renderWithIntl } from "@truedat/test/renderWithIntl";
4
5
  import { Password } from "../Password";
5
6
 
7
+ const render = (component) =>
8
+ renderWithIntl(<MemoryRouter>{component}</MemoryRouter>);
9
+
6
10
  describe("<Password />", () => {
7
11
  beforeEach(() => jest.useRealTimers());
8
12
 
@@ -1,4 +1,4 @@
1
- import { render } from "@truedat/test/render";
1
+ import { renderWithIntl as render } from "@truedat/test/renderWithIntl";
2
2
  import { UserAclRow } from "../UserAclRow";
3
3
 
4
4
  describe("<UserAclRow />", () => {
@@ -1,24 +1,23 @@
1
1
  import userEvent from "@testing-library/user-event";
2
2
  import { waitFor } from "@testing-library/react";
3
- import { render, waitForLoad } from "@truedat/test/render";
4
- import UserForm from "../UserForm";
3
+ import { MemoryRouter } from "react-router";
4
+ import { renderWithIntl } from "@truedat/test/renderWithIntl";
5
+ import { waitForLoad } from "@truedat/test/waitForLoad";
6
+ import { UserForm } from "../UserForm";
5
7
 
6
- const renderOpts = {
7
- state: {
8
- user: { id: 123, user_name: "fred", full_name: "fredrik foobar" },
9
- },
10
- };
8
+ const render = (component) =>
9
+ renderWithIntl(<MemoryRouter>{component}</MemoryRouter>);
11
10
 
12
11
  describe("<UserForm />", () => {
13
12
  beforeEach(() => jest.useRealTimers());
14
13
 
15
14
  it("matches the latest snapshot", async () => {
16
- const rendered = render(<UserForm />, renderOpts);
15
+ const rendered = render(<UserForm />);
17
16
  await waitForLoad(rendered);
18
17
  expect(rendered.container).toMatchSnapshot();
19
18
  });
20
19
  it("validates email format", async () => {
21
- const rendered = render(<UserForm />, renderOpts);
20
+ const rendered = render(<UserForm />);
22
21
  await waitForLoad(rendered);
23
22
 
24
23
  const user = userEvent.setup({ delay: null });
@@ -50,10 +49,7 @@ describe("<UserForm />", () => {
50
49
 
51
50
  it("calls the onSubmit function when submitted", async () => {
52
51
  const onSubmit = jest.fn();
53
- const rendered = render(
54
- <UserForm onSubmit={(props) => onSubmit(props)} />,
55
- renderOpts,
56
- );
52
+ const rendered = render(<UserForm onSubmit={(props) => onSubmit(props)} />);
57
53
  await waitForLoad(rendered);
58
54
 
59
55
  const user = userEvent.setup({ delay: null });
@@ -108,10 +104,7 @@ describe("<UserForm />", () => {
108
104
  { name: "admins", alias: "Administrators" },
109
105
  { name: "users", alias: "Users" },
110
106
  ];
111
- const rendered = render(<UserForm groups={groups} />, {
112
- ...renderOpts,
113
- state: { ...renderOpts.state, groups },
114
- });
107
+ const rendered = render(<UserForm groups={groups} />);
115
108
 
116
109
  await waitForLoad(rendered);
117
110
 
@@ -141,13 +134,6 @@ describe("<UserForm />", () => {
141
134
  groups: ["zzz", "admins", "ZZZ"],
142
135
  }}
143
136
  />,
144
- {
145
- ...renderOpts,
146
- state: {
147
- ...renderOpts.state,
148
- groups,
149
- },
150
- },
151
137
  );
152
138
  await waitForLoad(rendered);
153
139
 
@@ -1,5 +1,5 @@
1
1
  import { waitFor } from "@testing-library/react";
2
- import { render } from "@truedat/test/render";
2
+ import { renderWithIntl as render } from "@truedat/test/renderWithIntl";
3
3
  import UserGroupAclRow from "../UserGroupAclRow";
4
4
 
5
5
  describe("<UserGroupAclRow />", () => {
@@ -1,8 +1,15 @@
1
1
  import React from "react";
2
- import { render, waitForLoad } from "@truedat/test/render";
2
+ import { MemoryRouter } from "react-router";
3
+ import { renderWithIntl } from "@truedat/test/renderWithIntl";
4
+ import { waitForLoad } from "@truedat/test/waitForLoad";
3
5
  import { useAuthorized } from "@truedat/core/hooks/useAuthorized";
4
6
  import { UserRoutes } from "../UserRoutes";
5
7
 
8
+ const render = (component, { routes = ["/"] } = {}) =>
9
+ renderWithIntl(
10
+ <MemoryRouter initialEntries={routes}>{component}</MemoryRouter>,
11
+ );
12
+
6
13
  jest.mock("@truedat/core/hooks/useAuthorized", () => ({
7
14
  useAuthorized: jest.fn(() => true),
8
15
  }));