orc-shared 1.2.0-dev.1 → 1.2.0-dev.13

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 (227) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/dist/actions/applications.js +1 -1
  4. package/dist/actions/authentication.js +1 -1
  5. package/dist/actions/countries.js +1 -1
  6. package/dist/actions/locale.js +1 -1
  7. package/dist/actions/makeApiAction.js +3 -3
  8. package/dist/actions/makeOrcApiAction.js +2 -2
  9. package/dist/actions/metadata.js +3 -3
  10. package/dist/actions/modules.js +63 -1
  11. package/dist/actions/navigation.js +3 -3
  12. package/dist/actions/requestsApi.js +8 -8
  13. package/dist/actions/scopes.js +59 -22
  14. package/dist/actions/timezones.js +1 -1
  15. package/dist/actions/toasts.js +1 -1
  16. package/dist/actions/versionInfo.js +1 -1
  17. package/dist/actions/view.js +1 -1
  18. package/dist/buildStore.js +3 -3
  19. package/dist/components/AppFrame/About.js +11 -6
  20. package/dist/components/AppFrame/MenuItem.js +6 -15
  21. package/dist/components/AppFrame/Preferences.js +3 -3
  22. package/dist/components/AppFrame/Sidebar.js +20 -9
  23. package/dist/components/AppFrame/Topbar.js +1 -1
  24. package/dist/components/ApplicationModuleLoader.js +143 -0
  25. package/dist/components/Authenticate.js +13 -13
  26. package/dist/components/CategoryList.js +1 -1
  27. package/dist/components/Checkbox.js +1 -1
  28. package/dist/components/DropMenu/Menu.js +1 -1
  29. package/dist/components/DropMenu/index.js +1 -1
  30. package/dist/components/Form/FieldList.js +3 -3
  31. package/dist/components/Form/Form.js +1 -1
  32. package/dist/components/Form/Inputs/Button.js +1 -1
  33. package/dist/components/Form/Inputs/FieldButtons.js +1 -1
  34. package/dist/components/Form/Inputs/Number.js +1 -1
  35. package/dist/components/Form/Inputs/ReadOnly.js +1 -1
  36. package/dist/components/Form/Inputs/SmallButton.js +1 -1
  37. package/dist/components/Form/Inputs/Text.js +1 -1
  38. package/dist/components/Form/Inputs/Time.js +1 -1
  39. package/dist/components/Form/Inputs/Toggles.js +1 -1
  40. package/dist/components/Form/Inputs/Translation.js +3 -3
  41. package/dist/components/List/HeadCell.js +1 -1
  42. package/dist/components/List/List.js +1 -1
  43. package/dist/components/List/Row.js +1 -1
  44. package/dist/components/List/enhanceColumnDefs.js +2 -2
  45. package/dist/components/MaterialUI/DataDisplay/List.js +1 -1
  46. package/dist/components/MaterialUI/DataDisplay/Notification.js +2 -2
  47. package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +1 -1
  48. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +3 -3
  49. package/dist/components/MaterialUI/DataDisplay/Table.js +1 -1
  50. package/dist/components/MaterialUI/DataDisplay/TableProps.js +1 -1
  51. package/dist/components/MaterialUI/DataDisplay/TransferList.js +1 -1
  52. package/dist/components/MaterialUI/DataDisplay/chipProps.js +1 -1
  53. package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +1 -1
  54. package/dist/components/MaterialUI/DataDisplay/dividerProps.js +1 -1
  55. package/dist/components/MaterialUI/DataDisplay/index.js +1 -1
  56. package/dist/components/MaterialUI/DataDisplay/modalProps.js +1 -1
  57. package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +3 -3
  58. package/dist/components/MaterialUI/Feedback/useNotification.js +1 -1
  59. package/dist/components/MaterialUI/Inputs/Autocomplete.js +2 -2
  60. package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +1 -1
  61. package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +1 -1
  62. package/dist/components/MaterialUI/Inputs/CheckboxProps.js +1 -1
  63. package/dist/components/MaterialUI/Inputs/InputBase.js +42 -5
  64. package/dist/components/MaterialUI/Inputs/InputBaseProps.js +1 -1
  65. package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
  66. package/dist/components/MaterialUI/Inputs/RadioProps.js +1 -1
  67. package/dist/components/MaterialUI/Inputs/Select.js +2 -2
  68. package/dist/components/MaterialUI/Inputs/SelectProps.js +1 -1
  69. package/dist/components/MaterialUI/Inputs/Switch.js +3 -3
  70. package/dist/components/MaterialUI/Inputs/SwitchProps.js +1 -1
  71. package/dist/components/MaterialUI/Inputs/TimePicker.js +1 -1
  72. package/dist/components/MaterialUI/Inputs/createInput.js +3 -3
  73. package/dist/components/MaterialUI/Inputs/index.js +1 -1
  74. package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +1 -1
  75. package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +1 -1
  76. package/dist/components/MaterialUI/Navigation/ExternalLink.js +113 -0
  77. package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +8 -2
  78. package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +1 -1
  79. package/dist/components/MaterialUI/Surfaces/paperProps.js +1 -1
  80. package/dist/components/MaterialUI/muiThemes.js +7 -2
  81. package/dist/components/MaterialUI/textProps.js +1 -1
  82. package/dist/components/Modules.js +126 -41
  83. package/dist/components/MultiSelector.js +1 -1
  84. package/dist/components/Navigation/Bar.js +3 -3
  85. package/dist/components/Navigation/Tab.js +1 -1
  86. package/dist/components/Navigation/useNavigationState.js +3 -3
  87. package/dist/components/Placeholder.js +1 -1
  88. package/dist/components/Routing/FullPage.js +3 -1
  89. package/dist/components/Routing/Page.js +5 -3
  90. package/dist/components/Routing/Segment.js +1 -1
  91. package/dist/components/Routing/SegmentPage.js +1 -1
  92. package/dist/components/Routing/withWaypointing.js +8 -4
  93. package/dist/components/Scope/ScopeNode.js +1 -1
  94. package/dist/components/Scope/Selector.js +1 -1
  95. package/dist/components/Scope/index.js +3 -3
  96. package/dist/components/Scope/useScopeConfirmationModalState.js +7 -16
  97. package/dist/components/Scope/useScopeData.js +4 -13
  98. package/dist/components/Scope/useScopeSelect.js +1 -1
  99. package/dist/components/Selector.js +1 -1
  100. package/dist/components/Spritesheet.js +1 -1
  101. package/dist/components/Switch.js +1 -1
  102. package/dist/components/Text.js +1 -1
  103. package/dist/components/ToastList.js +1 -1
  104. package/dist/components/Toolbar.js +1 -1
  105. package/dist/components/Treeview/Label.js +1 -1
  106. package/dist/components/Treeview/Leaf.js +1 -1
  107. package/dist/components/Treeview/Node.js +3 -3
  108. package/dist/components/Treeview/index.js +2 -2
  109. package/dist/components/Treeview/settings.js +1 -1
  110. package/dist/constants.js +19 -2
  111. package/dist/content/icons/lock.svg +3 -0
  112. package/dist/content/icons/orckestra-icon.svg +5 -0
  113. package/dist/content/icons/unlock.svg +3 -0
  114. package/dist/content/iconsSheet.svg +11 -0
  115. package/dist/content/orckestra-logo-white.png +0 -0
  116. package/dist/getThemeOverrides.js +2 -2
  117. package/dist/hocs/withInfiniteScroll.js +1 -1
  118. package/dist/hocs/withUpdateHandler.js +2 -2
  119. package/dist/hooks/useDispatchWithModulesData.js +1 -1
  120. package/dist/hooks/useEditState.js +3 -3
  121. package/dist/hooks/useEntityLoader.js +2 -2
  122. package/dist/hooks/useFullEntityEditState.js +3 -3
  123. package/dist/hooks/useLabelMessage.js +3 -3
  124. package/dist/hooks/useMultipleFieldEditState.js +2 -2
  125. package/dist/hooks/useNavigationHandler.js +1 -1
  126. package/dist/hooks/useNotificationRequestState.js +2 -2
  127. package/dist/hooks/useSelectorAndUnwrap.js +1 -1
  128. package/dist/reducers/metadata.js +1 -1
  129. package/dist/reducers/modules.js +39 -1
  130. package/dist/reducers/scopes.js +27 -0
  131. package/dist/reducers/settings.js +31 -2
  132. package/dist/schemas/countries.js +1 -1
  133. package/dist/schemas/definitions.js +1 -1
  134. package/dist/schemas/metadata.js +1 -1
  135. package/dist/schemas/productDefinitions.js +1 -1
  136. package/dist/schemas/timezones.js +1 -1
  137. package/dist/selectors/applications.js +1 -1
  138. package/dist/selectors/authentication.js +57 -18
  139. package/dist/selectors/countries.js +1 -1
  140. package/dist/selectors/locale.js +1 -1
  141. package/dist/selectors/metadata.js +16 -6
  142. package/dist/selectors/modules.js +15 -1
  143. package/dist/selectors/navigation.js +1 -1
  144. package/dist/selectors/requests.js +1 -1
  145. package/dist/selectors/scope.js +8 -1
  146. package/dist/selectors/settings.js +13 -1
  147. package/dist/selectors/versionInfo.js +1 -1
  148. package/dist/selectors/view.js +1 -1
  149. package/dist/spawnerMiddleware.js +1 -1
  150. package/dist/utils/displayModeHelper.js +1 -1
  151. package/dist/utils/flatten.js +2 -2
  152. package/dist/utils/localizationHelper.js +1 -1
  153. package/dist/utils/mapHelper.js +1 -1
  154. package/dist/utils/modelValidationHelper.js +1 -1
  155. package/dist/utils/parseHelper.js +1 -1
  156. package/dist/utils/propertyHelper.js +2 -2
  157. package/dist/utils/propertyValidator.js +1 -1
  158. package/dist/utils/setTranslation.js +27 -1
  159. package/dist/utils/setTranslationWithFallback.js +31 -2
  160. package/dist/utils/testUtils.js +2 -1
  161. package/dist/utils/unwrapImmutable.js +1 -1
  162. package/dist/utils/urlHelper.js +1 -1
  163. package/package.json +6 -5
  164. package/src/actions/modules.js +30 -0
  165. package/src/actions/modules.test.js +50 -1
  166. package/src/actions/scopes.js +33 -7
  167. package/src/actions/scopes.test.js +84 -14
  168. package/src/components/AppFrame/About.js +10 -3
  169. package/src/components/AppFrame/AppFrame.test.js +9 -0
  170. package/src/components/AppFrame/MenuItem.js +3 -5
  171. package/src/components/AppFrame/MenuItem.test.js +2 -24
  172. package/src/components/AppFrame/Sidebar.js +11 -12
  173. package/src/components/AppFrame/Sidebar.test.js +18 -0
  174. package/src/components/ApplicationModuleLoader.js +52 -0
  175. package/src/components/ApplicationModuleLoader.test.js +149 -0
  176. package/src/components/Authenticate.js +5 -4
  177. package/src/components/Authenticate.test.js +23 -4
  178. package/src/components/MaterialUI/DataDisplay/PredefinedElements/Translations.test.js +7 -1
  179. package/src/components/MaterialUI/Inputs/InputBase.js +19 -2
  180. package/src/components/MaterialUI/Inputs/InputBase.test.js +68 -0
  181. package/src/components/MaterialUI/Navigation/ExternalLink.js +25 -0
  182. package/src/components/MaterialUI/Navigation/ExternalLink.test.js +26 -0
  183. package/src/components/MaterialUI/ScopeSelector/ScopeSelector.js +5 -1
  184. package/src/components/MaterialUI/muiThemes.js +5 -0
  185. package/src/components/Modules.js +103 -20
  186. package/src/components/Modules.test.js +315 -28
  187. package/src/components/Provision.test.js +34 -0
  188. package/src/components/Routing/FullPage.js +2 -1
  189. package/src/components/Routing/FullPage.test.js +23 -0
  190. package/src/components/Routing/Page.js +2 -2
  191. package/src/components/Routing/Page.test.js +20 -0
  192. package/src/components/Routing/Segment.js +1 -1
  193. package/src/components/Routing/withWaypointing.js +2 -2
  194. package/src/components/Routing/withWaypointing.test.js +33 -5
  195. package/src/components/Scope/Scope.test.js +4 -0
  196. package/src/components/Scope/useScopeConfirmationModalState.js +5 -16
  197. package/src/components/Scope/useScopeConfirmationModalState.test.js +39 -13
  198. package/src/components/Scope/useScopeData.js +0 -3
  199. package/src/components/Scope/useScopeData.test.js +0 -27
  200. package/src/constants.js +15 -0
  201. package/src/content/icons/lock.svg +3 -0
  202. package/src/content/icons/orckestra-icon.svg +5 -0
  203. package/src/content/icons/unlock.svg +3 -0
  204. package/src/content/iconsSheet.svg +11 -0
  205. package/src/content/orckestra-logo-white.png +0 -0
  206. package/src/hocs/withScopeData.test.js +0 -31
  207. package/src/reducers/modules.js +48 -2
  208. package/src/reducers/modules.test.js +117 -2
  209. package/src/reducers/scopes.js +30 -0
  210. package/src/reducers/scopes.test.js +45 -1
  211. package/src/reducers/settings.js +26 -2
  212. package/src/reducers/settings.test.js +74 -6
  213. package/src/selectors/authentication.js +53 -27
  214. package/src/selectors/authentication.test.js +600 -12
  215. package/src/selectors/metadata.js +18 -7
  216. package/src/selectors/metadata.test.js +221 -283
  217. package/src/selectors/modules.js +7 -0
  218. package/src/selectors/modules.test.js +16 -1
  219. package/src/selectors/scope.js +3 -1
  220. package/src/selectors/scope.test.js +5 -0
  221. package/src/selectors/settings.js +6 -0
  222. package/src/translations/en-US.json +1 -1
  223. package/src/translations/fr-CA.json +1 -1
  224. package/src/utils/setTranslation.js +16 -1
  225. package/src/utils/setTranslation.test.js +24 -0
  226. package/src/utils/setTranslationWithFallback.js +18 -1
  227. package/src/utils/setTranslationWithFallback.test.js +108 -0
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.getPropertyOrDefaultFromMap = getPropertyOrDefaultFromMap;
5
4
  exports.getPropertyOrDefault = getPropertyOrDefault;
