@zengenti/contensis-react-base 3.0.2-beta.9 → 3.1.1-beta.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 (141) hide show
  1. package/README.md +38 -2
  2. package/cjs/{App-81a45001.js → App-555eebb0.js} +70 -34
  3. package/cjs/App-555eebb0.js.map +1 -0
  4. package/cjs/{login-51b66359.js → ChangePassword.container-f3f94d8f.js} +246 -84
  5. package/cjs/ChangePassword.container-f3f94d8f.js.map +1 -0
  6. package/cjs/{ContensisDeliveryApi-de88df2a.js → ContensisDeliveryApi-ea5ffdc2.js} +162 -122
  7. package/cjs/ContensisDeliveryApi-ea5ffdc2.js.map +1 -0
  8. package/cjs/CookieConstants-000427db.js +10 -0
  9. package/cjs/CookieConstants-000427db.js.map +1 -0
  10. package/cjs/{RouteLoader-47d70a26.js → RouteLoader-014a95b9.js} +8 -5
  11. package/cjs/RouteLoader-014a95b9.js.map +1 -0
  12. package/cjs/{ToJs-61c03582.js → ToJs-64970869.js} +49 -2
  13. package/cjs/ToJs-64970869.js.map +1 -0
  14. package/cjs/_commonjsHelpers-b3309d7b.js +11 -0
  15. package/cjs/_commonjsHelpers-b3309d7b.js.map +1 -0
  16. package/cjs/client.js +14 -12
  17. package/cjs/client.js.map +1 -1
  18. package/cjs/contensis-react-base.js +47 -361
  19. package/cjs/contensis-react-base.js.map +1 -1
  20. package/cjs/forms.js +3495 -127
  21. package/cjs/forms.js.map +1 -1
  22. package/cjs/redux.js +3 -4
  23. package/cjs/redux.js.map +1 -1
  24. package/cjs/routing.js +4 -3
  25. package/cjs/routing.js.map +1 -1
  26. package/cjs/{sagas-6d12e7ca.js → sagas-e04b94c1.js} +44 -20
  27. package/cjs/sagas-e04b94c1.js.map +1 -0
  28. package/cjs/search.js +13 -13
  29. package/cjs/search.js.map +1 -1
  30. package/cjs/{selectors-c76c2676.js → selectors-8e56cc34.js} +14 -13
  31. package/cjs/selectors-8e56cc34.js.map +1 -0
  32. package/cjs/user.js +33 -159
  33. package/cjs/user.js.map +1 -1
  34. package/cjs/util.js +6 -4
  35. package/cjs/util.js.map +1 -1
  36. package/cjs/{version-886f49d8.js → version-91b90ee8.js} +3 -3
  37. package/cjs/{version-886f49d8.js.map → version-91b90ee8.js.map} +1 -1
  38. package/cjs/{version-38afaf2a.js → version-fb4ba30b.js} +16 -24
  39. package/cjs/version-fb4ba30b.js.map +1 -0
  40. package/esm/{App-5f914483.js → App-aaea6310.js} +64 -29
  41. package/esm/App-aaea6310.js.map +1 -0
  42. package/esm/{login-4d07c2de.js → ChangePassword.container-724c8e0a.js} +229 -78
  43. package/esm/ChangePassword.container-724c8e0a.js.map +1 -0
  44. package/esm/ContensisDeliveryApi-fe53fa10.js +265 -0
  45. package/esm/ContensisDeliveryApi-fe53fa10.js.map +1 -0
  46. package/esm/CookieConstants-3d3b6531.js +6 -0
  47. package/esm/CookieConstants-3d3b6531.js.map +1 -0
  48. package/esm/{RouteLoader-f5d5f733.js → RouteLoader-fe64ca81.js} +8 -5
  49. package/esm/RouteLoader-fe64ca81.js.map +1 -0
  50. package/esm/{ToJs-0066e629.js → ToJs-c75473e9.js} +49 -3
  51. package/esm/ToJs-c75473e9.js.map +1 -0
  52. package/esm/_commonjsHelpers-1789f0cf.js +8 -0
  53. package/esm/_commonjsHelpers-1789f0cf.js.map +1 -0
  54. package/esm/client.js +15 -13
  55. package/esm/client.js.map +1 -1
  56. package/esm/contensis-react-base.js +46 -361
  57. package/esm/contensis-react-base.js.map +1 -1
  58. package/esm/forms.js +3497 -129
  59. package/esm/forms.js.map +1 -1
  60. package/esm/redux.js +6 -7
  61. package/esm/redux.js.map +1 -1
  62. package/esm/routing.js +4 -3
  63. package/esm/routing.js.map +1 -1
  64. package/esm/{sagas-53d2aefb.js → sagas-933a8fc8.js} +44 -20
  65. package/esm/sagas-933a8fc8.js.map +1 -0
  66. package/esm/search.js +14 -14
  67. package/esm/search.js.map +1 -1
  68. package/esm/{selectors-3f0d804d.js → selectors-0fe67d47.js} +14 -14
  69. package/esm/selectors-0fe67d47.js.map +1 -0
  70. package/esm/user.js +21 -151
  71. package/esm/user.js.map +1 -1
  72. package/esm/util.js +4 -4
  73. package/esm/{version-dd31c7f0.js → version-7ea8bea8.js} +17 -24
  74. package/esm/version-7ea8bea8.js.map +1 -0
  75. package/esm/{version-f4629693.js → version-f42f7bdc.js} +3 -3
  76. package/esm/{version-f4629693.js.map → version-f42f7bdc.js.map} +1 -1
  77. package/models/client/client.d.ts +1 -1
  78. package/models/config.d.ts +4 -4
  79. package/models/redux/appstate.d.ts +2 -1
  80. package/models/routing/redux/actions.d.ts +10 -6
  81. package/models/routing/redux/selectors.d.ts +5 -4
  82. package/models/routing/redux/types.d.ts +0 -1
  83. package/models/routing/routes.d.ts +20 -17
  84. package/models/routing/util/queries.d.ts +3 -2
  85. package/models/search/models/Queries.d.ts +9 -10
  86. package/models/search/models/Search.d.ts +26 -24
  87. package/models/search/models/SearchActions.d.ts +36 -36
  88. package/models/search/models/SearchState.d.ts +11 -11
  89. package/models/search/models/SearchUtil.d.ts +1 -1
  90. package/models/search/models/WithSearch.d.ts +1 -1
  91. package/models/search/redux/actions.d.ts +7 -7
  92. package/models/search/redux/selectors.d.ts +27 -27
  93. package/models/search/redux/types.d.ts +21 -21
  94. package/models/search/redux/util.d.ts +2 -2
  95. package/models/search/search/ContensisDeliveryApi.d.ts +1 -1
  96. package/models/search/search/expressions.d.ts +4 -4
  97. package/models/search/search/util.d.ts +2 -2
  98. package/models/search/transformations/state-to-queryparams.mapper.d.ts +1 -1
  99. package/models/server/features/linkdepth-api/LinkDepthSearchService.d.ts +1 -1
  100. package/models/server/features/linkdepth-api/search.d.ts +3 -3
  101. package/models/server/internalServer.d.ts +7 -5
  102. package/models/server/util/bundles.d.ts +2 -2
  103. package/models/server/util/handleExceptions.d.ts +1 -1
  104. package/models/testImmer/redux/reducer.d.ts +1 -1
  105. package/models/user/components/Login.d.ts +2 -3
  106. package/models/user/containers/ChangePassword.container.d.ts +2 -2
  107. package/models/user/containers/ForgotPassword.container.d.ts +2 -2
  108. package/models/user/containers/Login.container.d.ts +2 -2
  109. package/models/user/containers/Registration.container.d.ts +2 -2
  110. package/models/user/hocs/withLogin.d.ts +5 -11
  111. package/models/user/hocs/withRegistration.d.ts +2 -8
  112. package/models/user/redux/actions.d.ts +2 -2
  113. package/models/user/redux/sagas/login.d.ts +9 -8
  114. package/models/user/redux/selectors.d.ts +4 -4
  115. package/models/user/util/CookieConstants.d.ts +8 -0
  116. package/models/user/util/CookieHelper.class.d.ts +15 -3
  117. package/models/user/util/LoginHelper.class.d.ts +27 -23
  118. package/models/util/CachedDeliveryApi.d.ts +25 -0
  119. package/models/util/ContensisDeliveryApi.d.ts +20 -44
  120. package/models/util/LruCache.d.ts +12 -0
  121. package/models/util/ToJs.d.ts +1 -1
  122. package/models/util/index.d.ts +1 -1
  123. package/models/util/json-mapper.d.ts +1 -1
  124. package/package.json +10 -11
  125. package/cjs/App-81a45001.js.map +0 -1
  126. package/cjs/ContensisDeliveryApi-de88df2a.js.map +0 -1
  127. package/cjs/RouteLoader-47d70a26.js.map +0 -1
  128. package/cjs/ToJs-61c03582.js.map +0 -1
  129. package/cjs/login-51b66359.js.map +0 -1
  130. package/cjs/sagas-6d12e7ca.js.map +0 -1
  131. package/cjs/selectors-c76c2676.js.map +0 -1
  132. package/cjs/version-38afaf2a.js.map +0 -1
  133. package/esm/App-5f914483.js.map +0 -1
  134. package/esm/ContensisDeliveryApi-ad06857d.js +0 -227
  135. package/esm/ContensisDeliveryApi-ad06857d.js.map +0 -1
  136. package/esm/RouteLoader-f5d5f733.js.map +0 -1
  137. package/esm/ToJs-0066e629.js.map +0 -1
  138. package/esm/login-4d07c2de.js.map +0 -1
  139. package/esm/sagas-53d2aefb.js.map +0 -1
  140. package/esm/selectors-3f0d804d.js.map +0 -1
  141. package/esm/version-dd31c7f0.js.map +0 -1
