@truedat/core 4.48.0 → 4.48.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.48.3] 2022-07-11
4
+
5
+ ### Changed
6
+
7
+ - [TD-3614] Always include Bearer token if present in localStorage
8
+
9
+ ## [4.48.2] 2022-07-08
10
+
11
+ ### Changed
12
+
13
+ - [TD-4995] Support localization of template fields and fixed values
14
+
3
15
  ## [4.47.5] 2022-06-30
4
16
 
5
17
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "4.48.0",
3
+ "version": "4.48.4",
4
4
  "description": "Truedat Web Core",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -112,5 +112,5 @@
112
112
  "react-dom": ">= 16.8.6 < 17",
113
113
  "semantic-ui-react": ">= 0.88.2 < 2.1"
114
114
  },
115
- "gitHead": "c4587d045fa6c9028082bdfbcfb35e4383f117ed"
115
+ "gitHead": "5e50a034469bf3ad8e02a64eb875ad2b710b6b03"
116
116
  }
@@ -1,8 +1,6 @@
1
1
  import React, { useEffect, useState } from "react";
2
2
  import moment from "moment";
3
3
  import PropTypes from "prop-types";
4
- import { useIntl } from "react-intl";
5
- import { Form, Input, Label, Dropdown } from "semantic-ui-react";
6
4
  import { DatesRangeInput } from "semantic-ui-calendar-react";
7
5
 
8
6
  const validNumber = (value) => RegExp("^\\d+$").test(value);
@@ -10,10 +8,8 @@ const validRange = (value) =>
10
8
  RegExp("^\\d{4}-\\d\\d-\\d\\d *- *\\d{4}-\\d\\d-\\d\\d$").test(value);
11
9
 
12
10
  export const DateRangeFilter = ({
13
- label,
14
11
  onChange,
15
12
  defaultValues,
16
- size = "small",
17
13
  name = "date",
18
14
  dateFormat = "YYYY-MM-DD",
19
15
  }) => {
@@ -47,10 +43,8 @@ export const DateRangeFilter = ({
47
43
  DateRangeFilter.propTypes = {
48
44
  dateFormat: PropTypes.string,
49
45
  defaultValues: PropTypes.object,
50
- label: PropTypes.node,
51
46
  name: PropTypes.string,
52
47
  onChange: PropTypes.func,
53
- size: PropTypes.string,
54
48
  };
55
49
 
56
50
  export default DateRangeFilter;
@@ -7,14 +7,15 @@ import { useQuery } from "@apollo/client";
7
7
  import { accentInsensitivePathOrder } from "../services/sort";
8
8
  import { TEMPLATES_QUERY } from "../api/queries";
9
9
 
10
- const makeOptions = _.flow(
11
- _.map(({ label: text, id: value }) => ({
12
- key: value,
13
- value,
14
- text,
15
- })),
16
- _.sortBy(accentInsensitivePathOrder("text"))
17
- );
10
+ const makeOptions = (formatMessage) =>
11
+ _.flow(
12
+ _.map(({ label, id: value }) => ({
13
+ key: value,
14
+ value,
15
+ text: formatMessage({ id: `templates.${label}`, defaultMessage: label }),
16
+ })),
17
+ _.sortBy(accentInsensitivePathOrder("text"))
18
+ );
18
19
 
19
20
  export const TemplateSelector = ({
20
21
  clearable,
@@ -26,7 +27,7 @@ export const TemplateSelector = ({
26
27
  templates,
27
28
  }) => {
28
29
  const { formatMessage } = useIntl();
29
- const options = makeOptions(templates);
30
+ const options = makeOptions(formatMessage)(templates);
30
31
  const hidden = loading ? false : _.size(templates) <= 1;
31
32
 
32
33
  const handleChange = (e, { value, ...data }) => {
@@ -16,11 +16,11 @@ export const UserFilters = ({
16
16
  }) => {
17
17
  return _.isEmpty(userFilters) ? null : (
18
18
  <div className="selectedFilters">
19
- {userFilters.map((userFilter, i) => (
19
+ {userFilters.map((userFilter, key) => (
20
20
  <Label
21
21
  basic={selectedUserFilter == userFilter.name ? false : true}
22
22
  circular
23
- key={`label${userFilter.id}.${i}`}
23
+ key={key}
24
24
  >
25
25
  <span
26
26
  onClick={
@@ -7,7 +7,7 @@ exports[`<UserFilters /> matches the latest snapshot 1`] = `
7
7
  <Label
8
8
  basic={true}
9
9
  circular={true}
10
- key="labelundefined.0"
10
+ key="0"
11
11
  >
12
12
  <span
13
13
  className="userFilter"
@@ -51,7 +51,7 @@ exports[`<UserFilters /> matches the latest snapshot 1`] = `
51
51
  <Label
52
52
  basic={true}
53
53
  circular={true}
54
- key="labelundefined.1"
54
+ key="1"
55
55
  >
56
56
  <span
57
57
  className="userFilter"
@@ -113,4 +113,7 @@ export default {
113
113
  "sidemenu.taxonomy": "Taxonomy",
114
114
  "sidemenu.templates": "Templates",
115
115
  "sidemenu.users": "Users",
116
+ "view.unauthorized.content":
117
+ "If you want to update your permissions, please contact the administrator.",
118
+ "view.unauthorized.head": "You are not authorized to view this content",
116
119
  };
@@ -116,4 +116,8 @@ export default {
116
116
  "sidemenu.taxonomy": "Dominios",
117
117
  "sidemenu.templates": "Plantillas",
118
118
  "sidemenu.users": "Usuarios",
119
+ "view.unauthorized.head":
120
+ "No dispones de autorización para ver este contenido",
121
+ "view.unauthorized.content":
122
+ "Si quiere actualizar sus permisos, por favor contacte con el administrador.",
119
123
  };
@@ -4,16 +4,15 @@ import { readToken } from "./storage";
4
4
  axios.interceptors.request.use(
5
5
  function (config) {
6
6
  const token = readToken();
7
- if (token != null && !config.url.match(/\/sessions/)) {
8
- return {
9
- ...config,
10
- headers: {
11
- ...config.headers,
12
- Authorization: `Bearer ${token}`,
13
- },
14
- };
15
- }
16
- return config;
7
+ return token === null
8
+ ? config
9
+ : {
10
+ ...config,
11
+ headers: {
12
+ ...config.headers,
13
+ Authorization: `Bearer ${token}`,
14
+ },
15
+ };
17
16
  },
18
17
  function (err) {
19
18
  return Promise.reject(err);