@k-int/stripes-kint-components 5.28.2 → 5.28.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 +14 -0
- package/es/lib/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js +5 -3
- package/es/lib/utils/parseErrorResponse.js +4 -2
- package/package.json +1 -1
- package/src/lib/Settings/hooks/staticSettingsPages/useSettingsSectionInitalValues/useSettingsSectionInitalValues.js +5 -4
- package/src/lib/utils/parseErrorResponse.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [5.28.4](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.28.3...v5.28.4) (2025-11-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **useSettingsSectionInitalValues:** Fixed issue where static sections initialValues were not taking default values into account ([dd5ff16](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/commit/dd5ff162d3ce0fd478b2d4c3328ab99bb4d9b071))
|
|
7
|
+
|
|
8
|
+
## [5.28.3](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.28.2...v5.28.3) (2025-11-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **parseErrorResponse:** Ensure when headers aren't present that we still attempt to resolve an error type (default to application/text) ([fa134d8](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/commit/fa134d8224381bf6cdf3e4bf53d8d0a575c9f541))
|
|
14
|
+
|
|
1
15
|
## [5.28.2](https://gitlab.com/knowledge-integration/folio/stripes-kint-components/compare/v5.28.1...v5.28.2) (2025-10-29)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -12,17 +12,19 @@ const useSettingsSectionInitalValues = _ref => {
|
|
|
12
12
|
const initialValues = (0, _react.useMemo)(() => {
|
|
13
13
|
const settingsKeyValue = rawSettings.map(setting => {
|
|
14
14
|
const {
|
|
15
|
+
defValue,
|
|
15
16
|
key,
|
|
16
17
|
value,
|
|
17
18
|
settingType
|
|
18
19
|
} = setting;
|
|
20
|
+
const valueToParse = value !== null && value !== void 0 ? value : defValue;
|
|
19
21
|
let parsedValue;
|
|
20
22
|
if (settingType === 'Boolean') {
|
|
21
|
-
parsedValue =
|
|
23
|
+
parsedValue = valueToParse === 'true';
|
|
22
24
|
} else if (settingType === 'Integer') {
|
|
23
|
-
parsedValue = Number(
|
|
25
|
+
parsedValue = Number(valueToParse);
|
|
24
26
|
} else {
|
|
25
|
-
parsedValue =
|
|
27
|
+
parsedValue = valueToParse;
|
|
26
28
|
}
|
|
27
29
|
return [key, parsedValue];
|
|
28
30
|
});
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
const parseErrorResponse = async responseObj => {
|
|
8
|
-
var _ref;
|
|
8
|
+
var _find$, _ref, _responseObj$headers;
|
|
9
9
|
let errorResp = {
|
|
10
10
|
message: 'something went wrong'
|
|
11
11
|
};
|
|
@@ -13,7 +13,9 @@ const parseErrorResponse = async responseObj => {
|
|
|
13
13
|
return errorResp;
|
|
14
14
|
}
|
|
15
15
|
const code = responseObj === null || responseObj === void 0 ? void 0 : responseObj.status;
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
// Assume text if we can't find content type
|
|
18
|
+
const contentType = (_find$ = (_ref = [...((_responseObj$headers = responseObj === null || responseObj === void 0 ? void 0 : responseObj.headers) !== null && _responseObj$headers !== void 0 ? _responseObj$headers : [])]) === null || _ref === void 0 || (_ref = _ref.find(header => header[0] === 'content-type')) === null || _ref === void 0 ? void 0 : _ref[1]) !== null && _find$ !== void 0 ? _find$ : 'application/text';
|
|
17
19
|
if (contentType.includes('json')) {
|
|
18
20
|
errorResp = await responseObj.json();
|
|
19
21
|
} else {
|
package/package.json
CHANGED
|
@@ -5,14 +5,15 @@ const useSettingsSectionInitalValues = ({
|
|
|
5
5
|
}) => {
|
|
6
6
|
const initialValues = useMemo(() => {
|
|
7
7
|
const settingsKeyValue = rawSettings.map(setting => {
|
|
8
|
-
const { key, value, settingType } = setting;
|
|
8
|
+
const { defValue, key, value, settingType } = setting;
|
|
9
|
+
const valueToParse = value ?? defValue;
|
|
9
10
|
let parsedValue;
|
|
10
11
|
if (settingType === 'Boolean') {
|
|
11
|
-
parsedValue =
|
|
12
|
+
parsedValue = valueToParse === 'true';
|
|
12
13
|
} else if (settingType === 'Integer') {
|
|
13
|
-
parsedValue = Number(
|
|
14
|
+
parsedValue = Number(valueToParse);
|
|
14
15
|
} else {
|
|
15
|
-
parsedValue =
|
|
16
|
+
parsedValue = valueToParse;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
return [key, parsedValue];
|
|
@@ -4,7 +4,9 @@ const parseErrorResponse = async (responseObj) => {
|
|
|
4
4
|
return errorResp;
|
|
5
5
|
}
|
|
6
6
|
const code = responseObj?.status;
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
// Assume text if we can't find content type
|
|
9
|
+
const contentType = [...(responseObj?.headers ?? [])]?.find(header => header[0] === 'content-type')?.[1] ?? 'application/text';
|
|
8
10
|
|
|
9
11
|
if (contentType.includes('json')) {
|
|
10
12
|
errorResp = await responseObj.json();
|