@@ -1,10 +1,12 @@
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-0066e629.js';
4
- import { q as queryParams, o as selectCurrentSearch, p as setRoute } from './selectors-3f0d804d.js';
2
+ import { L as LOGIN_USER, n as LOGOUT_USER, V as VALIDATE_USER, S as SET_AUTHENTICATION_STATE, R as REGISTER_USER, c as REQUEST_USER_PASSWORD_RESET, d as RESET_USER_PASSWORD, C as CHANGE_USER_PASSWORD } from './reducers-3d5c37d1.js';
3
+ import { a as selectUserIsAuthenticated, b as selectUserGroups, m as matchUserGroup, s as selectClientCredentials, C as CookieHelper, c as selectUserErrorMessage, d as selectUserIsAuthenticationError, e as selectUserIsError, f as selectUserIsLoading, g as selectUser, t as toJS, h as selectUserRegistrationError, i as selectUserRegistrationIsLoading, j as selectUserRegistrationIsSuccess, k as selectUserRegistration, l as selectPasswordResetRequestSending, n as selectPasswordResetRequestSent, o as selectPasswordResetRequestError, p as selectResetPasswordSending, q as selectResetPasswordSent, r as selectResetPasswordError, u as selectChangePasswordSending, v as selectChangePasswordSent, w as selectUserGuid, x as selectChangePasswordError } from './ToJs-c75473e9.js';
4
+ import { q as queryParams, o as selectCurrentSearch, p as setRoute, E as action } from './selectors-0fe67d47.js';
5
5
  import mapJson from 'jsonpath-mapper';
6
6
  import { to } from 'await-to-js';
7
- import JSCookie from 'js-cookie';
7
+ import { L as LOGIN_COOKIE, R as REFRESH_TOKEN_COOKIE } from './CookieConstants-3d3b6531.js';
8
+ import { useCookies } from 'react-cookie';
9
+ import { useDispatch, useSelector } from 'react-redux';
8
10
 
9
11
  const findContentTypeMapping = (ContentTypeMappings, contentTypeId) => ContentTypeMappings.find(ct => ct.contentTypeID === contentTypeId);
10
12
 
@@ -52,9 +54,15 @@ const getManagementApiClient = async ({
52
54
  }
53
55
  };
54
56
  }