6
- exports.isObjectContainsPropertyWithAnyValue = exports.isObjectContainsPropertyWithValue = void 0;
5
+ exports.getPropertyOrDefaultFromMap = getPropertyOrDefaultFromMap;
6
+ exports.isObjectContainsPropertyWithValue = exports.isObjectContainsPropertyWithAnyValue = void 0;
7
7
 
8
8
  (function () {
9
9
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.isReactComponent = exports.isStringNullOrWhitespace = exports.isObject = exports.isString = void 0;
4
+ exports.isStringNullOrWhitespace = exports.isString = exports.isReactComponent = exports.isObject = void 0;
5
5
 
6
6
  var _react = _interopRequireDefault(require("react"));
7
7
 
@@ -15,6 +15,12 @@ var _flatten = require("./flatten");
15
15
  enterModule && enterModule(module);
16
16
  })();
17
17
 
18
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
+
20
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
+
22
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
23
+
18
24
  var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
19
25
  return a;
20
26
  };
@@ -30,7 +36,27 @@ var setTranslation = function setTranslation(locale, obj) {
30
36
  }
31
37
 
32
38
  if (!obj || !obj.getIn((0, _flatten.flatten)([field]))) return obj;
33
- var value = obj.getIn((0, _flatten.flatten)([field, locale])) || obj.getIn((0, _flatten.flatten)([field])).filter(function (i) {
39
+ var localeValue = obj.getIn((0, _flatten.flatten)([field, locale]));
40
+
41
+ if (!localeValue && locale.includes("-")) {
42
+ var fieldValue = obj.getIn((0, _flatten.flatten)([field]));
43
+ var fieldKeys = fieldValue.keys();
44
+ var language = locale.substring(0, locale.indexOf("-"));
45
+
46
+ for (var _iterator = _createForOfIteratorHelperLoose(fieldKeys), _step; !(_step = _iterator()).done;) {
47
+ var key = _step.value;
48
+
49
+ if (key !== locale && key.startsWith(language)) {
50
+ localeValue = obj.getIn((0, _flatten.flatten)([field, key]));
51
+
52
+ if (localeValue) {
53
+ break;
54
+ }
55
+ }
56
+ }
57
+ }
58
+
59
+ var value = localeValue || obj.getIn((0, _flatten.flatten)([field])).filter(function (i) {
34
60
  return i;
35
61
  }).first() || "";
36
62
  return obj.setIn((0, _flatten.flatten)([field]), value);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.setTranslationWithFallbackField = exports.setTranslationWithFallbackValue = void 0;
4
+ exports.setTranslationWithFallbackValue = exports.setTranslationWithFallbackField = void 0;
5
5
 
6
6
  var _flatten = require("./flatten");
7
7
 
@@ -15,6 +15,12 @@ var _flatten = require("./flatten");
15
15
  enterModule && enterModule(module);
16
16
  })();
