@k-int/stripes-kint-components 2.8.1 → 2.8.3

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.
Files changed (168) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es/index.js +6 -0
  3. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +5 -3
  4. package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +3 -1
  5. package/es/lib/EditableRefdataList/EditableRefdataList.js +3 -1
  6. package/es/lib/utils/index.js +8 -0
  7. package/es/lib/utils/parseErrorResponse.js +91 -0
  8. package/junit.xml +157 -656
  9. package/package.json +1 -1
  10. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +56 -8
  11. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +394 -64
  12. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +10 -10
  13. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +1 -1
  14. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesLookup.js.html +187 -52
  15. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html +372 -87
  16. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +293 -74
  17. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyView.js.html +126 -54
  18. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +45 -60
  19. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.js.html +1 -1
  20. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEdit.js.html +23 -5
  21. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +59 -47
  22. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesListField.js.html +259 -97
  23. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyField.js.html +399 -105
  24. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyFormCard.js.html +41 -68
  25. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.html +57 -57
  26. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.js.html +1 -1
  27. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/testResources.js.html +67 -688
  28. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilter.js.html +92 -53
  29. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterField.js.html +103 -64
  30. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +54 -63
  31. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +49 -16
  32. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesRule.js.html +69 -18
  33. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.html +89 -89
  34. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.js.html +1 -1
  35. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/testResources.js.html +33 -786
  36. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useOperators.js.html +46 -46
  37. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useParseActiveFilterStrings.js.html +45 -36
  38. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useValueProps.js.html +43 -28
  39. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesView.js.html +20 -2
  40. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesViewCtx.js.html +50 -41
  41. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertyCard.js.html +54 -75
  42. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.html +24 -24
  43. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.js.html +1 -1
  44. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/testResources.js.html +1 -1
  45. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.html +1 -1
  46. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.js.html +1 -1
  47. package/src/artifacts/coverage-jest/lcov-report/{hooks/useAvailableCustomProperties.js.html → CycleButton/CycleButton.js.html} +62 -50
  48. package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.html +131 -0
  49. package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.js.html +88 -0
  50. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +664 -0
  51. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.html +131 -0
  52. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.js.html +88 -0
  53. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +264 -39
  54. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +9 -9
  55. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
  56. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +41 -14
  57. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +45 -6
  58. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +47 -11
  59. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +65 -14
  60. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +154 -31
  61. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +26 -26
  62. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +1 -1
  63. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +18 -18
  64. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +1 -1
  65. package/src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html +35 -17
  66. package/src/artifacts/coverage-jest/lcov-report/FormModal/index.html +15 -15
  67. package/src/artifacts/coverage-jest/lcov-report/FormModal/index.js.html +1 -1
  68. package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/FormattedKintMessage.js.html +247 -0
  69. package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.html +131 -0
  70. package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.js.html +88 -0
  71. package/src/artifacts/coverage-jest/lcov-report/{CustomProperties/Config/CustomPropertiesView.js.html → IconSelect/IconSelect.js.html} +158 -257
  72. package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.html +131 -0
  73. package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.js.html +88 -0
  74. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +48 -6
  75. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +7 -7
  76. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +1 -1
  77. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +1 -1
  78. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +1 -1
  79. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +1 -1
  80. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +3 -3
  81. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +1 -1
  82. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +1 -1
  83. package/src/artifacts/coverage-jest/lcov-report/{CustomProperties/Config/testResources.js.html → RichSelect/RichSelect.js.html} +256 -334
  84. package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.html +146 -0
  85. package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.js.html +91 -0
  86. package/src/artifacts/coverage-jest/lcov-report/RichSelect/useSelectedOption.js.html +127 -0
  87. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +52 -7
  88. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/TableBody.js.html +31 -4
  89. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.html +3 -3
  90. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.js.html +1 -1
  91. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +7 -7
  92. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +1 -1
  93. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +1 -1
  94. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +1 -1
  95. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +1 -1
  96. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +1 -1
  97. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +1 -1
  98. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +1 -1
  99. package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +1 -1
  100. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +1 -1
  101. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +1 -1
  102. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +24 -27
  103. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +47 -17
  104. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +22 -22
  105. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +1 -1
  106. package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +1 -1
  107. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +1 -1
  108. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
  109. package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +1 -1
  110. package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +1 -1
  111. package/src/artifacts/coverage-jest/lcov-report/constants/index.html +1 -1
  112. package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +2 -2
  113. package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +1 -1
  114. package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +1 -1
  115. package/src/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
  116. package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +142 -97
  117. package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +13 -4
  118. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +35 -20
  119. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +5 -2
  120. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useAppSettings.js.html +7 -7
  121. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +7 -7
  122. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +61 -22
  123. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +1 -1
  124. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +1 -1
  125. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +1 -1
  126. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +1 -1
  127. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
  128. package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +7 -7
  129. package/src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html +19 -22
  130. package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +7 -7
  131. package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKey.js.html +151 -0
  132. package/src/artifacts/coverage-jest/lcov-report/{utils/renderHelpText.js.html → hooks/useIntlKeyStore.js.html} +71 -38
  133. package/src/artifacts/coverage-jest/lcov-report/hooks/useInvalidateRefdata.js.html +7 -7
  134. package/src/artifacts/coverage-jest/lcov-report/hooks/useKintIntl.js.html +238 -0
  135. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +7 -7
  136. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +9 -9
  137. package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +7 -7
  138. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html +23 -11
  139. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataCategory.js.html +274 -0
  140. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +19 -10
  141. package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +7 -7
  142. package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +9 -9
  143. package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +7 -7
  144. package/src/artifacts/coverage-jest/lcov-report/index.html +205 -130
  145. package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
  146. package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +1 -1
  147. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +2 -2
  148. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +2 -2
  149. package/src/artifacts/coverage-jest/lcov-report/utils/groupCustomPropertiesByCtx.js.html +7 -7
  150. package/src/artifacts/coverage-jest/lcov-report/utils/highlightString.js.html +3 -3
  151. package/src/artifacts/coverage-jest/lcov-report/utils/index.html +34 -34
  152. package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +42 -3
  153. package/src/artifacts/coverage-jest/lcov-report/utils/matchString.js.html +2 -2
  154. package/src/artifacts/coverage-jest/lcov-report/utils/parseErrorResponse.js.html +139 -0
  155. package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +5 -2
  156. package/src/artifacts/coverage-jest/lcov-report/utils/refdataQueryKey.js.html +2 -2
  157. package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +2 -2
  158. package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +2 -2
  159. package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +2 -2
  160. package/src/artifacts/coverage-jest/lcov-report/utils/typedownQueryKey.js.html +2 -2
  161. package/src/artifacts/coverage-jest/lcov-report/utils/validators.js.html +128 -80
  162. package/src/artifacts/coverage-jest/lcov.info +2603 -2086
  163. package/src/index.js +1 -0
  164. package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +4 -2
  165. package/src/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +2 -1
  166. package/src/lib/EditableRefdataList/EditableRefdataList.js +2 -1
  167. package/src/lib/utils/index.js +3 -0
  168. package/src/lib/utils/parseErrorResponse.js +18 -0