55
- const {
57
+ let {
56
58
  Client
57
59
  } = await import('contensis-management-api');
60
+ if (typeof window === 'undefined') {
61
+ const {
62
+ UniversalClient
63
+ } = await import('contensis-management-api');
64
+ Client = UniversalClient;
65
+ }
58
66
  const client = Client.create({
59
67
  ...config,
60
68
  projectId,
@@ -68,32 +76,6 @@ const getManagementApiClient = async ({
68
76
  return client;
69
77
  };
70
78
 
71
- const COOKIE_VALID_DAYS = 1; // 0 = Session cookie
72
-
73
- // Override the default js-cookie conversion / encoding
74
- // methods so the written values work with Contensis sites
75
- const Cookies = JSCookie.withConverter({
76
- read: value => decodeURIComponent(value),
77
- write: value => encodeURIComponent(value)
78
- });
79
- class CookieHelper {
80
- static GetCookie(name) {
81
- const cookie = Cookies.get(name);
82
- if (typeof cookie === 'undefined') {
83
- return null;
84
- }
85
- return cookie;
86
- }
87
- static SetCookie(name, value, maxAgeDays = COOKIE_VALID_DAYS) {
88
- if (maxAgeDays === 0) Cookies.set(name, value);else Cookies.set(name, value, {
89
- expires: maxAgeDays
90
- });
91
- }
92
- static DeleteCookie(name) {
93
- Cookies.remove(name);
94
- }
95
- }
96
-
97
79
  const context$1 = typeof window != 'undefined' ? window : global;
98
80
  const requireOidc = process.env.NODE_ENV === 'development' ? WSFED_LOGIN === 'true' /* global WSFED_LOGIN */ : context$1.WSFED_LOGIN === 'true';
99
81
  const servers = SERVERS; /* global SERVERS */
@@ -121,30 +103,32 @@ const createUserManager = async config => {
121
103
  };
122
104
 
123
105
  /* eslint-disable require-atomic-updates */
124
- const LOGIN_COOKIE = 'ContensisCMSUserName';
125
- const REFRESH_TOKEN_COOKIE = 'RefreshToken';
126
106
  const context = typeof window != 'undefined' ? window : global;
127
107
  class LoginHelper {
128
- static SetLoginCookies({
108
+ constructor(cookies) {
109
+ this.cookies = void 0;
110
+ this.cookies = cookies;
111
+ }
112
+ SetLoginCookies({
129
113
  contensisClassicToken,
130
114
  refreshToken
131
115
  }) {
132
116
  console.info('SetLoginCookies:', LOGIN_COOKIE, contensisClassicToken, REFRESH_TOKEN_COOKIE, refreshToken);
133
- if (contensisClassicToken) CookieHelper.SetCookie(LOGIN_COOKIE, contensisClassicToken);
134
- if (refreshToken) CookieHelper.SetCookie(REFRESH_TOKEN_COOKIE, refreshToken);
117
+ if (contensisClassicToken) this.cookies.SetCookie(LOGIN_COOKIE, contensisClassicToken);
118
+ if (refreshToken) this.cookies.SetCookie(REFRESH_TOKEN_COOKIE, refreshToken);
135
119
  }
136
- static GetCachedCredentials() {
120
+ GetCachedCredentials() {
137
121
  return {
138
122
  bearerToken: null,
139
123
  bearerTokenExpiryDate: null,
140
- refreshToken: CookieHelper.GetCookie(REFRESH_TOKEN_COOKIE),
124
+ refreshToken: this.cookies.GetCookie(REFRESH_TOKEN_COOKIE),
141
125
  refreshTokenExpiryDate: null,
142
- contensisClassicToken: CookieHelper.GetCookie(LOGIN_COOKIE)
126
+ contensisClassicToken: this.cookies.GetCookie(LOGIN_COOKIE)
143
127
  };
144
128
  }
145
- static ClearCachedCredentials() {
146
- CookieHelper.DeleteCookie(LOGIN_COOKIE);
147
- CookieHelper.DeleteCookie(REFRESH_TOKEN_COOKIE);
129
+ ClearCachedCredentials() {
130
+ this.cookies.DeleteCookie(LOGIN_COOKIE);
131
+ this.cookies.DeleteCookie(REFRESH_TOKEN_COOKIE);
148
132
  if (LoginHelper.WSFED_LOGIN && typeof window !== 'undefined') {
149
133
  // remove any oidc keys left over in localStorage
150
134
  const {
@@ -158,7 +142,7 @@ class LoginHelper {
158
142
  keys.forEach(key => localStorage.removeItem(key));
159
143
  }
160
144
  }
161
- static async LoginUser({
145
+ async LoginUser({
162
146
  username,
163
147
  password,
164
148
  clientCredentials
@@ -191,14 +175,14 @@ class LoginHelper {
191
175
  isAuthenticationError: loginError.name.includes('ContensisAuthenticationError'),
192
176
  isError: true
193
177
  };
194
- LoginHelper.ClearCachedCredentials();
178
+ this.ClearCachedCredentials();
195
179
  }
196
180
 
197
181
  // Got a token using username and password
198
182
  if (clientBearerToken) {
199
183
  // Set credentials so we can continue to GetUserDetails
200
184
  credentials = mapClientCredentials(transientClient);
201
- LoginHelper.SetLoginCookies(credentials);
185
+ this.SetLoginCookies(credentials);
202
186
  authenticationState = {
203
187
  clientCredentials: credentials,
204
188
  isAuthenticated: true,
@@ -222,11 +206,11 @@ class LoginHelper {
222
206
  isAuthenticationError: false,
223
207
  isError: true
224
208
  };
225
- LoginHelper.ClearCachedCredentials();
209
+ this.ClearCachedCredentials();
226
210
  } else {
227
211
  // Ensure we get latest refreshToken and contensisClassicToken from the latest client
228
212
  const latestCredentials = mapClientCredentials(client);
229
- LoginHelper.SetLoginCookies(latestCredentials);
213
+ this.SetLoginCookies(latestCredentials);
230
214
  user = userDetails;
231
215
  authenticationState = {
232
216
  clientCredentials: latestCredentials,
@@ -241,8 +225,8 @@ class LoginHelper {
241
225
  user
242
226
  };
243
227
  }
244
- static LogoutUser(redirectPath) {
245
- LoginHelper.ClearCachedCredentials();
228
+ LogoutUser(redirectPath) {
229
+ this.ClearCachedCredentials();
246
230
  if (LoginHelper.WSFED_LOGIN) {
247
231
  LoginHelper.WsFedLogout(redirectPath);
248
232
  } else {
@@ -264,6 +248,7 @@ class LoginHelper {
264
248
  }
265
249
  }
266
250
  static async ClientRedirectToSignInPage(redirectPath) {
251
+ if (typeof location === 'undefined') return;
267
252
  if (LoginHelper.WSFED_LOGIN) {
268
253
  await LoginHelper.WsFedLogout();
269
254
  await LoginHelper.WsFedLogin();
@@ -274,11 +259,13 @@ class LoginHelper {
274
259
  if (typeof location !== 'undefined' && redirectPath !== LoginHelper.LOGIN_ROUTE) location.replace(url);
275
260
  }
276
261
  }
277
- static ClientRedirectToAccessDeniedPage(originalPath) {
262
+ static GetAccessDeniedRoute(originalPath) {
278
263
  let url = LoginHelper.ACCESS_DENIED_ROUTE;
279
- if (originalPath === url) return;
280
- if (typeof originalPath === 'string') url = `${url}?original_uri=${originalPath}`;
281
- if (typeof location !== 'undefined') location.href = url;
264
+ if (originalPath !== url && typeof originalPath === 'string') url = `${url}?original_uri=${originalPath}`;
265
+ return url;
266
+ }
267
+ static ClientRedirectToAccessDeniedPage(originalPath) {
268
+ if (typeof location !== 'undefined') location.href = LoginHelper.GetAccessDeniedRoute(originalPath);
282
269
  }
283
270
  static ClientRedirectToPath(redirectPath) {
284
271
  if (typeof redirectPath === 'string') {
@@ -335,6 +322,7 @@ class LoginHelper {
335
322
  ApplicationData = []
336
323
  } = body;
337
324
  if (LogonResult !== 0) {
325
+ console.info(`Security token is invalid - LogonResult: ${LogonResult}`);
338
326
  return [{
339
327
  message: 'Security token is invalid',
340
328
  data: ApplicationData
@@ -377,6 +365,7 @@ LoginHelper.CMS_URL = SERVERS.cms /* global SERVERS */;
377
365
  LoginHelper.WSFED_LOGIN = process.env.NODE_ENV === 'development' ? WSFED_LOGIN === 'true' /* global WSFED_LOGIN */ : context.WSFED_LOGIN === 'true';
378
366
  LoginHelper.LOGIN_ROUTE = '/account/login';
379
367
  LoginHelper.ACCESS_DENIED_ROUTE = '/account/access-denied';
368
+ LoginHelper.withCookies = cookieHelper => new LoginHelper(cookieHelper);
380
369
  LoginHelper.GetUserDetails = async client => {
381
370
  let userError,
382
371
  groupsError,
@@ -406,7 +395,9 @@ const loginSagas = [takeEvery(LOGIN_USER, loginUserSaga), takeEvery(LOGOUT_USER,
406
395
  function* handleRequiresLoginSaga(action) {
407
396
  var _entry$sys;
408
397
  const {
398
+ cookies,
409
399
  entry,
400
+ path,
410
401
  requireLogin,
411
402
  routes: {
412
403
  ContentTypeMappings
@@ -435,14 +426,18 @@ function* handleRequiresLoginSaga(action) {
435
426
  // If cookies or securityToken are found on any route change
436
427
  // always validate and login the user
437
428
  if (routeRequiresLogin) {
429
+ console.info(`Route requires login: ${path}`);
438
430
  // If routeRequiresLogin do a blocking call that returns userLoggedIn
439
431
  userLoggedIn = yield call(validateUserSaga, {
432
+ cookies,
440
433
  securityToken
441
434
  });
435
+ console.info(`User logged in: ${userLoggedIn}`);
442
436
  }
443
437
  // otherwise do a non blocking put to handle validation in the background
444
438
  else yield put({
445
439
  type: VALIDATE_USER,
440
+ cookies,
446
441
  securityToken
447
442
  });
448
443
  }
@@ -457,13 +452,16 @@ function* handleRequiresLoginSaga(action) {
457
452
  if (!groupMatch) LoginHelper.ClientRedirectToAccessDeniedPage(action.location.pathname);
458
453
  }
459
454
  }
455
+ return userLoggedIn;
460
456
  }
461
457
  function* validateUserSaga({
458
+ cookies,
462
459
  securityToken
463
460
  }) {
461
+ const login = LoginHelper.withCookies(cookies);
464
462
  // Check for refreshToken in cookies
465
- let clientCredentials = LoginHelper.GetCachedCredentials();
466
- if (securityToken || clientCredentials.refreshToken) {
463
+ let clientCredentials = login.GetCachedCredentials();
464
+ if (securityToken || clientCredentials.securityToken || clientCredentials.refreshToken) {
467
465
  // We only attempt to validate the user if one of the stored
468
466
  // tokens are found, in this case we set loading state manually
469
467
  // so we don't need to set and unset loading if there are no stored
@@ -475,26 +473,36 @@ function* validateUserSaga({
475
473
  });
476
474
  // If we have just a security token we will call a CMS endpoint
477
475
  // and provide us with a RefreshToken cookie we can use during login
478
- const [error, refreshToken] = yield LoginHelper.GetCredentialsForSecurityToken(securityToken);
479
- if (refreshToken) {
480
- // Set cookies and reload values
481
- LoginHelper.SetLoginCookies({
482
- contensisClassicToken: securityToken,
483
- refreshToken
484
- });
485
- clientCredentials = LoginHelper.GetCachedCredentials();
476
+ if (securityToken || clientCredentials.securityToken && !clientCredentials.refreshToken) {
477
+ const [error, refreshToken] = yield LoginHelper.GetCredentialsForSecurityToken(securityToken || clientCredentials.securityToken);
478
+ if (refreshToken) {
479
+ // Set cookies and reload values
480
+ login.SetLoginCookies({
481
+ contensisClassicToken: securityToken,
482
+ refreshToken
483
+ });
484
+ clientCredentials = login.GetCachedCredentials();
485
+ }
486
+ if (error) {
487
+ login.ClearCachedCredentials();
488
+ yield put({
489
+ type: SET_AUTHENTICATION_STATE,
490
+ authenticationState: {
491
+ isError: true,
492
+ errorMessage: (error === null || error === void 0 ? void 0 : error.message) || error && 'toString' in error && error.toString()
493
+ }
494
+ });
495
+ }
486
496
  }
487
497
 
488
498
  // Log the user in if a refreshToken is found
489
- if (clientCredentials.refreshToken) yield call(loginUserSaga, {
490
- clientCredentials
491
- });else if (error) yield put({
492
- type: SET_AUTHENTICATION_STATE,
493
- authenticationState: {
494
- isError: true,
495
- errorMessage: (error === null || error === void 0 ? void 0 : error.message) || error && 'toString' in error && error.toString()
496
- }
497
- });
499
+ if (clientCredentials.refreshToken) {
500
+ console.info(`Login user with refreshToken ${clientCredentials.refreshToken}`);
501
+ yield call(loginUserSaga, {
502
+ clientCredentials,
503
+ cookies: login.cookies
504
+ });
505
+ }
498
506
  }
499
507
 
500
508
  // Tell any callers have we successfully logged in?
@@ -504,8 +512,10 @@ function* loginUserSaga(action = {}) {
504
512
  const {
505
513
  username,
506
514
  password,
507
- clientCredentials
515
+ clientCredentials,
516
+ cookies
508
517
  } = action;
518
+ const login = LoginHelper.withCookies(cookies);
509
519
 
510
520
  // If a WSFED_LOGIN site has dispatched the loginUser action
511
521
  // just redirect them to the Identity Provider sign in
@@ -513,7 +523,7 @@ function* loginUserSaga(action = {}) {
513
523
  const {
514
524
  authenticationState,
515
525
  user
516
- } = yield LoginHelper.LoginUser({
526
+ } = yield login.LoginUser({
517
527
  username,
518
528
  password,
519
529
  clientCredentials
@@ -549,13 +559,14 @@ function* redirectAfterSuccessfulLoginSaga() {
549
559
  }
550
560
  }
551
561
  function* logoutUserSaga({
552
- redirectPath
562
+ redirectPath,
563
+ cookies
553
564
  }) {
554
565
  yield put({
555
566
  type: SET_AUTHENTICATION_STATE,
556
567
  user: null
557
568
  });
558
- yield LoginHelper.LogoutUser(redirectPath);
569
+ yield LoginHelper.withCookies(cookies).LogoutUser(redirectPath);
559
570
  }
560
571
  function* refreshSecurityToken() {
561
572
  const clientCredentials = yield select(selectClientCredentials, 'js');
@@ -571,5 +582,145 @@ function* refreshSecurityToken() {
571
582
  }
572
583
  }
573
584
 
574
- export { LoginHelper as L, findContentTypeMapping as f, getManagementApiClient as g, handleRequiresLoginSaga as h, loginSagas as l, refreshSecurityToken as r };
575
- //# sourceMappingURL=login-4d07c2de.js.map
585
+ const loginUser = (username, password, cookies) => action(LOGIN_USER, {
586
+ username,
587
+ password,
588
+ cookies
589
+ });
590
+ const logoutUser = (redirectPath, cookies) => action(LOGOUT_USER, {
591
+ redirectPath,
592
+ cookies
593
+ });
594
+ const registerUser = (user, mappers) => action(REGISTER_USER, {
595
+ user,
596
+ mappers
597
+ });
598
+ const requestPasswordReset = userEmailObject => action(REQUEST_USER_PASSWORD_RESET, {
599
+ userEmailObject
600
+ });
601
+ const resetPassword = resetPasswordObject => action(RESET_USER_PASSWORD, {
602
+ resetPasswordObject
603
+ });
604
+ const changePassword = (userId, currentPassword, newPassword) => action(CHANGE_USER_PASSWORD, {
605
+ userId,
606
+ currentPassword,
607
+ newPassword
608
+ });
609
+
610
+ var actions = /*#__PURE__*/Object.freeze({
611
+ __proto__: null,
612
+ loginUser: loginUser,
613
+ logoutUser: logoutUser,
614
+ registerUser: registerUser,
615
+ requestPasswordReset: requestPasswordReset,
616
+ resetPassword: resetPassword,
617
+ changePassword: changePassword
618
+ });
619
+
620
+ const useLogin = () => {
621
+ const cookies = new CookieHelper(...useCookies());
622
+ const dispatch = useDispatch();
623
+ const select = useSelector;
624
+ return {
625
+ loginUser: (username, password) => dispatch(loginUser(username, password, cookies)),
626
+ logoutUser: redirectPath => dispatch(logoutUser(redirectPath, cookies)),
627
+ errorMessage: select(selectUserErrorMessage),
628
+ isAuthenticated: select(selectUserIsAuthenticated),
629
+ isAuthenticationError: select(selectUserIsAuthenticationError),
630
+ isError: select(selectUserIsError),
631
+ isLoading: select(selectUserIsLoading),
632
+ user: select(selectUser),
633
+ // DEPRECATED: authenticationError is deprecated use isAuthenticationError instead
634
+ authenticationError: select(selectUserIsAuthenticationError),
635
+ // DEPRECATED: authenticationErrorMessage is deprecated use errorMessage instead
636
+ authenticationErrorMessage: select(selectUserErrorMessage),
637
+ // DEPRECATED: error is deprecated use isError instead
638
+ error: select(selectUserIsError)
639
+ };
640
+ };
641
+
642
+ const LoginContainer = ({
643
+ children,
644
+ ...props
645
+ }) => {
646
+ const userProps = useLogin();
647
+ return children(userProps);
648
+ };
649
+ LoginContainer.propTypes = {};
650
+ var Login_container = toJS(LoginContainer);
651
+
652
+ const useRegistration = () => {
653
+ const dispatch = useDispatch();
654
+ const select = useSelector;
655
+ return {
656
+ registerUser: (user, mappers) => dispatch(registerUser(user, mappers)),
657
+ error: select(selectUserRegistrationError),
658
+ isLoading: select(selectUserRegistrationIsLoading),
659
+ isSuccess: select(selectUserRegistrationIsSuccess),
660
+ user: select(selectUserRegistration)
661
+ };
662
+ };
663
+
664
+ const RegistrationContainer = ({
665
+ children,
666
+ ...props
667
+ }) => {
668
+ const userProps = useRegistration();
669
+ return children(userProps);
670
+ };
671
+ RegistrationContainer.propTypes = {};
672
+ var Registration_container = toJS(RegistrationContainer);
673
+
674
+ const useForgotPassword = () => {
675
+ const dispatch = useDispatch();
676
+ const select = useSelector;
677
+ return {
678
+ isLoading: select(selectPasswordResetRequestSending),
679
+ isSuccess: select(selectPasswordResetRequestSent),
680
+ error: select(selectPasswordResetRequestError),
681
+ requestPasswordReset: userEmailObject => dispatch(requestPasswordReset(userEmailObject)),
682
+ setNewPassword: {
683
+ queryString: select(selectCurrentSearch),
684
+ isLoading: select(selectResetPasswordSending),
685
+ isSuccess: select(selectResetPasswordSent),
686
+ error: select(selectResetPasswordError),
687
+ submit: resetPasswordObject => dispatch(resetPassword(resetPasswordObject))
688
+ }
689
+ };
690
+ };
691
+
692
+ const ForgotPasswordContainer = ({
693
+ children,
694
+ ...props
695
+ }) => {
696
+ const userProps = useForgotPassword();
697
+ return children(userProps);
698
+ };
699
+ ForgotPasswordContainer.propTypes = {};
700
+ var ForgotPassword_container = toJS(ForgotPasswordContainer);
701
+
702
+ const useChangePassword = () => {
703
+ const dispatch = useDispatch();
704
+ const select = useSelector;
705
+ return {
706
+ isLoading: select(selectChangePasswordSending),
707
+ isSuccess: select(selectChangePasswordSent),
708
+ userId: select(selectUserGuid),
709
+ isLoggedIn: select(selectUserIsAuthenticated),
710
+ error: select(selectChangePasswordError),
711
+ changePassword: (userId, currentPassword, newPassword) => dispatch(changePassword(userId, currentPassword, newPassword))
712
+ };
713
+ };
714
+
715
+ const ChangePasswordContainer = ({
716
+ children,
717
+ ...props
718
+ }) => {
719
+ const userProps = useChangePassword();
720
+ return children(userProps);
721
+ };
722
+ ChangePasswordContainer.propTypes = {};
723
+ var ChangePassword_container = toJS(ChangePasswordContainer);
724
+
725
+ export { ChangePassword_container as C, ForgotPassword_container as F, LoginHelper as L, Registration_container as R, loginUser as a, logoutUser as b, actions as c, Login_container as d, useRegistration as e, findContentTypeMapping as f, getManagementApiClient as g, handleRequiresLoginSaga as h, useForgotPassword as i, useChangePassword as j, refreshSecurityToken as k, loginSagas as l, registerUser as r, useLogin as u };
726
+ //# sourceMappingURL=ChangePassword.container-724c8e0a.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangePassword.container-724c8e0a.js","sources":["../src/routing/util/find-contenttype-mapping.ts","../src/user/transformations/mapClientCredentials.js","../src/user/util/ContensisManagementApi.js","../src/user/util/OidcUserManager.ts","../src/user/util/LoginHelper.class.js","../src/user/redux/sagas/login.js","../src/user/redux/actions.js","../src/user/hooks/useLogin.js","../src/user/containers/Login.container.js","../src/user/hooks/useRegistration.js","../src/user/containers/Registration.container.js","../src/user/hooks/useForgotPassword.js","../src/user/containers/ForgotPassword.container.js","../src/user/hooks/useChangePassword.js","../src/user/containers/ChangePassword.container.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\n let { Client } = await import('contensis-management-api');\n\n if (typeof window === 'undefined') {\n const { UniversalClient } = await import('contensis-management-api');\n Client = UniversalClient;\n }\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 { 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 { to } from 'await-to-js';\n\nimport { getManagementApiClient } from './ContensisManagementApi';\n\nimport mapClientCredentials from '../transformations/mapClientCredentials';\nimport { createUserManager, userManagerConfig } from './OidcUserManager';\nimport { LOGIN_COOKIE, REFRESH_TOKEN_COOKIE } from './CookieConstants';\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\n cookies;\n constructor(cookies) {\n this.cookies = cookies;\n }\n\n SetLoginCookies({ contensisClassicToken, refreshToken }) {\n console.info(\n 'SetLoginCookies:',\n LOGIN_COOKIE,\n contensisClassicToken,\n REFRESH_TOKEN_COOKIE,\n refreshToken\n );\n\n if (contensisClassicToken)\n this.cookies.SetCookie(LOGIN_COOKIE, contensisClassicToken);\n\n if (refreshToken)\n this.cookies.SetCookie(REFRESH_TOKEN_COOKIE, refreshToken);\n }\n\n GetCachedCredentials() {\n return {\n bearerToken: null,\n bearerTokenExpiryDate: null,\n refreshToken: this.cookies.GetCookie(REFRESH_TOKEN_COOKIE),\n refreshTokenExpiryDate: null,\n contensisClassicToken: this.cookies.GetCookie(LOGIN_COOKIE),\n };\n }\n\n ClearCachedCredentials() {\n this.cookies.DeleteCookie(LOGIN_COOKIE);\n this.cookies.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 async LoginUser({ 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 this.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 this.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 this.ClearCachedCredentials();\n } else {\n // Ensure we get latest refreshToken and contensisClassicToken from the latest client\n const latestCredentials = mapClientCredentials(client);\n this.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 LogoutUser(redirectPath) {\n this.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 withCookies = cookieHelper => new LoginHelper(cookieHelper);\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 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 (typeof location === 'undefined') return;\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 GetAccessDeniedRoute(originalPath) {\n let url = LoginHelper.ACCESS_DENIED_ROUTE;\n if (originalPath !== url && typeof originalPath === 'string')\n url = `${url}?original_uri=${originalPath}`;\n return url;\n }\n\n static ClientRedirectToAccessDeniedPage(originalPath) {\n if (typeof location !== 'undefined')\n location.href = LoginHelper.GetAccessDeniedRoute(originalPath);\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 console.info(`Security token is invalid - LogonResult: ${LogonResult}`);\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} from '../types';\nimport {\n selectUserIsAuthenticated,\n selectClientCredentials,\n selectUserGroups,\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(LOGOUT_USER, logoutUserSaga),\n takeEvery(VALIDATE_USER, validateUserSaga),\n takeEvery(SET_AUTHENTICATION_STATE, redirectAfterSuccessfulLoginSaga),\n];\n\nexport function* handleRequiresLoginSaga(action) {\n const {\n cookies,\n entry,\n path,\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 console.info(`Route requires login: ${path}`);\n // If routeRequiresLogin do a blocking call that returns userLoggedIn\n userLoggedIn = yield call(validateUserSaga, {\n cookies,\n securityToken,\n });\n console.info(`User logged in: ${userLoggedIn}`);\n }\n // otherwise do a non blocking put to handle validation in the background\n else yield put({ type: VALIDATE_USER, cookies, 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 return userLoggedIn;\n}\n\nfunction* validateUserSaga({ cookies, securityToken }) {\n const login = LoginHelper.withCookies(cookies);\n // Check for refreshToken in cookies\n let clientCredentials = login.GetCachedCredentials();\n\n if (\n securityToken ||\n clientCredentials.securityToken ||\n clientCredentials.refreshToken\n ) {\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 if (\n securityToken ||\n (clientCredentials.securityToken && !clientCredentials.refreshToken)\n ) {\n const [error, refreshToken] =\n yield LoginHelper.GetCredentialsForSecurityToken(\n securityToken || clientCredentials.securityToken\n );\n if (refreshToken) {\n // Set cookies and reload values\n login.SetLoginCookies({\n contensisClassicToken: securityToken,\n refreshToken,\n });\n clientCredentials = login.GetCachedCredentials();\n }\n if (error) {\n login.ClearCachedCredentials();\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\n // Log the user in if a refreshToken is found\n if (clientCredentials.refreshToken) {\n console.info(\n `Login user with refreshToken ${clientCredentials.refreshToken}`\n );\n yield call(loginUserSaga, {\n clientCredentials,\n cookies: login.cookies,\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, cookies } = action;\n const login = LoginHelper.withCookies(cookies);\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 login.LoginUser({\n username,\n password,\n clientCredentials,\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, cookies }) {\n yield put({\n type: SET_AUTHENTICATION_STATE,\n user: null,\n });\n yield LoginHelper.withCookies(cookies).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","import { action } from '~/redux/util';\nimport {\n CHANGE_USER_PASSWORD,\n LOGIN_USER,\n LOGOUT_USER,\n REGISTER_USER,\n REQUEST_USER_PASSWORD_RESET,\n RESET_USER_PASSWORD,\n} from './types';\n\nexport const loginUser = (username, password, cookies) =>\n action(LOGIN_USER, { username, password, cookies });\n\nexport const logoutUser = (redirectPath, cookies) =>\n action(LOGOUT_USER, { redirectPath, cookies });\n\nexport const registerUser = (user, mappers) =>\n action(REGISTER_USER, {\n user,\n mappers,\n });\n\nexport const requestPasswordReset = userEmailObject =>\n action(REQUEST_USER_PASSWORD_RESET, { userEmailObject });\n\nexport const resetPassword = resetPasswordObject =>\n action(RESET_USER_PASSWORD, { resetPasswordObject });\n\nexport const changePassword = (userId, currentPassword, newPassword) =>\n action(CHANGE_USER_PASSWORD, { userId, currentPassword, newPassword });\n","import { useCookies } from 'react-cookie';\nimport { useDispatch, useSelector } from 'react-redux';\nimport { loginUser, logoutUser } from '../redux/actions';\nimport {\n selectUser,\n selectUserIsAuthenticationError,\n selectUserIsError,\n selectUserErrorMessage,\n selectUserIsAuthenticated,\n selectUserIsLoading,\n} from '../redux/selectors';\nimport { CookieHelper } from '../util/CookieHelper.class';\n\nconst useLogin = () => {\n const cookies = new CookieHelper(...useCookies());\n\n const dispatch = useDispatch();\n const select = useSelector;\n\n return {\n loginUser: (username, password) =>\n dispatch(loginUser(username, password, cookies)),\n logoutUser: redirectPath => dispatch(logoutUser(redirectPath, cookies)),\n errorMessage: select(selectUserErrorMessage),\n isAuthenticated: select(selectUserIsAuthenticated),\n isAuthenticationError: select(selectUserIsAuthenticationError),\n isError: select(selectUserIsError),\n isLoading: select(selectUserIsLoading),\n user: select(selectUser),\n // DEPRECATED: authenticationError is deprecated use isAuthenticationError instead\n authenticationError: select(selectUserIsAuthenticationError),\n // DEPRECATED: authenticationErrorMessage is deprecated use errorMessage instead\n authenticationErrorMessage: select(selectUserErrorMessage),\n // DEPRECATED: error is deprecated use isError instead\n error: select(selectUserIsError),\n };\n};\n\nexport default useLogin;\n","import useLogin from '../hooks/useLogin';\nimport { toJS } from '~/util/ToJs';\n\nconst LoginContainer = ({ children, ...props }) => {\n const userProps = useLogin(props);\n return children(userProps);\n};\n\nLoginContainer.propTypes = {};\n\nexport default toJS(LoginContainer);\n","import { useDispatch, useSelector } from 'react-redux';\nimport { registerUser } from '../redux/actions';\nimport {\n selectUserRegistration,\n selectUserRegistrationError,\n selectUserRegistrationIsLoading,\n selectUserRegistrationIsSuccess,\n} from '../redux/selectors';\n\nconst useRegistration = () => {\n const dispatch = useDispatch();\n const select = useSelector;\n\n return {\n registerUser: (user, mappers) => dispatch(registerUser(user, mappers)),\n error: select(selectUserRegistrationError),\n isLoading: select(selectUserRegistrationIsLoading),\n isSuccess: select(selectUserRegistrationIsSuccess),\n user: select(selectUserRegistration),\n };\n};\n\nexport default useRegistration;\n","import useRegistration from '../hooks/useRegistration';\nimport { toJS } from '~/util/ToJs';\n\nconst RegistrationContainer = ({ children, ...props }) => {\n const userProps = useRegistration(props);\n return children(userProps);\n};\n\nRegistrationContainer.propTypes = {};\n\nexport default toJS(RegistrationContainer);\n","import { useDispatch, useSelector } from 'react-redux';\nimport { requestPasswordReset, resetPassword } from '../redux/actions';\nimport {\n selectPasswordResetRequestError,\n selectPasswordResetRequestSending,\n selectPasswordResetRequestSent,\n selectResetPasswordSending,\n selectResetPasswordSent,\n selectResetPasswordError,\n} from '../redux/selectors';\nimport { selectCurrentSearch } from '~/routing/redux/selectors';\n\nconst useForgotPassword = () => {\n const dispatch = useDispatch();\n const select = useSelector;\n\n return {\n isLoading: select(selectPasswordResetRequestSending),\n isSuccess: select(selectPasswordResetRequestSent),\n error: select(selectPasswordResetRequestError),\n requestPasswordReset: userEmailObject =>\n dispatch(requestPasswordReset(userEmailObject)),\n\n setNewPassword: {\n queryString: select(selectCurrentSearch),\n isLoading: select(selectResetPasswordSending),\n isSuccess: select(selectResetPasswordSent),\n error: select(selectResetPasswordError),\n submit: resetPasswordObject =>\n dispatch(resetPassword(resetPasswordObject)),\n },\n };\n};\n\nexport default useForgotPassword;\n","import useForgotPassword from '../hooks/useForgotPassword';\nimport { toJS } from '~/util/ToJs';\n\nconst ForgotPasswordContainer = ({ children, ...props }) => {\n const userProps = useForgotPassword(props);\n return children(userProps);\n};\n\nForgotPasswordContainer.propTypes = {};\n\nexport default toJS(ForgotPasswordContainer);\n","import { useDispatch, useSelector } from 'react-redux';\nimport { changePassword } from '../redux/actions';\nimport {\n selectChangePasswordSending,\n selectChangePasswordSent,\n selectChangePasswordError,\n selectUserIsAuthenticated,\n selectUserGuid,\n} from '../redux/selectors';\n\nconst useChangePassword = () => {\n const dispatch = useDispatch();\n const select = useSelector;\n\n return {\n isLoading: select(selectChangePasswordSending),\n isSuccess: select(selectChangePasswordSent),\n userId: select(selectUserGuid),\n isLoggedIn: select(selectUserIsAuthenticated),\n error: select(selectChangePasswordError),\n changePassword: (userId, currentPassword, newPassword) =>\n dispatch(changePassword(userId, currentPassword, newPassword)),\n };\n};\n\nexport default useChangePassword;\n","import useChangePassword from '../hooks/useChangePassword';\nimport { toJS } from '~/util/ToJs';\n\nconst ChangePasswordContainer = ({ children, ...props }) => {\n const userProps = useChangePassword(props);\n return children(userProps);\n};\n\nChangePasswordContainer.propTypes = {};\n\nexport default toJS(ChangePasswordContainer);\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","window","UniversalClient","client","create","context","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","LoginHelper","constructor","cookies","SetLoginCookies","info","LOGIN_COOKIE","REFRESH_TOKEN_COOKIE","SetCookie","GetCachedCredentials","GetCookie","ClearCachedCredentials","DeleteCookie","localStorage","keys","i","length","key","startsWith","push","forEach","removeItem","LoginUser","credentials","authenticationState","isAuthenticated","isAuthenticationError","isError","transientClient","user","loginError","clientBearerToken","to","ensureBearerToken","errorMessage","message","name","includes","mapClientCredentials","userDetails","GetUserDetails","latestCredentials","LogoutUser","redirectPath","WsFedLogout","ClientRedirectToPath","ClientRedirectToSignInPage","ClientRedirectToHome","url","search","hash","href","WsFedLogin","LOGIN_ROUTE","replace","GetAccessDeniedRoute","originalPath","ACCESS_DENIED_ROUTE","ClientRedirectToAccessDeniedPage","redirectUri","userManager","signinRedirect","RemoveSecurityTokenQuery","params","URLSearchParams","has","delete","pathname","fetch","CMS_URL","GetCredentialsForSecurityToken","securityToken","response","method","headers","Accept","body","JSON","stringify","encodeURIComponent","ok","parseError","json","LogonResult","ApplicationData","data","item","Key","Value","undefined","status","statusText","withCookies","cookieHelper","userError","groupsError","groupsResult","security","users","getCurrent","getUserGroups","userId","includeInherited","pageOptions","pageSize","items","groups","log","loginSagas","takeEvery","LOGIN_USER","loginUserSaga","LOGOUT_USER","logoutUserSaga","VALIDATE_USER","validateUserSaga","SET_AUTHENTICATION_STATE","redirectAfterSuccessfulLoginSaga","handleRequiresLoginSaga","action","_entry$sys","entry","path","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","login","isLoading","removeHostnamePart","relativePath","split","splice","join","isLoggedIn","ReturnURL","assetRedirectPath","setRoute","refreshSecurityToken","selectClientCredentials","Object","authenticate","loginUser","logoutUser","registerUser","mappers","REGISTER_USER","requestPasswordReset","userEmailObject","REQUEST_USER_PASSWORD_RESET","resetPassword","resetPasswordObject","RESET_USER_PASSWORD","changePassword","currentPassword","newPassword","CHANGE_USER_PASSWORD","useLogin","CookieHelper","useCookies","dispatch","useDispatch","useSelector","selectUserErrorMessage","selectUserIsAuthenticationError","selectUserIsError","selectUserIsLoading","selectUser","authenticationError","authenticationErrorMessage","LoginContainer","children","props","userProps","propTypes","toJS","useRegistration","selectUserRegistrationError","selectUserRegistrationIsLoading","isSuccess","selectUserRegistrationIsSuccess","selectUserRegistration","RegistrationContainer","useForgotPassword","selectPasswordResetRequestSending","selectPasswordResetRequestSent","selectPasswordResetRequestError","setNewPassword","queryString","selectResetPasswordSending","selectResetPasswordSent","selectResetPasswordError","submit","ForgotPasswordContainer","useChangePassword","selectChangePasswordSending","selectChangePasswordSent","selectUserGuid","selectChangePasswordError","ChangePasswordContainer"],"mappings":";;;;;;;;;;MAEaA,sBAAsB,GAAGA,CACpCC,mBAAyC,EACzCC,aAAqB,KAClBD,mBAAmB,CAACE,IAAI,CAACC,EAAE,IAAIA,EAAE,CAACC,aAAa,KAAKH,aAAa;;ACHtE,MAAMI,iBAAiB,GAAG;AACxBC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,qBAAqB,EAAEA,CAAC;AAAEA,IAAAA,qBAAAA;AAAsB,GAAC,KAC/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