@gridsuite/commons-ui 0.45.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/README.md +0 -17
  2. package/dist/components/AuthenticationRouter/AuthenticationRouter.js +147 -0
  3. package/dist/components/CardErrorBoundary/card-error-boundary.js +110 -0
  4. package/dist/components/ElementSearchDialog/element-search-dialog.js +139 -0
  5. package/dist/components/ElementSearchDialog/equipment-item.js +77 -0
  6. package/dist/components/ElementSearchDialog/tag-renderer.js +34 -0
  7. package/dist/components/FlatParameters/FlatParameters.js +411 -0
  8. package/dist/components/Login/Login.js +78 -0
  9. package/dist/components/Login/Logout.js +69 -0
  10. package/dist/components/MuiVirtualizedTable/ColumnHeader.js +127 -0
  11. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +548 -0
  12. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +790 -0
  13. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +87 -0
  14. package/dist/components/OverflowableText/overflowable-text.js +87 -0
  15. package/dist/components/ReportViewer/filter-button.js +64 -0
  16. package/dist/components/ReportViewer/log-report-item.js +95 -0
  17. package/dist/components/ReportViewer/log-report.js +49 -0
  18. package/dist/components/ReportViewer/log-table.js +131 -0
  19. package/dist/components/ReportViewer/multi-select-list.js +40 -0
  20. package/dist/components/ReportViewer/report-item.js +112 -0
  21. package/dist/components/ReportViewer/report-tree-view-context.js +8 -0
  22. package/dist/components/ReportViewer/report-viewer.js +158 -0
  23. package/dist/components/ReportViewerDialog/report-viewer-dialog.js +61 -0
  24. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +13 -0
  25. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +16 -0
  26. package/dist/components/SnackbarProvider/SnackbarProvider.js +28 -0
  27. package/dist/components/TopBar/AboutDialog.js +467 -0
  28. package/dist/components/TopBar/GridLogo.js +71 -0
  29. package/dist/components/TopBar/TopBar.js +679 -0
  30. package/dist/components/TreeViewFinder/TreeViewFinder.js +288 -0
  31. package/dist/components/react-hook-form/autocomplete-input.js +96 -0
  32. package/dist/components/react-hook-form/booleans/boolean-input.js +49 -0
  33. package/dist/components/react-hook-form/booleans/checkbox-input.js +24 -0
  34. package/dist/components/react-hook-form/booleans/switch-input.js +24 -0
  35. package/dist/components/react-hook-form/error-management/error-input.js +42 -0
  36. package/dist/components/react-hook-form/error-management/field-error-alert.js +9 -0
  37. package/dist/components/react-hook-form/error-management/mid-form-error.js +20 -0
  38. package/dist/components/react-hook-form/numbers/float-input.js +51 -0
  39. package/dist/components/react-hook-form/numbers/integer-input.js +36 -0
  40. package/dist/components/react-hook-form/numbers/utils.js +10 -0
  41. package/dist/components/react-hook-form/radio-input.js +44 -0
  42. package/dist/components/react-hook-form/select-input.js +31 -0
  43. package/dist/components/react-hook-form/slider-input.js +43 -0
  44. package/dist/components/react-hook-form/text-input.js +94 -0
  45. package/dist/components/react-hook-form/utils/cancel-button.js +16 -0
  46. package/dist/components/react-hook-form/utils/field-label.js +12 -0
  47. package/dist/components/react-hook-form/utils/functions.js +36 -0
  48. package/dist/components/react-hook-form/utils/submit-button.js +23 -0
  49. package/dist/components/react-hook-form/utils/text-field-with-adornment.js +96 -0
  50. package/dist/components/translations/card-error-boundary-en.js +8 -0
  51. package/dist/components/translations/card-error-boundary-fr.js +8 -0
  52. package/dist/components/translations/common-button-en.js +7 -0
  53. package/dist/components/translations/common-button-fr.js +7 -0
  54. package/dist/components/translations/element-search-en.js +7 -0
  55. package/dist/components/translations/element-search-fr.js +7 -0
  56. package/dist/components/translations/equipment-search-en.js +21 -0
  57. package/dist/components/translations/equipment-search-fr.js +21 -0
  58. package/dist/components/translations/flat-parameters-en.js +8 -0
  59. package/dist/components/translations/flat-parameters-fr.js +8 -0
  60. package/dist/components/translations/login-en.js +14 -0
  61. package/dist/components/translations/login-fr.js +14 -0
  62. package/dist/components/translations/multiple-selection-dialog-en.js +8 -0
  63. package/dist/components/translations/multiple-selection-dialog-fr.js +8 -0
  64. package/dist/components/translations/report-viewer-en.js +8 -0
  65. package/dist/components/translations/report-viewer-fr.js +8 -0
  66. package/dist/components/translations/table-en.js +6 -0
  67. package/dist/components/translations/table-fr.js +6 -0
  68. package/dist/components/translations/top-bar-en.js +27 -0
  69. package/dist/components/translations/top-bar-fr.js +27 -0
  70. package/dist/components/translations/treeview-finder-en.js +12 -0
  71. package/dist/components/translations/treeview-finder-fr.js +12 -0
  72. package/dist/hooks/useDebounce.js +17 -0
  73. package/{es/components/ElementSearchDialog/index.js → dist/hooks/useIntlRef.d.ts} +2 -2
  74. package/dist/hooks/useIntlRef.js +13 -0
  75. package/dist/hooks/useSnackMessage.js +81 -0
  76. package/dist/index.d.ts +225 -0
  77. package/dist/index.js +154 -0
  78. package/dist/utils/AuthService.js +336 -0
  79. package/dist/utils/ElementType.js +38 -0
  80. package/dist/utils/EquipmentType.js +132 -0
  81. package/dist/utils/UserManagerMock.js +85 -0
  82. package/dist/utils/actions.js +71 -0
  83. package/dist/utils/algos.js +24 -0
  84. package/dist/utils/styles.js +13 -0
  85. package/package.json +36 -21
  86. package/es/components/AuthenticationRouter/AuthenticationRouter.js +0 -102
  87. package/es/components/AuthenticationRouter/index.js +0 -7
  88. package/es/components/CardErrorBoundary/card-error-boundary.js +0 -138
  89. package/es/components/CardErrorBoundary/index.js +0 -7
  90. package/es/components/ElementSearchDialog/element-search-dialog.js +0 -153
  91. package/es/components/ElementSearchDialog/equipment-item.js +0 -63
  92. package/es/components/ElementSearchDialog/tag-renderer.js +0 -29
  93. package/es/components/FlatParameters/FlatParameters.js +0 -448
  94. package/es/components/FlatParameters/index.js +0 -8
  95. package/es/components/Login/Login.js +0 -79
  96. package/es/components/Login/Logout.js +0 -78
  97. package/es/components/Login/index.js +0 -7
  98. package/es/components/MuiVirtualizedTable/ColumnHeader.js +0 -125
  99. package/es/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +0 -619
  100. package/es/components/MuiVirtualizedTable/MuiVirtualizedTable.js +0 -780
  101. package/es/components/MuiVirtualizedTable/index.js +0 -9
  102. package/es/components/MultipleSelectionDialog/MultipleSelectionDialog.js +0 -95
  103. package/es/components/MultipleSelectionDialog/index.js +0 -8
  104. package/es/components/OverflowableText/index.js +0 -7
  105. package/es/components/OverflowableText/overflowable-text.js +0 -81
  106. package/es/components/ReportViewer/filter-button.js +0 -77
  107. package/es/components/ReportViewer/index.js +0 -7
  108. package/es/components/ReportViewer/log-report-item.js +0 -97
  109. package/es/components/ReportViewer/log-report.js +0 -63
  110. package/es/components/ReportViewer/log-table.js +0 -130
  111. package/es/components/ReportViewer/multi-select-list.js +0 -56
  112. package/es/components/ReportViewer/report-item.js +0 -131
  113. package/es/components/ReportViewer/report-tree-view-context.js +0 -13
  114. package/es/components/ReportViewer/report-viewer.js +0 -167
  115. package/es/components/ReportViewerDialog/index.js +0 -7
  116. package/es/components/ReportViewerDialog/report-viewer-dialog.js +0 -67
  117. package/es/components/SignInCallbackHandler/SignInCallbackHandler.js +0 -19
  118. package/es/components/SignInCallbackHandler/index.js +0 -7
  119. package/es/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +0 -19
  120. package/es/components/SilentRenewCallbackHandler/index.js +0 -7
  121. package/es/components/SnackbarProvider/SnackbarProvider.js +0 -39
  122. package/es/components/SnackbarProvider/index.js +0 -7
  123. package/es/components/TopBar/AboutDialog.js +0 -456
  124. package/es/components/TopBar/GridLogo.js +0 -73
  125. package/es/components/TopBar/TopBar.js +0 -487
  126. package/es/components/TopBar/index.js +0 -9
  127. package/es/components/TreeViewFinder/TreeViewFinder.js +0 -341
  128. package/es/components/TreeViewFinder/index.js +0 -7
  129. package/es/components/images/powsybl_logo.svg +0 -35
  130. package/es/components/react-hook-form/autocomplete-input.js +0 -110
  131. package/es/components/react-hook-form/booleans/boolean-input.js +0 -56
  132. package/es/components/react-hook-form/booleans/checkbox-input.js +0 -28
  133. package/es/components/react-hook-form/booleans/switch-input.js +0 -28
  134. package/es/components/react-hook-form/error-management/error-input.js +0 -50
  135. package/es/components/react-hook-form/error-management/field-error-alert.js +0 -22
  136. package/es/components/react-hook-form/error-management/mid-form-error.js +0 -25
  137. package/es/components/react-hook-form/numbers/float-input.js +0 -105
  138. package/es/components/react-hook-form/numbers/integer-input.js +0 -35
  139. package/es/components/react-hook-form/numbers/utils.js +0 -6
  140. package/es/components/react-hook-form/radio-input.js +0 -55
  141. package/es/components/react-hook-form/select-input.js +0 -40
  142. package/es/components/react-hook-form/slider-input.js +0 -48
  143. package/es/components/react-hook-form/text-input.js +0 -100
  144. package/es/components/react-hook-form/utils/cancel-button.js +0 -28
  145. package/es/components/react-hook-form/utils/field-label.js +0 -15
  146. package/es/components/react-hook-form/utils/functions.js +0 -42
  147. package/es/components/react-hook-form/utils/submit-button.js +0 -29
  148. package/es/components/react-hook-form/utils/text-field-with-adornment.js +0 -92
  149. package/es/components/translations/card-error-boundary-en.js +0 -13
  150. package/es/components/translations/card-error-boundary-fr.js +0 -13
  151. package/es/components/translations/common-button-en.js +0 -12
  152. package/es/components/translations/common-button-fr.js +0 -12
  153. package/es/components/translations/element-search-en.js +0 -12
  154. package/es/components/translations/element-search-fr.js +0 -12
  155. package/es/components/translations/equipment-search-en.js +0 -26
  156. package/es/components/translations/equipment-search-fr.js +0 -26
  157. package/es/components/translations/flat-parameters-en.js +0 -13
  158. package/es/components/translations/flat-parameters-fr.js +0 -13
  159. package/es/components/translations/inputs-en.js +0 -25
  160. package/es/components/translations/inputs-fr.js +0 -25
  161. package/es/components/translations/login-en.js +0 -19
  162. package/es/components/translations/login-fr.js +0 -19
  163. package/es/components/translations/multiple-selection-dialog-en.js +0 -13
  164. package/es/components/translations/multiple-selection-dialog-fr.js +0 -13
  165. package/es/components/translations/report-viewer-en.js +0 -13
  166. package/es/components/translations/report-viewer-fr.js +0 -13
  167. package/es/components/translations/table-en.js +0 -11
  168. package/es/components/translations/table-fr.js +0 -11
  169. package/es/components/translations/top-bar-en.js +0 -32
  170. package/es/components/translations/top-bar-fr.js +0 -32
  171. package/es/components/translations/treeview-finder-en.js +0 -17
  172. package/es/components/translations/treeview-finder-fr.js +0 -17
  173. package/es/hooks/useDebounce.js +0 -26
  174. package/es/hooks/useIntlRef.js +0 -22
  175. package/es/hooks/useSnackMessage.js +0 -81
  176. package/es/index.js +0 -71
  177. package/es/utils/AuthService.js +0 -312
  178. package/es/utils/ElementType.js +0 -49
  179. package/es/utils/EquipmentType.js +0 -133
  180. package/es/utils/UserManagerMock.js +0 -81
  181. package/es/utils/actions.js +0 -65
  182. package/es/utils/algos.js +0 -29
  183. package/es/utils/styles.js +0 -35
