orc-shared 5.8.0-dev.8 → 5.8.0

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 (309) hide show
  1. package/dist/actions/applications.js +5 -5
  2. package/dist/actions/authentication.js +5 -5
  3. package/dist/actions/countries.js +5 -5
  4. package/dist/actions/locale.js +5 -5
  5. package/dist/actions/makeApiAction.js +7 -7
  6. package/dist/actions/makeOrcApiAction.js +2 -2
  7. package/dist/actions/metadata.js +7 -7
  8. package/dist/actions/navigation.js +2 -2
  9. package/dist/actions/scopes.js +5 -5
  10. package/dist/actions/tasks.js +5 -5
  11. package/dist/actions/timezones.js +5 -5
  12. package/dist/actions/versionInfo.js +5 -5
  13. package/dist/buildStore.js +4 -4
  14. package/dist/components/AppFrame/About.js +9 -9
  15. package/dist/components/AppFrame/Anchor.js +1 -1
  16. package/dist/components/AppFrame/AppFrame.js +6 -6
  17. package/dist/components/AppFrame/ApplicationSelector/ApplicationDialog.js +1 -1
  18. package/dist/components/AppFrame/ApplicationSelector/Header.js +4 -4
  19. package/dist/components/AppFrame/ApplicationSelector/index.js +3 -3
  20. package/dist/components/AppFrame/ConnectedToastList.js +2 -2
  21. package/dist/components/AppFrame/Help.js +1 -1
  22. package/dist/components/AppFrame/MenuItem.js +6 -6
  23. package/dist/components/AppFrame/Preferences.js +7 -7
  24. package/dist/components/AppFrame/Sidebar.js +5 -5
  25. package/dist/components/AppFrame/Topbar.js +3 -3
  26. package/dist/components/AppFrame/index.js +2 -2
  27. package/dist/components/ApplicationModuleLoader.js +5 -5
  28. package/dist/components/Authenticate.js +2 -2
  29. package/dist/components/Button.js +1 -1
  30. package/dist/components/CategoryList.js +6 -6
  31. package/dist/components/Checkbox.js +5 -5
  32. package/dist/components/ColumnWrapper.js +1 -1
  33. package/dist/components/Culture.js +1 -1
  34. package/dist/components/DevPages.js +1 -1
  35. package/dist/components/DropMenu/Menu.js +2 -2
  36. package/dist/components/DropMenu/index.js +5 -5
  37. package/dist/components/ErrorPlaceholder.js +4 -4
  38. package/dist/components/Form/Combination.js +2 -2
  39. package/dist/components/Form/Field.js +3 -3
  40. package/dist/components/Form/FieldElements.js +4 -4
  41. package/dist/components/Form/FieldList.js +6 -6
  42. package/dist/components/Form/Fieldset.js +1 -1
  43. package/dist/components/Form/Form.js +2 -2
  44. package/dist/components/Form/FormElement.js +1 -1
  45. package/dist/components/Form/InputField.js +10 -10
  46. package/dist/components/Form/Inputs/Button.js +4 -4
  47. package/dist/components/Form/Inputs/Date.js +4 -4
  48. package/dist/components/Form/Inputs/FieldButtons.js +2 -2
  49. package/dist/components/Form/Inputs/Number.js +4 -4
  50. package/dist/components/Form/Inputs/ReadOnly.js +1 -1
  51. package/dist/components/Form/Inputs/SmallButton.js +4 -4
  52. package/dist/components/Form/Inputs/Text.js +4 -4
  53. package/dist/components/Form/Inputs/Time.js +4 -4
  54. package/dist/components/Form/Inputs/Toggles.js +4 -4
  55. package/dist/components/Form/Inputs/Translation.js +11 -11
  56. package/dist/components/Form/Inputs/index.js +1 -1
  57. package/dist/components/Form/index.js +2 -2
  58. package/dist/components/I18n.js +2 -2
  59. package/dist/components/Icon.js +3 -3
  60. package/dist/components/IconButton.js +3 -3
  61. package/dist/components/Input.js +5 -5
  62. package/dist/components/InternetExplorerWarningMessage.js +1 -1
  63. package/dist/components/List/DataCell.js +2 -2
  64. package/dist/components/List/HeadCell.js +2 -2
  65. package/dist/components/List/HeadRow.js +1 -1
  66. package/dist/components/List/List.js +5 -5
  67. package/dist/components/List/Row.js +2 -2
  68. package/dist/components/List/enhanceColumnDefs.js +2 -2
  69. package/dist/components/List/index.js +2 -2
  70. package/dist/components/Loader.js +6 -6
  71. package/dist/components/LoadingIcon.js +2 -2
  72. package/dist/components/MaterialUI/DataDisplay/Badge.js +4 -4
  73. package/dist/components/MaterialUI/DataDisplay/Chip.js +2 -2
  74. package/dist/components/MaterialUI/DataDisplay/CollapsableList.js +6 -6
  75. package/dist/components/MaterialUI/DataDisplay/Divider.js +2 -2
  76. package/dist/components/MaterialUI/DataDisplay/Icon.js +4 -4
  77. package/dist/components/MaterialUI/DataDisplay/List.js +1 -1
  78. package/dist/components/MaterialUI/DataDisplay/Modal.js +4 -4
  79. package/dist/components/MaterialUI/DataDisplay/Notification.js +8 -8
  80. package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +6 -6
  81. package/dist/components/MaterialUI/DataDisplay/PopperedElements/PopperedIcon.js +2 -2
  82. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ActionModal.js +1 -1
  83. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Address.js +2 -2
  84. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ConfirmationModal.js +1 -1
  85. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/DiscountedPrice.js +1 -1
  86. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +1 -1
  87. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +3 -3
  88. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +4 -4
  89. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +1 -1
  90. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionTitle.js +1 -1
  91. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +28 -12
  92. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
  93. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +9 -9
  94. package/dist/components/MaterialUI/DataDisplay/SelectionList.js +17 -25
  95. package/dist/components/MaterialUI/DataDisplay/Table.js +9 -9
  96. package/dist/components/MaterialUI/DataDisplay/TableHeaderCell.js +1 -1
  97. package/dist/components/MaterialUI/DataDisplay/TableProps.js +6 -6
  98. package/dist/components/MaterialUI/DataDisplay/Timeline.js +1 -1
  99. package/dist/components/MaterialUI/DataDisplay/TimelineItem.js +1 -1
  100. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +7 -7
  101. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedIcon.js +4 -4
  102. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedTypography.js +2 -2
  103. package/dist/components/MaterialUI/DataDisplay/TransferList.js +9 -9
  104. package/dist/components/MaterialUI/DataDisplay/chipProps.js +6 -6
  105. package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +6 -6
  106. package/dist/components/MaterialUI/DataDisplay/dividerProps.js +6 -6
  107. package/dist/components/MaterialUI/DataDisplay/index.js +1 -1
  108. package/dist/components/MaterialUI/DataDisplay/modalProps.js +6 -6
  109. package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +9 -5
  110. package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +6 -6
  111. package/dist/components/MaterialUI/Feedback/NotificationContext.js +6 -6
  112. package/dist/components/MaterialUI/Feedback/loadingScreen.js +6 -6
  113. package/dist/components/MaterialUI/Inputs/Autocomplete.js +5 -5
  114. package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +6 -6
  115. package/dist/components/MaterialUI/Inputs/Checkbox.js +4 -4
  116. package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +4 -4
  117. package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +6 -6
  118. package/dist/components/MaterialUI/Inputs/CheckboxProps.js +6 -6
  119. package/dist/components/MaterialUI/Inputs/DatePicker.js +15 -16
  120. package/dist/components/MaterialUI/Inputs/InputBase.js +11 -11
  121. package/dist/components/MaterialUI/Inputs/InputBaseProps.js +6 -6
  122. package/dist/components/MaterialUI/Inputs/LookupSelect.js +3 -3
  123. package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +2 -2
  124. package/dist/components/MaterialUI/Inputs/PredefinedElements/TitledSelect.js +1 -1
  125. package/dist/components/MaterialUI/Inputs/Radio.js +4 -3
  126. package/dist/components/MaterialUI/Inputs/RadioProps.js +6 -6
  127. package/dist/components/MaterialUI/Inputs/Select.js +23 -10
  128. package/dist/components/MaterialUI/Inputs/SelectProps.js +8 -7
  129. package/dist/components/MaterialUI/Inputs/StandaloneRadio.js +4 -4
  130. package/dist/components/MaterialUI/Inputs/Switch.js +32 -20
  131. package/dist/components/MaterialUI/Inputs/SwitchProps.js +6 -6
  132. package/dist/components/MaterialUI/Inputs/TimePicker.js +7 -7
  133. package/dist/components/MaterialUI/Inputs/createInput.js +5 -5
  134. package/dist/components/MaterialUI/Inputs/index.js +1 -1
  135. package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +6 -6
  136. package/dist/components/MaterialUI/Navigation/DropDownMenu.js +6 -6
  137. package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +6 -6
  138. package/dist/components/MaterialUI/Navigation/ExternalLink.js +1 -1
  139. package/dist/components/MaterialUI/Navigation/PredefinedElements/ActionMenu.js +1 -1
  140. package/dist/components/MaterialUI/Navigation/TabBar.js +60 -38
  141. package/dist/components/MaterialUI/Navigation/TabLabel.js +5 -5
  142. package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -1
  143. package/dist/components/MaterialUI/ScopeSelector/ScopeTreeView.js +5 -5
  144. package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +12 -6
  145. package/dist/components/MaterialUI/Surfaces/ExpansionPanel.js +5 -5
  146. package/dist/components/MaterialUI/Surfaces/Paper.js +2 -2
  147. package/dist/components/MaterialUI/Surfaces/PredefinedElements/TitledPaper.js +1 -1
  148. package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +5 -5
  149. package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +7 -7
  150. package/dist/components/MaterialUI/Surfaces/paperProps.js +6 -6
  151. package/dist/components/MaterialUI/componentProps.js +2 -2
  152. package/dist/components/MaterialUI/hocs/withDeferredPopper.js +10 -16
  153. package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +9 -9
  154. package/dist/components/MaterialUI/muiThemes.js +2 -2
  155. package/dist/components/MaterialUI/textProps.js +6 -6
  156. package/dist/components/Modal/Background.js +1 -1
  157. package/dist/components/Modal/Dialog.js +2 -2
  158. package/dist/components/Modal/Wrapper.js +2 -2
  159. package/dist/components/Modal/index.js +6 -6
  160. package/dist/components/Modules.js +9 -9
  161. package/dist/components/MultiSelector.js +9 -9
  162. package/dist/components/Navigation/Bar.js +8 -8
  163. package/dist/components/Navigation/Tab.js +8 -8
  164. package/dist/components/Navigation/index.js +1 -1
  165. package/dist/components/Navigation/useNavigationState.js +8 -8
  166. package/dist/components/Placeholder.js +5 -5
  167. package/dist/components/Provision.js +1 -1
  168. package/dist/components/Routing/FullPage.js +1 -1
  169. package/dist/components/Routing/Page.js +7 -7
  170. package/dist/components/Routing/Segment.js +2 -2
  171. package/dist/components/Routing/SegmentPage.js +10 -10
  172. package/dist/components/Routing/SubPage.js +5 -5
  173. package/dist/components/Routing/withWaypointing.js +4 -4
  174. package/dist/components/Scope/ScopeModificationConfirmationDialog.js +1 -1
  175. package/dist/components/Scope/ScopeNode.js +6 -6
  176. package/dist/components/Scope/Selector.js +1 -1
  177. package/dist/components/Scope/index.js +8 -8
  178. package/dist/components/Scope/useScopeConfirmationModalState.js +10 -10
  179. package/dist/components/Scope/useScopeSelect.js +1 -1
  180. package/dist/components/ScopeExtendedConfigurationLoader.js +5 -5
  181. package/dist/components/Selector.js +9 -9
  182. package/dist/components/Sidepanel.js +2 -2
  183. package/dist/components/Spritesheet.js +1 -1
  184. package/dist/components/Switch.js +5 -5
  185. package/dist/components/TaskDetailsModal.js +2 -2
  186. package/dist/components/Text.js +6 -6
  187. package/dist/components/ToastList.js +9 -6
  188. package/dist/components/Toolbar.js +5 -5
  189. package/dist/components/Tooltip.js +1 -1
  190. package/dist/components/Treeview/Branch.js +1 -1
  191. package/dist/components/Treeview/Label.js +2 -2
  192. package/dist/components/Treeview/Leaf.js +1 -1
  193. package/dist/components/Treeview/Node.js +6 -6
  194. package/dist/components/Treeview/index.js +10 -10
  195. package/dist/constants.js +7 -1
  196. package/dist/getThemeOverrides.js +2 -2
  197. package/dist/hocs/withAuthentication.js +2 -2
  198. package/dist/hocs/withClickOutside.js +4 -4
  199. package/dist/hocs/withErrorBoundary.js +7 -7
  200. package/dist/hocs/withId.js +4 -4
  201. package/dist/hocs/withNavigationLink.js +5 -5
  202. package/dist/hocs/withScopeData.js +5 -5
  203. package/dist/hocs/withScrollBox.js +4 -4
  204. package/dist/hocs/withToggle.js +7 -7
  205. package/dist/hocs/withUpdateHandler.js +2 -2
  206. package/dist/hocs/withViewState.js +5 -5
  207. package/dist/hooks/useEditState.js +2 -2
  208. package/dist/hooks/useEntityLoader.js +7 -7
  209. package/dist/hooks/useFullEntityEditState.js +7 -7
  210. package/dist/hooks/useInfiniteScroll.js +4 -4
  211. package/dist/hooks/useLabelMessage.js +3 -3
  212. package/dist/hooks/useMultipleFieldEditState.js +2 -2
  213. package/dist/hooks/useNotificationRequestState.js +3 -3
  214. package/dist/hooks/useRequestState.js +1 -1
  215. package/dist/hooks/useScopeGuardLoader.js +1 -1
  216. package/dist/hooks/useSelectorAndUnwrap.js +1 -1
  217. package/dist/hooks/useToggle.js +4 -4
  218. package/dist/reducers/applications.js +1 -1
  219. package/dist/reducers/authentication.js +5 -5
  220. package/dist/reducers/countries.js +1 -1
  221. package/dist/reducers/globalErrorMessages.js +1 -1
  222. package/dist/reducers/localeFactory.js +1 -1
  223. package/dist/reducers/metadata.js +6 -6
  224. package/dist/reducers/modules.js +1 -1
  225. package/dist/reducers/navigation.js +1 -1
  226. package/dist/reducers/request.js +1 -1
  227. package/dist/reducers/requestStates.js +1 -1
  228. package/dist/reducers/scopeRouteState.js +1 -1
  229. package/dist/reducers/scopes.js +1 -1
  230. package/dist/reducers/scopesExtendedConfiguration.js +1 -1
  231. package/dist/reducers/settings.js +1 -1
  232. package/dist/reducers/tasks.js +1 -1
  233. package/dist/reducers/timezones.js +1 -1
  234. package/dist/reducers/toasts.js +1 -1
  235. package/dist/reducers/versionInfo.js +1 -1
  236. package/dist/reducers/view.js +1 -1
  237. package/dist/selectors/locale.js +1 -1
  238. package/dist/selectors/metadata.js +3 -3
  239. package/dist/selectors/modules.js +2 -2
  240. package/dist/selectors/navigation.js +1 -1
  241. package/dist/selectors/route.js +1 -1
  242. package/dist/selectors/scope.js +1 -1
  243. package/dist/selectors/tasks.js +1 -1
  244. package/dist/utils/buildUrl.js +19 -5
  245. package/dist/utils/flatten.js +6 -6
  246. package/dist/utils/index.js +1 -1
  247. package/dist/utils/inputHelper.js +14 -2
  248. package/dist/utils/logPass.js +1 -1
  249. package/dist/utils/memoize.js +1 -1
  250. package/dist/utils/modelValidationHelper.js +2 -2
  251. package/dist/utils/normalizeForSearch.js +4 -1
  252. package/dist/utils/propertyBagHelper.js +4 -4
  253. package/dist/utils/propertyHelper.js +6 -6
  254. package/dist/utils/propertyValidator.js +1 -1
  255. package/dist/utils/setTranslation.js +3 -3
  256. package/dist/utils/setTranslationWithFallback.js +3 -3
  257. package/dist/utils/stripKey.js +3 -3
  258. package/dist/utils/styledPropFuncs.js +1 -1
  259. package/dist/utils/testUtils.js +8 -5
  260. package/dist/utils/timezoneHelper.js +6 -6
  261. package/dist/utils/unwrapImmutable.js +1 -1
  262. package/dist/utils/urlHelper.js +3 -3
  263. package/dist/whyDidYouRerender.js +1 -1
  264. package/package.json +2 -2
  265. package/src/components/AppFrame/ConnectedToastList.test.js +3 -1
  266. package/src/components/DropMenu/DropMenu.test.js +2 -0
  267. package/src/components/Form/InputField.js +1 -1
  268. package/src/components/Form/InputField.test.js +1 -1
  269. package/src/components/MaterialUI/DataDisplay/Badge.js +1 -1
  270. package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +33 -6
  271. package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +202 -0
  272. package/src/components/MaterialUI/DataDisplay/SelectionList.js +6 -20
  273. package/src/components/MaterialUI/DataDisplay/SelectionList.test.js +0 -6
  274. package/src/components/MaterialUI/DataDisplay/tableHelpers.js +14 -4
  275. package/src/components/MaterialUI/Feedback/loadingScreen.test.js +1 -0
  276. package/src/components/MaterialUI/Feedback/useNotification.test.js +1 -0
  277. package/src/components/MaterialUI/Inputs/DatePicker.js +16 -4
  278. package/src/components/MaterialUI/Inputs/DatePicker.test.js +35 -1
  279. package/src/components/MaterialUI/Inputs/Radio.js +1 -1
  280. package/src/components/MaterialUI/Inputs/Radio.test.js +35 -1
  281. package/src/components/MaterialUI/Inputs/Select.js +13 -1
  282. package/src/components/MaterialUI/Inputs/Select.test.js +37 -0
  283. package/src/components/MaterialUI/Inputs/SelectProps.js +1 -0
  284. package/src/components/MaterialUI/Inputs/Switch.js +28 -6
  285. package/src/components/MaterialUI/Inputs/Switch.test.js +39 -0
  286. package/src/components/MaterialUI/Navigation/TabBar.js +55 -34
  287. package/src/components/MaterialUI/ScopeSelector/TreeItem.js +6 -2
  288. package/src/components/MaterialUI/ScopeSelector/TreeItem.test.js +39 -0
  289. package/src/components/MaterialUI/hocs/withDeferredPopper.js +1 -4
  290. package/src/components/MaterialUI/hocs/withDeferredPopper.test.js +2 -0
  291. package/src/components/Modal/Modal.test.js +3 -1
  292. package/src/components/Modal/Wrapper.test.js +3 -1
  293. package/src/components/Routing/SegmentPage.js +1 -1
  294. package/src/components/Scope/Scope.test.js +3 -1
  295. package/src/components/Sidepanel.test.js +3 -1
  296. package/src/components/ToastList.js +2 -2
  297. package/src/constants.js +5 -0
  298. package/src/hocs/withErrorBoundary.test.js +4 -3
  299. package/src/hooks/useEditState.test.js +2 -0
  300. package/src/hooks/useLabelMessage.test.js +2 -0
  301. package/src/utils/buildUrl.js +15 -0
  302. package/src/utils/buildUrl.test.js +27 -1
  303. package/src/utils/inputHelper.js +18 -2
  304. package/src/utils/inputHelper.test.js +18 -2
  305. package/src/utils/normalizeForSearch.js +2 -0
  306. package/src/utils/propertyBagHelper.js +6 -3
  307. package/src/utils/propertyHelper.js +6 -6
  308. package/src/utils/testUtils.js +25 -22
  309. package/src/utils/testUtils.test.js +4 -4
