@truedat/ai 6.12.4 → 6.12.6

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/ai",
3
- "version": "6.12.4",
3
+ "version": "6.12.6",
4
4
  "description": "Truedat Web Artificial Intelligence package",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -84,7 +84,7 @@
84
84
  ]
85
85
  },
86
86
  "dependencies": {
87
- "@truedat/core": "6.12.4",
87
+ "@truedat/core": "6.12.6",
88
88
  "prop-types": "^15.8.1",
89
89
  "react-hook-form": "^7.45.4",
90
90
  "react-intl": "^5.20.10",
@@ -97,5 +97,5 @@
97
97
  "react-dom": ">= 16.8.6 < 17",
98
98
  "semantic-ui-react": ">= 2.0.3 < 2.2"
99
99
  },
100
- "gitHead": "0d67a012c6b0337f9c82db464137cf76062cbd81"
100
+ "gitHead": "6ee7f5e8767d2149347997223377f91f0164ee34"
101
101
  }
@@ -74,19 +74,23 @@ export default function SuggestionsWidget({
74
74
  });
75
75
  };
76
76
  const handleApplySuggestions = () => {
77
- const parsedSuggestions = _.flow(
77
+ _.flow(
78
78
  _.pick(selectedSuggestions),
79
79
  _.toPairs,
80
80
  _.map(([key, value]) => [
81
81
  key,
82
- fieldTypes[key] === "enriched_text"
83
- ? toEnrichedTextFormat(value)
84
- : value,
82
+ {
83
+ value:
84
+ fieldTypes[key] === "enriched_text"
85
+ ? toEnrichedTextFormat(value)
86
+ : value,
87
+ origin: "ai",
88
+ },
85
89
  ]),
86
- _.fromPairs
90
+ _.fromPairs,
91
+ applySuggestions
87
92
  )(suggestions);
88
93
 
89
- applySuggestions(parsedSuggestions);
90
94
  setSelectedSuggestions([]);
91
95
  setSuggestions(null);
92
96
  };
@@ -109,7 +109,9 @@ describe("<SuggestionsWidget />", () => {
109
109
  ).not.toBeInTheDocument()
110
110
  );
111
111
  expect(applySuggestions).toHaveBeenCalledWith(
112
- expect.objectContaining({ editable_field: "editable_field_value" })
112
+ expect.objectContaining({
113
+ editable_field: { origin: "ai", value: "editable_field_value" },
114
+ })
113
115
  );
114
116
 
115
117
  expect(container).toMatchSnapshot();