@@ -1,312 +0,0 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- /**
3
- * Copyright (c) 2020, RTE (http://www.rte-france.com)
4
- * This Source Code Form is subject to the terms of the Mozilla Public
5
- * License, v. 2.0. If a copy of the MPL was not distributed with this
6
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
- */
8
- import { Log, UserManager } from 'oidc-client';
9
- import { UserManagerMock } from './UserManagerMock';
10
- import { setLoggedUser, setSignInCallbackError, setUnauthorizedUserInfo, setLogoutError, setUserValidationError, resetAuthenticationRouterError, setShowAuthenticationRouterLogin } from './actions';
11
- import jwtDecode from 'jwt-decode';
12
-
13
- // set as a global variable to allow log level configuration at runtime
14
- window.OIDCLog = Log;
15
- var hackAuthorityKey = 'oidc.hack.authority';
16
- var oidcHackReloadedKey = 'gridsuite-oidc-hack-reloaded';
17
- var pathKey = 'powsybl-gridsuite-current-path';
18
- function isIssuerErrorForCodeFlow(error) {
19
- return error.message.includes('Invalid issuer in token');
20
- }
21
- function extractIssuerToSessionStorage(error) {
22
- var issuer = error.message.split(' ').pop();
23
- sessionStorage.setItem(hackAuthorityKey, issuer);
24
- }
25
- function reload() {
26
- if (!sessionStorage.getItem(oidcHackReloadedKey)) {
27
- sessionStorage.setItem(oidcHackReloadedKey, true);
28
- console.log('Hack oidc, reload page to make login work');
29
- window.location.reload();
30
- }
31
- }
32
- function reloadTimerOnExpiresIn(user, userManager, expiresIn) {
33
- // TODO: Can we stop doing it in the hash for implicit flow ? To make it common for both flows
34
- user.expires_in = expiresIn;
35
- userManager.storeUser(user).then(function () {
36
- userManager.getUser();
37
- });
38
- }
39
- function handleSigninSilent(dispatch, userManager) {
40
- userManager.getUser().then(function (user) {
41
- if (user == null || getIdTokenExpiresIn(user) < 0) {
42
- return userManager.signinSilent()["catch"](function (error) {
43
- dispatch(setShowAuthenticationRouterLogin(true));
44
- var errorIssuerCodeFlow = isIssuerErrorForCodeFlow(error);
45
- var errorIssuerImplicitFlow = error.message === 'authority mismatch on settings vs. signin state';
46
- if (errorIssuerCodeFlow) {
47
- // Replacing authority for code flow only because it's done in the hash for implicit flow
48
- // TODO: Can we stop doing it in the hash for implicit flow ? To make it common here for both flows
49
- extractIssuerToSessionStorage(error);
50
- }
51
- if (errorIssuerCodeFlow || errorIssuerImplicitFlow) {
52
- reload();
53
- }
54
- });
55
- }
56
- });
57
- }
58
- function initializeAuthenticationDev(dispatch, isSilentRenew, validateUser, isSigninCallback) {
59
- var userManager = new UserManagerMock({});
60
- if (!isSilentRenew) {
61
- handleUser(dispatch, userManager, validateUser);
62
- if (!isSigninCallback) {
63
- handleSigninSilent(dispatch, userManager);
64
- }
65
- }
66
- return Promise.resolve(userManager);
67
- }
68
- var accessTokenExpiringNotificationTime = 60; // seconds
69
-
70
- function initializeAuthenticationProd(dispatch, isSilentRenew, idpSettings, validateUser, authorizationCodeFlowEnabled, isSigninCallback) {
71
- return idpSettings.then(function (r) {
72
- return r.json();
73
- }).then(function (idpSettings) {
74
- /* hack to ignore the iss check. XXX TODO to remove */
75
- var regextoken = /id_token=[^&]*/;
76
- var regexstate = /state=[^&]*/;
77
- var regexexpires = /expires_in=[^&]*/;
78
- var authority;
79
- if (window.location.hash) {
80
- var matched_id_token = window.location.hash.match(regextoken);
81
- var matched_state = window.location.hash.match(regexstate);
82
- if (matched_id_token != null && matched_state != null) {
83
- var id_token = matched_id_token[0].split('=')[1];
84
- var state = matched_state[0].split('=')[1];
85
- var strState = localStorage.getItem('oidc.' + state);
86
- if (strState != null) {
87
- var decoded = jwtDecode(id_token);
88
- authority = decoded.iss;
89
- var storedState = JSON.parse(strState);
90
- console.debug('Replacing authority in storedState. Before: ', storedState.authority, 'after: ', authority);
91
- storedState.authority = authority;
92
- localStorage.setItem('oidc.' + state, JSON.stringify(storedState));
93
- sessionStorage.setItem(hackAuthorityKey, authority);
94
- var matched_expires = window.location.hash.match(regexexpires);
95
- if (matched_expires != null) {
96
- var expires_in = parseInt(matched_expires[0].split('=')[1]);
97
- window.location.hash = window.location.hash.replace(matched_expires[0], 'expires_in=' + computeMinExpiresIn(expires_in, id_token, idpSettings.maxExpiresIn));
98
- }
99
- }
100
- }
101
- }
102
- authority = authority || sessionStorage.getItem(hackAuthorityKey) || idpSettings.authority;
103
- var responseSettings = authorizationCodeFlowEnabled ? {
104
- response_type: 'code'
105
- } : {
106
- response_type: 'id_token token',
107
- response_mode: 'fragment'
108
- };
109
- var settings = _extends({
110
- authority: authority,
111
- client_id: idpSettings.client_id,
112
- redirect_uri: idpSettings.redirect_uri,
113
- post_logout_redirect_uri: idpSettings.post_logout_redirect_uri,
114
- silent_redirect_uri: idpSettings.silent_redirect_uri,
115
- scope: idpSettings.scope,
116
- automaticSilentRenew: !isSilentRenew,
117
- accessTokenExpiringNotificationTime: accessTokenExpiringNotificationTime
118
- }, responseSettings);
119
- var userManager = new UserManager(settings);
120
- userManager.idpSettings = idpSettings; //store our settings in there as well to use it later
121
- userManager.authorizationCodeFlowEnabled = authorizationCodeFlowEnabled;
122
- if (!isSilentRenew) {
123
- handleUser(dispatch, userManager, validateUser);
124
- if (!isSigninCallback) {
125
- handleSigninSilent(dispatch, userManager);
126
- }
127
- }
128
- return userManager;
129
- })["catch"](function (error) {
130
- console.debug('error when importing the idp settings', error);
131
- dispatch(setShowAuthenticationRouterLogin(true));
132
- throw error;
133
- });
134
- }
135
- function computeMinExpiresIn(expiresIn, idToken, maxExpiresIn) {
136
- var now = parseInt(Date.now() / 1000);
137
- var exp = jwtDecode(idToken).exp;
138
- var idTokenExpiresIn = exp - now;
139
- var newExpiresIn = expiresIn;
140
- var newExpiresInReplaceReason;
141
- if (expiresIn === undefined || idTokenExpiresIn < newExpiresIn) {
142
- newExpiresIn = idTokenExpiresIn;
143
- newExpiresInReplaceReason = 'idtoken.exp is earlier';
144
- }
145
- if (maxExpiresIn && maxExpiresIn < newExpiresIn) {
146
- newExpiresIn = maxExpiresIn;
147
- newExpiresInReplaceReason = 'idpSettings.maxExpiresIn is smaller';
148
- }
149
- if (newExpiresInReplaceReason) {
150
- console.debug('Replacing expiresIn in user to ' + newExpiresIn + ' because ' + newExpiresInReplaceReason + '. ', 'debug:', 'original expires_in: ' + expiresIn + ', ', 'idTokenExpiresIn: ' + idTokenExpiresIn + ', idpSettings maxExpiresIn: ' + maxExpiresIn);
151
- }
152
- return newExpiresIn;
153
- }
154
- function login(location, userManagerInstance) {
155
- sessionStorage.setItem(pathKey, location.pathname + location.search);
156
- return userManagerInstance.signinRedirect().then(function () {
157
- return console.debug('login');
158
- });
159
- }
160
- function logout(dispatch, userManagerInstance) {
161
- sessionStorage.removeItem(hackAuthorityKey); //To remove when hack is removed
162
- return userManagerInstance.getUser().then(function (user) {
163
- if (user) {
164
- // We don't need to check if token is valid at this point
165
- return userManagerInstance.signoutRedirect({
166
- extraQueryParams: {
167
- TargetResource: userManagerInstance.settings.post_logout_redirect_uri
168
- }
169
- }).then(function () {
170
- console.debug('logged out, window is closing...');
171
- })["catch"](function (e) {
172
- var _user$profile;
173
- console.log('Error during logout :', e);
174
- // An error occured, window may not be closed, reset the user state
175
- dispatch(setLoggedUser(null));
176
- dispatch(setLogoutError(user === null || user === void 0 ? void 0 : (_user$profile = user.profile) === null || _user$profile === void 0 ? void 0 : _user$profile.name, {
177
- error: e
178
- }));
179
- });
180
- } else {
181
- console.log('Error nobody to logout ');
182
- }
183
- });
184
- }
185
- function getIdTokenExpiresIn(user) {
186
- var now = parseInt(Date.now() / 1000);
187
- var exp = jwtDecode(user.id_token).exp;
188
- return exp - now;
189
- }
190
- function dispatchUser(dispatch, userManagerInstance, validateUser) {
191
- return userManagerInstance.getUser().then(function (user) {
192
- if (user) {
193
- // If session storage contains a expired token at initialization
194
- // We do not dispatch the user
195
- // Our explicit SigninSilent will attempt to connect once
196
- if (getIdTokenExpiresIn(user) < 0) {
197
- console.debug('User token is expired and will not be dispatched');
198
- return;
199
- }
200
- // without validateUser defined, valid user by default
201
- var validateUserPromise = validateUser && validateUser(user) || Promise.resolve(true);
202
- return validateUserPromise.then(function (valid) {
203
- if (!valid) {
204
- var _user$profile2;
205
- console.debug("User isn't authorized to log in and will not be dispatched");
206
- return dispatch(setUnauthorizedUserInfo(user === null || user === void 0 ? void 0 : (_user$profile2 = user.profile) === null || _user$profile2 === void 0 ? void 0 : _user$profile2.name, {}));
207
- }
208
- console.debug('User has been successfully loaded from store.');
209
-
210
- // In authorization code flow we have to make the oidc-client lib re-evaluate the date of the token renewal timers
211
- // because it is not hacked at page loading on the fragment before oidc-client lib initialization
212
- if (userManagerInstance.authorizationCodeFlowEnabled) {
213
- reloadTimerOnExpiresIn(user, userManagerInstance, computeMinExpiresIn(user.expires_in, user.id_token, userManagerInstance.idpSettings.maxExpiresIn));
214
- }
215
- return dispatch(setLoggedUser(user));
216
- })["catch"](function (e) {
217
- var _user$profile3;
218
- console.log('Error in dispatchUser', e);
219
- return dispatch(setUserValidationError(user === null || user === void 0 ? void 0 : (_user$profile3 = user.profile) === null || _user$profile3 === void 0 ? void 0 : _user$profile3.name, {
220
- error: e
221
- }));
222
- });
223
- } else {
224
- console.debug('You are not logged in.');
225
- }
226
- });
227
- }
228
- function getPreLoginPath() {
229
- return sessionStorage.getItem(pathKey);
230
- }
231
- function navigateToPreLoginPath(navigate) {
232
- var previousPath = getPreLoginPath();
233
- navigate(previousPath);
234
- }
235
- function handleSigninCallback(dispatch, navigate, userManagerInstance) {
236
- var reloadAfterNavigate = false;
237
- userManagerInstance.signinRedirectCallback()["catch"](function (e) {
238
- if (isIssuerErrorForCodeFlow(e)) {
239
- // Replacing authority for code flow only because it's done in the hash for implicit flow
240
- // TODO: Can we also do it here for the implicit flow ? To make it common here for both flows
241
- extractIssuerToSessionStorage(e);
242
- // After navigate, location will be out of a redirection route (sign-in-silent or sign-in-callback) so reloading the page will attempt a silent signin
243
- // It will reload the user manager based on hacked authority at initialization with the new authority
244
- // We do this because on Azure we only get to know the issuer of the user in the idtoken and so signingredirectcallback will always fail
245
- // We could restart the whole login process from signin redirect with the correct issuer, but instead we just rely on the silent login after the reload which will work
246
- reloadAfterNavigate = true;
247
- } else {
248
- throw e;
249
- }
250
- }).then(function () {
251
- dispatch(setSignInCallbackError(null));
252
- navigateToPreLoginPath(navigate);
253
- if (reloadAfterNavigate) {
254
- reload();
255
- }
256
- })["catch"](function (e) {
257
- dispatch(setSignInCallbackError(e));
258
- console.error(e);
259
- });
260
- }
261
- function handleSilentRenewCallback(userManagerInstance) {
262
- userManagerInstance.signinSilentCallback();
263
- }
264
- function handleUser(dispatch, userManager, validateUser) {
265
- userManager.events.addUserLoaded(function (user) {
266
- console.debug('user loaded', user);
267
- dispatchUser(dispatch, userManager, validateUser);
268
- });
269
- userManager.events.addSilentRenewError(function (error) {
270
- console.debug(error);
271
- // Wait for accessTokenExpiringNotificationTime so that the user is expired and not between expiring and expired
272
- // otherwise the library will fire AccessTokenExpiring everytime we do getUser()
273
- // Indeed, getUSer() => loadUser() => load() on events => if it's already expiring it will be init and triggerred again
274
- window.setTimeout(function () {
275
- userManager.getUser().then(function (user) {
276
- if (!user) {
277
- console.error("user is null at silent renew error, it shouldn't happen.");
278
- }
279
- var idTokenExpiresIn = getIdTokenExpiresIn(user);
280
- if (idTokenExpiresIn < 0) {
281
- console.log('Error in silent renew, idtoken expired: ' + idTokenExpiresIn + ' => Logging out.', error);
282
- // remove the user from our app, but don't sso logout on all other apps
283
- dispatch(setShowAuthenticationRouterLogin(true));
284
- // logout during token expiration, show login without errors
285
- dispatch(resetAuthenticationRouterError());
286
- return dispatch(setLoggedUser(null));
287
- } else if (userManager.idpSettings.maxExpiresIn) {
288
- if (idTokenExpiresIn < userManager.idpSettings.maxExpiresIn) {
289
- // TODO here attempt last chance login ? snackbar to notify the user ? Popup ?
290
- // for now we do the same thing as in the else block
291
- console.log('Error in silent renew, but idtoken ALMOST expiring (expiring in' + idTokenExpiresIn + ') => last chance, next error will logout', 'maxExpiresIn = ' + userManager.idpSettings.maxExpiresIn, 'last renew attempt in ' + idTokenExpiresIn - accessTokenExpiringNotificationTime + 'seconds', error);
292
- reloadTimerOnExpiresIn(user, userManager, idTokenExpiresIn);
293
- } else {
294
- console.log('Error in silent renew, but idtoken NOT expiring (expiring in' + idTokenExpiresIn + ') => postponing expiration to' + userManager.idpSettings.maxExpiresIn, error);
295
- reloadTimerOnExpiresIn(user, userManager, userManager.idpSettings.maxExpiresIn);
296
- }
297
- } else {
298
- console.log('Error in silent renew, unsupported configuration: token still valid for ' + idTokenExpiresIn + ' but maxExpiresIn is not configured:' + userManager.idpSettings.maxExpiresIn, error);
299
- }
300
- });
301
- }, accessTokenExpiringNotificationTime * 1000);
302
- // Should be min(accessTokenExpiringNotificationTime * 1000, idTokenExpiresIn) to avoid rare case
303
- // when user connection is dying and you refresh the page between expiring and expired.
304
- // but gateway has a DEFAULT_MAX_CLOCK_SKEW = 60s then the token is still valid for this time
305
- // even if expired
306
- // We accept to not manage this case further
307
- });
308
-
309
- console.debug('dispatch user');
310
- dispatchUser(dispatch, userManager, validateUser);
311
- }
312
- export { initializeAuthenticationDev, initializeAuthenticationProd, handleSilentRenewCallback, login, logout, dispatchUser, handleSigninCallback, getPreLoginPath };
@@ -1,49 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, RTE (http://www.rte-france.com)
3
- * This Source Code Form is subject to the terms of the Mozilla Public
4
- * License, v. 2.0. If a copy of the MPL was not distributed with this
5
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
- */
7
- import React from 'react';
8
- import LibraryBooksOutlinedIcon from '@mui/icons-material/LibraryBooksOutlined';
9
- import OfflineBoltIcon from '@mui/icons-material/OfflineBolt';
10
- import NoteAltIcon from '@mui/icons-material/NoteAlt';
11
- import ArticleIcon from '@mui/icons-material/Article';
12
- import SettingsIcon from '@mui/icons-material/Settings';
13
- export var elementType = {
14
- DIRECTORY: 'DIRECTORY',
15
- STUDY: 'STUDY',
16
- FILTER: 'FILTER',
17
- MODIFICATION: 'MODIFICATION',
18
- CONTINGENCY_LIST: 'CONTINGENCY_LIST',
19
- VOLTAGE_INIT_PARAMETERS: 'VOLTAGE_INIT_PARAMETERS'
20
- };
21
- export function getFileIcon(type, style) {
22
- switch (type) {
23
- case elementType.STUDY:
24
- return /*#__PURE__*/React.createElement(LibraryBooksOutlinedIcon, {
25
- sx: style
26
- });
27
- case elementType.CONTINGENCY_LIST:
28
- return /*#__PURE__*/React.createElement(OfflineBoltIcon, {
29
- sx: style
30
- });
31
- case elementType.MODIFICATION:
32
- return /*#__PURE__*/React.createElement(NoteAltIcon, {
33
- sx: style
34
- });
35
- case elementType.FILTER:
36
- return /*#__PURE__*/React.createElement(ArticleIcon, {
37
- sx: style
38
- });
39
- case elementType.VOLTAGE_INIT_PARAMETERS:
40
- return /*#__PURE__*/React.createElement(SettingsIcon, {
41
- sx: style
42
- });
43
- case elementType.DIRECTORY:
44
- // to easily use in TreeView we do not give icons for directories
45
- return;
46
- default:
47
- console.warn('unknown type [' + type + ']');
48
- }
49
- }
@@ -1,133 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, RTE (http://www.rte-france.com)
3
- * This Source Code Form is subject to the terms of the Mozilla Public
4
- * License, v. 2.0. If a copy of the MPL was not distributed with this
5
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
- */
7
- import { LIGHT_THEME } from '../components/TopBar/TopBar';
8
- export var TYPE_TAG_MAX_SIZE = '90px';
9
- export var VL_TAG_MAX_SIZE = '100px';
10
- export var equipmentStyles = {
11
- equipmentOption: {
12
- display: 'flex',
13
- gap: '20px',
14
- width: '100%',
15
- margin: '0px',
16
- padding: '0px',
17
- alignItems: 'center',
18
- justifyContent: 'space-between'
19
- },
20
- equipmentTag: function equipmentTag(theme) {
21
- return {
22
- borderRadius: '10px',
23
- padding: '4px',
24
- fontSize: 'x-small',
25
- textAlign: 'center',
26
- color: theme === LIGHT_THEME ? 'inherit' : 'black'
27
- };
28
- },
29
- equipmentTypeTag: {
30
- minWidth: TYPE_TAG_MAX_SIZE,
31
- maxWidth: TYPE_TAG_MAX_SIZE,
32
- background: 'lightblue'
33
- },
34
- equipmentVlTag: {
35
- width: VL_TAG_MAX_SIZE,
36
- minWidth: VL_TAG_MAX_SIZE,
37
- maxWidth: VL_TAG_MAX_SIZE,
38
- background: 'lightgray',
39
- fontStyle: 'italic'
40
- },
41
- result: {
42
- width: '100%',
43
- padding: '2px'
44
- }
45
- };
46
-
47
- // Must be equivalent as the back enum
48
- export var EQUIPMENT_TYPE = {
49
- SUBSTATION: {
50
- name: 'SUBSTATION',
51
- tagLabel: 'equipment_search/substationTag'
52
- },
53
- VOLTAGE_LEVEL: {
54
- name: 'VOLTAGE_LEVEL',
55
- tagLabel: 'equipment_search/voltageLevelTag'
56
- },
57
- LINE: {
58
- name: 'LINE',
59
- tagLabel: 'equipment_search/lineTag'
60
- },
61
- TWO_WINDINGS_TRANSFORMER: {
62
- name: 'TWO_WINDINGS_TRANSFORMER',
63
- tagLabel: 'equipment_search/2wtTag'
64
- },
65
- THREE_WINDINGS_TRANSFORMER: {
66
- name: 'THREE_WINDINGS_TRANSFORMER',
67
- tagLabel: 'equipment_search/3wtTag'
68
- },
69
- HVDC_LINE: {
70
- name: 'HVDC_LINE',
71
- tagLabel: 'equipment_search/hvdcLineTag'
72
- },
73
- GENERATOR: {
74
- name: 'GENERATOR',
75
- tagLabel: 'equipment_search/generatorTag'
76
- },
77
- BATTERY: {
78
- name: 'BATTERY',
79
- tagLabel: 'equipment_search/batteryTag'
80
- },
81
- LOAD: {
82
- name: 'LOAD',
83
- tagLabel: 'equipment_search/loadTag'
84
- },
85
- SHUNT_COMPENSATOR: {
86
- name: 'SHUNT_COMPENSATOR',
87
- tagLabel: 'equipment_search/shuntTag'
88
- },
89
- DANGLING_LINE: {
90
- name: 'DANGLING_LINE',
91
- tagLabel: 'equipment_search/lineTag'
92
- },
93
- STATIC_VAR_COMPENSATOR: {
94
- name: 'STATIC_VAR_COMPENSATOR',
95
- tagLabel: 'equipment_search/svcTag'
96
- },
97
- HVDC_CONVERTER_STATION: {
98
- name: 'HVDC_CONVERTER_STATION',
99
- tagLabel: 'equipment_search/hvdcStationTag'
100
- },
101
- BUSBAR_SECTION: {
102
- name: 'BUSBAR_SECTION',
103
- tagLabel: 'equipment_search/busbarSectionTag'
104
- },
105
- BUS: {
106
- name: 'BUS',
107
- tagLabel: 'equipment_search/busTag'
108
- },
109
- SWITCH: {
110
- name: 'SWITCH',
111
- tagLabel: 'equipment_search/switchTag'
112
- }
113
- };
114
- export var getEquipmentsInfosForSearchBar = function getEquipmentsInfosForSearchBar(equipmentsInfos, getNameOrId) {
115
- return equipmentsInfos.flatMap(function (e) {
116
- var label = getNameOrId(e);
117
- return e.type === 'SUBSTATION' ? [{
118
- label: label,
119
- id: e.id,
120
- key: e.id,
121
- type: e.type
122
- }] : e.voltageLevels.map(function (vli) {
123
- return {
124
- label: label,
125
- id: e.id,
126
- key: e.id + '_' + vli.id,
127
- type: e.type,
128
- voltageLevelLabel: getNameOrId(vli),
129
- voltageLevelId: vli.id
130
- };
131
- });
132
- });
133
- };
@@ -1,81 +0,0 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
- /**
5
- * Copyright (c) 2020, RTE (http://www.rte-france.com)
6
- * This Source Code Form is subject to the terms of the Mozilla Public
7
- * License, v. 2.0. If a copy of the MPL was not distributed with this
8
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
- */
10
- var Events = /*#__PURE__*/function () {
11
- function Events() {
12
- _defineProperty(this, "userLoadedCallbacks", []);
13
- }
14
- var _proto = Events.prototype;
15
- _proto.addUserLoaded = function addUserLoaded(callback) {
16
- this.userLoadedCallbacks.push(callback);
17
- };
18
- _proto.addSilentRenewError = function addSilentRenewError(callback) {
19
- // Nothing to do
20
- };
21
- return Events;
22
- }();
23
- export var UserManagerMock = /*#__PURE__*/function () {
24
- function UserManagerMock(settings) {
25
- _defineProperty(this, "settings", void 0);
26
- _defineProperty(this, "events", void 0);
27
- _defineProperty(this, "user", {
28
- profile: {
29
- name: 'John Doe',
30
- email: 'Jhon.Doe@rte-france.com'
31
- },
32
- id_token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiI5YzQwMjQ2MS1iMmFiLTQ3NjctOWRiMy02Njg1OWJiMGZjZDAiLCJpc3MiOiJodHRwczovL2' + 'xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vNzUwMmRhZDUtZDY0Yy00NmM3LTlkNDctYjE2ZjU4MGZjZmE5L3YyLjAiLCJpYXQiOjE1ODUzMzEyNDksIm5iZiI6MTU4NTMzMTI0OSwiZXhwIjoyNTg1MzM1MTQ5LCJhaW8iOiJBV1FB' + 'bS84UEFBQUF3Q0xyTDRIUEUvTnVjOU9OdHN0SUV4cVpyMUlqa1FGbXJvUW5EUzJBaksyWnpneUhQTldPdkE3bitveHkvRzgxWElsb1A0TitsQjZINFJteElwakhNYVArTjIyTzVnMUFaR04yc1d6VHA5T3JWMDIvOXhndXJBMjZrdU' + 'NXbGg2RSIsImF0X2hhc2giOiJJaWRYdGRHdzVkbjlOZDFQblVvbDh3IiwiaWRwIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvOTE4ODA0MGQtNmM2Ny00YzViLWIxMTItMzZhMzA0YjY2ZGFkLyIsIm5vbmNlIjoiMjkzZTcxNzhm' + 'OWE5NGZlNjg1ZWY3MjdlZTg5MTYxYjEiLCJzdWIiOiJyTnZjWXJMSXJSN25iSDJPQlhoOFkzU05wZEtPc3dfTUNkX3F3NF9vNDRJIiwidGlkIjoiNzUwMmRhZDUtZDY0Yy00NmM3LTlkNDctYjE2ZjU4MGZjZmE5IiwidXRpIjoiUF' + 'BYdkw1UWxDMG1oMGp2N3NaNGJBQSIsInZlciI6IjIuMCJ9.dPAh24KTfsqmDaRoBtMLcayAWnDqVtydQ97P1a99dg93JsDu4Jhxju9vlzvjd6Ro5a1RZdrKFKB_pgC2DkQ3wSeYjpdSNyBAlW1_ryq65JkTJVMp33OsM_7SdjaRIiJ' + 'fPiJ3U9jRBSyj7ofoHCLUjD_Uu-XreKxpMGhFHOQIO72UfXg8TBpsapjkEv9Dyz2UqMa2BQvO5mxKw93LNg5BI6j2a5LhbMEmmRWqfxWGITJ9TWfHjYdFkrXKcmvWZ9D2b4tsw_5NorDxkuzVFhA89M_0ASzOXoj1Yb6LgdkzWXDim' + 'ssvyyz5Oe4V3gdkAe8Jj7Uwz-9AR-MO2kNkH7ytHA',
33
- session_state: 'session state',
34
- access_token: 'eyJ0eXAiOiJKV1QiLCJub25jZSI6InhKWHlQeXVrU1paQ3BOeEcxZUQway1lVDF0YzZtQ01ZVkZKcnBDOTJxc28iLCJhbGciOiJSUzI1NiIsIng1dCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSIsImtpZC' + 'I6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTAwMDAtYzAwMC0wMDAwMDAwMDAwMDAiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC83NTAyZGFkNS1kNjRjLTQ2YzctOWQ' + '0Ny1iMTZmNTgwZmNmYTkvIiwiaWF0IjoxNTg1MzMxMjQ5LCJuYmYiOjE1ODUzMzEyNDksImV4cCI6MTU4NTMzNTE0OSwiYWNjdCI6MCwiYWNyIjoiMSIsImFpbyI6IkFVUUF1LzhQQUFBQXdwc3RYMlVkY2VDQWx4dU9tVHpIY0R3R' + 'lhTWUtYanIvZUNTSi9PdTRqbTJyUVBCUml0U1dWMThmNldCVEdNdnQ5ZGx0Ry9lTXB1VXZqaTN2NCtzanh3PT0iLCJhbHRzZWNpZCI6IjE6bGl2ZS5jb206MDAwMzQwMDExOUZEOTIxMiIsImFtciI6WyJwd2QiXSwiYXBwX2Rpc3B' + 'sYXluYW1lIjoic3BhIiwiYXBwaWQiOiI5YzQwMjQ2MS1iMmFiLTQ3NjctOWRiMy02Njg1OWJiMGZjZDAiLCJhcHBpZGFjciI6IjAiLCJlbWFpbCI6ImNoYW1zZWRkaW5lLmJlbmhhbWVkQGVuc2ktdW1hLnRuIiwiZmFtaWx5X25hb' + 'WUiOiJCRU5IQU1FRCIsImdpdmVuX25hbWUiOiJDaGFtc2VkZGluZSIsImlkcCI6ImxpdmUuY29tIiwiaXBhZGRyIjoiNzcuMjA0LjE0Ni4xNTkiLCJuYW1lIjoiQ2hhbXNlZGRpbmUgQkVOSEFNRUQiLCJvaWQiOiIzNTIzYmQ3OC0' + 'yZjIxLTQ3ZjYtODhlOC1hYWIzYjZmMjdmNjAiLCJwbGF0ZiI6IjE0IiwicHVpZCI6IjEwMDMyMDAwOURFMDg1NkEiLCJzY3AiOiJVc2VyLlJlYWQgcHJvZmlsZSBvcGVuaWQgZW1haWwiLCJzdWIiOiJjVEd5LVlfV3FLR2x1cmRUV' + 'DdSUVlfY3FjSDJoVHpEdllZTmotQ3hONXA4IiwidGlkIjoiNzUwMmRhZDUtZDY0Yy00NmM3LTlkNDctYjE2ZjU4MGZjZmE5IiwidW5pcXVlX25hbWUiOiJsaXZlLmNvbSNjaGFtc2VkZGluZS5iZW5oYW1lZEBlbnNpLXVtYS50biI' + 'sInV0aSI6IlBQWHZMNVFsQzBtaDBqdjdzWjRiQUEiLCJ2ZXIiOiIxLjAiLCJ4bXNfc3QiOnsic3ViIjoick52Y1lyTElyUjduYkgyT0JYaDhZM1NOcGRLT3N3X01DZF9xdzRfbzQ0SSJ9LCJ4bXNfdGNkdCI6MTU4MjgyMDM1Mn0.W_' + 'ccOGW_AGdg37KSMi7LWHtvm3Mw5p1dHjgDIrUaXduKF2iLS4dCaPw7yeo4VjAcOyV6C0h6ABLDCtkwVt8BSDTIIU7DaT8k2bRbMCCq69BmeiYPsbp-yX6ywGCx5DHsnOLqI2oHbBQktA2Nmv9Va651Pbm3OpSPuGPdVimkFCcnisiGl' + 'UOej1ZMNwyVT6386O2pERPtxmFUt_D1dKLxBXxBNxLVUG5BG3bI7wMpBOHEUA5CbaBzYXmGrLMXVVbrj9OsF-WQ6aNoqsm9cicX6pJB60lFz1dxLeSgcFO7Zh2K3PFe4FnXCqAvNPadQMz_kJEO9_phlDV85c2MPqeXbA',
35
- token_type: 'Bearer',
36
- scope: 'scopes'
37
- });
38
- this.settings = settings;
39
- this.events = new Events();
40
- }
41
- var _proto2 = UserManagerMock.prototype;
42
- _proto2.getUser = function getUser() {
43
- return Promise.resolve(JSON.parse(sessionStorage.getItem('powsybl-gridsuite-mock-user')));
44
- };
45
- _proto2.signinSilent = function signinSilent() {
46
- console.info('signinSilent..............');
47
- var localStorageUser = JSON.parse(localStorage.getItem('powsybl-gridsuite-mock-user'));
48
- if (localStorageUser === null) {
49
- return Promise.reject(new Error('End-User authentication required'));
50
- }
51
- sessionStorage.setItem('powsybl-gridsuite-mock-user', JSON.stringify(localStorageUser));
52
- this.events.userLoadedCallbacks.forEach(function (c) {
53
- return c(localStorageUser);
54
- });
55
- return Promise.resolve(localStorageUser);
56
- };
57
- _proto2.signinSilentCallback = function signinSilentCallback() {
58
- console.error('Unsupported, iframe signinSilentCallback in UserManagerMock (dev mode)');
59
- return Promise.reject();
60
- };
61
- _proto2.signinRedirect = function signinRedirect() {
62
- localStorage.setItem('powsybl-gridsuite-mock-user', JSON.stringify(this.user));
63
- window.location = './sign-in-callback';
64
- return Promise.resolve(null);
65
- };
66
- _proto2.signoutRedirect = function signoutRedirect() {
67
- sessionStorage.removeItem('powsybl-gridsuite-mock-user');
68
- localStorage.removeItem('powsybl-gridsuite-mock-user');
69
- window.location = '.';
70
- return Promise.resolve(null);
71
- };
72
- _proto2.signinRedirectCallback = function signinRedirectCallback() {
73
- var _this = this;
74
- sessionStorage.setItem('powsybl-gridsuite-mock-user', JSON.stringify(this.user));
75
- this.events.userLoadedCallbacks.forEach(function (c) {
76
- return c(_this.user);
77
- });
78
- return Promise.resolve('');
79
- };
80
- return UserManagerMock;
81
- }();
@@ -1,65 +0,0 @@
1
- /**
2
- * Copyright (c) 2020, RTE (http://www.rte-france.com)
3
- * This Source Code Form is subject to the terms of the Mozilla Public
4
- * License, v. 2.0. If a copy of the MPL was not distributed with this
5
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
- */
7
-
8
- export var USER = 'USER';
9
- export function setLoggedUser(user) {
10
- return {
11
- type: USER,
12
- user: user
13
- };
14
- }
15
- export var SIGNIN_CALLBACK_ERROR = 'SIGNIN_CALLBACK_ERROR';
16
- export function setSignInCallbackError(signInCallbackError) {
17
- return {
18
- type: SIGNIN_CALLBACK_ERROR,
19
- signInCallbackError: signInCallbackError
20
- };
21
- }
22
- export var UNAUTHORIZED_USER_INFO = 'UNAUTHORIZED_USER_INFO';
23
- export function setUnauthorizedUserInfo(userName, unauthorizedUserInfo) {
24
- return {
25
- type: UNAUTHORIZED_USER_INFO,
26
- authenticationRouterError: {
27
- userName: userName,
28
- unauthorizedUserInfo: unauthorizedUserInfo
29
- }
30
- };
31
- }
32
- export var LOGOUT_ERROR = 'LOGOUT_ERROR';
33
- export function setLogoutError(userName, logoutError) {
34
- return {
35
- type: LOGOUT_ERROR,
36
- authenticationRouterError: {
37
- userName: userName,
38
- logoutError: logoutError
39
- }
40
- };
41
- }
42
- export var USER_VALIDATION_ERROR = 'USER_VALIDATION_ERROR';
43
- export function setUserValidationError(userName, userValidationError) {
44
- return {
45
- type: USER_VALIDATION_ERROR,
46
- authenticationRouterError: {
47
- userName: userName,
48
- userValidationError: userValidationError
49
- }
50
- };
51
- }
52
- export var RESET_AUTHENTICATION_ROUTER_ERROR = 'RESET_AUTHENTICATION_ROUTER_ERROR';
53
- export function resetAuthenticationRouterError() {
54
- return {
55
- type: RESET_AUTHENTICATION_ROUTER_ERROR,
56
- authenticationRouterError: null
57
- };
58
- }
59
- export var SHOW_AUTH_INFO_LOGIN = 'SHOW_AUTH_INFO_LOGIN';
60
- export function setShowAuthenticationRouterLogin(showAuthenticationRouterLogin) {
61
- return {
62
- type: SHOW_AUTH_INFO_LOGIN,
63
- showAuthenticationRouterLogin: showAuthenticationRouterLogin
64
- };
65
- }
package/es/utils/algos.js DELETED
@@ -1,29 +0,0 @@
1
- /**
2
- * Copyright (c) 2022, RTE (http://www.rte-france.com)
3
- * This Source Code Form is subject to the terms of the Mozilla Public
4
- * License, v. 2.0. If a copy of the MPL was not distributed with this
5
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
- */
7
-
8
- export function equalsArray(a, b) {
9
- if (b === a) {
10
- return true;
11
- }
12
- if (!b || !a) {
13
- return false;
14
- }
15
- if (a.length !== b.length) {
16
- return false;
17
- }
18
- for (var i = 0, l = a.length; i < l; i++) {
19
- if (a[i] instanceof Array && b[i] instanceof Array) {
20
- if (!equalsArray(a[i], b[i])) {
21
- return false;
22
- }
23
- } else if (a[i] !== b[i]) {
24
- // Warning - two different object instances will never be equal: {x:20} != {x:20}
25
- return false;
26
- }
27
- }
28
- return true;
29
- }