orc-shared 1.5.0-dev.1 → 1.5.0-dev.11

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 (338) hide show
  1. package/dist/actions/applications.js +14 -52
  2. package/dist/actions/authentication.js +10 -45
  3. package/dist/actions/countries.js +6 -36
  4. package/dist/actions/locale.js +14 -54
  5. package/dist/actions/makeApiAction.js +31 -79
  6. package/dist/actions/makeOrcApiAction.js +3 -26
  7. package/dist/actions/metadata.js +65 -174
  8. package/dist/actions/modules.js +0 -26
  9. package/dist/actions/navigation.js +3 -33
  10. package/dist/actions/requestState.js +0 -18
  11. package/dist/actions/requestsApi.js +0 -17
  12. package/dist/actions/scopes.js +14 -56
  13. package/dist/actions/tasks.js +190 -0
  14. package/dist/actions/timezones.js +6 -36
  15. package/dist/actions/toasts.js +3 -23
  16. package/dist/actions/versionInfo.js +6 -39
  17. package/dist/actions/view.js +0 -38
  18. package/dist/buildStore.js +6 -54
  19. package/dist/components/AppFrame/About.js +8 -70
  20. package/dist/components/AppFrame/Anchor.js +1 -25
  21. package/dist/components/AppFrame/AppFrame.js +23 -92
  22. package/dist/components/AppFrame/ApplicationSelector/ApplicationDialog.js +4 -35
  23. package/dist/components/AppFrame/ApplicationSelector/Header.js +1 -31
  24. package/dist/components/AppFrame/ApplicationSelector/index.js +1 -30
  25. package/dist/components/AppFrame/ConnectedToastList.js +0 -31
  26. package/dist/components/AppFrame/Help.js +0 -25
  27. package/dist/components/AppFrame/MenuItem.js +17 -70
  28. package/dist/components/AppFrame/Preferences.js +17 -79
  29. package/dist/components/AppFrame/Sidebar.js +12 -61
  30. package/dist/components/AppFrame/Topbar.js +9 -65
  31. package/dist/components/AppFrame/index.js +0 -20
  32. package/dist/components/AppFrame/useApplicationHelpUrl.js +0 -22
  33. package/dist/components/ApplicationModuleLoader.js +7 -46
  34. package/dist/components/Authenticate.js +5 -48
  35. package/dist/components/Button.js +0 -24
  36. package/dist/components/CategoryList.js +27 -82
  37. package/dist/components/Checkbox.js +3 -41
  38. package/dist/components/ColumnWrapper.js +0 -19
  39. package/dist/components/Culture.js +0 -29
  40. package/dist/components/DevPages.js +0 -21
  41. package/dist/components/DropMenu/Menu.js +4 -36
  42. package/dist/components/DropMenu/index.js +12 -50
  43. package/dist/components/ErrorPlaceholder.js +3 -31
  44. package/dist/components/Form/Combination.js +3 -28
  45. package/dist/components/Form/Field.js +6 -37
  46. package/dist/components/Form/FieldElements.js +9 -41
  47. package/dist/components/Form/FieldList.js +28 -92
  48. package/dist/components/Form/Fieldset.js +1 -27
  49. package/dist/components/Form/Form.js +6 -37
  50. package/dist/components/Form/FormElement.js +1 -20
  51. package/dist/components/Form/InputField.js +17 -66
  52. package/dist/components/Form/Inputs/Button.js +5 -35
  53. package/dist/components/Form/Inputs/Date.js +2 -28
  54. package/dist/components/Form/Inputs/FieldButtons.js +0 -25
  55. package/dist/components/Form/Inputs/Number.js +7 -46
  56. package/dist/components/Form/Inputs/ReadOnly.js +0 -29
  57. package/dist/components/Form/Inputs/SmallButton.js +6 -38
  58. package/dist/components/Form/Inputs/Text.js +8 -41
  59. package/dist/components/Form/Inputs/Time.js +4 -33
  60. package/dist/components/Form/Inputs/Toggles.js +5 -39
  61. package/dist/components/Form/Inputs/Translation.js +21 -78
  62. package/dist/components/Form/Inputs/index.js +0 -28
  63. package/dist/components/Form/index.js +0 -20
  64. package/dist/components/Head.js +0 -22
  65. package/dist/components/I18n.js +0 -28
  66. package/dist/components/Icon.js +1 -27
  67. package/dist/components/IconButton.js +2 -32
  68. package/dist/components/Input.js +2 -42
  69. package/dist/components/InternetExplorerWarningMessage.js +0 -31
  70. package/dist/components/List/DataCell.js +3 -42
  71. package/dist/components/List/HeadCell.js +3 -43
  72. package/dist/components/List/HeadRow.js +2 -25
  73. package/dist/components/List/List.js +37 -107
  74. package/dist/components/List/Row.js +7 -38
  75. package/dist/components/List/enhanceColumnDefs.js +3 -29
  76. package/dist/components/List/index.js +0 -20
  77. package/dist/components/Loader.js +5 -48
  78. package/dist/components/LoadingIcon.js +0 -24
  79. package/dist/components/MaterialUI/DataDisplay/Badge.js +2 -31
  80. package/dist/components/MaterialUI/DataDisplay/Chip.js +1 -33
  81. package/dist/components/MaterialUI/DataDisplay/CollapsableList.js +7 -51
  82. package/dist/components/MaterialUI/DataDisplay/Divider.js +0 -30
  83. package/dist/components/MaterialUI/DataDisplay/Icon.js +2 -28
  84. package/dist/components/MaterialUI/DataDisplay/List.js +16 -55
  85. package/dist/components/MaterialUI/DataDisplay/Modal.js +4 -37
  86. package/dist/components/MaterialUI/DataDisplay/Notification.js +17 -69
  87. package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +3 -34
  88. package/dist/components/MaterialUI/DataDisplay/PopperedElements/PopperedIcon.js +0 -22
  89. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ActionModal.js +5 -37
  90. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Address.js +1 -33
  91. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ConfirmationModal.js +7 -28
  92. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/DiscountedPrice.js +2 -32
  93. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +17 -57
  94. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +4 -33
  95. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionTitle.js +0 -25
  96. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +14 -60
  97. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +0 -29
  98. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +15 -59
  99. package/dist/components/MaterialUI/DataDisplay/SelectionList.js +23 -70
  100. package/dist/components/MaterialUI/DataDisplay/Table.js +34 -123
  101. package/dist/components/MaterialUI/DataDisplay/TableHeaderCell.js +0 -35
  102. package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -49
  103. package/dist/components/MaterialUI/DataDisplay/Timeline.js +1 -21
  104. package/dist/components/MaterialUI/DataDisplay/TimelineItem.js +4 -32
  105. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +7 -46
  106. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedIcon.js +3 -29
  107. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedTypography.js +0 -21
  108. package/dist/components/MaterialUI/DataDisplay/TransferList.js +32 -97
  109. package/dist/components/MaterialUI/DataDisplay/chipProps.js +3 -38
  110. package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +3 -37
  111. package/dist/components/MaterialUI/DataDisplay/dividerProps.js +3 -41
  112. package/dist/components/MaterialUI/DataDisplay/index.js +0 -33
  113. package/dist/components/MaterialUI/DataDisplay/modalProps.js +3 -36
  114. package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +5 -68
  115. package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +11 -48
  116. package/dist/components/MaterialUI/Feedback/NotificationContext.js +5 -40
  117. package/dist/components/MaterialUI/Feedback/loadingScreen.js +5 -44
  118. package/dist/components/MaterialUI/Feedback/useNotification.js +0 -21
  119. package/dist/components/MaterialUI/Inputs/Autocomplete.js +5 -44
  120. package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +3 -37
  121. package/dist/components/MaterialUI/Inputs/Checkbox.js +3 -40
  122. package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +3 -43
  123. package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +3 -38
  124. package/dist/components/MaterialUI/Inputs/CheckboxProps.js +3 -39
  125. package/dist/components/MaterialUI/Inputs/DatePicker.js +18 -57
  126. package/dist/components/MaterialUI/Inputs/InputBase.js +7 -56
  127. package/dist/components/MaterialUI/Inputs/InputBaseProps.js +3 -51
  128. package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +12 -65
  129. package/dist/components/MaterialUI/Inputs/PredefinedElements/TitledSelect.js +3 -31
  130. package/dist/components/MaterialUI/Inputs/Radio.js +8 -54
  131. package/dist/components/MaterialUI/Inputs/RadioProps.js +3 -41
  132. package/dist/components/MaterialUI/Inputs/Select.js +10 -72
  133. package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -46
  134. package/dist/components/MaterialUI/Inputs/StandaloneRadio.js +3 -35
  135. package/dist/components/MaterialUI/Inputs/Switch.js +4 -38
  136. package/dist/components/MaterialUI/Inputs/SwitchProps.js +3 -40
  137. package/dist/components/MaterialUI/Inputs/TimePicker.js +14 -91
  138. package/dist/components/MaterialUI/Inputs/createInput.js +5 -30
  139. package/dist/components/MaterialUI/Inputs/index.js +0 -35
  140. package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +3 -41
  141. package/dist/components/MaterialUI/Navigation/DropDownMenu.js +12 -56
  142. package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +3 -33
  143. package/dist/components/MaterialUI/Navigation/ExternalLink.js +2 -27
  144. package/dist/components/MaterialUI/Navigation/PredefinedElements/ActionMenu.js +4 -31
  145. package/dist/components/MaterialUI/Navigation/TabBar.js +22 -103
  146. package/dist/components/MaterialUI/Navigation/TabLabel.js +7 -41
  147. package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +7 -42
  148. package/dist/components/MaterialUI/ScopeSelector/ScopeTreeView.js +22 -62
  149. package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +16 -68
  150. package/dist/components/MaterialUI/Surfaces/ExpansionPanel.js +15 -55
  151. package/dist/components/MaterialUI/Surfaces/Paper.js +1 -31
  152. package/dist/components/MaterialUI/Surfaces/PredefinedElements/TitledPaper.js +3 -28
  153. package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +19 -62
  154. package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +3 -55
  155. package/dist/components/MaterialUI/Surfaces/paperProps.js +3 -36
  156. package/dist/components/MaterialUI/componentProps.js +3 -29
  157. package/dist/components/MaterialUI/hocs/withDeferredPopper.js +10 -59
  158. package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +8 -44
  159. package/dist/components/MaterialUI/muiThemes.js +5 -57
  160. package/dist/components/MaterialUI/textProps.js +3 -33
  161. package/dist/components/Modal/Background.js +0 -19
  162. package/dist/components/Modal/Dialog.js +2 -26
  163. package/dist/components/Modal/Wrapper.js +0 -26
  164. package/dist/components/Modal/index.js +8 -44
  165. package/dist/components/Modules.js +21 -93
  166. package/dist/components/MultiSelector.js +21 -74
  167. package/dist/components/Navigation/Bar.js +29 -90
  168. package/dist/components/Navigation/Tab.js +22 -74
  169. package/dist/components/Navigation/index.js +2 -21
  170. package/dist/components/Navigation/useNavigationState.js +90 -173
  171. package/dist/components/Placeholder.js +5 -43
  172. package/dist/components/Provision.js +4 -36
  173. package/dist/components/Routing/FullPage.js +14 -37
  174. package/dist/components/Routing/Page.js +14 -51
  175. package/dist/components/Routing/Segment.js +5 -30
  176. package/dist/components/Routing/SegmentPage.js +26 -106
  177. package/dist/components/Routing/SubPage.js +22 -59
  178. package/dist/components/Routing/withWaypointing.js +5 -36
  179. package/dist/components/Scope/ScopeModificationConfirmationDialog.js +3 -30
  180. package/dist/components/Scope/ScopeNode.js +8 -49
  181. package/dist/components/Scope/Selector.js +8 -44
  182. package/dist/components/Scope/index.js +29 -96
  183. package/dist/components/Scope/useScopeConfirmationModalState.js +33 -100
  184. package/dist/components/Scope/useScopeData.js +0 -25
  185. package/dist/components/Scope/useScopeSelect.js +0 -26
  186. package/dist/components/Selector.js +15 -76
  187. package/dist/components/Sidepanel.js +0 -28
  188. package/dist/components/Spritesheet.js +0 -26
  189. package/dist/components/Switch.js +11 -51
  190. package/dist/components/TaskDetailsModal.js +193 -0
  191. package/dist/components/Text.js +6 -50
  192. package/dist/components/ToastList.js +5 -45
  193. package/dist/components/Toolbar.js +16 -74
  194. package/dist/components/Tooltip.js +0 -24
  195. package/dist/components/Treeview/Branch.js +0 -25
  196. package/dist/components/Treeview/Label.js +0 -29
  197. package/dist/components/Treeview/Leaf.js +0 -21
  198. package/dist/components/Treeview/Node.js +17 -55
  199. package/dist/components/Treeview/index.js +25 -66
  200. package/dist/components/Treeview/settings.js +0 -17
  201. package/dist/constants.js +21 -19
  202. package/dist/content/iconsSheet.svg +22 -0
  203. package/dist/content/orckestra-logo-white.png +0 -0
  204. package/dist/getTheme.js +0 -29
  205. package/dist/getThemeOverrides.js +3 -22
  206. package/dist/hocs/routingConnector.js +0 -21
  207. package/dist/hocs/withAuthentication.js +4 -26
  208. package/dist/hocs/withClickOutside.js +2 -28
  209. package/dist/hocs/withErrorBoundary.js +2 -37
  210. package/dist/hocs/withId.js +1 -30
  211. package/dist/hocs/withInfiniteScroll.js +15 -32
  212. package/dist/hocs/withInitialLoad.js +0 -20
  213. package/dist/hocs/withLocaleSwitch.js +0 -19
  214. package/dist/hocs/withNavigationLink.js +5 -32
  215. package/dist/hocs/withRequestActivity.js +0 -21
  216. package/dist/hocs/withScopeData.js +6 -33
  217. package/dist/hocs/withScrollBox.js +2 -31
  218. package/dist/hocs/withToggle.js +9 -37
  219. package/dist/hocs/withUpdateHandler.js +3 -23
  220. package/dist/hocs/withViewState.js +5 -32
  221. package/dist/hooks/useDispatchWithModulesData.js +0 -26
  222. package/dist/hooks/useEditState.js +10 -105
  223. package/dist/hooks/useEntityLoader.js +18 -67
  224. package/dist/hooks/useFullEntityEditState.js +9 -56
  225. package/dist/hooks/useInfiniteScroll.js +5 -33
  226. package/dist/hooks/useLabelMessage.js +3 -42
  227. package/dist/hooks/useLoader.js +0 -27
  228. package/dist/hooks/useMultipleFieldEditState.js +3 -40
  229. package/dist/hooks/useNavigationHandler.js +3 -28
  230. package/dist/hooks/useNotificationRequestState.js +17 -47
  231. package/dist/hooks/usePreviousModified.js +0 -24
  232. package/dist/hooks/useRequestState.js +8 -38
  233. package/dist/hooks/useSelectorAndUnwrap.js +0 -23
  234. package/dist/hooks/useToggle.js +5 -35
  235. package/dist/hooks/useViewState.js +0 -23
  236. package/dist/index.js +1 -2
  237. package/dist/reducers/applications.js +0 -23
  238. package/dist/reducers/authentication.js +6 -37
  239. package/dist/reducers/countries.js +0 -25
  240. package/dist/reducers/localeFactory.js +0 -30
  241. package/dist/reducers/metadata.js +3 -63
  242. package/dist/reducers/modules.js +0 -36
  243. package/dist/reducers/navigation.js +8 -47
  244. package/dist/reducers/request.js +4 -28
  245. package/dist/reducers/requestStates.js +0 -42
  246. package/dist/reducers/scopes.js +0 -28
  247. package/dist/reducers/settings.js +4 -39
  248. package/dist/reducers/tasks.js +99 -0
  249. package/dist/reducers/timezones.js +0 -25
  250. package/dist/reducers/toasts.js +0 -27
  251. package/dist/reducers/versionInfo.js +0 -24
  252. package/dist/reducers/view.js +36 -84
  253. package/dist/schemas/countries.js +0 -17
  254. package/dist/schemas/definitions.js +0 -17
  255. package/dist/schemas/metadata.js +0 -17
  256. package/dist/schemas/productDefinitions.js +0 -17
  257. package/dist/schemas/scopes.js +0 -17
  258. package/dist/schemas/timezones.js +0 -17
  259. package/dist/selectors/applications.js +0 -20
  260. package/dist/selectors/authentication.js +17 -41
  261. package/dist/selectors/countries.js +0 -22
  262. package/dist/selectors/locale.js +1 -29
  263. package/dist/selectors/metadata.js +4 -45
  264. package/dist/selectors/modules.js +3 -22
  265. package/dist/selectors/navigation.js +9 -39
  266. package/dist/selectors/requestStates.js +0 -22
  267. package/dist/selectors/requests.js +2 -22
  268. package/dist/selectors/route.js +0 -21
  269. package/dist/selectors/scope.js +0 -32
  270. package/dist/selectors/settings.js +0 -18
  271. package/dist/selectors/tasks.js +66 -0
  272. package/dist/selectors/timezones.js +0 -19
  273. package/dist/selectors/versionInfo.js +0 -18
  274. package/dist/selectors/view.js +3 -74
  275. package/dist/sharedMessages.js +17 -18
  276. package/dist/spawnerMiddleware.js +0 -24
  277. package/dist/utils/buildUrl.js +7 -38
  278. package/dist/utils/countryHelper.js +0 -18
  279. package/dist/utils/curry.js +0 -19
  280. package/dist/utils/debounce.js +1 -20
  281. package/dist/utils/displayModeHelper.js +0 -24
  282. package/dist/utils/domHelper.js +0 -17
  283. package/dist/utils/flatten.js +7 -38
  284. package/dist/utils/index.js +0 -31
  285. package/dist/utils/insertIcons.js +0 -21
  286. package/dist/utils/localizationHelper.js +0 -26
  287. package/dist/utils/logPass.js +1 -22
  288. package/dist/utils/mapHelper.js +1 -25
  289. package/dist/utils/memoize.js +0 -23
  290. package/dist/utils/modelValidationHelper.js +3 -42
  291. package/dist/utils/normalizeForSearch.js +2 -19
  292. package/dist/utils/objectHelper.js +2 -24
  293. package/dist/utils/parseHelper.js +0 -32
  294. package/dist/utils/profilerHelper.js +0 -18
  295. package/dist/utils/propertyHelper.js +36 -38
  296. package/dist/utils/propertyValidator.js +0 -25
  297. package/dist/utils/requestProcessingHelper.js +0 -24
  298. package/dist/utils/safeGet.js +0 -18
  299. package/dist/utils/setTranslation.js +1 -28
  300. package/dist/utils/setTranslationWithFallback.js +1 -33
  301. package/dist/utils/stripKey.js +1 -23
  302. package/dist/utils/styledPropFuncs.js +3 -29
  303. package/dist/utils/testUtils.js +14 -91
  304. package/dist/utils/timezoneHelper.js +8 -46
  305. package/dist/utils/unwrapImmutable.js +0 -19
  306. package/dist/utils/urlHelper.js +3 -28
  307. package/dist/whyDidYouRerender.js +0 -5
  308. package/package.json +3 -3
  309. package/src/actions/tasks.js +77 -0
  310. package/src/actions/tasks.test.js +169 -0
  311. package/src/buildStore.js +2 -0
  312. package/src/components/AppFrame/About.test.js +3 -3
  313. package/src/components/AppFrame/Sidebar.js +4 -3
  314. package/src/components/Routing/SubPage.js +17 -2
  315. package/src/components/Routing/SubPage.test.js +168 -1
  316. package/src/components/TaskDetailsModal.js +132 -0
  317. package/src/components/TaskDetailsModal.test.js +317 -0
  318. package/src/components/Text.test.js +44 -59
  319. package/src/constants.js +15 -0
  320. package/src/content/iconsSheet.svg +22 -0
  321. package/src/content/orckestra-logo-white.png +0 -0
  322. package/src/hooks/useEditState.js +12 -2
  323. package/src/hooks/useEditState.test.js +1 -1
  324. package/src/hooks/useLabelMessage.test.js +16 -10
  325. package/src/reducers/request.js +4 -0
  326. package/src/reducers/request.test.js +11 -0
  327. package/src/reducers/tasks.js +56 -0
  328. package/src/reducers/tasks.test.js +404 -0
  329. package/src/selectors/authentication.js +13 -0
  330. package/src/selectors/authentication.test.js +322 -0
  331. package/src/selectors/tasks.js +16 -0
  332. package/src/selectors/tasks.test.js +60 -0
  333. package/src/sharedMessages.js +17 -1
  334. package/src/translations/en-US.json +16 -12
  335. package/src/translations/fr-CA.json +16 -12
  336. package/src/utils/propertyHelper.js +38 -0
  337. package/src/utils/propertyHelper.test.js +160 -0
  338. package/src/utils/timezoneHelper.test.js +4 -2
