@zengenti/contensis-react-base 3.0.2-beta.34 → 3.0.2-beta.36

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 (61) hide show
  1. package/cjs/{App-c74fb1ff.js → App-ce3f1692.js} +8 -8
  2. package/cjs/{App-c74fb1ff.js.map → App-ce3f1692.js.map} +1 -1
  3. package/cjs/{ContensisDeliveryApi-c373405a.js → ContensisDeliveryApi-39a28d8f.js} +2 -2
  4. package/cjs/{ContensisDeliveryApi-c373405a.js.map → ContensisDeliveryApi-39a28d8f.js.map} +1 -1
  5. package/cjs/{RouteLoader-c048673f.js → RouteLoader-b8dfecc7.js} +2 -2
  6. package/cjs/{RouteLoader-c048673f.js.map → RouteLoader-b8dfecc7.js.map} +1 -1
  7. package/cjs/{ToJs-c5bbd17a.js → ToJs-4099e8f0.js} +4 -1
  8. package/cjs/ToJs-4099e8f0.js.map +1 -0
  9. package/cjs/client.js +8 -8
  10. package/cjs/contensis-react-base.js +8 -8
  11. package/cjs/{login-3df93749.js → login-d9b2597e.js} +208 -5
  12. package/cjs/login-d9b2597e.js.map +1 -0
  13. package/cjs/{reducers-9afb5f89.js → reducers-84b5db70.js} +13 -3
  14. package/cjs/reducers-84b5db70.js.map +1 -0
  15. package/cjs/redux.js +3 -3
  16. package/cjs/routing.js +2 -2
  17. package/cjs/user.js +9 -3
  18. package/cjs/user.js.map +1 -1
  19. package/cjs/util.js +3 -3
  20. package/cjs/{version-fe0119b6.js → version-94f16410.js} +2 -2
  21. package/cjs/{version-fe0119b6.js.map → version-94f16410.js.map} +1 -1
  22. package/cjs/{version-6998435a.js → version-cd1fb272.js} +2 -2
  23. package/cjs/{version-6998435a.js.map → version-cd1fb272.js.map} +1 -1
  24. package/esm/{App-ade8773a.js → App-77fd1bc4.js} +8 -8
  25. package/esm/{App-ade8773a.js.map → App-77fd1bc4.js.map} +1 -1
  26. package/esm/{ContensisDeliveryApi-5bb364b9.js → ContensisDeliveryApi-79fea22b.js} +2 -2
  27. package/esm/{ContensisDeliveryApi-5bb364b9.js.map → ContensisDeliveryApi-79fea22b.js.map} +1 -1
  28. package/esm/{RouteLoader-e6c2c8d6.js → RouteLoader-18ea9f04.js} +2 -2
  29. package/esm/{RouteLoader-e6c2c8d6.js.map → RouteLoader-18ea9f04.js.map} +1 -1
  30. package/esm/{ToJs-7233c038.js → ToJs-03fa077a.js} +4 -2
  31. package/esm/ToJs-03fa077a.js.map +1 -0
  32. package/esm/client.js +9 -9
  33. package/esm/contensis-react-base.js +9 -9
  34. package/esm/{login-c3cfb5ad.js → login-daaa5f35.js} +208 -5
  35. package/esm/login-daaa5f35.js.map +1 -0
  36. package/esm/{reducers-3d5c37d1.js → reducers-74f651dd.js} +13 -4
  37. package/esm/reducers-74f651dd.js.map +1 -0
  38. package/esm/redux.js +5 -5
  39. package/esm/routing.js +2 -2
  40. package/esm/user.js +11 -5
  41. package/esm/user.js.map +1 -1
  42. package/esm/util.js +3 -3
  43. package/esm/{version-88653900.js → version-2721f36b.js} +2 -2
  44. package/esm/{version-88653900.js.map → version-2721f36b.js.map} +1 -1
  45. package/esm/{version-aebe50f2.js → version-9fb5f2a3.js} +2 -2
  46. package/esm/{version-aebe50f2.js.map → version-9fb5f2a3.js.map} +1 -1
  47. package/models/redux/appstate.d.ts +1 -0
  48. package/models/user/hooks/useLogin.d.ts +2 -0
  49. package/models/user/redux/actions.d.ts +1 -0
  50. package/models/user/redux/reducers.d.ts +1 -0
  51. package/models/user/redux/sagas/login.d.ts +1 -3
  52. package/models/user/redux/selectors.d.ts +1 -0
  53. package/models/user/redux/types.d.ts +1 -0
  54. package/models/user/util/LoginHelper.class.d.ts +34 -1
  55. package/package.json +1 -1
  56. package/cjs/ToJs-c5bbd17a.js.map +0 -1
  57. package/cjs/login-3df93749.js.map +0 -1
  58. package/cjs/reducers-9afb5f89.js.map +0 -1
  59. package/esm/ToJs-7233c038.js.map +0 -1
  60. package/esm/login-c3cfb5ad.js.map +0 -1
  61. package/esm/reducers-3d5c37d1.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import { g as getImmutableOrJS } from './selectors-ff21e98a.js';
2
2
  import React from 'react';
3
3
 
4
+ const selectUserRequiresTwoFa = state => getImmutableOrJS(state, ['user', 'authenticationState', 'requiresTwoFa']);
4
5
  const selectUserIsLoading = state => getImmutableOrJS(state, ['user', 'authenticationState', 'isLoading']);
5
6
  const selectUserIsAuthenticated = state => getImmutableOrJS(state, ['user', 'authenticationState', 'isAuthenticated']);
6
7
  const selectUserIsAuthenticationError = state => getImmutableOrJS(state, ['user', 'authenticationState', 'isAuthenticationError']);
