@visns-studio/visns-components 2.8.2 → 2.8.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.
@@ -143,7 +143,7 @@ const Login = ({ logo, providers, setSystemAuth, setUserProfile }) => {
143
143
  <div className="formItem fwItem">
144
144
  <label className="fi__label">
145
145
  <input
146
- type="email"
146
+ type="text"
147
147
  name="email"
148
148
  value={auth.email}
149
149
  onChange={handleChange}
@@ -90,24 +90,32 @@ function GenericDetail({ setting, urlParam, userProfile }) {
90
90
 
91
91
  const getValueFromData = (data, path, id) => {
92
92
  let value =
93
- path.reduce(
94
- (result, key) =>
95
- result
96
- ? Array.isArray(result[key])
97
- ? result[key][0]
98
- : result[key]
99
- : '',
100
- data
101
- ) ?? '';
93
+ path.reduce((result, key) => (result ? result[key] : ''), data) ??
94
+ '';
95
+
96
+ if (path[0] && path[0] === 'insurance_types') {
97
+ console.info(value);
98
+ }
102
99
 
103
100
  if (value) {
104
- if (Array.isArray(id)) {
105
- return id.map((key) => value[key]).join(' ');
101
+ if (Array.isArray(value)) {
102
+ return value
103
+ .filter((item) => item[id]) // Filter out items without the specified id
104
+ .map((item) => item[id]) // Extract the id from each item
105
+ .join(', ');
106
106
  } else {
107
- return value[id];
107
+ if (Array.isArray(id)) {
108
+ return id.map((key) => value[key]).join(' ');
109
+ } else {
110
+ return value[id];
111
+ }
108
112
  }
109
113
  } else {
110
- return data[id] || '';
114
+ if (path.length > 0) {
115
+ return '';
116
+ } else {
117
+ return data[id] || '';
118
+ }
111
119
  }
112
120
  };
113
121
 
@@ -118,7 +126,15 @@ function GenericDetail({ setting, urlParam, userProfile }) {
118
126
  };
119
127
 
120
128
  const renderValue = (item, data) => {
121
- const { type, id, relation, relationKey, size, truncateLength } = item;
129
+ const {
130
+ type,
131
+ id,
132
+ options,
133
+ relation,
134
+ relationKey,
135
+ size,
136
+ truncateLength,
137
+ } = item;
122
138
  const value =
123
139
  relation && relation.length > 0
124
140
  ? getValueFromData(data, [...relation], id)
@@ -190,6 +206,8 @@ function GenericDetail({ setting, urlParam, userProfile }) {
190
206
 
191
207
  const renderLatestNotes = () => formatNoteValue();
192
208
 
209
+ const renderOptions = () => (options ? options[value] : '');
210
+
193
211
  const renderRichText = () => {
194
212
  if (!truncatedValue) {
195
213
  return null;
@@ -224,6 +242,8 @@ function GenericDetail({ setting, urlParam, userProfile }) {
224
242
  return renderJson();
225
243
  case 'latest_notes':
226
244
  return renderLatestNotes();
245
+ case 'options':
246
+ return renderOptions();
227
247
  case 'richtext':
228
248
  return renderRichText();
229
249
  case 'total':
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "akar-icons": "^1.9.30",
6
6
  "array-move": "^4.0.0",
7
7
  "awesome-debounce-promise": "^2.1.0",
8
- "axios": "^1.6.1",
8
+ "axios": "^1.6.2",
9
9
  "framer-motion": "^10.16.5",
10
10
  "html-react-parser": "^5.0.6",
11
11
  "lodash": "^4.17.21",
@@ -33,7 +33,7 @@
33
33
  "reactjs-popup": "^2.0.6",
34
34
  "truncate": "^3.0.0",
35
35
  "validator": "^13.11.0",
36
- "yarn": "^1.22.19"
36
+ "yarn": "^1.22.21"
37
37
  },
38
38
  "devDependecies": {
39
39
  "react": "^18.2.0",
@@ -44,7 +44,7 @@
44
44
  "react-dom": "^17.0.1"
45
45
  },
46
46
  "name": "@visns-studio/visns-components",
47
- "version": "2.8.2",
47
+ "version": "2.8.4",
48
48
  "description": "Various packages to assist in the development of our Custom Applications.",
49
49
  "main": "index.js",
50
50
  "scripts": {