package/src/index.js CHANGED
@@ -29,6 +29,7 @@ export {
29
29
  refdataQueryKey,
30
30
  selectorSafe,
31
31
  typedownQueryKey,
32
+ parseErrorResponse,
32
33
  } from './lib/utils';
33
34
 
34
35
  // Validators (Some/all copied from stripes-erm-components but this gives another way to acquire them)
@@ -15,6 +15,7 @@ import CustomPropertiesLookup from './CustomPropertiesLookup';
15
15
  import CustomPropertyView from './CustomPropertyView';
16
16
  import CustomPropertiesForm from './CustomPropertyForm';
17
17
  import { useMutateCustomProperties, useRefdata } from '../../hooks';
18
+ import { parseErrorResponse } from '../../utils';
18
19
 
19
20
  const EDITING = 'edit';
20
21
  const CREATING = 'create';
@@ -99,7 +100,8 @@ const CustomPropertiesSettings = ({
99
100
  // Default delete behaviour is to fire a callout, either with kint-components default message
100
101
  // or one provided in labelOverrides, which is passed the error message and customProperty in question
101
102
  delete: async (err) => {
102
- const errorResp = await err.response.json();
103
+ const errorResp = await parseErrorResponse(err.response);
104
+
103
105
  callout.sendCallout({
104
106
  message: labelOverrides?.deleteError ? labelOverrides.deleteError(errorResp?.message, customProperty) : (
105
107
  <FormattedMessage
@@ -122,7 +124,7 @@ const CustomPropertiesSettings = ({
122
124
  const handeContextSubmit = (submitData) => {
123
125
  return {
124
126
  ...submitData,
125
- ctx: submitData?.ctx?.[0]?.value
127
+ ctx: submitData?.ctx?.[0]?.value ?? ''
126
128
  };
127
129
  };
128
130
 
@@ -9,6 +9,7 @@ import { useMutateRefdataCategory, useRefdata } from '../hooks';
9
9
 
10
10
  import ActionList from '../ActionList';
11
11
  import { required } from '../utils/validators';
12
+ import { parseErrorResponse } from '../utils';
12
13
 
13
14
  const propTypes = {
14
15
  afterQueryCalls: PropTypes.object,
@@ -70,7 +71,7 @@ const EditableRefdataCategoryList = ({
70
71
  // Default delete behaviour is to fire a callout, either with kint-components default message
71
72
  // or one provided in labelOverrides, which is passed the error message and refdata in question
72
73
  delete: async (err) => {
73
- const errorResp = await err.response.json();
74
+ const errorResp = await parseErrorResponse(err.response);
74
75
  callout.sendCallout({
75
76
  message: labelOverrides?.deleteError ? labelOverrides.deleteError(errorResp?.message, deleteModal?.refdata) : (
76
77
  <FormattedMessage
@@ -9,6 +9,7 @@ import { useMutateRefdataValue, useRefdata } from '../hooks';
9
9
 
10
10
  import ActionList from '../ActionList';
11
11
  import { required } from '../utils/validators';
12
+ import { parseErrorResponse } from '../utils';
12
13
 
13
14
  const propTypes = {
14
15
  afterQueryCalls: PropTypes.object,
@@ -75,7 +76,7 @@ const EditableRefdataList = ({
75
76
  // Default delete behaviour is to fire a callout, either with kint-components default message
76
77
  // or one provided in labelOverrides, which is passed the error message and refdata in question
77
78
  delete: async (err) => {
78
- const errorResp = await err.response.json();
79
+ const errorResp = await parseErrorResponse(err.response);
79
80
  callout.sendCallout({
80
81
  message: labelOverrides?.deleteError ? labelOverrides.deleteError(errorResp?.message, deleteModal?.refdata) : (
81
82
  <FormattedMessage
@@ -19,3 +19,6 @@ export { default as toCamelCase } from './toCamelCase'; // I hate that this exis
19
19
 
20
20
  export { default as matchString } from './matchString';
21
21
  export { boldString, highlightString } from './highlightString';
22
+
23
+ // HTTP Utils
24
+ export { default as parseErrorResponse } from './parseErrorResponse';
@@ -0,0 +1,18 @@
1
+ const parseErrorResponse = async (responseObj) => {
2
+ let errorResp;
3
+ const contentType = [...responseObj?.headers]?.find(header => header[0] === 'content-type')?.[1];
4
+
5
+ if (contentType.includes('json')) {
6
+ errorResp = await responseObj.json();
7
+ } else {
8
+ try {
9
+ errorResp = { message: await responseObj.text() };
10
+ } catch {
11
+ errorResp = { message: "something went wrong" };
12
+ }
13
+ }
14
+
15
+ return errorResp;
16
+ };
17
+
18
+ export default parseErrorResponse;