orc-shared 1.2.0-dev.2 → 1.2.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/modules.js +63 -1
- package/dist/actions/scopes.js +59 -22
- package/dist/components/AppFrame/MenuItem.js +5 -14
- package/dist/components/AppFrame/Sidebar.js +11 -5
- package/dist/components/ApplicationModuleLoader.js +143 -0
- package/dist/components/Authenticate.js +12 -12
- package/dist/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
- package/dist/components/MaterialUI/Navigation/ExternalLink.js +113 -0
- package/dist/components/MaterialUI/muiThemes.js +5 -0
- package/dist/components/Modules.js +126 -41
- package/dist/components/Routing/FullPage.js +3 -1
- package/dist/components/Routing/Page.js +5 -3
- package/dist/components/Routing/Segment.js +1 -1
- package/dist/components/Routing/withWaypointing.js +6 -2
- package/dist/components/Scope/useScopeConfirmationModalState.js +7 -16
- package/dist/components/Scope/useScopeData.js +4 -13
- package/dist/constants.js +19 -2
- package/dist/content/iconsSheet.svg +3 -0
- package/dist/reducers/modules.js +39 -1
- package/dist/reducers/scopes.js +27 -0
- package/dist/reducers/settings.js +31 -2
- package/dist/selectors/authentication.js +57 -18
- package/dist/selectors/modules.js +15 -1
- package/dist/selectors/scope.js +7 -1
- package/dist/selectors/settings.js +13 -1
- package/package.json +6 -5
- package/src/actions/modules.js +30 -0
- package/src/actions/modules.test.js +50 -1
- package/src/actions/scopes.js +33 -7
- package/src/actions/scopes.test.js +84 -14
- package/src/components/AppFrame/AppFrame.test.js +9 -0
- package/src/components/AppFrame/MenuItem.js +3 -5
- package/src/components/AppFrame/MenuItem.test.js +2 -24
- package/src/components/AppFrame/Sidebar.js +8 -1
- package/src/components/AppFrame/Sidebar.test.js +18 -0
- package/src/components/ApplicationModuleLoader.js +52 -0
- package/src/components/ApplicationModuleLoader.test.js +149 -0
- package/src/components/Authenticate.js +5 -4
- package/src/components/Authenticate.test.js +23 -4
- package/src/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
- package/src/components/MaterialUI/DataDisplay/SelectionList.test.js +2 -2
- package/src/components/MaterialUI/Navigation/ExternalLink.js +25 -0
- package/src/components/MaterialUI/Navigation/ExternalLink.test.js +26 -0
- package/src/components/MaterialUI/muiThemes.js +5 -0
- package/src/components/Modules.js +103 -20
- package/src/components/Modules.test.js +315 -28
- package/src/components/Provision.test.js +34 -0
- package/src/components/Routing/FullPage.js +2 -1
- package/src/components/Routing/FullPage.test.js +23 -0
- package/src/components/Routing/Page.js +2 -2
- package/src/components/Routing/Page.test.js +20 -0
- package/src/components/Routing/Segment.js +1 -1
- package/src/components/Routing/withWaypointing.js +2 -2
- package/src/components/Routing/withWaypointing.test.js +33 -5
- package/src/components/Scope/useScopeConfirmationModalState.js +5 -16
- package/src/components/Scope/useScopeConfirmationModalState.test.js +39 -13
- package/src/components/Scope/useScopeData.js +0 -3
- package/src/components/Scope/useScopeData.test.js +0 -27
- package/src/constants.js +15 -0
- package/src/content/iconsSheet.svg +3 -0
- package/src/hocs/withScopeData.test.js +0 -31
- package/src/reducers/modules.js +48 -2
- package/src/reducers/modules.test.js +117 -2
- package/src/reducers/scopes.js +30 -0
- package/src/reducers/scopes.test.js +45 -1
- package/src/reducers/settings.js +26 -2
- package/src/reducers/settings.test.js +74 -6
- package/src/selectors/authentication.js +53 -27
- package/src/selectors/authentication.test.js +600 -12
- package/src/selectors/modules.js +7 -0
- package/src/selectors/modules.test.js +16 -1
- package/src/selectors/scope.js +2 -0
- package/src/selectors/scope.test.js +5 -0
- package/src/selectors/settings.js +6 -0
|
@@ -189,6 +189,11 @@ var setThemeOverrides = function setThemeOverrides(theme) {
|
|
|
189
189
|
}
|
|
190
190
|
})
|
|
191
191
|
}),
|
|
192
|
+
MuiLink: {
|
|
193
|
+
root: {
|
|
194
|
+
fontSize: theme.spacing(1.3)
|
|
195
|
+
}
|
|
196
|
+
},
|
|
192
197
|
MuiButton: _objectSpread(_objectSpread({}, theme.MuiButton), {}, {
|
|
193
198
|
root: {
|
|
194
199
|
padding: "".concat(theme.spacing(0.8), " ").concat(theme.spacing(1)),
|
|
@@ -25,6 +25,12 @@ var _modules = require("../actions/modules");
|
|
|
25
25
|
|
|
26
26
|
var _settings = require("../selectors/settings");
|
|
27
27
|
|
|
28
|
+
var _modules2 = require("../selectors/modules");
|
|
29
|
+
|
|
30
|
+
var _urlPattern = _interopRequireDefault(require("url-pattern"));
|
|
31
|
+
|
|
32
|
+
var _constants = require("../constants");
|
|
33
|
+
|
|
28
34
|
var _excluded = ["customPath"];
|
|
29
35
|
|
|
30
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -69,42 +75,50 @@ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoader
|
|
|
69
75
|
return a;
|
|
70
76
|
};
|
|
71
77
|
|
|
78
|
+
var rerouteOnScopeAndModule = function rerouteOnScopeAndModule(history, currentRoute, scope, module) {
|
|
79
|
+
var params = {
|
|
80
|
+
scope: scope
|
|
81
|
+
};
|
|
82
|
+
var pattern = new _urlPattern.default("/:scope/".concat(module));
|
|
83
|
+
var href = pattern.stringify(params);
|
|
84
|
+
|
|
85
|
+
if (currentRoute !== href) {
|
|
86
|
+
history.push(href);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
72
90
|
var Module = (0, _withErrorBoundary.default)("Module")(__signature__(__signature__(function (_ref) {
|
|
73
|
-
var
|
|
91
|
+
var id = _ref.id,
|
|
92
|
+
config = _ref.config,
|
|
74
93
|
path = _ref.path,
|
|
75
94
|
error = _ref.error,
|
|
76
95
|
location = _ref.location,
|
|
77
96
|
match = _ref.match,
|
|
78
97
|
modulePrependPath = _ref.modulePrependPath;
|
|
79
|
-
var currentRoute = (0, _reactRedux.useSelector)(_navigation.selectRouteHref);
|
|
80
98
|
var history = (0, _reactRouterDom.useHistory)();
|
|
81
|
-
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return typeof config.hide === "function" ? config.hide(state) : (_config$hide = config.hide) != null ? _config$hide : false;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
var isHidden = (0, _reactRedux.useSelector)(hideSelector);
|
|
99
|
+
var scope = (0, _reactRedux.useSelector)(_navigation.getCurrentScopeFromRoute);
|
|
100
|
+
var currentRoute = (0, _reactRedux.useSelector)(_navigation.selectRouteHref);
|
|
101
|
+
var moduleInfo = (0, _reactRedux.useSelector)(_modules2.getScopeModuleInformationSelector);
|
|
102
|
+
var isVisible = moduleInfo.scope != null && moduleInfo.visibleModules.length > 0 && moduleInfo.visibleModules.includes(id);
|
|
89
103
|
|
|
90
104
|
_react.default.useEffect(function () {
|
|
91
|
-
if (
|
|
92
|
-
history.
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
}, [isHidden, currentRoute, match.url]);
|
|
105
|
+
if (moduleInfo.scope != null && scope === moduleInfo.scope && moduleInfo.visibleModules.length > 0 && !isVisible) {
|
|
106
|
+
rerouteOnScopeAndModule(history, currentRoute, moduleInfo.scope, moduleInfo.visibleModules[0]);
|
|
107
|
+
}
|
|
108
|
+
}, [history, scope, isVisible, currentRoute, moduleInfo.scope, moduleInfo.visibleModules]);
|
|
96
109
|
|
|
97
110
|
return /*#__PURE__*/_react.default.createElement(_FullPage.default, {
|
|
98
111
|
path: path,
|
|
99
112
|
config: config,
|
|
100
113
|
location: location,
|
|
101
114
|
match: match,
|
|
102
|
-
modulePrependPath: modulePrependPath
|
|
115
|
+
modulePrependPath: modulePrependPath,
|
|
116
|
+
isVisible: isVisible
|
|
103
117
|
});
|
|
104
|
-
}, "
|
|
105
|
-
return [_reactRedux.useSelector,
|
|
106
|
-
}), "
|
|
107
|
-
return [_reactRedux.useSelector,
|
|
118
|
+
}, "useHistory{history}\nuseSelector{scope}\nuseSelector{currentRoute}\nuseSelector{moduleInfo}\nuseEffect{}", function () {
|
|
119
|
+
return [_reactRouterDom.useHistory, _reactRedux.useSelector, _reactRedux.useSelector, _reactRedux.useSelector];
|
|
120
|
+
}), "useHistory{history}\nuseSelector{scope}\nuseSelector{currentRoute}\nuseSelector{moduleInfo}\nuseEffect{}", function () {
|
|
121
|
+
return [_reactRouterDom.useHistory, _reactRedux.useSelector, _reactRedux.useSelector, _reactRedux.useSelector];
|
|
108
122
|
}));
|
|
109
123
|
exports.Module = Module;
|
|
110
124
|
|
|
@@ -112,26 +126,76 @@ var getHrefFromPath = function getHrefFromPath(path, scope) {
|
|
|
112
126
|
return path.replace(":scope", scope);
|
|
113
127
|
};
|
|
114
128
|
|
|
115
|
-
var
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
129
|
+
var CheckModuleVisibility = function CheckModuleVisibility(_ref2) {
|
|
130
|
+
var _moduleInfo$scope;
|
|
131
|
+
|
|
132
|
+
var id = _ref2.id,
|
|
133
|
+
config = _ref2.config,
|
|
134
|
+
moduleInfo = _ref2.moduleInfo;
|
|
135
|
+
var dispatch = (0, _reactRedux.useDispatch)();
|
|
136
|
+
var applicationModules = (0, _reactRedux.useSelector)(_settings.getApplicationModulesSelector);
|
|
137
|
+
var scopeFromRoute = (0, _reactRedux.useSelector)(_navigation.getCurrentScopeFromRoute);
|
|
138
|
+
|
|
139
|
+
var hideSelector = function hideSelector(state) {
|
|
140
|
+
return typeof config.hide === "function" ? config.hide(state) : function () {
|
|
141
|
+
var _config$hide;
|
|
142
|
+
|
|
143
|
+
return (_config$hide = config.hide) != null ? _config$hide : false;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
var isHidden = (0, _reactRedux.useSelector)(hideSelector((_moduleInfo$scope = moduleInfo.scope) != null ? _moduleInfo$scope : scopeFromRoute));
|
|
148
|
+
var moduleScope = moduleInfo.scope;
|
|
149
|
+
var moduleIsVisible = isHidden === false && !moduleInfo.visibleModules.includes(id);
|
|
150
|
+
|
|
151
|
+
_react.default.useEffect(function () {
|
|
152
|
+
// We need to wait for the ROUTE to be set the first time in the Redux/Store before to set module's visibility
|
|
153
|
+
if (scopeFromRoute !== null || applicationModules.includes(_constants.overtureModule.System)) {
|
|
154
|
+
if (moduleScope == null) {
|
|
155
|
+
dispatch((0, _modules.initializeFirstModuleScope)(scopeFromRoute));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (moduleIsVisible) {
|
|
159
|
+
dispatch((0, _modules.setModuleAsVisible)(id));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}, [moduleScope, moduleIsVisible, dispatch, id, scopeFromRoute, applicationModules]);
|
|
163
|
+
|
|
164
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
__signature__(CheckModuleVisibility, "useDispatch{dispatch}\nuseSelector{applicationModules}\nuseSelector{scopeFromRoute}\nuseSelector{isHidden}\nuseEffect{}", function () {
|
|
168
|
+
return [_reactRedux.useDispatch, _reactRedux.useSelector, _reactRedux.useSelector, _reactRedux.useSelector];
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
__signature__(CheckModuleVisibility, "useDispatch{dispatch}\nuseSelector{applicationModules}\nuseSelector{scopeFromRoute}\nuseSelector{isHidden}\nuseEffect{}", function () {
|
|
172
|
+
return [_reactRedux.useDispatch, _reactRedux.useSelector, _reactRedux.useSelector, _reactRedux.useSelector];
|
|
173
|
+
});
|
|
119
174
|
|
|
120
|
-
|
|
121
|
-
|
|
175
|
+
var Modules = function Modules(_ref3) {
|
|
176
|
+
var modules = _ref3.modules,
|
|
177
|
+
_ref3$pathConfig = _ref3.pathConfig;
|
|
178
|
+
_ref3$pathConfig = _ref3$pathConfig === void 0 ? {} : _ref3$pathConfig;
|
|
179
|
+
|
|
180
|
+
var customPath = _ref3$pathConfig.customPath,
|
|
181
|
+
otherConfigs = _objectWithoutProperties(_ref3$pathConfig, _excluded);
|
|
122
182
|
|
|
123
183
|
var dispatch = (0, _reactRedux.useDispatch)();
|
|
124
|
-
var
|
|
184
|
+
var currentScope = (0, _reactRedux.useSelector)(_navigation.getCurrentScope);
|
|
125
185
|
var isAuthorizedScope = (0, _reactRedux.useSelector)(_scope.isCurrentScopeAuthorizedSelector);
|
|
126
186
|
var defaultScope = (0, _reactRedux.useSelector)(_settings.defaultScopeSelector);
|
|
127
187
|
var history = (0, _reactRouterDom.useHistory)();
|
|
128
188
|
var location = (0, _reactRouterDom.useLocation)();
|
|
189
|
+
var currentRoute = (0, _reactRedux.useSelector)(_navigation.selectRouteHref);
|
|
190
|
+
var moduleInfo = (0, _reactRedux.useSelector)(_modules2.getScopeModuleInformationSelector);
|
|
191
|
+
var firstModuleName = Object.keys(modules)[0];
|
|
192
|
+
var destinationModule = moduleInfo.routingPerformed === false && moduleInfo.scope != null && moduleInfo.visibleModules.length > 0 && moduleInfo.moduleName != null ? moduleInfo.visibleModules.includes(moduleInfo.moduleName) ? moduleInfo.moduleName : moduleInfo.visibleModules[0] : null;
|
|
129
193
|
var scopePath = "/:scope/";
|
|
130
194
|
var prependPath = customPath || scopePath;
|
|
131
|
-
var prependHref = getHrefFromPath(prependPath,
|
|
195
|
+
var prependHref = getHrefFromPath(prependPath, currentScope);
|
|
132
196
|
Object.keys(otherConfigs).forEach(function (key) {
|
|
133
197
|
var moduleConfig = otherConfigs[key];
|
|
134
|
-
moduleConfig.prependHref = getHrefFromPath(moduleConfig.prependPath,
|
|
198
|
+
moduleConfig.prependHref = getHrefFromPath(moduleConfig.prependPath, currentScope);
|
|
135
199
|
});
|
|
136
200
|
(0, _react.useEffect)(function () {
|
|
137
201
|
dispatch((0, _navigation2.setHrefConfig)(prependPath, prependHref, otherConfigs));
|
|
@@ -144,27 +208,43 @@ var Modules = function Modules(_ref2) {
|
|
|
144
208
|
};
|
|
145
209
|
};
|
|
146
210
|
|
|
147
|
-
var firstModuleName = Object.keys(modules)[0];
|
|
148
211
|
(0, _react.useEffect)(function () {
|
|
149
212
|
var pathname = location.pathname,
|
|
150
213
|
search = location.search;
|
|
151
214
|
|
|
152
|
-
if (!isAuthorizedScope && pathname.includes(
|
|
153
|
-
history.push(pathname.replace(
|
|
215
|
+
if (!isAuthorizedScope && pathname.includes(currentScope) && defaultScope) {
|
|
216
|
+
history.push(pathname.replace(currentScope, defaultScope) + search);
|
|
154
217
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
155
218
|
|
|
156
|
-
}, [isAuthorizedScope, defaultScope, history,
|
|
219
|
+
}, [isAuthorizedScope, defaultScope, history, currentScope]);
|
|
157
220
|
|
|
158
221
|
_react.default.useEffect(function () {
|
|
159
222
|
dispatch((0, _modules.setModulesStructure)(modules));
|
|
160
223
|
}, [dispatch, modules]);
|
|
161
224
|
|
|
225
|
+
(0, _react.useEffect)(function () {
|
|
226
|
+
if (destinationModule != null) {
|
|
227
|
+
rerouteOnScopeAndModule(history, currentRoute, moduleInfo.scope, destinationModule);
|
|
228
|
+
dispatch((0, _modules.setRoutingPerformed)());
|
|
229
|
+
}
|
|
230
|
+
}, [dispatch, history, moduleInfo.scope, destinationModule, currentRoute]);
|
|
162
231
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Navigation.default, {
|
|
163
232
|
modules: modules
|
|
164
|
-
}),
|
|
165
|
-
var
|
|
166
|
-
name =
|
|
167
|
-
module =
|
|
233
|
+
}), Object.entries(modules).map(function (_ref4) {
|
|
234
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
235
|
+
name = _ref5[0],
|
|
236
|
+
module = _ref5[1];
|
|
237
|
+
|
|
238
|
+
return /*#__PURE__*/_react.default.createElement(CheckModuleVisibility, {
|
|
239
|
+
key: name,
|
|
240
|
+
id: name,
|
|
241
|
+
config: module,
|
|
242
|
+
moduleInfo: moduleInfo
|
|
243
|
+
});
|
|
244
|
+
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Switch, null, Object.entries(modules).map(function (_ref6) {
|
|
245
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
246
|
+
name = _ref7[0],
|
|
247
|
+
module = _ref7[1];
|
|
168
248
|
|
|
169
249
|
var moduleConfig = getModuleConfig(name);
|
|
170
250
|
var path = "".concat(moduleConfig.prependPath).concat(name);
|
|
@@ -173,6 +253,7 @@ var Modules = function Modules(_ref2) {
|
|
|
173
253
|
path: path,
|
|
174
254
|
render: function render(route) {
|
|
175
255
|
return /*#__PURE__*/_react.default.createElement(Module, _extends({
|
|
256
|
+
id: name,
|
|
176
257
|
modulePrependPath: moduleConfig.prependPath,
|
|
177
258
|
config: module,
|
|
178
259
|
path: path
|
|
@@ -186,12 +267,12 @@ var Modules = function Modules(_ref2) {
|
|
|
186
267
|
|
|
187
268
|
exports.Modules = Modules;
|
|
188
269
|
|
|
189
|
-
__signature__(Modules, "useDispatch{dispatch}\nuseSelector{
|
|
190
|
-
return [_reactRedux.useDispatch, _reactRedux.useSelector, _reactRedux.useSelector, _reactRedux.useSelector, _reactRouterDom.useHistory, _reactRouterDom.useLocation];
|
|
270
|
+
__signature__(Modules, "useDispatch{dispatch}\nuseSelector{currentScope}\nuseSelector{isAuthorizedScope}\nuseSelector{defaultScope}\nuseHistory{history}\nuseLocation{location}\nuseSelector{currentRoute}\nuseSelector{moduleInfo}\nuseEffect{}\nuseEffect{}\nuseEffect{}\nuseEffect{}", function () {
|
|
271
|
+
return [_reactRedux.useDispatch, _reactRedux.useSelector, _reactRedux.useSelector, _reactRedux.useSelector, _reactRouterDom.useHistory, _reactRouterDom.useLocation, _reactRedux.useSelector, _reactRedux.useSelector];
|
|
191
272
|
});
|
|
192
273
|
|
|
193
|
-
__signature__(Modules, "useDispatch{dispatch}\nuseSelector{
|
|
194
|
-
return [_reactRedux.useDispatch, _reactRedux.useSelector, _reactRedux.useSelector, _reactRedux.useSelector, _reactRouterDom.useHistory, _reactRouterDom.useLocation];
|
|
274
|
+
__signature__(Modules, "useDispatch{dispatch}\nuseSelector{currentScope}\nuseSelector{isAuthorizedScope}\nuseSelector{defaultScope}\nuseHistory{history}\nuseLocation{location}\nuseSelector{currentRoute}\nuseSelector{moduleInfo}\nuseEffect{}\nuseEffect{}\nuseEffect{}\nuseEffect{}", function () {
|
|
275
|
+
return [_reactRedux.useDispatch, _reactRedux.useSelector, _reactRedux.useSelector, _reactRedux.useSelector, _reactRouterDom.useHistory, _reactRouterDom.useLocation, _reactRedux.useSelector, _reactRedux.useSelector];
|
|
195
276
|
});
|
|
196
277
|
|
|
197
278
|
var _default = Modules;
|
|
@@ -207,8 +288,10 @@ exports.default = _default3;
|
|
|
207
288
|
return;
|
|
208
289
|
}
|
|
209
290
|
|
|
291
|
+
reactHotLoader.register(rerouteOnScopeAndModule, "rerouteOnScopeAndModule", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
210
292
|
reactHotLoader.register(Module, "Module", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
211
293
|
reactHotLoader.register(getHrefFromPath, "getHrefFromPath", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
294
|
+
reactHotLoader.register(CheckModuleVisibility, "CheckModuleVisibility", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
212
295
|
reactHotLoader.register(Modules, "Modules", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
213
296
|
reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
214
297
|
})();
|
|
@@ -229,8 +312,10 @@ exports.default = _default3;
|
|
|
229
312
|
return;
|
|
230
313
|
}
|
|
231
314
|
|
|
315
|
+
reactHotLoader.register(rerouteOnScopeAndModule, "rerouteOnScopeAndModule", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
232
316
|
reactHotLoader.register(Module, "Module", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
233
317
|
reactHotLoader.register(getHrefFromPath, "getHrefFromPath", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
318
|
+
reactHotLoader.register(CheckModuleVisibility, "CheckModuleVisibility", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
234
319
|
reactHotLoader.register(Modules, "Modules", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
235
320
|
reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/Modules.js");
|
|
236
321
|
})();
|
|
@@ -34,7 +34,8 @@ var FullPage = function FullPage(_ref) {
|
|
|
34
34
|
config = _ref.config,
|
|
35
35
|
location = _ref.location,
|
|
36
36
|
match = _ref.match,
|
|
37
|
-
modulePrependPath = _ref.modulePrependPath
|
|
37
|
+
modulePrependPath = _ref.modulePrependPath,
|
|
38
|
+
isVisible = _ref.isVisible;
|
|
38
39
|
var component = config.component,
|
|
39
40
|
componentProps = config.componentProps,
|
|
40
41
|
_config$pages = config.pages,
|
|
@@ -63,6 +64,7 @@ var FullPage = function FullPage(_ref) {
|
|
|
63
64
|
subpages: subpages,
|
|
64
65
|
location: location,
|
|
65
66
|
match: match,
|
|
67
|
+
isVisible: isVisible,
|
|
66
68
|
modulePrependPath: modulePrependPath
|
|
67
69
|
});
|
|
68
70
|
};
|
|
@@ -60,10 +60,12 @@ var Page = function Page(_ref) {
|
|
|
60
60
|
pages = _ref$pages === void 0 ? {} : _ref$pages,
|
|
61
61
|
_ref$subpages = _ref.subpages,
|
|
62
62
|
subpages = _ref$subpages === void 0 ? {} : _ref$subpages,
|
|
63
|
-
modulePrependPath = _ref.modulePrependPath
|
|
63
|
+
modulePrependPath = _ref.modulePrependPath,
|
|
64
|
+
_ref$isVisible = _ref.isVisible,
|
|
65
|
+
isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible;
|
|
64
66
|
var WrappedView = (0, _react.useMemo)(function () {
|
|
65
|
-
return (0, _withErrorBoundary.default)(path)((0, _withWaypointing.default)(View));
|
|
66
|
-
}, [path, View]);
|
|
67
|
+
return (0, _withErrorBoundary.default)(path)((0, _withWaypointing.default)(View, isVisible));
|
|
68
|
+
}, [path, View, isVisible]);
|
|
67
69
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactRouter.Switch, null, Object.entries(pages).map(function (_ref2) {
|
|
68
70
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
69
71
|
subpath = _ref3[0],
|
|
@@ -43,7 +43,7 @@ var Segment = function Segment(_ref) {
|
|
|
43
43
|
componentProps = config.componentProps;
|
|
44
44
|
var path = location.pathname;
|
|
45
45
|
var View = (0, _react.useMemo)(function () {
|
|
46
|
-
return (0, _withErrorBoundary.default)(path)((0, _withWaypointing.default)(component, componentProps));
|
|
46
|
+
return (0, _withErrorBoundary.default)(path)((0, _withWaypointing.default)(component, true, componentProps));
|
|
47
47
|
}, [path, component, componentProps]);
|
|
48
48
|
return /*#__PURE__*/_react.default.createElement(View, {
|
|
49
49
|
location: location,
|
|
@@ -41,7 +41,11 @@ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoader
|
|
|
41
41
|
return a;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
var withWaypointing = function withWaypointing(Comp, componentProps) {
|
|
44
|
+
var withWaypointing = function withWaypointing(Comp, isVisible, componentProps) {
|
|
45
|
+
if (isVisible === void 0) {
|
|
46
|
+
isVisible = true;
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
if (componentProps === void 0) {
|
|
46
50
|
componentProps = {};
|
|
47
51
|
}
|
|
@@ -72,7 +76,7 @@ var withWaypointing = function withWaypointing(Comp, componentProps) {
|
|
|
72
76
|
};
|
|
73
77
|
|
|
74
78
|
(0, _useLoader.default)(loadActions, cutout);
|
|
75
|
-
return /*#__PURE__*/_react.default.createElement(Comp, _extends({}, props, componentProps));
|
|
79
|
+
return isVisible ? /*#__PURE__*/_react.default.createElement(Comp, _extends({}, props, componentProps)) : null;
|
|
76
80
|
}, "useLocation{location}\nuseLoader{}", function () {
|
|
77
81
|
return [_reactRouterDom.useLocation, _useLoader.default];
|
|
78
82
|
}), "useLocation{location}\nuseLoader{}", function () {
|
|
@@ -19,9 +19,7 @@ var _view = require("../../selectors/view");
|
|
|
19
19
|
|
|
20
20
|
var _constants = require("../../constants");
|
|
21
21
|
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
var _urlPattern = _interopRequireDefault(require("url-pattern"));
|
|
22
|
+
var _modules = require("../../actions/modules");
|
|
25
23
|
|
|
26
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
25
|
|
|
@@ -112,28 +110,21 @@ var ExecuteClosingTabHandlerActions = /*#__PURE__*/function () {
|
|
|
112
110
|
|
|
113
111
|
var useApplicationScopeChanger = function useApplicationScopeChanger(closingTabHandlerActions) {
|
|
114
112
|
var dispatch = (0, _reactRedux.useDispatch)();
|
|
115
|
-
var history = (0, _reactRouterDom.useHistory)();
|
|
116
113
|
var moduleName = (0, _useSelectorAndUnwrap.default)(_navigation.selectCurrentModuleName);
|
|
117
114
|
return function (previousScope, newScope) {
|
|
118
|
-
var params = {
|
|
119
|
-
scope: newScope
|
|
120
|
-
}; // did not find a more reliable way to get the URL for the first tab of the module
|
|
121
|
-
|
|
122
|
-
var pattern = new _urlPattern.default("/:scope/".concat(moduleName));
|
|
123
|
-
var href = pattern.stringify(params);
|
|
124
|
-
history.push(href);
|
|
125
115
|
ExecuteClosingTabHandlerActions(closingTabHandlerActions).then(function () {
|
|
126
|
-
|
|
116
|
+
dispatch((0, _modules.setNewScopeAndModuleName)(newScope, moduleName));
|
|
117
|
+
dispatch((0, _scopes.applicationScopeHasChanged)(previousScope, newScope));
|
|
127
118
|
});
|
|
128
119
|
};
|
|
129
120
|
};
|
|
130
121
|
|
|
131
|
-
__signature__(useApplicationScopeChanger, "useDispatch{dispatch}\
|
|
132
|
-
return [_reactRedux.useDispatch,
|
|
122
|
+
__signature__(useApplicationScopeChanger, "useDispatch{dispatch}\nuseSelectorAndUnwrap{moduleName}", function () {
|
|
123
|
+
return [_reactRedux.useDispatch, _useSelectorAndUnwrap.default];
|
|
133
124
|
});
|
|
134
125
|
|
|
135
|
-
__signature__(useApplicationScopeChanger, "useDispatch{dispatch}\
|
|
136
|
-
return [_reactRedux.useDispatch,
|
|
126
|
+
__signature__(useApplicationScopeChanger, "useDispatch{dispatch}\nuseSelectorAndUnwrap{moduleName}", function () {
|
|
127
|
+
return [_reactRedux.useDispatch, _useSelectorAndUnwrap.default];
|
|
137
128
|
});
|
|
138
129
|
|
|
139
130
|
var useScopeConfirmationModalState = function useScopeConfirmationModalState() {
|
|
@@ -5,16 +5,10 @@ exports.default = void 0;
|
|
|
5
5
|
|
|
6
6
|
var _reactRedux = require("react-redux");
|
|
7
7
|
|
|
8
|
-
var _useLoader = _interopRequireDefault(require("../../hooks/useLoader"));
|
|
9
|
-
|
|
10
8
|
var _utils = require("../../utils");
|
|
11
9
|
|
|
12
10
|
var _scope = require("../../selectors/scope");
|
|
13
11
|
|
|
14
|
-
var _scopes = require("../../actions/scopes");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
(function () {
|
|
19
13
|
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
20
14
|
enterModule && enterModule(module);
|
|
@@ -47,19 +41,16 @@ var buildDefaultNodeState = function buildDefaultNodeState(current, getScope) {
|
|
|
47
41
|
var useScopeData = function useScopeData() {
|
|
48
42
|
var currentScope = (0, _utils.unwrapImmutable)((0, _reactRedux.useSelector)(_scope.currentScopeSelector));
|
|
49
43
|
var getScope = (0, _reactRedux.useSelector)(_scope.scopeGetter);
|
|
50
|
-
(0, _useLoader.default)((0, _scopes.getScopes)(), function () {
|
|
51
|
-
return currentScope.name;
|
|
52
|
-
});
|
|
53
44
|
var defaultNodeState = buildDefaultNodeState(currentScope, getScope);
|
|
54
45
|
return [currentScope, defaultNodeState, getScope];
|
|
55
46
|
};
|
|
56
47
|
|
|
57
|
-
__signature__(useScopeData, "useSelector{}\nuseSelector{getScope}
|
|
58
|
-
return [_reactRedux.useSelector, _reactRedux.useSelector
|
|
48
|
+
__signature__(useScopeData, "useSelector{}\nuseSelector{getScope}", function () {
|
|
49
|
+
return [_reactRedux.useSelector, _reactRedux.useSelector];
|
|
59
50
|
});
|
|
60
51
|
|
|
61
|
-
__signature__(useScopeData, "useSelector{}\nuseSelector{getScope}
|
|
62
|
-
return [_reactRedux.useSelector, _reactRedux.useSelector
|
|
52
|
+
__signature__(useScopeData, "useSelector{}\nuseSelector{getScope}", function () {
|
|
53
|
+
return [_reactRedux.useSelector, _reactRedux.useSelector];
|
|
63
54
|
});
|
|
64
55
|
|
|
65
56
|
var _default = useScopeData;
|
package/dist/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.validationErrorTypes = exports.scopeTypes = exports.scopeConfirmationDialogTypes = exports.roleGroups = exports.requestStates = exports.requestStateOperations = exports.requestStateOperationMap = exports.platformRoles = exports.infoBar = exports.displayMode = exports.definitionType = exports.attributeDataType = void 0;
|
|
4
|
+
exports.validationErrorTypes = exports.scopeTypes = exports.scopeConfirmationDialogTypes = exports.roleGroups = exports.requestStates = exports.requestStateOperations = exports.requestStateOperationMap = exports.platformRoles = exports.overtureModule = exports.infoBar = exports.displayMode = exports.definitionType = exports.attributeDataType = void 0;
|
|
5
5
|
|
|
6
6
|
(function () {
|
|
7
7
|
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
@@ -46,6 +46,7 @@ var roleGroups = {
|
|
|
46
46
|
Shopping: "Shopping",
|
|
47
47
|
Search: "Search",
|
|
48
48
|
Profiles: "Profiles",
|
|
49
|
+
Locations: "Locations",
|
|
49
50
|
Orchestrator: "Orchestrator",
|
|
50
51
|
PriceManagement: "PriceManagement",
|
|
51
52
|
UserManagement: "UserManagement",
|
|
@@ -94,8 +95,22 @@ var attributeDataType = {
|
|
|
94
95
|
lookup: "Lookup",
|
|
95
96
|
entityReference: "EntityReference",
|
|
96
97
|
customType: "CustomType"
|
|
97
|
-
};
|
|
98
|
+
}; // It is intended that some of them have a different value of its keys
|
|
99
|
+
|
|
98
100
|
exports.attributeDataType = attributeDataType;
|
|
101
|
+
var overtureModule = {
|
|
102
|
+
System: "System",
|
|
103
|
+
Products: "Product",
|
|
104
|
+
Customers: "Customer",
|
|
105
|
+
Orders: "Order",
|
|
106
|
+
Marketing: "Marketing",
|
|
107
|
+
Report: "Reports",
|
|
108
|
+
Administration: "Administration",
|
|
109
|
+
UserManagement: "UserManagement",
|
|
110
|
+
PriceManagement: "PriceManagement",
|
|
111
|
+
Locations: "Location"
|
|
112
|
+
};
|
|
113
|
+
exports.overtureModule = overtureModule;
|
|
99
114
|
var definitionType = {
|
|
100
115
|
shared: "Shared",
|
|
101
116
|
embedded: "Embedded"
|
|
@@ -133,6 +148,7 @@ exports.requestStateOperationMap = requestStateOperationMap;
|
|
|
133
148
|
reactHotLoader.register(requestStates, "requestStates", "/home/vsts/work/1/s/src/constants.js");
|
|
134
149
|
reactHotLoader.register(scopeConfirmationDialogTypes, "scopeConfirmationDialogTypes", "/home/vsts/work/1/s/src/constants.js");
|
|
135
150
|
reactHotLoader.register(attributeDataType, "attributeDataType", "/home/vsts/work/1/s/src/constants.js");
|
|
151
|
+
reactHotLoader.register(overtureModule, "overtureModule", "/home/vsts/work/1/s/src/constants.js");
|
|
136
152
|
reactHotLoader.register(definitionType, "definitionType", "/home/vsts/work/1/s/src/constants.js");
|
|
137
153
|
reactHotLoader.register(requestStateOperations, "requestStateOperations", "/home/vsts/work/1/s/src/constants.js");
|
|
138
154
|
reactHotLoader.register(requestStateOperationMap, "requestStateOperationMap", "/home/vsts/work/1/s/src/constants.js");
|
|
@@ -163,6 +179,7 @@ exports.requestStateOperationMap = requestStateOperationMap;
|
|
|
163
179
|
reactHotLoader.register(requestStates, "requestStates", "/home/vsts/work/1/s/src/constants.js");
|
|
164
180
|
reactHotLoader.register(scopeConfirmationDialogTypes, "scopeConfirmationDialogTypes", "/home/vsts/work/1/s/src/constants.js");
|
|
165
181
|
reactHotLoader.register(attributeDataType, "attributeDataType", "/home/vsts/work/1/s/src/constants.js");
|
|
182
|
+
reactHotLoader.register(overtureModule, "overtureModule", "/home/vsts/work/1/s/src/constants.js");
|
|
166
183
|
reactHotLoader.register(definitionType, "definitionType", "/home/vsts/work/1/s/src/constants.js");
|
|
167
184
|
reactHotLoader.register(requestStateOperations, "requestStateOperations", "/home/vsts/work/1/s/src/constants.js");
|
|
168
185
|
reactHotLoader.register(requestStateOperationMap, "requestStateOperationMap", "/home/vsts/work/1/s/src/constants.js");
|
|
@@ -122,6 +122,9 @@
|
|
|
122
122
|
<symbol id="icon-dropdown-chevron-down" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
|
|
123
123
|
<polyline fill="none" stroke-linecap="round" stroke-linejoin="round" points="9 3 5 7 1 3"/>
|
|
124
124
|
</symbol>
|
|
125
|
+
<symbol id="icon-open-in-new-tab" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
|
|
126
|
+
<path stroke="none" fill-rule="evenodd" d="M8.4375,6.25 L7.8125,6.25 C7.63991102,6.25 7.5,6.38991102 7.5,6.5625 L7.5,8.75 L1.25,8.75 L1.25,2.5 L4.0625,2.5 C4.23508898,2.5 4.375,2.36008898 4.375,2.1875 L4.375,1.5625 C4.375,1.38991102 4.23508898,1.25 4.0625,1.25 L0.9375,1.25 C0.419733047,1.25 0,1.66973305 0,2.1875 L0,9.0625 C0,9.58026695 0.419733047,10 0.9375,10 L7.8125,10 C8.33026695,10 8.75,9.58026695 8.75,9.0625 L8.75,6.5625 C8.75,6.38991102 8.61008898,6.25 8.4375,6.25 Z M9.53125,0 L7.03125,0 C6.61386719,0 6.40527344,0.506054688 6.69921875,0.80078125 L7.39707031,1.49863281 L2.63671875,6.25722656 C2.54845882,6.34518057 2.49884911,6.46465556 2.49884911,6.58925781 C2.49884911,6.71386007 2.54845882,6.83333506 2.63671875,6.92128906 L3.07949219,7.36328125 C3.16744619,7.45154118 3.28692118,7.50115089 3.41152344,7.50115089 C3.53612569,7.50115089 3.65560068,7.45154118 3.74355469,7.36328125 L8.5015625,2.60390625 L9.19921875,3.30078125 C9.4921875,3.59375 10,3.38867188 10,2.96875 L10,0.46875 C10,0.209866524 9.79013348,0 9.53125,0 Z"/>
|
|
127
|
+
</symbol>
|
|
125
128
|
<symbol id="icon-dropdown-chevron-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
|
|
126
129
|
<polyline fill="none" stroke-linecap="round" stroke-linejoin="round" points="9 3 5 7 1 3" transform="rotate(-90 5 5)"/>
|
|
127
130
|
</symbol>
|
package/dist/reducers/modules.js
CHANGED
|
@@ -29,7 +29,15 @@ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoader
|
|
|
29
29
|
return a;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
var initialState = _immutable.default.
|
|
32
|
+
var initialState = _immutable.default.fromJS({
|
|
33
|
+
tree: {},
|
|
34
|
+
visibleModules: [],
|
|
35
|
+
lastScopeAndModuleSelection: {
|
|
36
|
+
scope: null,
|
|
37
|
+
moduleName: null,
|
|
38
|
+
routingPerformed: true
|
|
39
|
+
}
|
|
40
|
+
});
|
|
33
41
|
|
|
34
42
|
var viewStateReducer = function viewStateReducer(state, action) {
|
|
35
43
|
if (state === void 0) {
|
|
@@ -73,6 +81,36 @@ var viewStateReducer = function viewStateReducer(state, action) {
|
|
|
73
81
|
return state.set("tree", _immutable.default.fromJS(modulesTree));
|
|
74
82
|
}
|
|
75
83
|
|
|
84
|
+
case _modules.INITIALIZE_FIRST_MODULE_SCOPE:
|
|
85
|
+
{
|
|
86
|
+
return state.setIn(["lastScopeAndModuleSelection", "scope"], action.payload);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
case _modules.SET_MODULE_AS_VISIBLE:
|
|
90
|
+
{
|
|
91
|
+
var visibleModules = state.get("visibleModules").toJS();
|
|
92
|
+
visibleModules.push(action.payload);
|
|
93
|
+
return state.set("visibleModules", _immutable.default.fromJS(visibleModules));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
case _modules.SET_NEW_SCOPE_AND_MODULE_NAME:
|
|
97
|
+
{
|
|
98
|
+
var lastScopeAndModuleSelection = state.get("lastScopeAndModuleSelection").toJS();
|
|
99
|
+
|
|
100
|
+
if (action.payload.scope !== lastScopeAndModuleSelection.scope) {
|
|
101
|
+
state = state.set("visibleModules", _immutable.default.fromJS([]));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return state.set("lastScopeAndModuleSelection", _immutable.default.fromJS({
|
|
105
|
+
moduleName: action.payload.moduleName,
|
|
106
|
+
scope: action.payload.scope,
|
|
107
|
+
routingPerformed: false
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
case _modules.SET_ROUTING_PERFORMED:
|
|
112
|
+
return state.setIn(["lastScopeAndModuleSelection", "routingPerformed"], true);
|
|
113
|
+
|
|
76
114
|
default:
|
|
77
115
|
return state;
|
|
78
116
|
}
|
package/dist/reducers/scopes.js
CHANGED
|
@@ -41,7 +41,34 @@ var scopeReducer = function scopeReducer(state, action) {
|
|
|
41
41
|
switch (action.type) {
|
|
42
42
|
case _scopes2.GET_SCOPES_SUCCESS:
|
|
43
43
|
{
|
|
44
|
+
var loadedScopes = state.toJS();
|
|
44
45
|
var normalizedScopes = (0, _normalizr.normalize)(action.payload, _scopes.default);
|
|
46
|
+
|
|
47
|
+
if (Object.keys(loadedScopes).length > 0) {
|
|
48
|
+
var addedScope = {};
|
|
49
|
+
Object.values(normalizedScopes.entities.scopes).forEach(function (scope) {
|
|
50
|
+
if (!loadedScopes[scope.id]) {
|
|
51
|
+
loadedScopes[scope.id] = scope;
|
|
52
|
+
addedScope[scope.id] = scope;
|
|
53
|
+
} else if (scope.isAuthorizedScope) {
|
|
54
|
+
loadedScopes[scope.id] = scope;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
Object.values(addedScope).forEach(function (scope) {
|
|
58
|
+
var parentScope = loadedScopes[scope.parentScopeId];
|
|
59
|
+
|
|
60
|
+
if (parentScope) {
|
|
61
|
+
if (!parentScope.children.includes(scope.id)) {
|
|
62
|
+
parentScope.children.push(scope.id);
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
// Should not happen, but for safety
|
|
66
|
+
delete loadedScopes[scope.id];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return state.merge(_immutable.default.fromJS(loadedScopes));
|
|
70
|
+
}
|
|
71
|
+
|
|
45
72
|
return state.merge(_immutable.default.fromJS(normalizedScopes.entities.scopes));
|
|
46
73
|
}
|
|
47
74
|
|