@truedat/bg 7.1.8 → 7.2.1

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/bg",
3
- "version": "7.1.8",
3
+ "version": "7.2.1",
4
4
  "description": "Truedat Web Business Glossary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.5",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "7.1.8",
37
+ "@truedat/test": "7.2.1",
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",
@@ -86,9 +86,9 @@
86
86
  ]
87
87
  },
88
88
  "dependencies": {
89
- "@truedat/core": "7.1.8",
90
- "@truedat/df": "7.1.8",
91
- "@truedat/lm": "7.1.8",
89
+ "@truedat/core": "7.2.1",
90
+ "@truedat/df": "7.2.1",
91
+ "@truedat/lm": "7.2.1",
92
92
  "decode-uri-component": "^0.2.2",
93
93
  "file-saver": "^2.0.5",
94
94
  "moment": "^2.29.4",
@@ -111,5 +111,5 @@
111
111
  "react-dom": ">= 16.8.6 < 17",
112
112
  "semantic-ui-react": ">= 2.0.3 < 2.2"
113
113
  },
114
- "gitHead": "eb92417df5ba0fbc5bc9f670d0d8540c39e3d712"
114
+ "gitHead": "10ba779646ef549e6db1235b3acd6d430526f487"
115
115
  }
@@ -5,7 +5,7 @@ import { connect } from "react-redux";
5
5
  import { List, Header, Progress, Segment, Icon } from "semantic-ui-react";
6
6
  import { FormattedMessage } from "react-intl";
7
7
  import { isRequired } from "@truedat/df/utils";
8
- import { useLocales } from "@truedat/core/hooks";
8
+ import { useLanguage } from "@truedat/core/i18n";
9
9
  import { splitTranslatableFields } from "@truedat/core/services/i18nContent";
10
10
 