@@ -37,6 +38,7 @@ const selectChangePasswordError = state => getImmutableOrJS(state, ['user', 'cha
37
38
 
38
39
  var selectors = /*#__PURE__*/Object.freeze({
39
40
  __proto__: null,
41
+ selectUserRequiresTwoFa: selectUserRequiresTwoFa,
40
42
  selectUserIsLoading: selectUserIsLoading,
41
43
  selectUserIsAuthenticated: selectUserIsAuthenticated,
42
44
  selectUserIsAuthenticationError: selectUserIsAuthenticationError,
@@ -94,5 +96,5 @@ const toJS = WrappedComponent => wrappedComponentProps => {
94
96
  return /*#__PURE__*/React.createElement(WrappedComponent, propsJS);
95
97
  };
96
98
 
97
- export { selectUserIsAuthenticated as a, selectUserGroups as b, selectUserErrorMessage as c, selectUserIsAuthenticationError as d, selectUserIsError as e, selectUserIsLoading as f, selectUser as g, selectUserRegistrationError as h, selectUserRegistrationIsLoading as i, selectUserRegistrationIsSuccess as j, selectUserRegistration as k, selectPasswordResetRequestSending as l, matchUserGroup as m, selectPasswordResetRequestSent as n, selectPasswordResetRequestError as o, selectResetPasswordSending as p, selectResetPasswordSent as q, selectResetPasswordError as r, selectClientCredentials as s, toJS as t, selectChangePasswordSending as u, selectChangePasswordSent as v, selectUserGuid as w, selectChangePasswordError as x, selectors as y };
98
- //# sourceMappingURL=ToJs-7233c038.js.map
99
+ export { selectUserIsAuthenticated as a, selectUserGroups as b, selectUser as c, selectUserErrorMessage as d, selectUserRequiresTwoFa as e, selectUserIsAuthenticationError as f, selectUserIsError as g, selectUserIsLoading as h, selectUserRegistrationError as i, selectUserRegistrationIsLoading as j, selectUserRegistrationIsSuccess as k, selectUserRegistration as l, matchUserGroup as m, selectPasswordResetRequestSending as n, selectPasswordResetRequestSent as o, selectPasswordResetRequestError as p, selectResetPasswordSending as q, selectResetPasswordSent as r, selectClientCredentials as s, toJS as t, selectResetPasswordError as u, selectChangePasswordSending as v, selectChangePasswordSent as w, selectUserGuid as x, selectChangePasswordError as y, selectors as z };
100
+ //# sourceMappingURL=ToJs-03fa077a.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToJs-03fa077a.js","sources":["../src/user/redux/selectors.ts","../src/user/util/matchGroups.ts","../src/util/ToJs.tsx"],"sourcesContent":["import { StateType } from '~/config';\nimport { AppState } from '~/redux/appstate';\nimport { getImmutableOrJS as getIn } from '~/redux/util';\n\nexport const selectUserRequiresTwoFa = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'requiresTwoFa']);\n\nexport const selectUserIsLoading = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isLoading']);\n\nexport const selectUserIsAuthenticated = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticated']);\n\nexport const selectUserIsAuthenticationError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticationError']);\n\nexport const selectUserIsError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isError']);\n\n/**\n * DEPRECATED 12/2021 - use selectUserErrorMessage instead\n * @param state AppState\n * @returns string\n */\nexport const selectUserAuthenticationErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectUserErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectClientCredentials = (\n state: AppState,\n returnType?: StateType\n) =>\n getIn(\n state,\n ['user', 'authenticationState', 'clientCredentials'],\n {},\n returnType\n );\n\nexport const selectUser = (state: AppState, returnType?: StateType) =>\n getIn(state, 'user', {}, returnType);\n\nexport const selectUserIsZengentiStaff = (state: AppState) =>\n getIn(state, ['user', 'isZengentiStaff']);\n\nexport const selectUserGuid = (state: AppState) => getIn(state, ['user', 'id']);\n\nexport const selectUsername = (state: AppState) =>\n getIn(state, ['user', 'username']);\n\nexport const selectUserEmail = (state: AppState) =>\n getIn(state, ['user', 'email']);\n\nexport const selectUserGroups = (state: AppState, returnType?: StateType) =>\n getIn(state, ['user', 'groups'], [], returnType);\n\nexport const selectUserSecurityToken = (state: AppState) =>\n getIn(state, [\n 'user',\n 'authenticationState',\n 'clientCredentials',\n 'contensisClassicToken',\n ]);\n\nexport const selectUserRegistration = (\n state: AppState,\n returnType?: StateType\n) => getIn(state, ['user', 'registration'], {}, returnType);\n\nexport const selectUserRegistrationError = (state: AppState) =>\n getIn(state, ['user', 'registration', 'error'], false);\n\nexport const selectUserRegistrationIsLoading = (state: AppState) =>\n getIn(state, ['user', 'registration', 'isLoading'], false);\n\nexport const selectUserRegistrationIsSuccess = (state: AppState) =>\n getIn(state, ['user', 'registration', 'success'], false);\n\nexport const selectPasswordResetRequestSending = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'isSending']);\n\nexport const selectPasswordResetRequestSent = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'sent']);\n\nexport const selectPasswordResetRequestError = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'error']);\n\nexport const selectResetPasswordSending = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'isSending']);\n\nexport const selectResetPasswordSent = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'sent']);\n\nexport const selectResetPasswordError = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'error']);\n\nexport const selectChangePasswordSending = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'isSending']);\n\nexport const selectChangePasswordSent = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'sent']);\n\nexport const selectChangePasswordError = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'error']);\n","import { Group } from 'contensis-management-api/lib/models';\nimport { RequireLogin } from '~/routing/routes';\n\nexport const matchUserGroup = (\n userGroups: Group[] = [],\n requiredGroups: RequireLogin = []\n) => {\n if (\n !Array.isArray(requiredGroups) ||\n (Array.isArray(requiredGroups) && requiredGroups.length === 0)\n )\n return true;\n\n const groupMatch = requiredGroups.some(requiredGroup => {\n return userGroups.some(userGroup => {\n if (requiredGroup.id === userGroup.id) {\n return true;\n }\n if (requiredGroup.name === userGroup.name) {\n return true;\n }\n });\n });\n return groupMatch;\n};\n","/* eslint-disable react/display-name */\n/* eslint-disable @typescript-eslint/naming-convention */\nimport React from 'react';\n\nexport const toJS =\n <Props extends { [key: string]: any }>(\n WrappedComponent: React.ComponentType<Props>\n ): React.ComponentType<Props> =>\n (wrappedComponentProps: Props) => {\n const KEY = 0;\n const VALUE = 1;\n\n const propsJS = Object.entries(wrappedComponentProps).reduce<Props>(\n (newProps: any, wrappedComponentProp) => {\n const propKey = wrappedComponentProp[KEY];\n const propValue = wrappedComponentProp[VALUE];\n newProps[propKey] =\n propValue && typeof propValue === 'object' && 'toJS' in propValue\n ? propValue.toJS()\n : propValue;\n return newProps as Props;\n },\n {} as Props\n );\n\n return <WrappedComponent {...propsJS} />;\n };\n"],"names":["selectUserRequiresTwoFa","state","getIn","selectUserIsLoading","selectUserIsAuthenticated","selectUserIsAuthenticationError","selectUserIsError","selectUserAuthenticationErrorMessage","selectUserErrorMessage","selectClientCredentials","returnType","selectUser","selectUserIsZengentiStaff","selectUserGuid","selectUsername","selectUserEmail","selectUserGroups","selectUserSecurityToken","selectUserRegistration","selectUserRegistrationError","selectUserRegistrationIsLoading","selectUserRegistrationIsSuccess","selectPasswordResetRequestSending","selectPasswordResetRequestSent","selectPasswordResetRequestError","selectResetPasswordSending","selectResetPasswordSent","selectResetPasswordError","selectChangePasswordSending","selectChangePasswordSent","selectChangePasswordError","matchUserGroup","userGroups","requiredGroups","Array","isArray","length","groupMatch","some","requiredGroup","userGroup","id","name","toJS","WrappedComponent","wrappedComponentProps","KEY","VALUE","propsJS","Object","entries","reduce","newProps","wrappedComponentProp","propKey","propValue","React","createElement"],"mappings":";;;MAIaA,uBAAuB,GAAIC,KAAe,IACrDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,eAAe,CAAC,EAAC;MAEnDE,mBAAmB,GAAIF,KAAe,IACjDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,WAAW,CAAC,EAAC;MAE/CG,yBAAyB,GAAIH,KAAe,IACvDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,EAAC;MAErDI,+BAA+B,GAAIJ,KAAe,IAC7DC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,uBAAuB,CAAC,EAAC;MAE3DK,iBAAiB,GAAIL,KAAe,IAC/CC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,SAAS,CAAC,EAAC;;AAE1D;AACA;AACA;AACA;AACA;AACO,MAAMM,oCAAoC,GAAIN,KAAe,IAClEC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,cAAc,CAAC,CAAC,CAAA;MAElDO,sBAAsB,GAAIP,KAAe,IACpDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,cAAc,CAAC,EAAC;AAExD,MAAMQ,uBAAuB,GAAGA,CACrCR,KAAe,EACfS,UAAsB,KAEtBR,gBAAK,CACHD,KAAK,EACL,CAAC,MAAM,EAAE,qBAAqB,EAAE,mBAAmB,CAAC,EACpD,EAAE,EACFS,UAAU,EACX;MAEUC,UAAU,GAAGA,CAACV,KAAe,EAAES,UAAsB,KAChER,gBAAK,CAACD,KAAK,E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O,CAAI,CAAA;AAC1C;;;;"}
package/esm/client.js CHANGED
@@ -7,29 +7,29 @@ import { Router } from 'react-router-dom';
7
7
  import { loadableReady } from '@loadable/component';
8
8
  import { parse } from 'query-string';
9
9
  import { CookiesProvider } from 'react-cookie';
10
- import { c as createStore, s as selectVersionStatus } from './version-aebe50f2.js';
11
- import { s as setVersionStatus } from './version-88653900.js';
12
- import { b as browserHistory, r as rootSaga, p as pickProject } from './App-ade8773a.js';
13
- export { A as ReactApp } from './App-ade8773a.js';
10
+ import { c as createStore, s as selectVersionStatus } from './version-9fb5f2a3.js';
11
+ import { s as setVersionStatus } from './version-2721f36b.js';
12
+ import { b as browserHistory, r as rootSaga, p as pickProject } from './App-77fd1bc4.js';
13
+ export { A as ReactApp } from './App-77fd1bc4.js';
14
14
  import { c as setCurrentProject } from './selectors-ff21e98a.js';
15
- import { d as deliveryApi } from './ContensisDeliveryApi-5bb364b9.js';
15
+ import { d as deliveryApi } from './ContensisDeliveryApi-79fea22b.js';
16
16
  import 'redux';
17
17
  import 'redux-thunk';
18
18
  import 'redux-saga';
19
19
  import 'redux-injectors';
20
20
  import 'immer';
21
21
  import 'deepmerge';
22
- import './reducers-3d5c37d1.js';
22
+ import './reducers-74f651dd.js';
23
23
  import '@redux-saga/core/effects';
24
24
  import 'history';
25
25
  import 'loglevel';
26
- import './login-c3cfb5ad.js';
27
- import './ToJs-7233c038.js';
26
+ import './login-daaa5f35.js';
27
+ import './ToJs-03fa077a.js';
28
28
  import 'jsonpath-mapper';
29
29
  import 'await-to-js';
30
30
  import 'js-cookie';
31
31
  import 'contensis-delivery-api';
32
- import './RouteLoader-e6c2c8d6.js';
32
+ import './RouteLoader-18ea9f04.js';
33
33
  import 'react-router-config';
34
34
  import 'reselect';
35
35
 
@@ -1,4 +1,4 @@
1
- import { c as cachedSearch, d as deliveryApi } from './ContensisDeliveryApi-5bb364b9.js';
1
+ import { c as cachedSearch, d as deliveryApi } from './ContensisDeliveryApi-79fea22b.js';
2
2
  import { Query as Query$1 } from 'contensis-delivery-api';
3
3
  import React from 'react';
4
4
  import { Provider } from 'react-redux';
@@ -30,10 +30,10 @@ import { identity, noop } from 'lodash';
30
30
  import { c as commonjsGlobal } from './_commonjsHelpers-1789f0cf.js';
31
31
  import { buildCleaner } from 'lodash-clean';
32
32
  import { CookiesProvider } from 'react-cookie';
33
- import { c as createStore } from './version-aebe50f2.js';
34
- import { h as history, p as pickProject, r as rootSaga } from './App-ade8773a.js';
35
- export { A as ReactApp } from './App-ade8773a.js';
36
- import { s as setVersionStatus, a as setVersion } from './version-88653900.js';
33
+ import { c as createStore } from './version-9fb5f2a3.js';
34
+ import { h as history, p as pickProject, r as rootSaga } from './App-77fd1bc4.js';
35
+ export { A as ReactApp } from './App-77fd1bc4.js';
36
+ import { s as setVersionStatus, a as setVersion } from './version-2721f36b.js';
37
37
  import { s as selectSurrogateKeys, a as selectRouteEntry, b as selectCurrentProject, g as getImmutableOrJS, c as setCurrentProject } from './selectors-ff21e98a.js';
38
38
  import chalk from 'chalk';
39
39
  import 'loglevel';
@@ -42,14 +42,14 @@ import 'redux';
42
42
  import 'redux-thunk';
43
43
  import 'redux-saga';
44
44
  import 'redux-injectors';
45
- import './reducers-3d5c37d1.js';
45
+ import './reducers-74f651dd.js';
46
46
  import 'history';
47
- import './login-c3cfb5ad.js';
48
- import './ToJs-7233c038.js';
47
+ import './login-daaa5f35.js';
48
+ import './ToJs-03fa077a.js';
49
49
  import 'await-to-js';
50
50
  import 'js-cookie';
51
51
  import 'react-hot-loader';
52
- import './RouteLoader-e6c2c8d6.js';
52
+ import './RouteLoader-18ea9f04.js';
53
53
 
54
54
  /**
55
55
  * Util class holds our search results helper boilerplate methods
@@ -1,6 +1,6 @@
1
1
  import { takeEvery, put, call, select } from '@redux-saga/core/effects';
2
- import { L as LOGIN_USER, n as LOGOUT_USER, V as VALIDATE_USER, S as SET_AUTHENTICATION_STATE } from './reducers-3d5c37d1.js';
3
- import { a as selectUserIsAuthenticated, b as selectUserGroups, m as matchUserGroup, s as selectClientCredentials } from './ToJs-7233c038.js';
2
+ import { L as LOGIN_USER, V as VERIFY_TWO_FA_TOKEN, n as LOGOUT_USER, o as VALIDATE_USER, S as SET_AUTHENTICATION_STATE } from './reducers-74f651dd.js';
3
+ import { a as selectUserIsAuthenticated, c as selectUser, s as selectClientCredentials, b as selectUserGroups, m as matchUserGroup } from './ToJs-03fa077a.js';
4
4
  import { q as queryParams, o as selectCurrentSearch, p as setRoute } from './selectors-ff21e98a.js';
5
5
  import mapJson from 'jsonpath-mapper';
6
6
  import { to } from 'await-to-js';
@@ -125,6 +125,8 @@ const LOGIN_COOKIE = 'ContensisCMSUserName';
125
125
  const REFRESH_TOKEN_COOKIE = 'RefreshToken';
126
126
  const context = typeof window != 'undefined' ? window : global;
127
127
  class LoginHelper {
128
+ /* global TWO_FACTOR_AUTH */
129
+
128
130
  static SetLoginCookies({
129
131
  contensisClassicToken,
130
132
  refreshToken
@@ -158,7 +160,141 @@ class LoginHelper {
158
160
  keys.forEach(key => localStorage.removeItem(key));
159
161
  }
160
162
  }
161
- static async LoginUser({
163
+ static async LoginUserTwoFactorAuth({
164
+ username,
165
+ password,
166
+ clientCredentials,
167
+ userIn,
168
+ twoFaToken
169
+ }) {
170
+ let authenticationState = {
171
+ clientCredentials: null,
172
+ isAuthenticated: false,
173
+ isAuthenticationError: false,
174
+ isError: false
175
+ };
176
+ let transientClient;
177
+ let user = userIn;
178
+ let credentials = clientCredentials;
179
+ if (user && credentials && twoFaToken) {
180
+ const [authTokenError, authTokenResponse] = await LoginHelper.VerifyTwoFaAuthToken(user.username, twoFaToken);
181
+ if (authTokenResponse !== null && authTokenResponse !== void 0 && authTokenResponse.isTokenValid) {
182
+ LoginHelper.SetLoginCookies(clientCredentials);
183
+ authenticationState = {
184
+ requiresTwoFa: false,
185
+ clientCredentials: clientCredentials,
186
+ isAuthenticated: true,
187
+ isAuthenticationError: false,
188
+ isError: false
189
+ };
190
+ } else {
191
+ const errorMessage = authTokenError || (authTokenResponse === null || authTokenResponse === void 0 ? void 0 : authTokenResponse.error) || 'Unknown error';
192
+ authenticationState = {
193
+ requiresTwoFa: true,
194
+ clientCredentials: clientCredentials,
195
+ errorMessage,
196
+ isAuthenticated: false,
197
+ isAuthenticationError: false,
198
+ isError: true
199
+ };
200
+ LoginHelper.ClearCachedCredentials();
201
+ // eslint-disable-next-line no-console
202
+ console.log('Error verifying 2fa token: ', errorMessage);
203
+ }
204
+ } else if (username && password) {
205
+ // Get a management client with username and password
206
+ transientClient = await getManagementApiClient({
207
+ username,
208
+ password
209
+ });
210
+
211
+ // Ensure the client has requested a bearer token
212
+ const [loginError, clientBearerToken] = await to(transientClient.ensureBearerToken());
213
+
214
+ // Problem getting token with username and password
215
+ if (loginError) {
216
+ authenticationState = {
217
+ clientCredentials: null,
218
+ errorMessage: loginError.message || null,
219
+ isAuthenticated: false,
220
+ isAuthenticationError: loginError.name.includes('ContensisAuthenticationError'),
221
+ isError: true
222
+ };
223
+ LoginHelper.ClearCachedCredentials();
224
+ }
225
+
226
+ // Got a token using username and password
227
+ if (clientBearerToken) {
228
+ // Next, we need to request the 2fa token
229
+ const [tokenError] = await LoginHelper.RequestTwoFaAuthToken(username);
230
+ if (tokenError) {
231
+ // eslint-disable-next-line no-console
232
+ console.log(`Error requesting two-factor auth token: ${tokenError}`);
233
+ authenticationState = {
234
+ clientCredentials: null,
235
+ errorMessage: tokenError || null,
236
+ isAuthenticated: false,
237
+ isAuthenticationError: false,
238
+ isError: true
239
+ };
240
+ LoginHelper.ClearCachedCredentials();
241
+ } else {
242
+ // If we have successfully generated a 2fa token, get the user details next
243
+ const [userDetailsError, userDetails] = await LoginHelper.GetUserDetails(transientClient);
244
+ if (userDetailsError) {
245
+ authenticationState = {
246
+ clientCredentials: null,
247
+ errorMessage: userDetailsError.message,
248
+ isAuthenticated: false,
249
+ isAuthenticationError: false,
250
+ isError: true
251
+ };
252
+ LoginHelper.ClearCachedCredentials();
253
+ } else {
254
+ user = userDetails;
255
+ const credentials = mapClientCredentials(transientClient);
256
+ authenticationState = {
257
+ requiresTwoFa: true,
258
+ clientCredentials: credentials,
259
+ errorMessage: null,
260
+ isAuthenticated: false,
261
+ isAuthenticationError: false,
262
+ isError: false
263
+ };
264
+ }
265
+ }
266
+ }
267
+ } else if (credentials) {
268
+ const client = transientClient || (await getManagementApiClient(credentials));
269
+ const [error, userDetails] = await LoginHelper.GetUserDetails(client);
270
+ if (error) {
271
+ authenticationState = {
272
+ clientCredentials: null,
273
+ errorMessage: error.message,
274
+ isAuthenticated: false,
275
+ isAuthenticationError: false,
276
+ isError: true
277
+ };
278
+ LoginHelper.ClearCachedCredentials();
279
+ } else {
280
+ // Ensure we get latest refreshToken and contensisClassicToken from the latest client
281
+ const latestCredentials = mapClientCredentials(client);
282
+ LoginHelper.SetLoginCookies(latestCredentials);
283
+ user = userDetails;
284
+ authenticationState = {
285
+ clientCredentials: latestCredentials,
286
+ isAuthenticated: true,
287
+ isAuthenticationError: false,
288
+ isError: false
289
+ };
290
+ }
291
+ }
292
+ return {
293
+ authenticationState,
294
+ user
295
+ };
296
+ }
297
+ static async LoginUserRegular({
162
298
  username,
163
299
  password,
164
300
  clientCredentials
@@ -241,6 +377,25 @@ class LoginHelper {
241
377
  user
242
378
  };
243
379
  }
380
+ static async LoginUser({
381
+ username,
382
+ password,
383
+ clientCredentials,
384
+ userIn,
385
+ twoFaToken
386
+ }) {
387
+ return LoginHelper.IS_TWO_FA ? LoginHelper.LoginUserTwoFactorAuth({
388
+ username,
389
+ password,
390
+ clientCredentials,
391
+ userIn,
392
+ twoFaToken
393
+ }) : LoginHelper.LoginUserRegular({
394
+ username,
395
+ password,
396
+ clientCredentials
397
+ });
398
+ }
244
399
  static LogoutUser(redirectPath) {
245
400
  LoginHelper.ClearCachedCredentials();
246
401
  if (LoginHelper.WSFED_LOGIN) {
@@ -377,6 +532,34 @@ LoginHelper.CMS_URL = SERVERS.cms /* global SERVERS */;
377
532
  LoginHelper.WSFED_LOGIN = process.env.NODE_ENV === 'development' ? WSFED_LOGIN === 'true' /* global WSFED_LOGIN */ : context.WSFED_LOGIN === 'true';
378
533
  LoginHelper.LOGIN_ROUTE = '/account/login';
379
534
  LoginHelper.ACCESS_DENIED_ROUTE = '/account/access-denied';
535
+ LoginHelper.IS_TWO_FA = typeof TWO_FACTOR_AUTH === 'undefined' ? false : TWO_FACTOR_AUTH;
536
+ LoginHelper.RequestTwoFaAuthToken = async username => {
537
+ const [error, res] = await to(fetch(`/account/token`, {
538
+ method: 'POST',
539
+ headers: {
540
+ Accept: 'application/json',
541
+ 'Content-Type': 'application/json'
542
+ },
543
+ body: JSON.stringify({
544
+ username
545
+ })
546
+ }));
547
+ return [error, res];
548
+ };
549
+ LoginHelper.VerifyTwoFaAuthToken = async (username, token) => {
550
+ const [error, res] = await to(fetch(`/account/token/verify`, {
551
+ method: 'POST',
552
+ headers: {
553
+ Accept: 'application/json',
554
+ 'Content-Type': 'application/json'
555
+ },
556
+ body: JSON.stringify({
557
+ username,
558
+ token
559
+ })
560
+ }).then(res => res.json()));
561
+ return [error, res];
562
+ };
380
563
  LoginHelper.GetUserDetails = async client => {
381
564
  let userError,
382
565
  groupsError,
@@ -402,7 +585,7 @@ LoginHelper.GetUserDetails = async client => {
402
585
  return [userError, user];
403
586
  };
404
587
 
405
- const loginSagas = [takeEvery(LOGIN_USER, loginUserSaga), takeEvery(LOGOUT_USER, logoutUserSaga), takeEvery(VALIDATE_USER, validateUserSaga), takeEvery(SET_AUTHENTICATION_STATE, redirectAfterSuccessfulLoginSaga)];
588
+ const loginSagas = [takeEvery(LOGIN_USER, loginUserSaga), takeEvery(VERIFY_TWO_FA_TOKEN, verifyTwoFaTokenSaga), takeEvery(LOGOUT_USER, logoutUserSaga), takeEvery(VALIDATE_USER, validateUserSaga), takeEvery(SET_AUTHENTICATION_STATE, redirectAfterSuccessfulLoginSaga)];
406
589
  function* handleRequiresLoginSaga(action) {
407
590
  var _entry$sys;
408
591
  const {
@@ -524,6 +707,26 @@ function* loginUserSaga(action = {}) {
524
707
  user
525
708
  });
526
709
  }
710
+ function* verifyTwoFaTokenSaga(action = {}) {
711
+ const {
712
+ twoFaToken
713
+ } = action;
714
+ const userIn = yield select(selectUser);
715
+ const clientCredentials = yield select(selectClientCredentials);
716
+ const {
717
+ authenticationState,
718
+ user
719
+ } = yield LoginHelper.LoginUser({
720
+ clientCredentials,
721
+ userIn,
722
+ twoFaToken
723
+ });
724
+ yield put({
725
+ type: SET_AUTHENTICATION_STATE,
726
+ authenticationState,
727
+ user
728
+ });
729
+ }
527
730
  const removeHostnamePart = path => {
528
731
  // eslint-disable-next-line no-console
529
732
  console.log(path);
@@ -572,4 +775,4 @@ function* refreshSecurityToken() {
572
775
  }
573
776
 
574
777
  export { LoginHelper as L, findContentTypeMapping as f, getManagementApiClient as g, handleRequiresLoginSaga as h, loginSagas as l, refreshSecurityToken as r };
575
- //# sourceMappingURL=login-c3cfb5ad.js.map
778
+ //# sourceMappingURL=login-daaa5f35.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login-daaa5f35.js","sources":["../src/routing/util/find-contenttype-mapping.ts","../src/user/transformations/mapClientCredentials.js","../src/user/util/ContensisManagementApi.js","../src/user/util/CookieHelper.class.ts","../src/user/util/OidcUserManager.ts","../src/user/util/LoginHelper.class.js","../src/user/redux/sagas/login.js"],"sourcesContent":["import { ContentTypeMapping } from '../routes';\n\nexport const findContentTypeMapping = (\n ContentTypeMappings: ContentTypeMapping[],\n contentTypeId: string\n) => ContentTypeMappings.find(ct => ct.contentTypeID === contentTypeId);\n","import { mapJson } from '~/util/json-mapper';\n\nconst clientCredentials = {\n bearerToken: 'bearerToken',\n bearerTokenExpiryDate: ({ bearerTokenExpiryDate }) =>\n bearerTokenExpiryDate.toISOString(),\n refreshToken: 'refreshToken',\n refreshTokenExpiryDate: ({ refreshTokenExpiryDate }) =>\n refreshTokenExpiryDate.toISOString(),\n contensisClassicToken: 'contensisClassicToken',\n};\nexport default obj => mapJson(obj, clientCredentials);\n","// import { Client } from 'contensis-management-api';\n\nexport const getManagementApiClient = async ({\n bearerToken,\n bearerTokenExpiryDate,\n refreshToken,\n refreshTokenExpiryDate,\n contensisClassicToken,\n username,\n password,\n}) => {\n const rootUrl = SERVERS.api || SERVERS.cms; /* global SERVERS */\n const projectId = PROJECTS[0].id; /* global PROJECTS */\n\n let config = {};\n if (refreshToken) {\n config = {\n clientType: 'contensis_classic_refresh_token',\n clientDetails: {\n refreshToken,\n },\n };\n } else {\n config = {\n clientType: 'contensis_classic',\n clientDetails: {\n username,\n password,\n },\n };\n }\n const { Client } = await import('contensis-management-api');\n\n const client = Client.create({\n ...config,\n projectId,\n rootUrl,\n });\n\n if (bearerToken) client.bearerToken = bearerToken;\n if (bearerTokenExpiryDate)\n client.bearerTokenExpiryDate = bearerTokenExpiryDate;\n if (refreshToken) client.refreshToken = refreshToken;\n if (refreshTokenExpiryDate)\n client.refreshTokenExpiryDate = refreshTokenExpiryDate;\n if (contensisClassicToken)\n client.contensisClassicToken = contensisClassicToken;\n\n return client;\n};\n","import JSCookie from 'js-cookie';\n\nconst COOKIE_VALID_DAYS = 1; // 0 = Session cookie\n\n// Override the default js-cookie conversion / encoding\n// methods so the written values work with Contensis sites\nconst Cookies = JSCookie.withConverter({\n read: value => decodeURIComponent(value),\n write: value => encodeURIComponent(value),\n});\n\nexport class CookieHelper {\n static GetCookie(name) {\n const cookie = Cookies.get(name);\n if (typeof cookie === 'undefined') {\n return null;\n }\n return cookie;\n }\n\n static SetCookie(name, value, maxAgeDays = COOKIE_VALID_DAYS) {\n if (maxAgeDays === 0) Cookies.set(name, value);\n else Cookies.set(name, value, { expires: maxAgeDays });\n }\n\n static DeleteCookie(name) {\n Cookies.remove(name);\n }\n}\n","import { UserManagerSettings } from 'oidc-client';\n\nconst context = (\n typeof window != 'undefined' ? window : global\n) as typeof globalThis & {\n WSFED_LOGIN: string;\n};\n\nconst requireOidc =\n process.env.NODE_ENV === 'development'\n ? WSFED_LOGIN === 'true' /* global WSFED_LOGIN */\n : context.WSFED_LOGIN === 'true';\n\nconst servers = SERVERS; /* global SERVERS */\n\nexport const userManagerConfig =\n typeof window !== 'undefined'\n ? {\n authority: `${servers.cms}/authenticate/`,\n client_id: 'WebsiteAdfsClient',\n redirect_uri: window.location.toString(),\n post_logout_redirect_uri: window.location.toString(),\n response_type: 'id_token',\n scope: 'openid',\n filterProtocolClaims: false,\n }\n : {};\n\nexport const createUserManager = async (config: UserManagerSettings) => {\n if (typeof window !== 'undefined' && requireOidc) {\n try {\n const { UserManager } = await import(\n /* webpackChunkName: \"oidcclient\" */ 'oidc-client'\n );\n return new UserManager(config);\n } catch (e) {\n console.error('Exception in createUserManager: ', e);\n }\n } else return {};\n};\n","/* eslint-disable require-atomic-updates */\nimport { getManagementApiClient } from './ContensisManagementApi';\nimport { to } from 'await-to-js';\n\nimport { CookieHelper } from './CookieHelper.class';\n\nimport mapClientCredentials from '../transformations/mapClientCredentials';\nimport { createUserManager, userManagerConfig } from './OidcUserManager';\n\nconst LOGIN_COOKIE = 'ContensisCMSUserName';\nconst REFRESH_TOKEN_COOKIE = 'RefreshToken';\n\nconst context = typeof window != 'undefined' ? window : global;\n\nexport class LoginHelper {\n static CMS_URL = SERVERS.cms /* global SERVERS */;\n static WSFED_LOGIN =\n process.env.NODE_ENV === 'development'\n ? WSFED_LOGIN === 'true' /* global WSFED_LOGIN */\n : context.WSFED_LOGIN === 'true';\n static LOGIN_ROUTE = '/account/login';\n static ACCESS_DENIED_ROUTE = '/account/access-denied';\n static IS_TWO_FA =\n typeof TWO_FACTOR_AUTH === 'undefined'\n ? false\n : TWO_FACTOR_AUTH; /* global TWO_FACTOR_AUTH */\n\n static SetLoginCookies({ contensisClassicToken, refreshToken }) {\n console.info(\n 'SetLoginCookies:',\n LOGIN_COOKIE,\n contensisClassicToken,\n REFRESH_TOKEN_COOKIE,\n refreshToken\n );\n if (contensisClassicToken)\n CookieHelper.SetCookie(LOGIN_COOKIE, contensisClassicToken);\n if (refreshToken)\n CookieHelper.SetCookie(REFRESH_TOKEN_COOKIE, refreshToken);\n }\n\n static GetCachedCredentials() {\n return {\n bearerToken: null,\n bearerTokenExpiryDate: null,\n refreshToken: CookieHelper.GetCookie(REFRESH_TOKEN_COOKIE),\n refreshTokenExpiryDate: null,\n contensisClassicToken: CookieHelper.GetCookie(LOGIN_COOKIE),\n };\n }\n\n static ClearCachedCredentials() {\n CookieHelper.DeleteCookie(LOGIN_COOKIE);\n CookieHelper.DeleteCookie(REFRESH_TOKEN_COOKIE);\n\n if (LoginHelper.WSFED_LOGIN && typeof window !== 'undefined') {\n // remove any oidc keys left over in localStorage\n const { localStorage } = window;\n const keys = [];\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (typeof key === 'string' && key.startsWith('oidc.'))\n keys.push(localStorage.key(i));\n }\n keys.forEach(key => localStorage.removeItem(key));\n }\n }\n\n static RequestTwoFaAuthToken = async username => {\n const [error, res] = await to(\n fetch(`/account/token`, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n username,\n }),\n })\n );\n\n return [error, res];\n };\n\n static VerifyTwoFaAuthToken = async (username, token) => {\n const [error, res] = await to(\n fetch(`/account/token/verify`, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n username,\n token,\n }),\n }).then(res => res.json())\n );\n\n return [error, res];\n };\n\n static async LoginUserTwoFactorAuth({\n username,\n password,\n clientCredentials,\n userIn,\n twoFaToken,\n }) {\n let authenticationState = {\n clientCredentials: null,\n isAuthenticated: false,\n isAuthenticationError: false,\n isError: false,\n };\n let transientClient;\n let user = userIn;\n let credentials = clientCredentials;\n\n if (user && credentials && twoFaToken) {\n const [authTokenError, authTokenResponse] =\n await LoginHelper.VerifyTwoFaAuthToken(user.username, twoFaToken);\n\n if (authTokenResponse?.isTokenValid) {\n LoginHelper.SetLoginCookies(clientCredentials);\n authenticationState = {\n requiresTwoFa: false,\n clientCredentials: clientCredentials,\n isAuthenticated: true,\n isAuthenticationError: false,\n isError: false,\n };\n } else {\n const errorMessage =\n authTokenError || authTokenResponse?.error || 'Unknown error';\n authenticationState = {\n requiresTwoFa: true,\n clientCredentials: clientCredentials,\n errorMessage,\n isAuthenticated: false,\n isAuthenticationError: false,\n isError: true,\n };\n LoginHelper.ClearCachedCredentials();\n // eslint-disable-next-line no-console\n console.log('Error verifying 2fa token: ', errorMessage);\n }\n } else if (username && password) {\n // Get a management client with username and password\n transientClient = await getManagementApiClient({\n username,\n password,\n });\n\n // Ensure the client has requested a bearer token\n const [loginError, clientBearerToken] = await to(\n transientClient.ensureBearerToken()\n );\n\n // Problem getting token with username and password\n if (loginError) {\n authenticationState = {\n clientCredentials: null,\n errorMessage: loginError.message || null,\n isAuthenticated: false,\n isAuthenticationError: loginError.name.includes(\n 'ContensisAuthenticationError'\n ),\n isError: true,\n };\n LoginHelper.ClearCachedCredentials();\n }\n\n // Got a token using username and password\n if (clientBearerToken) {\n // Next, we need to request the 2fa token\n const [tokenError] = await LoginHelper.RequestTwoFaAuthToken(username);\n if (tokenError) {\n // eslint-disable-next-line no-console\n console.log(`Error requesting two-factor auth token: ${tokenError}`);\n authenticationState = {\n clientCredentials: null,\n errorMessage: tokenError || null,\n isAuthenticated: false,\n isAuthenticationError: false,\n isError: true,\n };\n LoginHelper.ClearCachedCredentials();\n } else {\n // If we have successfully generated a 2fa token, get the user details next\n const [userDetailsError, userDetails] =\n await LoginHelper.GetUserDetails(transientClient);\n\n if (userDetailsError) {\n authenticationState = {\n clientCredentials: null,\n errorMessage: userDetailsError.message,\n isAuthenticated: false,\n isAuthenticationError: false,\n isError: true,\n };\n LoginHelper.ClearCachedCredentials();\n } else {\n user = userDetails;\n const credentials = mapClientCredentials(transientClient);\n\n authenticationState = {\n requiresTwoFa: true,\n clientCredentials: credentials,\n errorMessage: null,\n isAuthenticated: false,\n isAuthenticationError: false,\n isError: false,\n };\n }\n }\n }\n } else if (credentials) {\n const client =\n transientClient || (await getManagementApiClient(credentials));\n const [error, userDetails] = await LoginHelper.GetUserDetails(client);\n\n if (error) {\n authenticationState = {\n clientCredentials: null,\n errorMessage: error.message,\n isAuthenticated: false,\n isAuthenticationError: false,\n isError: true,\n };\n LoginHelper.ClearCachedCredentials();\n } else {\n // Ensure we get latest refreshToken and contensisClassicToken from the latest client\n const latestCredentials = mapClientCredentials(client);\n LoginHelper.SetLoginCookies(latestCredentials);\n\n user = userDetails;\n authenticationState = {\n clientCredentials: latestCredentials,\n isAuthenticated: true,\n isAuthenticationError: false,\n isError: false,\n };\n }\n }\n\n return { authenticationState, user };\n }\n\n static async LoginUserRegular({ username, password, clientCredentials }) {\n let credentials = clientCredentials;\n let authenticationState = {\n clientCredentials: null,\n isAuthenticated: false,\n isAuthenticationError: false,\n isError: false,\n };\n let transientClient;\n let user;\n\n if (username && password) {\n // Get a management client with username and password\n transientClient = await getManagementApiClient({\n username,\n password,\n });\n\n // Ensure the client has requested a bearer token\n const [loginError, clientBearerToken] = await to(\n transientClient.ensureBearerToken()\n );\n\n // Problem getting token with username and password\n if (loginError) {\n authenticationState = {\n clientCredentials: null,\n errorMessage: loginError.message || null,\n isAuthenticated: false,\n isAuthenticationError: loginError.name.includes(\n 'ContensisAuthenticationError'\n ),\n isError: true,\n };\n LoginHelper.ClearCachedCredentials();\n }\n\n // Got a token using username and password\n if (clientBearerToken) {\n // Set credentials so we can continue to GetUserDetails\n credentials = mapClientCredentials(transientClient);\n LoginHelper.SetLoginCookies(credentials);\n authenticationState = {\n clientCredentials: credentials,\n isAuthenticated: true,\n isAuthenticationError: false,\n isError: false,\n };\n }\n }\n\n // If we have credentials supplied by a successful username and password login\n // or clientCredentials supplied in the options argument we can continue to\n // fetch the user's details\n if (credentials) {\n const client =\n transientClient || (await getManagementApiClient(credentials));\n const [error, userDetails] = await LoginHelper.GetUserDetails(client);\n\n if (error) {\n authenticationState = {\n clientCredentials: null,\n errorMessage: error.message,\n isAuthenticated: false,\n isAuthenticationError: false,\n isError: true,\n };\n LoginHelper.ClearCachedCredentials();\n } else {\n // Ensure we get latest refreshToken and contensisClassicToken from the latest client\n const latestCredentials = mapClientCredentials(client);\n LoginHelper.SetLoginCookies(latestCredentials);\n\n user = userDetails;\n authenticationState = {\n clientCredentials: latestCredentials,\n isAuthenticated: true,\n isAuthenticationError: false,\n isError: false,\n };\n }\n }\n\n return { authenticationState, user };\n }\n\n static async LoginUser({\n username,\n password,\n clientCredentials,\n userIn,\n twoFaToken,\n }) {\n return LoginHelper.IS_TWO_FA\n ? LoginHelper.LoginUserTwoFactorAuth({\n username,\n password,\n clientCredentials,\n userIn,\n twoFaToken,\n })\n : LoginHelper.LoginUserRegular({\n username,\n password,\n clientCredentials,\n });\n }\n\n static GetUserDetails = async client => {\n let userError,\n groupsError,\n user = {},\n groupsResult;\n\n [userError, user] = await to(client.security.users.getCurrent());\n if (user && user.id) {\n [groupsError, groupsResult] = await to(\n client.security.users.getUserGroups({\n userId: user.id,\n includeInherited: true,\n pageOptions: { pageSize: 100 },\n })\n );\n // Set groups attribute in user object to be the items\n // array from the getUserGroups result\n if (groupsResult && groupsResult.items) user.groups = groupsResult.items;\n\n //If groups call fails then log the error but allow the user to login still\n // eslint-disable-next-line no-console\n if (groupsError) console.log(groupsError);\n }\n return [userError, user];\n };\n\n static LogoutUser(redirectPath) {\n LoginHelper.ClearCachedCredentials();\n if (LoginHelper.WSFED_LOGIN) {\n LoginHelper.WsFedLogout(redirectPath);\n } else {\n if (redirectPath) LoginHelper.ClientRedirectToPath(redirectPath);\n else LoginHelper.ClientRedirectToSignInPage();\n }\n }\n\n static ClientRedirectToHome(location) {\n if (typeof window != 'undefined') {\n let url = '/';\n if (location) {\n const { search, hash } = location;\n url = search ? `${url}${search}` : url;\n url = hash ? `${url}${hash}` : url;\n }\n window.location.href = url;\n }\n }\n\n static async ClientRedirectToSignInPage(redirectPath) {\n if (LoginHelper.WSFED_LOGIN) {\n await LoginHelper.WsFedLogout();\n await LoginHelper.WsFedLogin();\n } else {\n // Standard Contensis Login\n let url = LoginHelper.LOGIN_ROUTE;\n if (typeof redirectPath === 'string')\n url = `${url}?redirect_uri=${redirectPath}`;\n if (\n typeof location !== 'undefined' &&\n redirectPath !== LoginHelper.LOGIN_ROUTE\n )\n location.replace(url);\n }\n }\n\n static ClientRedirectToAccessDeniedPage(originalPath) {\n let url = LoginHelper.ACCESS_DENIED_ROUTE;\n if (originalPath === url) return;\n\n if (typeof originalPath === 'string')\n url = `${url}?original_uri=${originalPath}`;\n if (typeof location !== 'undefined') location.href = url;\n }\n\n static ClientRedirectToPath(redirectPath) {\n if (typeof redirectPath === 'string') {\n if (typeof location !== 'undefined') window.location.href = redirectPath;\n } else LoginHelper.ClientRedirectToHome();\n }\n\n static async WsFedLogin(redirectUri) {\n const userManager = await createUserManager(userManagerConfig);\n userManager.signinRedirect({\n scope: 'openid',\n response_type: 'id_token',\n redirect_uri: redirectUri || window.location.toString(),\n });\n }\n\n static RemoveSecurityTokenQuery() {\n const params = new URLSearchParams(window.location.search);\n if (params.has('securitytoken') || params.has('securityToken')) {\n params.delete('securitytoken');\n params.delete('securityToken');\n window.location = `${window.location.pathname}${\n params.toString() ? `?${params}` : ''\n }`;\n }\n }\n\n static async WsFedLogout(redirectPath) {\n await fetch(\n `${LoginHelper.CMS_URL}/authenticate/logout?jsonResponseRequired=true`,\n {\n credentials: 'include',\n }\n );\n if (redirectPath) {\n window.location = redirectPath;\n } else {\n // Explicitly check and remove any stale\n // security token that may be in the query string\n LoginHelper.RemoveSecurityTokenQuery();\n }\n }\n\n static async GetCredentialsForSecurityToken(securityToken) {\n const [error, response] = await to(\n fetch(`${LoginHelper.CMS_URL}/REST/Contensis/Security/IsAuthenticated`, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n securityToken: encodeURIComponent(securityToken),\n }),\n })\n );\n if (error) return [{ message: 'Failed to fetch credentials' }];\n if (response.ok) {\n const [parseError, body] = await to(response.json());\n if (parseError) return [parseError];\n\n const { LogonResult, ApplicationData = [] } = body;\n if (LogonResult !== 0) {\n return [\n { message: 'Security token is invalid', data: ApplicationData },\n ];\n }\n if (ApplicationData.length > 0) {\n let refreshToken;\n ApplicationData.forEach(item => {\n if (item.Key === 'ContensisSecurityRefreshToken')\n refreshToken = item.Value;\n });\n if (!refreshToken) {\n return [\n {\n message:\n 'Fetch credentials: Unable to find ContensisSecurityRefreshToken',\n },\n ];\n }\n return [undefined, refreshToken];\n } else {\n return [\n {\n message:\n 'Fetch credentials: Unable to find ContensisSecurityRefreshToken',\n },\n ];\n }\n } else {\n return [\n {\n message: `Fetch credentials error: ${response.status} ${response.statusText}`,\n },\n ];\n }\n }\n\n // static isZengentiStaff(email) {\n // const emailRefs = ['@zengenti', '@contensis'];\n\n // return emailRefs.some(emailRef => {\n // if (email.includes(emailRef)) {\n // return true;\n // }\n // });\n // }\n}\n","import { takeEvery, select, put, call } from 'redux-saga/effects';\nimport {\n SET_AUTHENTICATION_STATE,\n LOGIN_USER,\n LOGOUT_USER,\n VALIDATE_USER,\n VERIFY_TWO_FA_TOKEN,\n} from '../types';\nimport {\n selectUserIsAuthenticated,\n selectClientCredentials,\n selectUserGroups,\n selectUser,\n} from '../selectors';\n\nimport { setRoute } from '~/routing/redux/actions';\nimport { selectCurrentSearch } from '~/routing/redux/selectors';\nimport { findContentTypeMapping } from '~/routing/util/find-contenttype-mapping';\n\nimport mapClientCredentials from '~/user/transformations/mapClientCredentials';\n\nimport { getManagementApiClient } from '~/user/util/ContensisManagementApi';\nimport { LoginHelper } from '~/user/util/LoginHelper.class';\nimport { matchUserGroup } from '~/user/util/matchGroups';\nimport { queryParams } from '~/util/navigation';\n\nexport const loginSagas = [\n takeEvery(LOGIN_USER, loginUserSaga),\n takeEvery(VERIFY_TWO_FA_TOKEN, verifyTwoFaTokenSaga),\n takeEvery(LOGOUT_USER, logoutUserSaga),\n takeEvery(VALIDATE_USER, validateUserSaga),\n takeEvery(SET_AUTHENTICATION_STATE, redirectAfterSuccessfulLoginSaga),\n];\n\nexport function* handleRequiresLoginSaga(action) {\n const {\n entry,\n requireLogin,\n routes: { ContentTypeMappings },\n staticRoute,\n } = action;\n let userLoggedIn = yield select(selectUserIsAuthenticated);\n\n // Check for a securityToken in querystring\n const currentQs = queryParams(yield select(selectCurrentSearch));\n const securityToken = currentQs.securityToken || currentQs.securitytoken;\n\n // Check if any of the defined routes have \"requireLogin\" attribute\n const { requireLogin: authRoute } = (staticRoute && staticRoute.route) || {};\n const { requireLogin: authContentType } =\n (entry &&\n findContentTypeMapping(ContentTypeMappings, entry?.sys?.contentTypeId)) ||\n {};\n\n // If requireLogin, authRoute or authContentType has been specified as an\n // array of groups we can merge all the arrays and match on any group supplied\n const routeRequiresGroups = [\n ...((Array.isArray(authContentType) && authContentType) || []),\n ...((Array.isArray(authRoute) && authRoute) || []),\n ...((Array.isArray(requireLogin) && requireLogin) || []),\n ];\n const routeRequiresLogin = !!authContentType || !!authRoute || !!requireLogin;\n\n if (!userLoggedIn) {\n // If cookies or securityToken are found on any route change\n // always validate and login the user\n if (routeRequiresLogin) {\n // If routeRequiresLogin do a blocking call that returns userLoggedIn\n userLoggedIn = yield call(validateUserSaga, { securityToken });\n }\n // otherwise do a non blocking put to handle validation in the background\n else yield put({ type: VALIDATE_USER, securityToken });\n }\n\n if (routeRequiresLogin) {\n // If a security token is in the querystring and we are not already\n // logged in something is wrong and we won't bother going on another redirect loop\n if (!userLoggedIn && !securityToken) {\n LoginHelper.ClientRedirectToSignInPage(action.location.pathname);\n } else if (routeRequiresGroups.length > 0) {\n const userGroups = yield select(selectUserGroups, 'js');\n const groupMatch = matchUserGroup(userGroups, routeRequiresGroups);\n\n if (!groupMatch)\n LoginHelper.ClientRedirectToAccessDeniedPage(action.location.pathname);\n }\n }\n}\n\nfunction* validateUserSaga({ securityToken }) {\n // Check for refreshToken in cookies\n let clientCredentials = LoginHelper.GetCachedCredentials();\n\n if (securityToken || clientCredentials.refreshToken) {\n // We only attempt to validate the user if one of the stored\n // tokens are found, in this case we set loading state manually\n // so we don't need to set and unset loading if there are no stored\n yield put({\n type: SET_AUTHENTICATION_STATE,\n authenticationState: {\n isLoading: true,\n },\n });\n // If we have just a security token we will call a CMS endpoint\n // and provide us with a RefreshToken cookie we can use during login\n const [error, refreshToken] =\n yield LoginHelper.GetCredentialsForSecurityToken(securityToken);\n if (refreshToken) {\n // Set cookies and reload values\n LoginHelper.SetLoginCookies({\n contensisClassicToken: securityToken,\n refreshToken,\n });\n clientCredentials = LoginHelper.GetCachedCredentials();\n }\n\n // Log the user in if a refreshToken is found\n if (clientCredentials.refreshToken)\n yield call(loginUserSaga, { clientCredentials });\n else if (error)\n yield put({\n type: SET_AUTHENTICATION_STATE,\n authenticationState: {\n isError: true,\n errorMessage:\n error?.message ||\n (error && 'toString' in error && error.toString()),\n },\n });\n }\n\n // Tell any callers have we successfully logged in?\n return yield select(selectUserIsAuthenticated);\n}\n\nfunction* loginUserSaga(action = {}) {\n const { username, password, clientCredentials } = action;\n\n // If a WSFED_LOGIN site has dispatched the loginUser action\n // just redirect them to the Identity Provider sign in\n if (action.type === LOGIN_USER && LoginHelper.WSFED_LOGIN)\n LoginHelper.ClientRedirectToSignInPage();\n\n const { authenticationState, user } = yield LoginHelper.LoginUser({\n username,\n password,\n clientCredentials,\n });\n\n yield put({\n type: SET_AUTHENTICATION_STATE,\n authenticationState,\n user,\n });\n}\n\nfunction* verifyTwoFaTokenSaga(action = {}) {\n const { twoFaToken } = action;\n const userIn = yield select(selectUser);\n const clientCredentials = yield select(selectClientCredentials);\n\n const { authenticationState, user } = yield LoginHelper.LoginUser({\n clientCredentials,\n userIn,\n twoFaToken,\n });\n\n yield put({\n type: SET_AUTHENTICATION_STATE,\n authenticationState,\n user,\n });\n}\n\nconst removeHostnamePart = path => {\n // eslint-disable-next-line no-console\n console.log(path);\n const relativePath = '/' + path.split('/').splice(3).join('/');\n // eslint-disable-next-line no-console\n console.log(relativePath);\n return relativePath;\n};\n\nfunction* redirectAfterSuccessfulLoginSaga() {\n const isLoggedIn = yield select(selectUserIsAuthenticated);\n const { redirect_uri: redirectPath, ReturnURL: assetRedirectPath } =\n queryParams(yield select(selectCurrentSearch));\n\n if (isLoggedIn && assetRedirectPath && typeof window != 'undefined') {\n const path = removeHostnamePart(assetRedirectPath);\n // This has to be a hard href to get the app to\n // leave React and hit the server for the IIS hosted assets\n window.location.href = path;\n // yield put(setRoute(path)); // does not work in this scenario\n } else if (isLoggedIn && redirectPath) {\n yield put(setRoute(redirectPath));\n }\n}\n\nfunction* logoutUserSaga({ redirectPath }) {\n yield put({\n type: SET_AUTHENTICATION_STATE,\n user: null,\n });\n yield LoginHelper.LogoutUser(redirectPath);\n}\n\nexport function* refreshSecurityToken() {\n const clientCredentials = yield select(selectClientCredentials, 'js');\n if (Object.keys(clientCredentials).length > 0) {\n const client = yield getManagementApiClient(clientCredentials);\n yield client.authenticate();\n\n yield put({\n type: SET_AUTHENTICATION_STATE,\n authenticationState: {\n clientCredentials: mapClientCredentials(client),\n },\n });\n }\n}\n"],"names":["findContentTypeMapping","ContentTypeMappings","contentTypeId","find","ct","contentTypeID","clientCredentials","bearerToken","bearerTokenExpiryDate","toISOString","refreshToken","refreshTokenExpiryDate","contensisClassicToken","obj","mapJson","getManagementApiClient","username","password","rootUrl","SERVERS","api","cms","projectId","PROJECTS","id","config","clientType","clientDetails","Client","client","create","COOKIE_VALID_DAYS","Cookies","JSCookie","withConverter","read","value","decodeURIComponent","write","encodeURIComponent","CookieHelper","GetCookie","name","cookie","get","SetCookie","maxAgeDays","set","expires","DeleteCookie","remove","context","window","global","requireOidc","process","env","NODE_ENV","WSFED_LOGIN","servers","userManagerConfig","authority","client_id","redirect_uri","location","toString","post_logout_redirect_uri","response_type","scope","filterProtocolClaims","createUserManager","UserManager","e","console","error","LOGIN_COOKIE","REFRESH_TOKEN_COOKIE","LoginHelper","SetLoginCookies","info","GetCachedCredentials","ClearCachedCredentials","localStorage","keys","i","length","key","startsWith","push","forEach","removeItem","LoginUserTwoFactorAuth","userIn","twoFaToken","authenticationState","isAuthenticated","isAuthenticationError","isError","transientClient","user","credentials","authTokenError","authTokenResponse","VerifyTwoFaAuthToken","isTokenValid","requiresTwoFa","errorMessage","log","loginError","clientBearerToken","to","ensureBearerToken","message","includes","tokenError","RequestTwoFaAuthToken","userDetailsError","userDetails","GetUserDetails","mapClientCredentials","latestCredentials","LoginUserRegular","LoginUser","IS_TWO_FA","LogoutUser","redirectPath","WsFedLogout","ClientRedirectToPath","ClientRedirectToSignInPage","ClientRedirectToHome","url","search","hash","href","WsFedLogin","LOGIN_ROUTE","replace","ClientRedirectToAccessDeniedPage","originalPath","ACCESS_DENIED_ROUTE","redirectUri","userManager","signinRedirect","RemoveSecurityTokenQuery","params","URLSearchParams","has","delete","pathname","fetch","CMS_URL","GetCredentialsForSecurityToken","securityToken","response","method","headers","Accept","body","JSON","stringify","ok","parseError","json","LogonResult","ApplicationData","data","item","Key","Value","undefined","status","statusText","TWO_FACTOR_AUTH","res","token","then","userError","groupsError","groupsResult","security","users","getCurrent","getUserGroups","userId","includeInherited","pageOptions","pageSize","items","groups","loginSagas","takeEvery","LOGIN_USER","loginUserSaga","VERIFY_TWO_FA_TOKEN","verifyTwoFaTokenSaga","LOGOUT_USER","logoutUserSaga","VALIDATE_USER","validateUserSaga","SET_AUTHENTICATION_STATE","redirectAfterSuccessfulLoginSaga","handleRequiresLoginSaga","action","_entry$sys","entry","requireLogin","routes","staticRoute","userLoggedIn","select","selectUserIsAuthenticated","currentQs","queryParams","selectCurrentSearch","securitytoken","authRoute","route","authContentType","sys","routeRequiresGroups","Array","isArray","routeRequiresLogin","call","put","type","userGroups","selectUserGroups","groupMatch","matchUserGroup","isLoading","selectUser","selectClientCredentials","removeHostnamePart","path","relativePath","split","splice","join","isLoggedIn","ReturnURL","assetRedirectPath","setRoute","refreshSecurityToken","Object","authenticate"],"mappings":";;;;;;;;MAEaA,s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AI,CAAC7E,iBAAiB,CAAC,CAAC+E,MAAM,GAAG,CAAC,EAAE;AAC7C,IAAA,MAAMxD,MAAM,GAAG,MAAMd,sBAAsB,CAACT,iBAAiB,CAAC,CAAA;IAC9D,MAAMuB,MAAM,CAACwN,YAAY,EAAE,CAAA;AAE3B,IAAA,MAAMrB,GAAG,CAAC;AACRC,MAAAA,IAAI,EAAE1B,wBAAwB;AAC9BzG,MAAAA,mBAAmB,EAAE;QACnBxF,iBAAiB,EAAEiH,oBAAoB,CAAC1F,MAAM,CAAA;AAChD,OAAA;AACF,KAAC,CAAC,CAAA;AACJ,GAAA;AACF;;;;"}
@@ -4,6 +4,7 @@ const ACTION_PREFIX = '@USER/';
4
4
  const VALIDATE_USER = `${ACTION_PREFIX}VALIDATE_USER`;
5
5
  const SET_AUTHENTICATION_STATE = `${ACTION_PREFIX}SET_AUTHENTICATION_STATE`;
6
6
  const LOGIN_USER = `${ACTION_PREFIX}LOGIN_USER`;
7
+ const VERIFY_TWO_FA_TOKEN = `${ACTION_PREFIX}VERIFY_TWO_FA_TOKEN`;
7
8
  const LOGIN_SUCCESSFUL = `${ACTION_PREFIX}LOGIN_SUCCESSFUL`;
8
9
  const LOGIN_FAILED = `${ACTION_PREFIX}LOGIN_FAILED`;
9
10
  const LOGOUT_USER = `${ACTION_PREFIX}LOGOUT_USER`;
@@ -28,6 +29,7 @@ var types = /*#__PURE__*/Object.freeze({
28
29
  VALIDATE_USER: VALIDATE_USER,
29
30
  SET_AUTHENTICATION_STATE: SET_AUTHENTICATION_STATE,
30
31
  LOGIN_USER: LOGIN_USER,
32
+ VERIFY_TWO_FA_TOKEN: VERIFY_TWO_FA_TOKEN,
31
33
  LOGIN_SUCCESSFUL: LOGIN_SUCCESSFUL,
32
34
  LOGIN_FAILED: LOGIN_FAILED,
33
35
  LOGOUT_USER: LOGOUT_USER,
@@ -49,6 +51,7 @@ var types = /*#__PURE__*/Object.freeze({
49
51
  });
50
52
 
51
53
  const defaultAuthenticationState = {
54
+ requiresTwoFa: false,
52
55
  clientCredentials: null,
53
56
  errorMessage: null,
54
57
  isAuthenticated: false,
@@ -98,6 +101,7 @@ var UserReducer = produce((state, action) => {
98
101
  }
99
102
  const {
100
103
  authenticationState: {
104
+ requiresTwoFa = false,
101
105
  clientCredentials = null,
102
106
  errorMessage = null,
103
107
  isAuthenticated,
@@ -107,14 +111,19 @@ var UserReducer = produce((state, action) => {
107
111
  },
108
112
  user
109
113
  } = action;
114
+
115
+ // userObj is so we aren't trying to modify user prop directly, as it can be immutable
116
+ const userObj = {};
110
117
  if (user) {
111
- user.name = `${user.firstName}${user.lastName ? ` ${user.lastName}` : ''}` || null;
112
- user.isZengentiStaff = user.email.includes('@zengenti.com');
118
+ userObj.name = `${user.firstName}${user.lastName ? ` ${user.lastName}` : ''}` || null;
119
+ userObj.isZengentiStaff = user.email.includes('@zengenti.com');
113
120
  }
114
121
  state = {
115
122
  ...initialUserState,
116
123
  ...(user || state),
124
+ ...userObj,
117
125
  authenticationState: {
126
+ requiresTwoFa,
118
127
  clientCredentials,
119
128
  errorMessage,
120
129
  isAuthenticated: isAuthenticated || ((_state = state) === null || _state === void 0 ? void 0 : (_state$authentication = _state.authenticationState) === null || _state$authentication === void 0 ? void 0 : _state$authentication.isAuthenticated),
@@ -209,5 +218,5 @@ var UserReducer = produce((state, action) => {
209
218
  }
210
219
  }, initialUserState);
211
220
 
212
- export { CHANGE_USER_PASSWORD as C, LOGIN_USER as L, REGISTER_USER as R, SET_AUTHENTICATION_STATE as S, UserReducer as U, VALIDATE_USER as V, REGISTER_USER_SUCCESS as a, REGISTER_USER_FAILED as b, REQUEST_USER_PASSWORD_RESET as c, RESET_USER_PASSWORD as d, REQUEST_USER_PASSWORD_RESET_SENDING as e, REQUEST_USER_PASSWORD_RESET_SUCCESS as f, REQUEST_USER_PASSWORD_RESET_ERROR as g, RESET_USER_PASSWORD_SENDING as h, RESET_USER_PASSWORD_SUCCESS as i, RESET_USER_PASSWORD_ERROR as j, CHANGE_USER_PASSWORD_ERROR as k, CHANGE_USER_PASSWORD_SENDING as l, CHANGE_USER_PASSWORD_SUCCESS as m, LOGOUT_USER as n, initialUserState as o, types as t };
213
- //# sourceMappingURL=reducers-3d5c37d1.js.map
221
+ export { CHANGE_USER_PASSWORD as C, LOGIN_USER as L, REGISTER_USER as R, SET_AUTHENTICATION_STATE as S, UserReducer as U, VERIFY_TWO_FA_TOKEN as V, REGISTER_USER_SUCCESS as a, REGISTER_USER_FAILED as b, REQUEST_USER_PASSWORD_RESET as c, RESET_USER_PASSWORD as d, REQUEST_USER_PASSWORD_RESET_SENDING as e, REQUEST_USER_PASSWORD_RESET_SUCCESS as f, REQUEST_USER_PASSWORD_RESET_ERROR as g, RESET_USER_PASSWORD_SENDING as h, RESET_USER_PASSWORD_SUCCESS as i, RESET_USER_PASSWORD_ERROR as j, CHANGE_USER_PASSWORD_ERROR as k, CHANGE_USER_PASSWORD_SENDING as l, CHANGE_USER_PASSWORD_SUCCESS as m, LOGOUT_USER as n, VALIDATE_USER as o, initialUserState as p, types as t };
222
+ //# sourceMappingURL=reducers-74f651dd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reducers-74f651dd.js","sources":["../src/user/redux/types.js","../src/user/redux/reducers.ts"],"sourcesContent":["const ACTION_PREFIX = '@USER/';\nexport const VALIDATE_USER = `${ACTION_PREFIX}VALIDATE_USER`;\nexport const SET_AUTHENTICATION_STATE = `${ACTION_PREFIX}SET_AUTHENTICATION_STATE`;\nexport const LOGIN_USER = `${ACTION_PREFIX}LOGIN_USER`;\nexport const VERIFY_TWO_FA_TOKEN = `${ACTION_PREFIX}VERIFY_TWO_FA_TOKEN`;\nexport const LOGIN_SUCCESSFUL = `${ACTION_PREFIX}LOGIN_SUCCESSFUL`;\nexport const LOGIN_FAILED = `${ACTION_PREFIX}LOGIN_FAILED`;\nexport const LOGOUT_USER = `${ACTION_PREFIX}LOGOUT_USER`;\nexport const REGISTER_USER = `${ACTION_PREFIX}REGISTER_USER`;\nexport const REGISTER_USER_SUCCESS = `${ACTION_PREFIX}REGISTER_USER_SUCCESS`;\nexport const REGISTER_USER_FAILED = `${ACTION_PREFIX}REGISTER_USER_FAILED`;\n\nexport const REQUEST_USER_PASSWORD_RESET = `${ACTION_PREFIX}REQUEST_USER_PASSWORD_RESET`;\nexport const RESET_USER_PASSWORD = `${ACTION_PREFIX}RESET_USER_PASSWORD`;\nexport const REQUEST_USER_PASSWORD_RESET_SENDING = `${ACTION_PREFIX}REQUEST_USER_PASSWORD_RESET_SENDING`;\nexport const REQUEST_USER_PASSWORD_RESET_SUCCESS = `${ACTION_PREFIX}REQUEST_USER_PASSWORD_RESET_SUCCESS`;\nexport const REQUEST_USER_PASSWORD_RESET_ERROR = `${ACTION_PREFIX}REQUEST_USER_PASSWORD_RESET_ERROR`;\nexport const RESET_USER_PASSWORD_SENDING = `${ACTION_PREFIX}RESET_USER_PASSWORD_SENDING`;\nexport const RESET_USER_PASSWORD_SUCCESS = `${ACTION_PREFIX}RESET_USER_PASSWORD_SUCCESS`;\nexport const RESET_USER_PASSWORD_ERROR = `${ACTION_PREFIX}RESET_USER_PASSWORD_ERROR`;\n\nexport const CHANGE_USER_PASSWORD = `${ACTION_PREFIX}CHANGE_USER_PASSWORD`;\nexport const CHANGE_USER_PASSWORD_SENDING = `${ACTION_PREFIX}CHANGE_USER_PASSWORD_SENDING`;\nexport const CHANGE_USER_PASSWORD_SUCCESS = `${ACTION_PREFIX}CHANGE_USER_PASSWORD_SUCCESS`;\nexport const CHANGE_USER_PASSWORD_ERROR = `${ACTION_PREFIX}CHANGE_USER_PASSWORD_ERROR`;\n","import { Draft, produce } from 'immer';\nimport { AppState } from '~/redux/appstate';\nimport {\n REGISTER_USER,\n REGISTER_USER_FAILED,\n REGISTER_USER_SUCCESS,\n SET_AUTHENTICATION_STATE,\n LOGIN_USER,\n LOGOUT_USER,\n REQUEST_USER_PASSWORD_RESET_SENDING,\n REQUEST_USER_PASSWORD_RESET_SUCCESS,\n REQUEST_USER_PASSWORD_RESET_ERROR,\n RESET_USER_PASSWORD_SENDING,\n RESET_USER_PASSWORD_SUCCESS,\n RESET_USER_PASSWORD_ERROR,\n CHANGE_USER_PASSWORD_SENDING,\n CHANGE_USER_PASSWORD_SUCCESS,\n CHANGE_USER_PASSWORD_ERROR,\n} from './types';\n\nconst defaultAuthenticationState = {\n requiresTwoFa: false,\n clientCredentials: null,\n errorMessage: null,\n isAuthenticated: false,\n isAuthenticationError: false,\n isError: false,\n isLoading: false,\n};\n\nconst defaultPasswordResetRequestValues = {\n isSending: false,\n sent: false,\n error: null,\n};\n\nconst defaultResetPasswordValues = {\n isSending: false,\n sent: false,\n error: null,\n};\n\nconst defaultChangePasswordValues = {\n isSending: false,\n sent: false,\n error: null,\n};\n\nconst defaultRegistrationValues = {\n isLoading: false,\n success: false,\n error: null,\n};\n\nexport const initialUserState = {\n authenticationState: defaultAuthenticationState,\n passwordResetRequest: defaultPasswordResetRequestValues,\n resetPassword: defaultResetPasswordValues,\n changePassword: defaultChangePasswordValues,\n groups: [],\n};\n\nexport default produce((state: Draft<AppState['user']>, action) => {\n switch (action.type) {\n case LOGOUT_USER: {\n return initialUserState;\n }\n case LOGIN_USER:\n case SET_AUTHENTICATION_STATE: {\n if (!action.authenticationState) {\n action.authenticationState = defaultAuthenticationState;\n }\n\n const {\n authenticationState: {\n requiresTwoFa = false,\n clientCredentials = null,\n errorMessage = null,\n isAuthenticated,\n isAuthenticationError = false,\n isError = false,\n isLoading = action.type === LOGIN_USER,\n },\n user,\n } = action;\n\n // userObj is so we aren't trying to modify user prop directly, as it can be immutable\n const userObj: any = {};\n if (user) {\n userObj.name =\n `${user.firstName}${user.lastName ? ` ${user.lastName}` : ''}` ||\n null;\n userObj.isZengentiStaff = user.email.includes('@zengenti.com');\n }\n\n state = {\n ...initialUserState,\n ...(user || state),\n ...userObj,\n authenticationState: {\n requiresTwoFa,\n clientCredentials,\n errorMessage,\n isAuthenticated:\n isAuthenticated || state?.authenticationState?.isAuthenticated,\n isAuthenticationError,\n isError,\n isLoading,\n },\n };\n return state;\n }\n // REGISTER_USER is the trigger to set the user.registration initial state\n // and will set user.registration.isLoading to true\n // REGISTER_USER_FAILED will unset user.registration.isLoading and will set\n // the value in user.registration.error\n // REGISTER_USER_SUCCESS will unset user.registration.isLoading and will\n // set user.registration to the created user from the api response\n case REGISTER_USER:\n case REGISTER_USER_FAILED:\n case REGISTER_USER_SUCCESS: {\n const { error, user } = action;\n\n // Set registration object from the supplied action.user\n // so we can call these values back later\n state.registration = (user ||\n state.registration ||\n defaultRegistrationValues) as typeof defaultRegistrationValues;\n\n // Set registration flags so the UI can track the status\n state.registration.success = action.type === REGISTER_USER_SUCCESS;\n state.registration.error = error || false;\n state.registration.isLoading = action.type === REGISTER_USER;\n return;\n }\n case REQUEST_USER_PASSWORD_RESET_SENDING:\n if (state.passwordResetRequest) {\n state.passwordResetRequest = { ...defaultPasswordResetRequestValues };\n state.passwordResetRequest.isSending = true;\n }\n return;\n case REQUEST_USER_PASSWORD_RESET_SUCCESS:\n if (state.passwordResetRequest) {\n state.passwordResetRequest.isSending = false;\n state.passwordResetRequest.sent = true;\n }\n return;\n case REQUEST_USER_PASSWORD_RESET_ERROR:\n if (state.passwordResetRequest) {\n state.passwordResetRequest.isSending = false;\n state.passwordResetRequest.error = action.error;\n }\n return;\n case RESET_USER_PASSWORD_SENDING:\n if (state.resetPassword) {\n state.resetPassword.isSending = true;\n }\n return;\n case RESET_USER_PASSWORD_SUCCESS:\n if (state.resetPassword) {\n state.resetPassword.isSending = false;\n state.resetPassword.sent = true;\n }\n return;\n case RESET_USER_PASSWORD_ERROR:\n if (state.resetPassword) {\n state.resetPassword.isSending = false;\n state.resetPassword.error = action.error;\n }\n return;\n case CHANGE_USER_PASSWORD_SENDING:\n if (state.changePassword) {\n state.changePassword.isSending = true;\n }\n return;\n case CHANGE_USER_PASSWORD_SUCCESS:\n if (state.changePassword) {\n state.changePassword.isSending = false;\n state.changePassword.sent = true;\n }\n return;\n case CHANGE_USER_PASSWORD_ERROR:\n if (state.changePassword) {\n state.changePassword.isSending = false;\n state.changePassword.error = action.error;\n }\n return;\n default:\n return;\n }\n}, initialUserState);\n"],"names":["ACTION_PREFIX","VALIDATE_USER","SET_AUTHENTICATION_STATE","LOGIN_USER","VERIFY_TWO_FA_TOKEN","LOGIN_SUCCESSFUL","LOGIN_FAILED","LOGOUT_USER","REGISTER_USER","REGISTER_USER_SUCCESS","REGISTER_USER_FAILED","REQUEST_USER_PASSWORD_RESET","RESET_USER_PASSWORD","REQUEST_USER_PASSWORD_RESET_SENDING","REQUEST_USER_PASSWORD_RESET_SUCCESS","REQUEST_USER_PASSWORD_RESET_ERROR","RESET_USER_PASSWORD_SENDING","RESET_USER_PASSWORD_SUCCESS","RESET_USER_PASSWORD_ERROR","CHANGE_USER_PASSWORD","CHANGE_USER_PASSWORD_SENDING","CHANGE_USER_PASSWORD_SUCCESS","CHANGE_USER_PASSWORD_ERROR","defaultAuthenticationState","requiresTwoFa","clientCredentials","errorMessage","isAuthenticated","isAuthenticationError","isError","isLoading","defaultPasswordResetRequestValues","isSending","sent","error","defaultResetPasswordValues","defaultChangePasswordValues","defaultRegistrationValues","success","initialUserState","authenticationState","passwordResetRequest","resetPassword","changePassword","groups","produce","state","action","type","_state","_state$authentication","user","userObj","name","firstName","lastName","isZengentiStaff","email","includes","registration"],"mappings":";;AAAA,MAAMA,aAAa,GAAG,QAAQ,CAAA;AACjBC,MAAAA,aAAa,GAAI,CAAA,EAAED,aAAc,CAAc,aAAA,EAAA;AAC/CE,MAAAA,wBAAwB,GAAI,CAAA,EAAEF,aAAc,CAAyB,wBAAA,EAAA;AACrEG,MAAAA,UAAU,GAAI,CAAA,EAAEH,aAAc,CAAW,UAAA,EAAA;AACzCI,MAAAA,mBAAmB,GAAI,CAAA,EAAEJ,aAAc,CAAoB,mBAAA,EAAA;AACjE,MAAMK,gBAAgB,GAAI,CAAA,EAAEL,aAAc,CAAiB,gBAAA,CAAA,CAAA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