@@ -4,9 +4,11 @@ import {
4
4
  selectRolesClaims,
5
5
  selectGroupRolesClaims,
6
6
  hasEditorPermissions,
7
+ hasPermissionsForRole,
7
8
  hasAdministratorPermissions,
8
9
  hasReaderPermissions,
9
10
  hasEditorPermissionsForScope,
11
+ hasPermissionsForRoleAndScope,
10
12
  hasAdministratorPermissionsForScope,
11
13
  hasReaderPermissionsForScope,
12
14
  } from "./authentication";
@@ -455,6 +457,326 @@ describe("hasEditorPermissionsForScope", () => {
455
457
  });
456
458
  });
457
459
 
460
+ describe("hasPermissionsForRole", () => {
461
+ it("Retrieves true if user has permissions in specified group and role", () => {
462
+ const claims = Immutable.fromJS({
463
+ Orders: {
464
+ "*": {
465
+ Tester: true,
466
+ },
467
+ },
468
+ });
469
+
470
+ expect(
471
+ hasPermissionsForRole,
472
+ "when called with",
473
+ ["Orders", "Tester"],
474
+ "called with",
475
+ [
476
+ Immutable.fromJS({
477
+ authentication: { rolesClaimsValues: claims },
478
+ navigation: {
479
+ route: { location: {}, match: { params: { scope: "Global" } } },
480
+ },
481
+ settings: { defaultScope: "Global" },
482
+ }),
483
+ ],
484
+ "to equal",
485
+ true,
486
+ );
487
+ });
488
+
489
+ it("Retrieves false if user does not have permissions in specified group and role", () => {
490
+ const claims = Immutable.fromJS({
491
+ Orders: {
492
+ "*": {
493
+ Tester: false,
494
+ },
495
+ },
496
+ });
497
+
498
+ expect(
499
+ hasPermissionsForRole,
500
+ "when called with",
501
+ ["Orders", "Tester"],
502
+ "called with",
503
+ [
504
+ Immutable.fromJS({
505
+ authentication: { rolesClaimsValues: claims },
506
+ ...state,
507
+ }),
508
+ ],
509
+ "to equal",
510
+ false,
511
+ );
512
+ });
513
+
514
+ it("Retrieves true if user hasn't global permissions but, has in current scope in specified group for role", () => {
515
+ const claims = Immutable.fromJS({
516
+ Orders: {
517
+ "*": {
518
+ Tester: false,
519
+ },
520
+ MyScope: {
521
+ Tester: true,
522
+ },
523
+ },
524
+ });
525
+
526
+ expect(
527
+ hasPermissionsForRole,
528
+ "when called with",
529
+ ["Orders", "Tester"],
530
+ "called with",
531
+ [
532
+ Immutable.fromJS({
533
+ authentication: { rolesClaimsValues: claims },
534
+ navigation: {
535
+ route: { location: {}, match: { params: { scope: "MyScope" } } },
536
+ },
537
+ settings: { defaultScope: "Global" },
538
+ }),
539
+ ],
540
+ "to equal",
541
+ true,
542
+ );
543
+ });
544
+
545
+ it("Retrieves true if user has permissions just in specified scope for role", () => {
546
+ const claims = Immutable.fromJS({
547
+ Orders: {
548
+ MyScope: {
549
+ Tester: true,
550
+ },
551
+ },
552
+ });
553
+
554
+ expect(
555
+ hasPermissionsForRole,
556
+ "when called with",
557
+ ["Orders", "Tester"],
558
+ "called with",
559
+ [
560
+ Immutable.fromJS({
561
+ authentication: { rolesClaimsValues: claims },
562
+ navigation: {
563
+ route: { location: {}, match: { params: { scope: "MyScope" } } },
564
+ },
565
+ settings: { defaultScope: "Global" },
566
+ }),
567
+ ],
568
+ "to equal",
569
+ true,
570
+ );
571
+ });
572
+
573
+ it("Retrieves true if user has permissions just in specified scope with permission on parents for role", () => {
574
+ const claims = Immutable.fromJS({
575
+ Orders: {
576
+ MyScope: {
577
+ Tester: true,
578
+ },
579
+ },
580
+ });
581
+
582
+ expect(
583
+ hasPermissionsForRole,
584
+ "when called with",
585
+ ["Orders", "Tester"],
586
+ "called with",
587
+ [
588
+ Immutable.fromJS({
589
+ authentication: { rolesClaimsValues: claims },
590
+ ...state,
591
+ navigation: {
592
+ route: { location: {}, match: { params: { scope: "ChildScope" } } },
593
+ },
594
+ }),
595
+ ],
596
+ "to equal",
597
+ true,
598
+ );
599
+ });
600
+
601
+ it("Retrieves false if app roles claims are null", () => {
602
+ expect(
603
+ hasPermissionsForRole,
604
+ "when called with",
605
+ ["Orders", "Tester"],
606
+ "called with",
607
+ [
608
+ Immutable.fromJS({
609
+ authentication: { rolesClaimsValues: {} },
610
+ navigation: {
611
+ route: { location: {}, match: { params: { scope: "Global" } } },
612
+ },
613
+ settings: { defaultScope: "Global" },
614
+ }),
615
+ ],
616
+ "to equal",
617
+ false,
618
+ );
619
+ });
620
+ });
621
+
622
+ describe("hasPermissionsForRoleAndScope", () => {
623
+ it("Retrieves true if user has permissions in specified group for role", () => {
624
+ const claims = Immutable.fromJS({
625
+ Orders: {
626
+ "*": {
627
+ Tester: true,
628
+ },
629
+ },
630
+ });
631
+
632
+ expect(
633
+ hasPermissionsForRoleAndScope,
634
+ "when called with",
635
+ ["Global", "Orders", "Tester"],
636
+ "called with",
637
+ [
638
+ Immutable.fromJS({
639
+ authentication: { rolesClaimsValues: claims },
640
+ }),
641
+ ],
642
+ "to equal",
643
+ true,
644
+ );
645
+ });
646
+
647
+ it("Retrieves false if user does not have permissions in specified group for role", () => {
648
+ const claims = Immutable.fromJS({
649
+ Orders: {
650
+ "*": {
651
+ Tester: false,
652
+ },
653
+ },
654
+ });
655
+
656
+ expect(
657
+ hasPermissionsForRoleAndScope,
658
+ "when called with",
659
+ ["Global", "Orders", "Tester"],
660
+ "called with",
661
+ [
662
+ Immutable.fromJS({
663
+ authentication: { rolesClaimsValues: claims },
664
+ ...state,
665
+ }),
666
+ ],
667
+ "to equal",
668
+ false,
669
+ );
670
+ });
671
+
672
+ it("Retrieves true if user hasn't global permissions but, has in current scope in specified group for role", () => {
673
+ const claims = Immutable.fromJS({
674
+ Orders: {
675
+ "*": {
676
+ Tester: false,
677
+ },
678
+ MyScope: {
679
+ Tester: true,
680
+ },
681
+ },
682
+ });
683
+
684
+ expect(
685
+ hasPermissionsForRoleAndScope,
686
+ "when called with",
687
+ ["MyScope", "Orders", "Tester"],
688
+ "called with",
689
+ [
690
+ Immutable.fromJS({
691
+ authentication: { rolesClaimsValues: claims },
692
+ navigation: {
693
+ route: { location: {}, match: { params: { scope: "MyScope" } } },
694
+ },
695
+ settings: { defaultScope: "Global" },
696
+ }),
697
+ ],
698
+ "to equal",
699
+ true,
700
+ );
701
+ });
702
+
703
+ it("Retrieves true if user has permissions just in specified scope and role", () => {
704
+ const claims = Immutable.fromJS({
705
+ Orders: {
706
+ MyScope: {
707
+ Tester: true,
708
+ },
709
+ },
710
+ });
711
+
712
+ expect(
713
+ hasPermissionsForRoleAndScope,
714
+ "when called with",
715
+ ["MyScope", "Orders", "Tester"],
716
+ "called with",
717
+ [
718
+ Immutable.fromJS({
719
+ authentication: { rolesClaimsValues: claims },
720
+ navigation: {
721
+ route: { location: {}, match: { params: { scope: "MyScope" } } },
722
+ },
723
+ settings: { defaultScope: "Global" },
724
+ }),
725
+ ],
726
+ "to equal",
727
+ true,
728
+ );
729
+ });
730
+
731
+ it("Retrieves true if user has permissions just in specified scope with permission on parents for role", () => {
732
+ const claims = Immutable.fromJS({
733
+ Orders: {
734
+ MyScope: {
735
+ Tester: true,
736
+ },
737
+ },
738
+ });
739
+
740
+ expect(
741
+ hasPermissionsForRoleAndScope,
742
+ "when called with",
743
+ ["ChildScope", "Orders", "Tester"],
744
+ "called with",
745
+ [
746
+ Immutable.fromJS({
747
+ authentication: { rolesClaimsValues: claims },
748
+ ...state,
749
+ navigation: {
750
+ route: { location: {}, match: { params: { scope: "ChildScope" } } },
751
+ },
752
+ }),
753
+ ],
754
+ "to equal",
755
+ true,
756
+ );
757
+ });
758
+
759
+ it("Retrieves false if app roles claims are null", () => {
760
+ expect(
761
+ hasPermissionsForRoleAndScope,
762
+ "when called with",
763
+ ["Global", "Orders", "Tester"],
764
+ "called with",
765
+ [
766
+ Immutable.fromJS({
767
+ authentication: { rolesClaimsValues: {} },
768
+ navigation: {
769
+ route: { location: {}, match: { params: { scope: "Global" } } },
770
+ },
771
+ settings: { defaultScope: "Global" },
772
+ }),
773
+ ],
774
+ "to equal",
775
+ false,
776
+ );
777
+ });
778
+ });
779
+
458
780
  describe("hasAdministratorPermissions", () => {
459
781
  it("Retrieves true if user has global administrator permissions in specified group", () => {
460
782
  const claims = Immutable.fromJS({
@@ -0,0 +1,16 @@
1
+ import Immutable from "immutable";
2
+ import { createSelector } from "reselect";
3
+
4
+ const tasksData = state => state.get("tasks");
5
+
6
+ export const taskInfo = taskId => {
7
+ return createSelector(tasksData, tasks => {
8
+ return tasks.getIn(["taskInfos", taskId]) || null;
9
+ });
10
+ };
11
+
12
+ export const taskLogs = taskId => {
13
+ return createSelector(tasksData, tasks => {
14
+ return tasks.getIn(["logs", taskId]) || Immutable.List();
15
+ });
16
+ };
@@ -0,0 +1,60 @@
1
+ import Immutable from "immutable";
2
+ import { taskInfo, taskLogs } from "./tasks";
3
+
4
+ const defaultState = {
5
+ tasks: [],
6
+ taskInfos: {
7
+ "8908517403b84b44832e99f5c59eb4eb": {
8
+ taskId: "8908517403b84b44832e99f5c59eb4eb",
9
+ name: "Report export (Report Export)",
10
+ status: "RanToCompletion",
11
+ resultBlobUrl: "packages/Report_20190430_11324479637592.xlsx",
12
+ type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
13
+ },
14
+ },
15
+ logs: {
16
+ "8908517403b84b44832e99f5c59eb4eb": ["a"],
17
+ "5cb96f72f9bb47fc9e4feb5f9817772e": ["b"],
18
+ },
19
+ };
20
+
21
+ describe("Tasks Selectors", () => {
22
+ let state;
23
+ beforeEach(() => {
24
+ state = Immutable.fromJS({
25
+ tasks: defaultState,
26
+ });
27
+ });
28
+
29
+ it("Retrieves task info by id", () => {
30
+ expect(
31
+ taskInfo,
32
+ "when called with",
33
+ ["8908517403b84b44832e99f5c59eb4eb"],
34
+ "called with",
35
+ [state],
36
+ "to satisfy",
37
+ Immutable.fromJS(defaultState.taskInfos["8908517403b84b44832e99f5c59eb4eb"]),
38
+ );
39
+ });
40
+
41
+ it("Retrieves unknown task info by id", () => {
42
+ expect(taskInfo, "when called with", ["404"], "called with", [state], "to be null");
43
+ });
44
+
45
+ it("Retrieves task logs by id", () => {
46
+ expect(
47
+ taskLogs,
48
+ "when called with",
49
+ ["8908517403b84b44832e99f5c59eb4eb"],
50
+ "called with",
51
+ [state],
52
+ "to satisfy",
53
+ defaultState.logs["8908517403b84b44832e99f5c59eb4eb"],
54
+ );
55
+ });
56
+
57
+ it("Retrieves unknown task logs by id", () => {
58
+ expect(taskLogs, "when called with", ["404"], "called with", [state], "to satisfy", Immutable.List());
59
+ });
60
+ });
@@ -56,7 +56,7 @@ const sharedMessages = defineMessages({
56
56
  },
57
57
  copyright: {
58
58
  id: "orc-shared.copyright",
59
- defaultMessage: "© 2021 Orckestra Technologies Inc.",
59
+ defaultMessage: "© {year} Orckestra Technologies Inc.",
60
60
  },
61
61
  allRightsReserved: {
62
62
  id: "orc-shared.allRightsReserved",
@@ -255,6 +255,22 @@ const sharedMessages = defineMessages({
255
255
  id: "orc-shared.errorUnknown",
256
256
  defaultMessage: "Unknown Error",
257
257
  },
258
+ taskInProgressModalTitle: {
259
+ id: "orc-shared.taskInProgressModalTitle",
260
+ defaultMessage: "Task In Progress",
261
+ },
262
+ taskId: {
263
+ id: "orc-shared.taskId",
264
+ defaultMessage: "Task ID",
265
+ },
266
+ taskStatus: {
267
+ id: "orc-shared.taskStatus",
268
+ defaultMessage: "Status",
269
+ },
270
+ taskLogs: {
271
+ id: "orc-shared.taskLogs",
272
+ defaultMessage: "Logs",
273
+ },
258
274
  });
259
275
 
260
276
  export default sharedMessages;
@@ -3,8 +3,8 @@
3
3
  "orc-shared.active": "Active",
4
4
  "orc-shared.add": "Add",
5
5
  "orc-shared.allRightsReserved": "All rights reserved.",
6
- "orc-shared.applyChanges": "Apply Changes",
7
6
  "orc-shared.appSelectorTitle": "Orckestra Commerce Cloud Applications List",
7
+ "orc-shared.applyChanges": "Apply Changes",
8
8
  "orc-shared.back": "Back",
9
9
  "orc-shared.cancel": "Cancel",
10
10
  "orc-shared.ccDescription": "The API-first commerce platform that makes omnichannel retail work.",
@@ -14,12 +14,21 @@
14
14
  "orc-shared.confirmation": "Confirmation",
15
15
  "orc-shared.copyright": "© {year} Orckestra Technologies Inc.",
16
16
  "orc-shared.copyrightTermsNotice": "This computer program is protected by copyright laws and international treaties. Unauthorized reproduction or redistribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law. Orckestra is a trademark of Orckestra Technologies Inc. All other trademarks are property of the respective owners.",
17
+ "orc-shared.dataTypeBoolean": "Yes/No Choice",
18
+ "orc-shared.dataTypeDate": "Date/Calendar",
19
+ "orc-shared.dataTypeDecimal": "Decimal Number",
20
+ "orc-shared.dataTypeEntityReference": "Profile Reference",
21
+ "orc-shared.dataTypeInteger": "Whole Number",
22
+ "orc-shared.dataTypeLookup": "Lookup List",
23
+ "orc-shared.dataTypeText": "Text",
17
24
  "orc-shared.defaultApp": "Default application",
18
25
  "orc-shared.delete": "Delete",
19
26
  "orc-shared.description": "Description",
20
27
  "orc-shared.displayLanguage": "Display language",
21
28
  "orc-shared.displayName": "Display Name",
29
+ "orc-shared.embedded": "Embedded",
22
30
  "orc-shared.error": "Error",
31
+ "orc-shared.errorUnknown": "Unknown Error",
23
32
  "orc-shared.fieldIsRequired": "This field is required",
24
33
  "orc-shared.fieldMustBeValidEmail": "This field must be a valid email",
25
34
  "orc-shared.fieldMustBeValidPhoneExtension": "This field must be a valid phone extension",
@@ -44,22 +53,17 @@
44
53
  "orc-shared.scopeChangeWithUnsavedDataConfirmation": "One or more entities opened will be closed with unsaved data. Would you like to change scope?",
45
54
  "orc-shared.scopeChangeWithUnsavedDataTitle": "Confirm scope change without saving data",
46
55
  "orc-shared.scopeFilterPlaceholder": "Type a scope name",
56
+ "orc-shared.shared": "Shared",
47
57
  "orc-shared.showFewerLanguages": "Show fewer languages",
48
58
  "orc-shared.showMoreLanguages": "Show more languages",
49
59
  "orc-shared.signOut": "Sign out",
50
60
  "orc-shared.sortOrder": "Sort Order",
51
61
  "orc-shared.status": "Status",
62
+ "orc-shared.taskId": "Task ID",
63
+ "orc-shared.taskInProgressModalTitle": "Task In Progress",
64
+ "orc-shared.taskLogs": "Logs",
65
+ "orc-shared.taskStatus": "Status",
52
66
  "orc-shared.unsavedChanges": "This entity has unsaved changes. All changes will be lost.\n\nAre you sure you want to close it?",
53
67
  "orc-shared.valueName": "Value Name",
54
- "orc-shared.yes": "Yes",
55
- "orc-shared.embedded": "Embedded",
56
- "orc-shared.shared": "Shared",
57
- "orc-shared.dataTypeText": "Text",
58
- "orc-shared.dataTypeBoolean": "Yes/No Choice",
59
- "orc-shared.dataTypeDate": "Date/Calendar",
60
- "orc-shared.dataTypeDecimal": "Decimal Number",
61
- "orc-shared.dataTypeInteger": "Whole Number",
62
- "orc-shared.dataTypeEntityReference": "Profile Reference",
63
- "orc-shared.dataTypeLookup": "Lookup List",
64
- "orc-shared.errorUnknown": "Unknown Error"
68
+ "orc-shared.yes": "Yes"
65
69
  }
@@ -3,8 +3,8 @@
3
3
  "orc-shared.active": "Actif",
4
4
  "orc-shared.add": "Ajouter",
5
5
  "orc-shared.allRightsReserved": "Tout droits réservés.",
6
- "orc-shared.applyChanges": "Appliquer les modifications",
7
6
  "orc-shared.appSelectorTitle": "Orckestra Commerce Cloud : Liste des applications",
7
+ "orc-shared.applyChanges": "Appliquer les modifications",
8
8
  "orc-shared.back": "Précédent",
9
9
  "orc-shared.cancel": "Annuler",
10
10
  "orc-shared.ccDescription": "La plateforme de commerce « API-first » qui rend le commerce de détail omnicanal fluide.",
@@ -14,12 +14,21 @@
14
14
  "orc-shared.confirmation": "Confirmation",
15
15
  "orc-shared.copyright": "© {year} Technologies Orckestra Inc.",
16
16
  "orc-shared.copyrightTermsNotice": "Avertissement: Ce programme est protégé par la loi relative au droit d'auteur et par les conventions internationales. Toute reproduction ou distribution partielle ou totale du logiciel, par quelque moyen que ce soit, est strictement interdite. Toute personne ne respectant pas ces dispositions se rendra coupable du délit de contrefaçon et sera passible des sanctions pénales prévues par la loi. Orckestra est une marque de commerce déposée et détenue par Technologies Orckestra Inc. Toutes les autres marques de commerce sont la propriété de leurs détenteurs respectifs.",
17
+ "orc-shared.dataTypeBoolean": "Choix Oui/Non",
18
+ "orc-shared.dataTypeDate": "Date/Calendrier",
19
+ "orc-shared.dataTypeDecimal": "Nombre décimal",
20
+ "orc-shared.dataTypeEntityReference": "Profil de référence",
21
+ "orc-shared.dataTypeInteger": "Nombre entier",
22
+ "orc-shared.dataTypeLookup": "Index des listes",
23
+ "orc-shared.dataTypeText": "Texte",
17
24
  "orc-shared.defaultApp": "Application par défaut",
18
25
  "orc-shared.delete": "Supprimer",
19
26
  "orc-shared.description": "Description",
20
27
  "orc-shared.displayLanguage": "Langue d'affichage",
21
28
  "orc-shared.displayName": "Nom d'affichage",
29
+ "orc-shared.embedded": "Intégré",
22
30
  "orc-shared.error": "Erreur",
31
+ "orc-shared.errorUnknown": "Erreur inconnue",
23
32
  "orc-shared.fieldIsRequired": "Est requis",
24
33
  "orc-shared.fieldMustBeValidEmail": "Ce champ doit contenir un courriel valide",
25
34
  "orc-shared.fieldMustBeValidPhoneExtension": "Ce champ doit contenir une extension de téléphone valide",
@@ -44,22 +53,17 @@
44
53
  "orc-shared.scopeChangeWithUnsavedDataConfirmation": "Une ou plusieurs entités ouvertes seront fermées, entraînant la perte de données non-sauvegardées. Voulez-vous vraiment changer de Scope?",
45
54
  "orc-shared.scopeChangeWithUnsavedDataTitle": "Confirmation du changement de Scope sans sauvegarde",
46
55
  "orc-shared.scopeFilterPlaceholder": "Entrez un nom de Scope",
56
+ "orc-shared.shared": "Partagé",
47
57
  "orc-shared.showFewerLanguages": "Afficher moins de langues",
48
58
  "orc-shared.showMoreLanguages": "Afficher plus de langues",
49
59
  "orc-shared.signOut": "Se déconnecter",
50
60
  "orc-shared.sortOrder": "Ordre de tri",
51
61
  "orc-shared.status": "Statut",
62
+ "orc-shared.taskId": "Identifiant de la tâche",
63
+ "orc-shared.taskInProgressModalTitle": "Tâche en cours",
64
+ "orc-shared.taskLogs": "Journal",
65
+ "orc-shared.taskStatus": "Statut",
52
66
  "orc-shared.unsavedChanges": "Ce dossier contient des modifications qui ne sont sauvegardées. Si vous quittez, les modifications seront perdues.\n\nVoulez vous vraiment quitter?",
53
67
  "orc-shared.valueName": "Nom de la valeur",
54
- "orc-shared.yes": "Oui",
55
- "orc-shared.embedded": "Intégré",
56
- "orc-shared.shared": "Partagé",
57
- "orc-shared.dataTypeText": "Texte",
58
- "orc-shared.dataTypeBoolean": "Choix Oui/Non",
59
- "orc-shared.dataTypeDate": "Date/Calendrier",
60
- "orc-shared.dataTypeDecimal": "Nombre décimal",
61
- "orc-shared.dataTypeInteger": "Nombre entier",
62
- "orc-shared.dataTypeEntityReference": "Profil de référence",
63
- "orc-shared.dataTypeLookup": "Index des listes",
64
- "orc-shared.errorUnknown": "Erreur inconnue"
68
+ "orc-shared.yes": "Oui"
65
69
  }
@@ -67,3 +67,41 @@ export const isObjectContainsPropertyWithAnyValue = (obj, propertyName) => {
67
67
 
68
68
  return false;
69
69
  };
70
+
71
+ export const compareObjectProperty = (obj1, obj2, propertyName) => {
72
+ if (propertyName == null || propertyName === "") {
73
+ return 0;
74
+ }
75
+
76
+ const val1 = obj1?.[propertyName];
77
+ const val2 = obj2?.[propertyName];
78
+
79
+ if (val1 === val2) {
80
+ return 0;
81
+ }
82
+
83
+ if (val1 < val2) {
84
+ return -1;
85
+ }
86
+
87
+ return 1;
88
+ };
89
+
90
+ export const compareObjectPropertyDescending = (obj1, obj2, propertyName) => {
91
+ if (propertyName == null || propertyName === "") {
92
+ return 0;
93
+ }
94
+
95
+ const val1 = obj1?.[propertyName];
96
+ const val2 = obj2?.[propertyName];
97
+
98
+ if (val1 === val2) {
99
+ return 0;
100
+ }
101
+
102
+ if (val1 > val2) {
103
+ return -1;
104
+ }
105
+
106
+ return 1;
107
+ };