11
11
  const missingRequiredFields = (concept, content) => {
@@ -94,7 +94,7 @@ Completeness.propTypes = {
94
94
  };
95
95
 
96
96
  export const ConceptCompleteness = ({ concept }) => {
97
- const { locales } = useLocales(false);
97
+ const { locales } = useLanguage();
98
98
 
99
99
  const completeness = _.get("completeness")(concept);
100
100
  const content = _.getOr({}, "content")(concept);
@@ -2,7 +2,7 @@ import _ from "lodash/fp";
2
2
  import React, { useState, useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
- import { useLocales } from "@truedat/core/hooks";
5
+ import { useLanguage } from "@truedat/core/i18n";
6
6
  import {
7
7
  splitTranslatableFields,
8
8
  formatLocales,
@@ -14,7 +14,7 @@ import ConceptForms from "./ConceptForms";
14
14
  const actionKey = "create";
15
15
 
16
16
  const ConceptCreate = ({ conceptActionLoading, conceptAction }) => {
17
- const { locales, loading: localesLoading } = useLocales(false);
17
+ const { locales } = useLanguage();
18
18
  const { actions: conceptsActions } = useConceptVersionsActions();
19
19
 
20
20
  const [i18nConcept, setI18nConcept] = useState({});
@@ -95,7 +95,7 @@ const ConceptCreate = ({ conceptActionLoading, conceptAction }) => {
95
95
  domainId={domainId}
96
96
  template={template}
97
97
  i18nConcept={i18nConcept}
98
- loading={localesLoading || conceptActionLoading}
98
+ loading={conceptActionLoading}
99
99
  langs={langs}
100
100
  noTranslatableFields={noTranslatableKeys}
101
101
  translatableFields={translatableKeys}
@@ -4,7 +4,7 @@ import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { Button, ButtonGroup, Segment } from "semantic-ui-react";
6
6
  import { useIntl } from "react-intl";
7
- import { useLocales } from "@truedat/core/hooks";
7
+ import { useLanguage } from "@truedat/core/i18n";
8
8
  import { splitTranslatableFields } from "@truedat/core/services/i18nContent";
9
9
 
10
10
  const DynamicFormViewer = React.lazy(() =>
@@ -13,7 +13,7 @@ const DynamicFormViewer = React.lazy(() =>
13
13
 
14
14
  export const ConceptDetails = ({ concept }) => {
15
15
  const { locale } = useIntl();
16
- const { locales } = useLocales(false);
16
+ const { locales } = useLanguage();
17
17
 
18
18
  const defaultLang = _.flow(
19
19
  _.find({ is_default: true }),
@@ -4,7 +4,7 @@ import PropTypes from "prop-types";
4
4
  import { compose } from "redux";
5
5
  import { connect } from "react-redux";
6
6
  import { applyTemplate } from "@truedat/df/utils";
7
- import { useLocales } from "@truedat/core/hooks";
7
+ import { useLanguage } from "@truedat/core/i18n";
8
8
  import {
9
9
  splitTranslatableFields,
10
10
  formatLocales,
@@ -98,7 +98,7 @@ export const ConceptEditLoader = (props) => {
98
98
  const concept = _.prop("concept")(props);
99
99
  const { dynamic_content: propContent, name: propName, domain } = concept;
100
100
 
101
- const { locales, loading: localesLoading } = useLocales(false);
101
+ const { locales } = useLanguage();
102
102
  const { data, loading: templateLoading } = useTemplate({
103
103
  name: templateName,
104
104
  domainIds: [domain.id],
@@ -135,7 +135,7 @@ export const ConceptEditLoader = (props) => {
135
135
  return (
136
136
  <ConceptEdit
137
137
  templateLoading={templateLoading}
138
- localesLoading={localesLoading}
138
+ localesLoading={false}
139
139
  processedContent={processedContent}
140
140
  content={i18nContent}
141
141
  template={template}
@@ -1,21 +1,19 @@
1
1
  import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
+ import { LangProviderWrapper } from "@truedat/core/i18n";
3
4
  import { ConceptCompleteness } from "../ConceptCompleteness";
4
5
 
5
- jest.mock("@truedat/core/hooks", () => ({
6
- useLocales: jest.fn(() => ({
7
- loading: false,
8
- locales: [
9
- {
10
- lang: "es",
11
- id: 1,
12
- is_default: true,
13
- is_required: true,
14
- is_enabled: true,
15
- },
16
- ],
17
- })),
18
- }));
6
+ const renderOpts = {
7
+ messages: {},
8
+ };
9
+
10
+ const renderComponent = (props) =>
11
+ render(
12
+ <LangProviderWrapper langs={["es"]}>
13
+ <ConceptCompleteness {...props} />
14
+ </LangProviderWrapper>,
15
+ renderOpts
16
+ );
19
17
 
20
18
  describe("<ConceptCompleteness />", () => {
21
19
  const props = {
@@ -41,7 +39,7 @@ describe("<ConceptCompleteness />", () => {
41
39
  };
42
40
 
43
41
  it("matches the latest snapshot", () => {
44
- const { container } = render(<ConceptCompleteness {...props} />);
42
+ const { container } = renderComponent(props);
45
43
  expect(container).toMatchSnapshot();
46
44
  });
47
45
  });
@@ -1,26 +1,21 @@
1
1
  import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
+ import { LangProviderWrapper } from "@truedat/core/i18n";
3
4
  import { ConceptDetails } from "../ConceptDetails";
4
5
 
5
- jest.mock("@truedat/core/hooks", () => ({
6
- useLocales: jest.fn(() => ({
7
- loading: false,
8
- locales: [
9
- {
10
- lang: "en",
11
- id: 1,
12
- is_default: true,
13
- is_required: true,
14
- is_enabled: true,
15
- },
16
- ],
17
- })),
18
- }));
19
-
20
6
  const renderOpts = {
21
- fallback: <div>Loading</div>,
7
+ fallback: "lazy",
8
+ messages: {},
22
9
  };
23
10
 
11
+ const renderComponent = (props) =>
12
+ render(
13
+ <LangProviderWrapper langs={["es"]}>
14
+ <ConceptDetails {...props} />
15
+ </LangProviderWrapper>,
16
+ renderOpts
17
+ );
18
+
24
19
  describe("<ConceptDetails />", () => {
25
20
  const props = {
26
21
  concept: {
@@ -44,9 +39,7 @@ describe("<ConceptDetails />", () => {
44
39
  };
45
40
 
46
41
  it("matches the latest snapshot", async () => {
47
- const { container, findByText } = render(<ConceptDetails {...props} />, {
48
- ...renderOpts,
49
- });
42
+ const { container, findByText } = renderComponent(props);
50
43
 
51
44
  await findByText("field_label");
52
45
  expect(container).toMatchSnapshot();
@@ -1,6 +1,7 @@
1
- import React, { Suspense } from "react";
1
+ import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
3
  import { waitFor } from "@testing-library/react";
4
+ import { LangProviderWrapper } from "@truedat/core/i18n";
4
5
  import ConceptEdit from "../ConceptEdit";
5
6
 
6
7
  const template1 = {
@@ -27,20 +28,6 @@ const template1 = {
27
28
  };
28
29
 
29
30
  jest.mock("@truedat/core/hooks", () => ({
30
- useLocales: jest.fn(() => ({
31
- loading: false,
32
- locales: [
33
- {
34
- local_name: "es",
35
- name: "es",
36
- lang: "es",
37
- id: 1,
38
- is_default: true,
39
- is_enabled: true,
40
- is_required: true,
41
- },
42
- ],
43
- })),
44
31
  useTemplate: jest.fn(() => ({
45
32
  loading: false,
46
33
  data: { template: template1 },
@@ -94,19 +81,24 @@ const concept = {
94
81
 
95
82
  const renderOpts = {
96
83
  state: { concept },
84
+ messages: {},
85
+ fallback: "lazy",
97
86
  };
98
87
 
88
+ const renderComponent = (props) =>
89
+ render(
90
+ <LangProviderWrapper langs={["es"]}>
91
+ <ConceptEdit {...props} />
92
+ </LangProviderWrapper>,
93
+ renderOpts
94
+ );
95
+
99
96
  describe("<ConceptEdit />", () => {
100
97
  const props = {
101
98
  concept,
102
99
  };
103
100
  it("matches the latest snapshot", async () => {
104
- const { container, queryByText } = render(
105
- <Suspense fallback={null}>
106
- <ConceptEdit {...props} />
107
- </Suspense>,
108
- renderOpts
109
- );
101
+ const { container, queryByText } = renderComponent(props);
110
102
  await waitFor(() => expect(queryByText(/foo_user/i)).toBeInTheDocument());
111
103
  expect(container).toMatchSnapshot();
112
104
  });
@@ -16,7 +16,7 @@ exports[`<ConceptEdit /> matches the latest snapshot 1`] = `
16
16
  <div
17
17
  class="content"
18
18
  >
19
- Edit Business Concept
19
+ concepts.header.edit
20
20
  </div>
21
21
  </h2>
22
22
  <form
@@ -26,7 +26,7 @@ exports[`<ConceptEdit /> matches the latest snapshot 1`] = `
26
26
  class="required field"
27
27
  >
28
28
  <label>
29
- Term
29
+ concepts.props.name
30
30
  </label>
31
31
  <div
32
32
  class="field"
@@ -45,7 +45,7 @@ exports[`<ConceptEdit /> matches the latest snapshot 1`] = `
45
45
  <h3
46
46
  class="ui header"
47
47
  >
48
- Template fields (only required for publishing)
48
+ concepts.form.aditional_fields
49
49
  </h3>
50
50
  <div
51
51
  class="ui segment"
@@ -83,7 +83,7 @@ exports[`<ConceptEdit /> matches the latest snapshot 1`] = `
83
83
  class="divider default text"
84
84
  role="alert"
85
85
  >
86
- Select one...
86
+ fields.dropdown.placeholder
87
87
  </div>
88
88
  <i
89
89
  aria-hidden="true"
@@ -104,7 +104,7 @@ exports[`<ConceptEdit /> matches the latest snapshot 1`] = `
104
104
  <span
105
105
  class="text"
106
106
  >
107
- No selection
107
+ selector.no.selection
108
108
  </span>
109
109
  </div>
110
110
  <div
@@ -159,12 +159,12 @@ exports[`<ConceptEdit /> matches the latest snapshot 1`] = `
159
159
  href="/"
160
160
  role="button"
161
161
  >
162
- Cancel
162
+ actions.cancel
163
163
  </a>
164
164
  <button
165
165
  class="ui primary button"
166
166
  >
167
- Update
167
+ actions.update
168
168
  </button>
169
169
  </div>
170
170
  </div>