@@ -78,16 +78,13 @@ const withDeferredPopper =
78
78
  const defaultComponent = <Comp onClick={event => togglePopper(event)} {...props} />;
79
79
 
80
80
  const togglePopper = function (event) {
81
- const linkParent = event?._dispatchInstances?.filter(item => item.elementType === "a");
82
- if (linkParent) {
83
- event.preventDefault();
84
- }
85
81
  const isDisplayed = !popperState.isDisplayed;
86
82
  const anchorElement = event.currentTarget;
87
83
  setPopperState({
88
84
  isDisplayed: isDisplayed,
89
85
  anchorElement: anchorElement,
90
86
  });
87
+ event.preventDefault();
91
88
  event.bubbles = false;
92
89
  event.stopPropagation();
93
90
  };
@@ -265,6 +265,7 @@ describe("withDeferredPopper", () => {
265
265
  ignoreConsoleError(() => {
266
266
  const event = {
267
267
  currentTarget: wrapper,
268
+ preventDefault: jest.fn(),
268
269
  stopPropagation: jest.fn(),
269
270
  };
270
271
 
@@ -296,6 +297,7 @@ describe("withDeferredPopper", () => {
296
297
  ignoreConsoleError(() => {
297
298
  const event = {
298
299
  currentTarget: null,
300
+ preventDefault: jest.fn(),
299
301
  stopPropagation: jest.fn(),
300
302
  };
301
303
 
@@ -22,7 +22,9 @@ describe("Modal", () => {
22
22
  afterEach(() => {
23
23
  try {
24
24
  ReactDOM.unmountComponentAtNode(appRoot);
25
- } catch (_) {}
25
+ } catch {
26
+ // don't do anything
27
+ }
26
28
  document.body.removeChild(appRoot);
27
29
  document.body.removeChild(modalRoot);
28
30
  });
@@ -35,7 +35,9 @@ describe("Wrapper", () => {
35
35
  afterEach(() => {
36
36
  try {
37
37
  ReactDOM.unmountComponentAtNode(appRoot);
38
- } catch (_) {}
38
+ } catch {
39
+ // don't do anything
40
+ }
39
41
  document.body.removeChild(appRoot);
40
42
  document.body.removeChild(modalRoot);
41
43
  });
@@ -168,7 +168,7 @@ const SegmentPage = ({
168
168
  modulePrependPath,
169
169
  entityIdResolver,
170
170
  }) => {
171
- const classes = useStyles({ isComponentNull: !!!View });
171
+ const classes = useStyles({ isComponentNull: !View });
172
172
  const pattern = new UrlPattern(path);
173
173
  const baseHref = pattern.stringify(match.params);
174
174
  const pages = [],
@@ -121,7 +121,9 @@ beforeEach(() => {
121
121
  afterEach(() => {
122
122
  try {
123
123
  ReactDOM.unmountComponentAtNode(appRoot);
124
- } catch (_) {}
124
+ } catch {
125
+ // don't do anything
126
+ }
125
127
  document.body.removeChild(appRoot);
126
128
  document.body.removeChild(modalRoot);
127
129
  });
@@ -25,7 +25,9 @@ describe("Sidepanel", () => {
25
25
  afterEach(() => {
26
26
  try {
27
27
  ReactDOM.unmountComponentAtNode(appRoot);
28
- } catch (_) {}
28
+ } catch {
29
+ // don't do anything
30
+ }
29
31
  document.body.removeChild(appRoot);
30
32
  document.body.removeChild(modalRoot);
31
33
  });
@@ -104,8 +104,8 @@ const ListWrapper = styled(TransitionGroup)`
104
104
  export const ToastList = ({ toasts }) =>
105
105
  ReactDOM.createPortal(
106
106
  <ListWrapper>
107
- {toasts.map(props => (
108
- <Toast {...props} />
107
+ {toasts.map((props, idx) => (
108
+ <Toast key={"toast" + idx} {...props} />
109
109
  ))}
110
110
  </ListWrapper>,
111
111
  portal,
package/src/constants.js CHANGED
@@ -1,5 +1,10 @@
1
1
  export const infoBar = "infoBar";
2
2
 
3
+ export const applications = {
4
+ oms: "oms",
5
+ pim: "pim",
6
+ };
7
+
3
8
  export const scopeTypes = {
4
9
  global: "Global",
5
10
  virtual: "Virtual",
@@ -28,9 +28,10 @@ describe("withErrorBoundary", () => {
28
28
  { args: ["Caught an error: Fail, at boundary Failed"] },
29
29
  {
30
30
  args: [
31
- "\n in FailBall (created by ErrorBoundary)\n" +
32
- " in ErrorBoundary (created by BoundedFailBall)\n" +
33
- " in BoundedFailBall",
31
+ expect.it(
32
+ "to match",
33
+ /at FailBall.*withErrorBoundary\.test\.js.*at ErrorBoundary.*withErrorBoundary\.js.*at BoundedFailBall/s,
34
+ ),
34
35
  ],
35
36
  },
36
37
  ]);
@@ -1,3 +1,5 @@
1
+ /* eslint-disable react/no-unknown-property */
2
+
1
3
  import React from "react";
2
4
  import { useEditState, useDynamicEditState } from "./useEditState";
3
5
  import { TestWrapper } from "./../utils/testUtils";
@@ -1,3 +1,5 @@
1
+ /* eslint react/no-unknown-property: off */
2
+
1
3
  import React from "react";
2
4
  import { Provider } from "react-redux";
3
5
  import { IntlProvider } from "react-intl";
@@ -1,3 +1,5 @@
1
+ import { applications } from "../constants";
2
+
1
3
  /* Constructs a URL search string from an object with key value pairs */
2
4
  const buildParamString = params =>
3
5
  Object.entries(params)
@@ -32,6 +34,19 @@ export const loadConfig = () =>
32
34
  `${host}/${pathParts.join("/")}` + (parameters ? "?" + buildParamString(parameters) : "");
33
35
  });
34
36
 
37
+ export const buildExternalAppUrl = (app, relativeUrl) => {
38
+ const url = relativeUrl[0] === "/" ? relativeUrl.substring(1) : relativeUrl;
39
+
40
+ let lowercaseApp = app.toLowerCase();
41
+ switch (lowercaseApp) {
42
+ case applications.oms:
43
+ case applications.pim:
44
+ return `/${lowercaseApp}/app/${url}`;
45
+ default:
46
+ throw new Error("Not implemented app '" + app + "'");
47
+ }
48
+ };
49
+
35
50
  /* Reset function for testing, never use this in actual code */
36
51
  export const resetConfig = () => {
37
52
  buildUrl = placeholder;
@@ -1,6 +1,6 @@
1
1
  import sinon from "sinon";
2
2
  import { spyOnConsole } from "./testUtils";
3
- import { loadConfig, resetConfig, buildUrl } from "./buildUrl";
3
+ import { loadConfig, resetConfig, buildUrl, buildExternalAppUrl } from "./buildUrl";
4
4
 
5
5
  describe("loadConfig", () => {
6
6
  spyOnConsole();
@@ -72,4 +72,30 @@ describe("loadConfig", () => {
72
72
  ));
73
73
  });
74
74
  });
75
+
76
+ describe("buildExternalAppUrl", () => {
77
+ it("throws an error if called with an unknown app", () => {
78
+ expect(
79
+ () => expect(buildExternalAppUrl, "when called with", ["unknown", "fakeurl"]),
80
+ "to throw",
81
+ "Not implemented app 'unknown'",
82
+ );
83
+ });
84
+
85
+ it("should build an valid relative url with oms", () => {
86
+ expect(buildExternalAppUrl, "called with", ["oms", "fakeurl"], "to equal", "/oms/app/fakeurl");
87
+ });
88
+
89
+ it("should build an valid relative url with pim", () => {
90
+ expect(buildExternalAppUrl, "called with", ["pim", "fakeurl"], "to equal", "/pim/app/fakeurl");
91
+ });
92
+
93
+ it("should not be case sensitive about the app name", () => {
94
+ expect(buildExternalAppUrl, "called with", ["PIM", "fakeurl"], "to equal", "/pim/app/fakeurl");
95
+ });
96
+
97
+ it("should handle delimiter", () => {
98
+ expect(buildExternalAppUrl, "called with", ["pim", "/fakeurl"], "to equal", "/pim/app/fakeurl");
99
+ });
100
+ });
75
101
  });
@@ -1,6 +1,22 @@
1
1
  export const trimSpacesAndLeadingZeros = (value, fallback = "") => {
2
- const trimmed = (value ?? "").trim().replace(/^0+/, "");
3
- return trimmed === "" ? fallback : limitNumericValueLength(trimmed);
2
+ if (!value || isNaN(value)) {
3
+ return fallback;
4
+ }
5
+
6
+ let trimmed = value.trim();
7
+ const isNegative = trimmed[0] === "-";
8
+ if (isNegative) {
9
+ trimmed = trimmed.substring(1, trimmed.length);
10
+ }
11
+
12
+ const withoutLeadingZeros = trimmed.replace(/^0+/, "");
13
+ if (withoutLeadingZeros == "") {
14
+ return "0";
15
+ }
16
+
17
+ const cleanNumber = `${isNegative ? "-" : ""}${withoutLeadingZeros}`;
18
+
19
+ return limitNumericValueLength(cleanNumber);
4
20
  };
5
21
 
6
22
  export const limitNumericValueLength = (value, maximum = 9) => value.substring(0, maximum);
@@ -5,14 +5,26 @@ describe("Numeric Input Helper", () => {
5
5
  expect(trimSpacesAndLeadingZeros, "when called with", [" 00013 "], "to equal", "13");
6
6
  });
7
7
 
8
- it("trimSpacesAndLeadingZeros trims spaces and leading zeros returning fallback value", () => {
9
- expect(trimSpacesAndLeadingZeros, "when called with", [" 000 ", "def"], "to equal", "def");
8
+ it("trimSpacesAndLeadingZeros trims spaces and leading zeros returning 0 when 000 value", () => {
9
+ expect(trimSpacesAndLeadingZeros, "when called with", [" 000 ", "def"], "to equal", "0");
10
+ });
11
+
12
+ it("trimSpacesAndLeadingZeros trims spaces and leading zeros returning fallback when empty string value", () => {
13
+ expect(trimSpacesAndLeadingZeros, "when called with", ["", "def"], "to equal", "def");
14
+ });
15
+
16
+ it("trimSpacesAndLeadingZeros trims spaces and leading zeros returning 0 when 0 value", () => {
17
+ expect(trimSpacesAndLeadingZeros, "when called with", [" 0 ", "def"], "to equal", "0");
10
18
  });
11
19
 
12
20
  it("trimSpacesAndLeadingZeros should work on floating values", () => {
13
21
  expect(trimSpacesAndLeadingZeros, "when called with", ["042.2", "def"], "to equal", "42.2");
14
22
  });
15
23
 
24
+ it("trimSpacesAndLeadingZeros should work on negative values", () => {
25
+ expect(trimSpacesAndLeadingZeros, "when called with", ["-0012.2", "def"], "to equal", "-12.2");
26
+ });
27
+
16
28
  it("trimSpacesAndLeadingZeros returns fallback on null value", () => {
17
29
  expect(trimSpacesAndLeadingZeros, "when called with", [null, "def"], "to equal", "def");
18
30
  });
@@ -21,6 +33,10 @@ describe("Numeric Input Helper", () => {
21
33
  expect(trimSpacesAndLeadingZeros, "when called with", [undefined, "def"], "to equal", "def");
22
34
  });
23
35
 
36
+ it("trimSpacesAndLeadingZeros returns fallback when value is not a number", () => {
37
+ expect(trimSpacesAndLeadingZeros, "when called with", ["hello", "def"], "to equal", "def");
38
+ });
39
+
24
40
  it("limitNumericValueLength trims extra characters", () => {
25
41
  expect(limitNumericValueLength, "when called with", ["01234567890"], "to equal", "012345678");
26
42
  });
@@ -6,6 +6,8 @@ if ("".normalize) {
6
6
  .toLowerCase()
7
7
  // Strip accents by normalizing to letters + combining chars, then strip all combining chars.
8
8
  .normalize("NFKD")
9
+ // Note AD20240801: the new eslint config complains on the next line however I have no idea what it is supposed to do so to be safe I'll disable the warning
10
+ // eslint-disable-next-line no-misleading-character-class
9
11
  .replace(/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/g, "");
10
12
  } else {
11
13
  // IE11 does not support string#normalize(). V. sad for IE users.
@@ -149,7 +149,7 @@ export const getPropertyBagFormattedPrimitiveValue = (propertyBagValue, formatMe
149
149
  }
150
150
 
151
151
  if (dataTypesChecker.isBoolean(propertyBagValue[serializationTypeKey])) {
152
- return Boolean(propertyBagValue.value)
152
+ return propertyBagValue.value
153
153
  ? formatMessage(sharedMessages.valueTypeWrapperTrue)
154
154
  : formatMessage(sharedMessages.valueTypeWrapperFalse);
155
155
  }
@@ -182,7 +182,7 @@ export const formatNumber = (value, precision) => Number(value).toFixed(precisio
182
182
 
183
183
  export const fixPropertyBagModifiedModel = (model, ...fields) => {
184
184
  const fixProfileOperations = model => {
185
- if (model.hasOwnProperty("profileOperations")) {
185
+ if (Object.prototype.hasOwnProperty.call(model, "profileOperations")) {
186
186
  let { profilesToAdd, profilesToUpdate } = model.profileOperations;
187
187
  if (profilesToAdd) {
188
188
  const items = Array.isArray(profilesToAdd) ? profilesToAdd : Object.values(profilesToAdd);
@@ -224,7 +224,10 @@ export const fixPropertyBagEmptyValues = propertyBag => {
224
224
  const modifiedFields = Object.keys(propertyBag);
225
225
  modifiedFields.forEach(propertyName => {
226
226
  let property = propertyBag[propertyName];
227
- let propertyValue = property && isObject(property) && property.hasOwnProperty("value") ? property.value : property;
227
+ let propertyValue =
228
+ property && isObject(property) && Object.prototype.hasOwnProperty.call(property, "value")
229
+ ? property.value
230
+ : property;
228
231
  if (propertyValue === "") {
229
232
  propertyBag[propertyName] = null;
230
233
  }
@@ -22,13 +22,13 @@ export function getPropertyOrDefault(obj, property, defaultValue, ignoreCase = f
22
22
  }
23
23
 
24
24
  if (ignoreCase === false && startWith === false) {
25
- return obj.hasOwnProperty(property) ? obj[property] : defaultValue;
25
+ return Object.prototype.hasOwnProperty.call(obj, property) ? obj[property] : defaultValue;
26
26
  }
27
27
 
28
28
  const compareFunction = startWith ? caseInsensitiveStartWithCompare : caseInsensitiveCompare;
29
29
 
30
30
  for (let prop in obj) {
31
- if (obj.hasOwnProperty(prop) && compareFunction(prop, property)) {
31
+ if (Object.prototype.hasOwnProperty.call(obj, prop) && compareFunction(prop, property)) {
32
32
  return obj[prop];
33
33
  }
34
34
  }
@@ -39,12 +39,12 @@ export function getPropertyOrDefault(obj, property, defaultValue, ignoreCase = f
39
39
  export const isObjectContainsPropertyWithValue = (obj, propertyName, value) => {
40
40
  if (obj === null || obj === undefined) return false;
41
41
 
42
- if (obj.hasOwnProperty(propertyName) && obj[propertyName] === value) {
42
+ if (Object.prototype.hasOwnProperty.call(obj, propertyName) && obj[propertyName] === value) {
43
43
  return true;
44
44
  }
45
45
 
46
46
  for (let prop in obj) {
47
- if (obj.hasOwnProperty(prop) && typeof obj[prop] === "object") {
47
+ if (Object.prototype.hasOwnProperty.call(obj, prop) && typeof obj[prop] === "object") {
48
48
  if (isObjectContainsPropertyWithValue(obj[prop], propertyName, value)) return true;
49
49
  }
50
50
  }
@@ -55,12 +55,12 @@ export const isObjectContainsPropertyWithValue = (obj, propertyName, value) => {
55
55
  export const isObjectContainsPropertyWithAnyValue = (obj, propertyName) => {
56
56
  if (!obj) return false;
57
57
 
58
- if (obj.hasOwnProperty(propertyName) && obj[propertyName]) {
58
+ if (Object.prototype.hasOwnProperty.call(obj, propertyName) && obj[propertyName]) {
59
59
  return true;
60
60
  }
61
61
 
62
62
  for (let prop in obj) {
63
- if (obj.hasOwnProperty(prop) && typeof obj[prop] === "object") {
63
+ if (Object.prototype.hasOwnProperty.call(obj, prop) && typeof obj[prop] === "object") {
64
64
  if (isObjectContainsPropertyWithAnyValue(obj[prop], propertyName)) return true;
65
65
  }
66
66
  }
@@ -15,6 +15,7 @@ const sinon = require("sinon");
15
15
  /* istanbul ignore next */
16
16
  export const spyOnConsole = (spyNames = ["log", "warn", "error"]) => {
17
17
  let spiedFuncs;
18
+ // eslint-disable-next-line no-undef
18
19
  beforeEach(() => {
19
20
  spiedFuncs = spyNames.map(funcName => {
20
21
  const func = sinon.spy().named("console." + funcName);
@@ -23,6 +24,7 @@ export const spyOnConsole = (spyNames = ["log", "warn", "error"]) => {
23
24
  return oldFunc;
24
25
  });
25
26
  });
27
+ // eslint-disable-next-line no-undef
26
28
  afterEach(() => {
27
29
  spiedFuncs.forEach((func, index) => {
28
30
  const name = spyNames[index];
@@ -74,34 +76,35 @@ export const PropStruct = React.forwardRef((props, ref) => (
74
76
  value === undefined || value === null
75
77
  ? null
76
78
  : value === "__ignore"
77
- ? [<Ignore key={"dt-" + key} />, <Ignore key={"dd-" + key} />]
78
- : [
79
- <dt key={"dt-" + key}>{`${key}:`}</dt>,
80
- <dd key={"dd-" + key}>
81
- {key === "children" ? (
82
- value
83
- ) : typeof value === "object" ? (
84
- value["$$typeof"] && value["$$typeof"] === Symbol.for("react.element") ? (
85
- "React <" + (value.type.name || value.type) + ">"
79
+ ? [<Ignore key={"dt-" + key} />, <Ignore key={"dd-" + key} />]
80
+ : [
81
+ <dt key={"dt-" + key}>{`${key}:`}</dt>,
82
+ <dd key={"dd-" + key}>
83
+ {key === "children" ? (
84
+ value
85
+ ) : typeof value === "object" ? (
86
+ value["$$typeof"] && value["$$typeof"] === Symbol.for("react.element") ? (
87
+ "React <" + (value.type.name || value.type) + ">"
88
+ ) : (
89
+ <PropStruct {...value} />
90
+ )
91
+ ) : typeof value === "function" ? (
92
+ "Function"
93
+ ) : typeof value === "string" ? (
94
+ `string "${value}"`
95
+ ) : typeof value === "symbol" ? (
96
+ `symbol ${value.toString()}`
86
97
  ) : (
87
- <PropStruct {...value} />
88
- )
89
- ) : typeof value === "function" ? (
90
- "Function"
91
- ) : typeof value === "string" ? (
92
- `string "${value}"`
93
- ) : typeof value === "symbol" ? (
94
- `symbol ${value.toString()}`
95
- ) : (
96
- typeof value + " " + value
97
- )}
98
- </dd>,
99
- ],
98
+ typeof value + " " + value
99
+ )}
100
+ </dd>,
101
+ ],
100
102
  )}
101
103
  </dl>
102
104
  ));
103
105
 
104
106
  export const ignoreConsoleError = func => {
107
+ // eslint-disable-next-line no-undef
105
108
  jest.spyOn(console, "error");
106
109
  console.error.mockImplementation(() => {});
107
110
 
@@ -187,7 +187,7 @@ describe("PropStruct", () => {
187
187
  <dt>num:</dt>
188
188
  <dd>number 1</dd>
189
189
  <dt>str:</dt>
190
- <dd>string "foo"</dd>
190
+ <dd>string &quot;foo&quot;</dd>
191
191
  </dl>,
192
192
  ));
193
193
 
@@ -198,7 +198,7 @@ describe("PropStruct", () => {
198
198
  "to satisfy",
199
199
  <dl id="testProps">
200
200
  <dt>id:</dt>
201
- <dd>string "testProps"</dd>
201
+ <dd>string &quot;testProps&quot;</dd>
202
202
  </dl>,
203
203
  ));
204
204
 
@@ -261,7 +261,7 @@ describe("PropStruct", () => {
261
261
  <div id="tc2" />
262
262
  </dd>
263
263
  <dt>foo:</dt>
264
- <dd>string "bar"</dd>
264
+ <dd>string &quot;bar&quot;</dd>
265
265
  </dl>,
266
266
  ));
267
267
 
@@ -275,7 +275,7 @@ describe("PropStruct", () => {
275
275
  <dd>
276
276
  <dl>
277
277
  <dt>bar:</dt>
278
- <dd>string "false"</dd>
278
+ <dd>string &quot;false&quot;</dd>
279
279
  <dt>foo:</dt>
280
280
  <dd>boolean true</dd>
281
281
  </dl>