17
17
 
18
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
+
20
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
+
22
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
23
+
18
24
  var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
19
25
  return a;
20
26
  };
@@ -30,7 +36,30 @@ var setTranslationWithFallbackValue = function setTranslationWithFallbackValue(l
30
36
  field[_key - 3] = arguments[_key];
31
37
  }
32
38
 
33
- var value = obj.getIn((0, _flatten.flatten)([field, locale])) || fallbackValue || "";
39
+ var localeValue = obj.getIn((0, _flatten.flatten)([field, locale]));
40
+
41
+ if (!localeValue && locale.includes("-")) {
42
+ var fieldValue = obj.getIn((0, _flatten.flatten)([field]));
43
+
44
+ if (fieldValue) {
45
+ var fieldKeys = fieldValue.keys();
46
+ var language = locale.substring(0, locale.indexOf("-"));
47
+
48
+ for (var _iterator = _createForOfIteratorHelperLoose(fieldKeys), _step; !(_step = _iterator()).done;) {
49
+ var key = _step.value;
50
+
51
+ if (key !== locale && key.startsWith(language)) {
52
+ localeValue = obj.getIn((0, _flatten.flatten)([field, key]));
53
+
54
+ if (localeValue) {
55
+ break;
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+
62
+ var value = localeValue || fallbackValue || "";
34
63
  return obj.setIn((0, _flatten.flatten)([field]), value);
35
64
  };
36
65
 
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ exports.createMuiTheme = exports.TestWrapper = exports.PropStruct = void 0;
4
5
  exports.extractMessages = extractMessages;
5
- exports.TestWrapper = exports.generateClassName = exports.createMuiTheme = exports.ignoreConsoleError = exports.PropStruct = exports.firstItemComparator = exports.getStyledClassSelector = exports.getClassSelector = exports.getClassName = exports.getElmClasses = exports.spyOnConsole = void 0;
6
+ exports.spyOnConsole = exports.ignoreConsoleError = exports.getStyledClassSelector = exports.getElmClasses = exports.getClassSelector = exports.getClassName = exports.generateClassName = exports.firstItemComparator = void 0;
6
7
 
7
8
  var _react = _interopRequireDefault(require("react"));
8
9
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.default = exports.unwrapImmutable = void 0;
4
+ exports.unwrapImmutable = exports.default = void 0;
5
5
 
6
6
  var _immutable = _interopRequireDefault(require("immutable4"));
7
7
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.resolveEntityId = exports.tryGetNewEntityIdKey = exports.NEW_ENTITY_URL_KEY = exports.getValueFromUrlByKey = void 0;
4
+ exports.tryGetNewEntityIdKey = exports.resolveEntityId = exports.getValueFromUrlByKey = exports.NEW_ENTITY_URL_KEY = void 0;
5
5
 
6
6
  (function () {
7
7
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orc-shared",
3
- "version": "1.2.0-dev.1",
3
+ "version": "1.2.0-dev.13",
4
4
  "description": "Shared code for Orckestra applications",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
@@ -47,11 +47,9 @@
47
47
  "cultureIso": "fr-CA"
48
48
  }
49
49
  ],
50
- "devDependencies": {
51
- "orc-scripts": "1.3.0-dev.1"
52
- },
50
+ "devDependencies": {},
53
51
  "peerDependencies": {
54
- "orc-scripts": "1.3.0-dev.1"
52
+ "orc-scripts": "1.3.0-dev.2"
55
53
  },
56
54
  "sideEffects": false,
57
55
  "lint-staged": {
@@ -69,5 +67,8 @@
69
67
  "hooks": {
70
68
  "pre-commit": "lint-staged"
71
69
  }
70
+ },
71
+ "dependencies": {
72
+ "orc-scripts": "1.3.0-dev.2"
72
73
  }
73
74
  }
@@ -4,3 +4,33 @@ export const setModulesStructure = modules => ({
4
4
  type: SET_MODULES_STRUCTURE,
5
5
  payload: modules,
6
6
  });
7
+
8
+ export const SET_MODULE_AS_VISIBLE = "SET_MODULE_AS_VISIBLE";
9
+
10
+ export const setModuleAsVisible = module => ({
11
+ type: SET_MODULE_AS_VISIBLE,
12
+ payload: module,
13
+ });
14
+
15
+ export const INITIALIZE_FIRST_MODULE_SCOPE = "INITIALIZE_FIRST_MODULE_SCOPE";
16
+
17
+ export const initializeFirstModuleScope = scope => ({
18
+ type: INITIALIZE_FIRST_MODULE_SCOPE,
19
+ payload: scope,
20
+ });
21
+
22
+ export const SET_NEW_SCOPE_AND_MODULE_NAME = "SET_NEW_SCOPE_AND_MODULE_NAME";
23
+
24
+ export const setNewScopeAndModuleName = (scope, moduleName) => ({
25
+ type: SET_NEW_SCOPE_AND_MODULE_NAME,
26
+ payload: {
27
+ scope,
28
+ moduleName,
29
+ },
30
+ });
31
+
32
+ export const SET_ROUTING_PERFORMED = "SET_ROUTING_PERFORMED";
33
+
34
+ export const setRoutingPerformed = () => ({
35
+ type: SET_ROUTING_PERFORMED,
36
+ });
@@ -1,4 +1,15 @@
1
- import { SET_MODULES_STRUCTURE, setModulesStructure } from "./modules";
1
+ import {
2
+ INITIALIZE_FIRST_MODULE_SCOPE,
3
+ initializeFirstModuleScope,
4
+ SET_MODULE_AS_VISIBLE,
5
+ SET_MODULES_STRUCTURE,
6
+ SET_NEW_SCOPE_AND_MODULE_NAME,
7
+ SET_ROUTING_PERFORMED,
8
+ setModuleAsVisible,
9
+ setModulesStructure,
10
+ setNewScopeAndModuleName,
11
+ setRoutingPerformed,
12
+ } from "./modules";
2
13
 
3
14
  describe("setModulesStructure", () => {
4
15
  it("creates an action object", () => {
@@ -8,3 +19,41 @@ describe("setModulesStructure", () => {
8
19
  });
9
20
  });
10
21
  });
22
+
23
+ describe("initializeFirstModuleScope", () => {
24
+ it("creates an action object", () => {
25
+ expect(initializeFirstModuleScope, "when called with", ["module_1"], "to equal", {
26
+ type: INITIALIZE_FIRST_MODULE_SCOPE,
27
+ payload: "module_1",
28
+ });
29
+ });
30
+ });
31
+
32
+ describe("setModuleAsVisible", () => {
33
+ it("creates an action object", () => {
34
+ expect(setModuleAsVisible, "when called with", ["module_A"], "to equal", {
35
+ type: SET_MODULE_AS_VISIBLE,
36
+ payload: "module_A",
37
+ });
38
+ });
39
+ });
40
+
41
+ describe("setNewScopeAndModuleName", () => {
42
+ it("creates an action object", () => {
43
+ expect(setNewScopeAndModuleName, "when called with", ["matrixScope", "moduleNeo"], "to equal", {
44
+ type: SET_NEW_SCOPE_AND_MODULE_NAME,
45
+ payload: {
46
+ scope: "matrixScope",
47
+ moduleName: "moduleNeo",
48
+ },
49
+ });
50
+ });
51
+ });
52
+
53
+ describe("setRoutingPerformed", () => {
54
+ it("creates an action object", () => {
55
+ expect(setRoutingPerformed, "when called", "to equal", {
56
+ type: SET_ROUTING_PERFORMED,
57
+ });
58
+ });
59
+ });
@@ -1,26 +1,52 @@
1
1
  import { makeActionTypes } from "./makeApiAction";
2
2
  import makeOrcApiAction from "./makeOrcApiAction";
3
- import { getUserScopeRequest, getUserScopeTreeRequest } from "./requestsApi";
3
+ import { getApplicationModules, getUserScopeRequest, getUserScopeTreeRequest } from "./requestsApi";
4
+ import { overtureModule } from "../constants";
4
5
 
5
- export const validateOvertureModule = () => {
6
- if (!OVERTURE_MODULE) {
7
- throw new Error('"overtureModule.name" is missing in the configuration.');
6
+ export const validateOvertureApplication = () => {
7
+ if (!OVERTURE_APPLICATION) {
8
+ throw new Error('"overtureApplication.name" is missing in the configuration.');
8
9
  }
9
10
  };
10
11
 
11
- validateOvertureModule();
12
+ validateOvertureApplication();
13
+
14
+ export const GET_APPLICATION_MODULES = "GET_APPLICATION_MODULES";
15
+
16
+ export const [GET_APPLICATION_MODULES_REQUEST, GET_APPLICATION_MODULES_SUCCESS, GET_APPLICATION_MODULES_FAILURE] =
17
+ makeActionTypes(GET_APPLICATION_MODULES);
18
+
19
+ export const getAppModules = () =>
20
+ makeOrcApiAction(GET_APPLICATION_MODULES, getApplicationModules.buildUrl(OVERTURE_APPLICATION));
12
21
 
13
22
  export const GET_SCOPES = "GET_SCOPES";
14
23
 
15
24
  export const [GET_SCOPES_REQUEST, GET_SCOPES_SUCCESS, GET_SCOPES_FAILURE] = makeActionTypes(GET_SCOPES);
16
25
 
17
- export const getScopes = () => makeOrcApiAction(GET_SCOPES, getUserScopeTreeRequest.buildUrl(OVERTURE_MODULE, {}));
26
+ export const getScopes = module =>
27
+ makeOrcApiAction(
28
+ GET_SCOPES,
29
+ getUserScopeTreeRequest.buildUrl(module === overtureModule.System ? overtureModule.Orders : module, {}),
30
+ getUserScopeTreeRequest.verb,
31
+ {
32
+ bailout: false,
33
+ meta: { module },
34
+ },
35
+ );
18
36
 
19
37
  export const GET_MY_SCOPE = "GET_MY_SCOPE";
20
38
 
21
39
  export const [GET_MY_SCOPE_REQUEST, GET_MY_SCOPE_SUCCESS, GET_MY_SCOPE_FAILURE] = makeActionTypes(GET_MY_SCOPE);
22
40
 
23
- export const getDefaultScope = () => makeOrcApiAction(GET_MY_SCOPE, getUserScopeRequest.buildUrl(OVERTURE_MODULE));
41
+ export const getDefaultScope = module =>
42
+ makeOrcApiAction(
43
+ GET_MY_SCOPE,
44
+ getUserScopeRequest.buildUrl(module === overtureModule.System ? overtureModule.Orders : module),
45
+ getUserScopeRequest.verb,
46
+ {
47
+ bailout: false,
48
+ },
49
+ );
24
50
 
25
51
  export const APPLICATION_SCOPE_HAS_CHANGED = "APPLICATION_SCOPE_HAS_CHANGED";
26
52
 
@@ -1,16 +1,17 @@
1
1
  import { RSAA } from "redux-api-middleware";
2
2
  import {
3
- GET_SCOPES_REQUEST,
4
- GET_SCOPES_SUCCESS,
5
- GET_SCOPES_FAILURE,
6
3
  getScopes,
7
4
  GET_MY_SCOPE_REQUEST,
8
5
  GET_MY_SCOPE_SUCCESS,
9
6
  GET_MY_SCOPE_FAILURE,
10
7
  getDefaultScope,
11
- validateOvertureModule,
8
+ validateOvertureApplication,
12
9
  APPLICATION_SCOPE_HAS_CHANGED,
13
10
  applicationScopeHasChanged,
11
+ getAppModules,
12
+ GET_APPLICATION_MODULES_REQUEST,
13
+ GET_APPLICATION_MODULES_SUCCESS,
14
+ GET_APPLICATION_MODULES_FAILURE,
14
15
  } from "./scopes";
15
16
 
16
17
  jest.mock("../utils/buildUrl", () => {
@@ -20,19 +21,71 @@ jest.mock("../utils/buildUrl", () => {
20
21
  return modExport;
21
22
  });
22
23
 
24
+ describe("getAppModules", () => {
25
+ it("creates a RSAA to fetch application modules", () => {
26
+ expect(getAppModules, "when called", "to exhaustively satisfy", {
27
+ [RSAA]: {
28
+ types: [GET_APPLICATION_MODULES_REQUEST, GET_APPLICATION_MODULES_SUCCESS, GET_APPLICATION_MODULES_FAILURE],
29
+ endpoint: 'URL: modules/byApplicationName/anApplication ""',
30
+ method: "GET",
31
+ body: undefined,
32
+ credentials: "include",
33
+ bailout: expect.it("to be a function"),
34
+ headers: {
35
+ Accept: "application/json; charset=utf-8",
36
+ "Content-Type": "application/json",
37
+ },
38
+ options: { redirect: "follow" },
39
+ },
40
+ });
41
+ });
42
+ });
43
+
23
44
  describe("getScopes", () => {
24
- beforeEach(() => {});
25
- afterEach(() => {});
45
+ let originalApplication;
46
+
47
+ beforeEach(() => {
48
+ originalApplication = global.OVERTURE_APPLICATION;
49
+ });
50
+
51
+ afterEach(() => {
52
+ global.OVERTURE_APPLICATION = originalApplication;
53
+ });
26
54
 
27
55
  it("creates a RSAA to fetch authorized scope tree", () =>
28
- expect(getScopes, "when called", "to exhaustively satisfy", {
56
+ expect(getScopes, "when called with", ["aModule"], "to exhaustively satisfy", {
29
57
  [RSAA]: {
30
- types: [GET_SCOPES_REQUEST, GET_SCOPES_SUCCESS, GET_SCOPES_FAILURE],
58
+ types: [
59
+ { type: "GET_SCOPES_REQUEST", meta: { module: "aModule" } },
60
+ { type: "GET_SCOPES_SUCCESS", meta: { module: "aModule" } },
61
+ { type: "GET_SCOPES_FAILURE", meta: { module: "aModule" } },
62
+ ],
31
63
  endpoint: "URL: my/scope/aModule/tree {}",
32
64
  method: "GET",
33
65
  body: undefined,
34
66
  credentials: "include",
35
- bailout: expect.it("to be a function"),
67
+ bailout: false,
68
+ headers: {
69
+ Accept: "application/json; charset=utf-8",
70
+ "Content-Type": "application/json",
71
+ },
72
+ options: { redirect: "follow" },
73
+ },
74
+ }));
75
+
76
+ it("creates a RSAA to fetch authorized scope tree for system module", () =>
77
+ expect(getScopes, "when called with", ["System"], "to exhaustively satisfy", {
78
+ [RSAA]: {
79
+ types: [
80
+ { type: "GET_SCOPES_REQUEST", meta: { module: "System" } },
81
+ { type: "GET_SCOPES_SUCCESS", meta: { module: "System" } },
82
+ { type: "GET_SCOPES_FAILURE", meta: { module: "System" } },
83
+ ],
84
+ endpoint: "URL: my/scope/Order/tree {}",
85
+ method: "GET",
86
+ body: undefined,
87
+ credentials: "include",
88
+ bailout: false,
36
89
  headers: {
37
90
  Accept: "application/json; charset=utf-8",
38
91
  "Content-Type": "application/json",
@@ -42,14 +95,31 @@ describe("getScopes", () => {
42
95
  }));
43
96
 
44
97
  it("creates a RSAA to fetch default user scope", () =>
45
- expect(getDefaultScope, "when called", "to exhaustively satisfy", {
98
+ expect(getDefaultScope, "when called with", ["aModule"], "to exhaustively satisfy", {
46
99
  [RSAA]: {
47
100
  types: [GET_MY_SCOPE_REQUEST, GET_MY_SCOPE_SUCCESS, GET_MY_SCOPE_FAILURE],
48
101
  endpoint: 'URL: my/scope/aModule ""',
49
102
  method: "GET",
50
103
  body: undefined,
51
104
  credentials: "include",
52
- bailout: expect.it("to be a function"),
105
+ bailout: false,
106
+ headers: {
107
+ Accept: "application/json; charset=utf-8",
108
+ "Content-Type": "application/json",
109
+ },
110
+ options: { redirect: "follow" },
111
+ },
112
+ }));
113
+
114
+ it("creates a RSAA to fetch default user scope for System module", () =>
115
+ expect(getDefaultScope, "when called with", ["System"], "to exhaustively satisfy", {
116
+ [RSAA]: {
117
+ types: [GET_MY_SCOPE_REQUEST, GET_MY_SCOPE_SUCCESS, GET_MY_SCOPE_FAILURE],
118
+ endpoint: 'URL: my/scope/Order ""',
119
+ method: "GET",
120
+ body: undefined,
121
+ credentials: "include",
122
+ bailout: false,
53
123
  headers: {
54
124
  Accept: "application/json; charset=utf-8",
55
125
  "Content-Type": "application/json",
@@ -59,11 +129,11 @@ describe("getScopes", () => {
59
129
  }));
60
130
 
61
131
  it("throws an error if no class found on DOM element", () => {
62
- global.OVERTURE_MODULE = "";
132
+ global.OVERTURE_APPLICATION = "";
63
133
  expect(
64
- () => expect(validateOvertureModule, "when called with", []),
134
+ () => expect(validateOvertureApplication, "when called with", []),
65
135
  "to throw",
66
- '"overtureModule.name" is missing in the configuration.',
136
+ '"overtureApplication.name" is missing in the configuration.',
67
137
  );
68
138
  });
69
139
  });
@@ -8,7 +8,7 @@ import Text from "../Text";
8
8
  import withClickOutside from "../../hocs/withClickOutside";
9
9
  import useViewState from "../../hooks/useViewState";
10
10
  import bgImage from "../../content/aboutBackground.png";
11
- import logoImage from "../../content/aboutLogo.png";
11
+ import logoImage from "../../content/orckestra-logo-white.png";
12
12
  import close from "../../content/close.png";
13
13
  import { getVersionSelector } from "../../selectors/versionInfo";
14
14
  import { currentLocaleOrDefault } from "../../selectors/locale";
@@ -101,7 +101,7 @@ export const About = ({ currentApplication }) => {
101
101
  <CloseButton onClick={closeAboutBox}>
102
102
  <img src={close} alt="X" />
103
103
  </CloseButton>
104
- <img src={logoImage} alt="Orckestra" />
104
+ <img src={logoImage} width="250" alt="Orckestra" />
105
105
  <AboutParagraph>
106
106
  <Text
107
107
  message={{
@@ -164,7 +164,14 @@ export const About = ({ currentApplication }) => {
164
164
  </AboutLink>
165
165
  </AboutParagraph>
166
166
  <AboutParagraph>
167
- <Text message={sharedMessages.copyright} />
167
+ <Text
168
+ message={{
169
+ ...sharedMessages.copyright,
170
+ values: {
171
+ year: new Date().getFullYear(),
172
+ },
173
+ }}
174
+ />
168
175
  <br />
169
176
  <Text message={sharedMessages.allRightsReserved} />
170
177
  </AboutParagraph>
@@ -202,6 +202,15 @@ describe("AppFrame", () => {
202
202
  bar: true,
203
203
  },
204
204
  },
205
+ modules: {
206
+ tree: "modulesTree",
207
+ visibleModules: ["a", "module123", "test1", "test2", "test3"],
208
+ lastScopeAndModuleSelection: {
209
+ scope: "Norway",
210
+ moduleName: "Profiles",
211
+ routingPerformed: false,
212
+ },
213
+ },
205
214
  settings: { defaultScope: "myScope", defaultApp: "12" },
206
215
  versionInfo: { version: "4.2", defaultHelpUrl: "help_url", moduleHelpUrls: [] },
207
216
  view: { scopeSelector: { filter: "1" }, __prefsDialog: { show: false } },
@@ -1,5 +1,4 @@
1
1
  import React, { useRef } from "react";
2
- import { useSelector } from "react-redux";
3
2
  import styled, { css } from "styled-components";
4
3
  import transition from "styled-transition-group";
5
4
  import { Link } from "react-router-dom";
@@ -124,13 +123,11 @@ const MenuItem = ({
124
123
  alert,
125
124
  pageScopeSelector,
126
125
  closingTabHandler,
127
- hide,
126
+ hide, // This props is not used in the component, but we need to destructure it so props can be used in ItemWrapper
127
+ isHidden = false,
128
128
  href,
129
129
  ...props
130
130
  }) => {
131
- let hideSelector = state => (typeof hide === "function" ? hide(state) : hide ?? false);
132
- const isHidden = useSelector(hideSelector);
133
-
134
131
  let ItemWrapper = Block;
135
132
  if (props.menuToggle) {
136
133
  ItemWrapper = BlockWithA;
@@ -139,6 +136,7 @@ const MenuItem = ({
139
136
  if (alert && alert.message) {
140
137
  alertMessage.current = alert.message;
141
138
  }
139
+
142
140
  return (
143
141
  !isHidden && (
144
142
  <ItemWrapper to={href} {...props}>
@@ -168,7 +168,7 @@ describe("MenuItem", () => {
168
168
  </MemoryRouter>,
169
169
  ));
170
170
 
171
- it("shows nothing if hide is true", () => {
171
+ it("shows nothing if isHidden is true", () => {
172
172
  expect(
173
173
  <Provider store={store}>
174
174
  <MemoryRouter>
@@ -178,29 +178,7 @@ describe("MenuItem", () => {
178
178
  icon="cake"
179
179
  label="Test"
180
180
  alert={{ message: "Test message", type: "warn" }}
181
- hide={true}
182
- />
183
- </MemoryRouter>
184
- </Provider>,
185
- "when mounted",
186
- "to equal",
187
- null,
188
- );
189
- });
190
-
191
- it("shows nothing if hide selector returns true", () => {
192
- const hide = state => true;
193
-
194
- expect(
195
- <Provider store={store}>
196
- <MemoryRouter>
197
- <MenuItem
198
- id="test"
199
- href="/foo/test"
200
- icon="cake"
201
- label="Test"
202
- alert={{ message: "Test message", type: "warn" }}
203
- hide={hide}
181
+ isHidden={true}
204
182
  />
205
183
  </MemoryRouter>
206
184
  </Provider>,
@@ -5,6 +5,7 @@ import { useLocation } from "react-router-dom";
5
5
  import { getThemeProp } from "../../utils";
6
6
  import { selectPrependHrefConfig } from "../../selectors/navigation";
7
7
  import MenuItem from "./MenuItem";
8
+ import { getScopeModuleInformationSelector } from "../../selectors/modules";
8
9
 
9
10
  export const Bar = styled.div`
10
11
  box-sizing: border-box;
@@ -40,7 +41,13 @@ const useEnhancement = id => {
40
41
  };
41
42
  };
42
43
 
43
- export const EnhancedMenuItem = ({ id, ...props }) => <MenuItem {...props} {...useEnhancement(id)} />;
44
+ export const EnhancedMenuItem = ({ id, ...props }) => {
45
+ const defaultModule = useSelector(getScopeModuleInformationSelector);
46
+
47
+ const isHidden = !defaultModule.visibleModules.includes(id);
48
+
49
+ return <MenuItem {...props} {...useEnhancement(id)} isHidden={isHidden} />;
50
+ };
44
51
 
45
52
  const LogoSvg = styled.svg`
46
53
  flex: 0 0 auto;
@@ -53,17 +60,9 @@ const LogoSvg = styled.svg`
53
60
  `;
54
61
 
55
62
  export const Logo = () => (
56
- <LogoSvg>
57
- <path
58
- id="orckestra-logo"
59
- d="M10.3,3.8c-1.7,0-3.5,0.7-4.7,1.9L2.8,3c1.9-1.9,4.6-3,7.5-3c0.6,0,1.3,0.1,1.9,0.2
60
- l-0.9,3.7C11,3.8,10.6,3.8,10.3,3.8L10.3,3.8z M16.1,7.5c-1.4-1.4-3.2-2.1-5.1-2.1c-2,0-3.9,0.8-5.3,2.3c-1.2,1.2-1.9,2.8-2,4.5H0
61
- c0.1-2.7,1-4.9,3-7c0.2-0.2,0.5-0.5,0.7-0.7l1.8,1.8l0.1-0.1c1.2-1.2,2.9-1.9,4.6-1.9c0.4,0,0.8,0,1.2,0.1l0.2,0l0.6-2.5
62
- c2.3,0.3,4.3,1.2,6,2.8l0.3,0.3c2,1.9,3.1,4.5,3.3,7.3h-3.6C18.1,10.4,17.3,8.7,16.1,7.5L16.1,7.5z M19.8,3.3
63
- c2.9,2.8,4.4,6.8,4,10.8c-0.3,2.8-1.5,5.4-3.4,7.6L17,19.1c0.4-0.4,0.7-0.8,1-1.2c0.9-1.2,1.4-2.7,1.6-4.2c0-0.4,0.1-0.7,0-1.1h2.7
64
- l0-0.2c-0.1-3-1.4-5.7-3.5-7.8l-0.2-0.2L19.8,3.3L19.8,3.3z M16.5,18.9l-0.2,0.2l2.6,2c-2.3,2.6-5.6,4-9.1,3.8l0-4
65
- c0.2,0,0.4,0,0.6,0h0c2.6,0,5-1.4,6.4-3.6l0.7,0.5C17.2,18.2,16.9,18.6,16.5,18.9L16.5,18.9z"
66
- />
63
+ <LogoSvg viewBox="0 0 260 260">
64
+ <path d="M1.11,125.62C1.11,74.94,40.22,39,93.72,39S186,74.94,186,125.62s-38.79,86.66-92.29,86.66S1.11,176.3,1.11,125.62Zm135.47,0c0-29.1-18.46-46.62-42.86-46.62S50.54,96.52,50.54,125.62s18.77,46.62,43.18,46.62S136.58,154.72,136.58,125.62Z" />
65
+ <circle cx="227.6" cy="181.13" r="31.29" />
67
66
  </LogoSvg>
68
67
  );
69
68