@truedat/cx 4.31.7 → 4.33.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.32.0] 2021-11-08
4
+
5
+ ### Added
6
+
7
+ - [TD-4099] Add source events subscriptions
8
+
3
9
  ## [4.30.0] 2021-10-06
4
10
 
5
11
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/cx",
3
- "version": "4.31.7",
3
+ "version": "4.33.1",
4
4
  "description": "Truedat Web Connectors",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -31,7 +31,7 @@
31
31
  "@babel/plugin-transform-modules-commonjs": "^7.15.0",
32
32
  "@babel/preset-env": "^7.15.0",
33
33
  "@babel/preset-react": "^7.14.5",
34
- "@truedat/test": "4.31.7",
34
+ "@truedat/test": "4.33.1",
35
35
  "babel-jest": "^27.0.6",
36
36
  "babel-plugin-dynamic-import-node": "^2.3.3",
37
37
  "babel-plugin-lodash": "^3.3.4",
@@ -83,7 +83,7 @@
83
83
  ]
84
84
  },
85
85
  "dependencies": {
86
- "@truedat/core": "4.31.7",
86
+ "@truedat/core": "4.33.1",
87
87
  "lodash": "^4.17.21",
88
88
  "path-to-regexp": "^1.7.0",
89
89
  "prop-types": "^15.7.2",
@@ -100,5 +100,5 @@
100
100
  "react-dom": ">= 16.8.6 < 17",
101
101
  "semantic-ui-react": ">= 0.88.2 < 2.1"
102
102
  },
103
- "gitHead": "eb71852427257eba949ffcf6c9b3cd62d7c4c466"
103
+ "gitHead": "0fda4a132dfb5e386ad02d6e6a2ac3cfa58bc1ba"
104
104
  }
@@ -46,6 +46,7 @@ export default {
46
46
  "source.config.label": "Configuration",
47
47
  "source.props.external_id": "External id",
48
48
  "source.search.no_results": "No sources found",
49
+ "source.search.placeholder": "Select Source",
49
50
  "sources.actions.activate.tooltip": "Activate",
50
51
  "sources.actions.deactivate.tooltip": "Deactivate",
51
52
  "sources.actions.create": "New Source",
@@ -60,5 +61,5 @@ export default {
60
61
  "type.selector.label": "Type",
61
62
  "type.selector.placeholder": "Source type (template)",
62
63
  vault_error: "Vault error: {text}",
63
- "source.deactivated": "Deactivated"
64
+ "source.deactivated": "Deactivated",
64
65
  };
@@ -46,6 +46,7 @@ export default {
46
46
  "source.config.label": "Configuración",
47
47
  "source.props.external_id": "External id",
48
48
  "source.search.no_results": "No se han encontrado orígenes",
49
+ "source.search.placeholder": "Seleccionar origen",
49
50
  "sources.actions.activate.tooltip": "Activar",
50
51
  "sources.actions.deactivate.tooltip": "Desactivar",
51
52
  "sources.actions.create": "Nuevo origen",
@@ -60,5 +61,5 @@ export default {
60
61
  "type.selector.label": "Tipo",
61
62
  "type.selector.placeholder": "Tipo de origen (plantilla)",
62
63
  vault_error: "Error en Vault: {text}",
63
- "source.deactivated": "Desactivado"
64
+ "source.deactivated": "Desactivado",
64
65
  };
@@ -0,0 +1,62 @@
1
+ import _ from "lodash/fp";
2
+ import React from "react";
3
+ import PropTypes from "prop-types";
4
+ import { connect } from "react-redux";
5
+ import { useIntl } from "react-intl";
6
+ import { Form } from "semantic-ui-react";
7
+
8
+ const SourcesLoader = React.lazy(() =>
9
+ import("@truedat/cx/sources/components/SourcesLoader")
10
+ );
11
+
12
+ export const SourceSelector = ({
13
+ value,
14
+ onChange,
15
+ onBlur,
16
+ error,
17
+ disabled,
18
+ sources,
19
+ }) => {
20
+ const { formatMessage } = useIntl();
21
+ const options = _.flow(
22
+ _.orderBy([({ name }) => name.toLowerCase()], ["asc"]),
23
+ _.map(({ name: text, id: key }) => ({
24
+ key,
25
+ value: key,
26
+ text,
27
+ }))
28
+ )(sources);
29
+ return (
30
+ <>
31
+ <SourcesLoader />
32
+ <Form.Dropdown
33
+ disabled={disabled}
34
+ error={error}
35
+ onBlur={onBlur}
36
+ placeholder={formatMessage({ id: "source.search.placeholder" })}
37
+ search
38
+ selection
39
+ options={options}
40
+ onChange={onChange}
41
+ value={value}
42
+ />
43
+ </>
44
+ );
45
+ };
46
+
47
+ SourceSelector.propTypes = {
48
+ onChange: PropTypes.func.isRequired,
49
+ value: PropTypes.string,
50
+ onBlur: PropTypes.func,
51
+ error: PropTypes.bool,
52
+ disabled: PropTypes.bool,
53
+ sources: PropTypes.array,
54
+ };
55
+
56
+ const mapStateToProps = ({ sources }) => ({
57
+ sources: _.map((source) => ({ name: source.external_id, id: source.id }))(
58
+ sources
59
+ ),
60
+ });
61
+
62
+ export default connect(mapStateToProps)(SourceSelector);