@zengenti/contensis-react-base 4.0.0-beta.2 → 4.0.0-beta.3

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 (209) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +18 -478
  3. package/cjs/{App-b56aca04.js → App-BNcmM8rN.js} +215 -234
  4. package/cjs/App-BNcmM8rN.js.map +1 -0
  5. package/cjs/{ChangePassword.container-ae35785e.js → ChangePassword.container-642SYfpS.js} +209 -286
  6. package/cjs/ChangePassword.container-642SYfpS.js.map +1 -0
  7. package/cjs/CookieHelper.class-BoY5TrIi.js +562 -0
  8. package/cjs/CookieHelper.class-BoY5TrIi.js.map +1 -0
  9. package/cjs/{RouteLoader-c06dccd5.js → RouteLoader-DvyYYyIE.js} +55 -68
  10. package/cjs/RouteLoader-DvyYYyIE.js.map +1 -0
  11. package/cjs/{ContensisDeliveryApi-4fcf049d.js → SSRContext-D66GKlH7.js} +165 -119
  12. package/cjs/SSRContext-D66GKlH7.js.map +1 -0
  13. package/cjs/{ToJs-a8d8f3f0.js → ToJs-C9jwV7YB.js} +26 -80
  14. package/cjs/ToJs-C9jwV7YB.js.map +1 -0
  15. package/cjs/{_commonjsHelpers-b3309d7b.js → _commonjsHelpers-BJu3ubxk.js} +1 -1
  16. package/cjs/_commonjsHelpers-BJu3ubxk.js.map +1 -0
  17. package/cjs/client.js +67 -65
  18. package/cjs/client.js.map +1 -1
  19. package/cjs/contensis-react-base.js +386 -3293
  20. package/cjs/contensis-react-base.js.map +1 -1
  21. package/cjs/{fromJSLeaveImmer-e74c673c.js → fromJSLeaveImmer-Blvlk4t2.js} +3 -7
  22. package/{esm/fromJSLeaveImmer-0114ffcf.js.map → cjs/fromJSLeaveImmer-Blvlk4t2.js.map} +1 -1
  23. package/cjs/redux.js +18 -19
  24. package/cjs/redux.js.map +1 -1
  25. package/cjs/routing.js +13 -6
  26. package/cjs/routing.js.map +1 -1
  27. package/cjs/sagas-CbZhaRNd.js +6010 -0
  28. package/cjs/sagas-CbZhaRNd.js.map +1 -0
  29. package/cjs/search.js +105 -305
  30. package/cjs/search.js.map +1 -1
  31. package/cjs/selectors-wCs5fHD4.js +460 -0
  32. package/cjs/selectors-wCs5fHD4.js.map +1 -0
  33. package/cjs/{version-34d91f68.js → store-CADDS7cV.js} +44 -111
  34. package/cjs/store-CADDS7cV.js.map +1 -0
  35. package/cjs/{urls-6fcaf4c6.js → urls-DVIwGZmd.js} +1 -1
  36. package/{esm/urls-eac9a747.js.map → cjs/urls-DVIwGZmd.js.map} +1 -1
  37. package/cjs/user.js +12 -20
  38. package/cjs/user.js.map +1 -1
  39. package/cjs/util.js +108 -115
  40. package/cjs/util.js.map +1 -1
  41. package/cjs/{version-a410c88e.js → version-ASZx0NDG.js} +19 -22
  42. package/{esm/version-9f29becb.js.map → cjs/version-ASZx0NDG.js.map} +1 -1
  43. package/cjs/version-CM-bJ62L.js +20 -0
  44. package/cjs/version-CM-bJ62L.js.map +1 -0
  45. package/esm/{App-83107d7e.js → App-CfIZbvU9.js} +176 -195
  46. package/esm/App-CfIZbvU9.js.map +1 -0
  47. package/esm/{ChangePassword.container-76fd5e9b.js → ChangePassword.container-Q7bElOVz.js} +191 -250
  48. package/esm/ChangePassword.container-Q7bElOVz.js.map +1 -0
  49. package/esm/CookieHelper.class-DzleKOOc.js +555 -0
  50. package/esm/CookieHelper.class-DzleKOOc.js.map +1 -0
  51. package/esm/{RouteLoader-29fd689a.js → RouteLoader-qJA3UqTM.js} +40 -53
  52. package/esm/RouteLoader-qJA3UqTM.js.map +1 -0
  53. package/esm/{ContensisDeliveryApi-fe57a037.js → SSRContext-C743Oeli.js} +159 -120
  54. package/esm/SSRContext-C743Oeli.js.map +1 -0
  55. package/esm/{ToJs-df57f31d.js → ToJs-CpPNdcXS.js} +24 -77
  56. package/esm/ToJs-CpPNdcXS.js.map +1 -0
  57. package/esm/{_commonjsHelpers-1789f0cf.js → _commonjsHelpers-BFTU3MAI.js} +1 -1
  58. package/esm/_commonjsHelpers-BFTU3MAI.js.map +1 -0
  59. package/esm/client.js +55 -53
  60. package/esm/client.js.map +1 -1
  61. package/esm/contensis-react-base.js +317 -3222
  62. package/esm/contensis-react-base.js.map +1 -1
  63. package/esm/{fromJSLeaveImmer-0114ffcf.js → fromJSLeaveImmer-C_YACmOf.js} +2 -6
  64. package/{cjs/fromJSLeaveImmer-e74c673c.js.map → esm/fromJSLeaveImmer-C_YACmOf.js.map} +1 -1
  65. package/esm/redux.js +9 -8
  66. package/esm/redux.js.map +1 -1
  67. package/esm/routing.js +13 -4
  68. package/esm/routing.js.map +1 -1
  69. package/esm/sagas-xJU-zOpn.js +5916 -0
  70. package/esm/sagas-xJU-zOpn.js.map +1 -0
  71. package/esm/search.js +113 -311
  72. package/esm/search.js.map +1 -1
  73. package/esm/selectors-CBdCY0u3.js +396 -0
  74. package/esm/selectors-CBdCY0u3.js.map +1 -0
  75. package/esm/{version-3d9911e2.js → store-uQZKjfA8.js} +36 -81
  76. package/esm/store-uQZKjfA8.js.map +1 -0
  77. package/esm/{urls-eac9a747.js → urls-DfCisos-.js} +1 -1
  78. package/{cjs/urls-6fcaf4c6.js.map → esm/urls-DfCisos-.js.map} +1 -1
  79. package/esm/user.js +7 -13
  80. package/esm/user.js.map +1 -1
  81. package/esm/util.js +66 -74
  82. package/esm/util.js.map +1 -1
  83. package/esm/{version-9f29becb.js → version-B9nPx4IF.js} +6 -9
  84. package/{cjs/version-a410c88e.js.map → esm/version-B9nPx4IF.js.map} +1 -1
  85. package/esm/version-D773TD9j.js +15 -0
  86. package/esm/version-D773TD9j.js.map +1 -0
  87. package/models/app/App.d.ts +1 -1
  88. package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +1 -1
  89. package/models/app/pages/VersionInfo/components/VersionInfo.styled.d.ts +2 -1
  90. package/models/client/client.d.ts +1 -1
  91. package/models/index.d.ts +1 -2
  92. package/models/models/AppRouteProps.d.ts +11 -0
  93. package/models/models/ContentTypeMapping.d.ts +89 -0
  94. package/models/models/EntryMapper.d.ts +3 -0
  95. package/models/models/GetRouteActionArgs.d.ts +15 -0
  96. package/models/models/MatchedRoute.d.ts +4 -0
  97. package/models/models/ReduxInjector.d.ts +5 -0
  98. package/models/models/RequireLogin.d.ts +6 -0
  99. package/models/models/RouteComponent.d.ts +4 -0
  100. package/models/models/RouteComponentProps.d.ts +9 -0
  101. package/models/models/RouteLoaderProps.d.ts +9 -0
  102. package/models/models/RouteNode.d.ts +5 -0
  103. package/models/models/SSRContext.d.ts +11 -0
  104. package/models/models/StaticRoute.d.ts +60 -0
  105. package/models/models/WithEvents.d.ts +58 -0
  106. package/models/models/config/AppConfig.d.ts +12 -0
  107. package/models/{config.d.ts → models/config/ServerConfig.d.ts} +3 -12
  108. package/models/models/config/StateType.d.ts +1 -0
  109. package/models/models/config/index.d.ts +3 -0
  110. package/models/models/index.d.ts +16 -0
  111. package/models/redux/actions/index.d.ts +2 -2
  112. package/models/redux/sagas/navigation.d.ts +1 -3
  113. package/models/redux/selectors/index.d.ts +2 -2
  114. package/models/redux/store/injectors.d.ts +16 -4
  115. package/models/redux/store/store.d.ts +10 -4
  116. package/models/redux/types/index.d.ts +2 -2
  117. package/models/redux/types/navigation.d.ts +3 -3
  118. package/models/redux/types/version.d.ts +2 -2
  119. package/models/routing/components/Redirect.d.ts +1 -1
  120. package/models/routing/components/RouteLoader.d.ts +1 -1
  121. package/models/routing/components/StaticRouteLoader.d.ts +1 -1
  122. package/models/routing/components/Status.d.ts +1 -1
  123. package/models/routing/redux/actions.d.ts +3 -4
  124. package/models/routing/redux/selectors.d.ts +2 -2
  125. package/models/routing/redux/types.d.ts +11 -11
  126. package/models/routing/routes.d.ts +1 -1
  127. package/models/routing/util/find-contenttype-mapping.d.ts +1 -1
  128. package/models/routing/util/queries.d.ts +2 -2
  129. package/models/search/models/Queries.d.ts +4 -2
  130. package/models/search/models/Search.d.ts +8 -1
  131. package/models/search/models/SearchActions.d.ts +3 -2
  132. package/models/search/models/SearchState.d.ts +5 -1
  133. package/models/search/redux/reducers.d.ts +2 -257
  134. package/models/search/redux/schema.d.ts +1 -1
  135. package/models/search/redux/selectors.d.ts +5 -5
  136. package/models/search/search/ContensisDeliveryApi.d.ts +2 -2
  137. package/models/search/search/ToJs.d.ts +1 -1
  138. package/models/search/search/expressions.d.ts +3 -3
  139. package/models/search/search/util.d.ts +17 -2
  140. package/models/search/transformations/searchresult-to-state.mapper.d.ts +1 -2
  141. package/models/server/features/caching/cacheDuration.schema.d.ts +1 -0
  142. package/models/server/features/linkdepth-api/search.d.ts +1 -1
  143. package/models/server/features/static-assets/index.d.ts +1 -1
  144. package/models/server/internalServer.d.ts +1 -1
  145. package/models/server/util/bundles.d.ts +1 -1
  146. package/models/server/util/headers.d.ts +1 -1
  147. package/models/server/webApp.d.ts +1 -1
  148. package/models/user/components/Login.d.ts +1 -1
  149. package/models/user/components/LoginForm.d.ts +6 -6
  150. package/models/user/components/LogoutForm.d.ts +4 -4
  151. package/models/user/components.styled/Login.styled.d.ts +1 -1
  152. package/models/user/components.styled/LoginForm.styled.d.ts +1 -1
  153. package/models/user/hocs/withLogin.d.ts +4 -4
  154. package/models/user/hooks/useLogin.d.ts +4 -4
  155. package/models/user/redux/actions.d.ts +7 -6
  156. package/models/user/redux/sagas/index.d.ts +1 -1
  157. package/models/user/redux/sagas/login.d.ts +5 -17
  158. package/models/user/redux/selectors.d.ts +1 -2
  159. package/models/user/redux/types.d.ts +21 -21
  160. package/models/user/state.d.ts +12 -0
  161. package/models/user/transformations/mapClientCredentials.d.ts +3 -1
  162. package/models/user/util/ContensisManagementApi.d.ts +10 -9
  163. package/models/user/util/CookieConstants.d.ts +1 -0
  164. package/models/user/util/CookieHelper.class.d.ts +8 -4
  165. package/models/user/util/LoginHelper.class.d.ts +25 -37
  166. package/models/user/util/OidcUserManager.d.ts +1 -1
  167. package/models/user/util/matchGroups.d.ts +1 -1
  168. package/models/util/CachedDeliveryApi.d.ts +11 -10
  169. package/models/util/ContensisDeliveryApi.d.ts +11 -7
  170. package/models/util/SSRContext.d.ts +29 -0
  171. package/models/util/index.d.ts +1 -0
  172. package/models/util/json-mapper.d.ts +4 -5
  173. package/package.json +71 -92
  174. package/cjs/App-b56aca04.js.map +0 -1
  175. package/cjs/ChangePassword.container-ae35785e.js.map +0 -1
  176. package/cjs/ContensisDeliveryApi-4fcf049d.js.map +0 -1
  177. package/cjs/CookieConstants-000427db.js +0 -10
  178. package/cjs/CookieConstants-000427db.js.map +0 -1
  179. package/cjs/RouteLoader-c06dccd5.js.map +0 -1
  180. package/cjs/ToJs-a8d8f3f0.js.map +0 -1
  181. package/cjs/_commonjsHelpers-b3309d7b.js.map +0 -1
  182. package/cjs/forms.js +0 -5998
  183. package/cjs/forms.js.map +0 -1
  184. package/cjs/reducers-73a03ef4.js +0 -257
  185. package/cjs/reducers-73a03ef4.js.map +0 -1
  186. package/cjs/sagas-570f23ba.js +0 -2175
  187. package/cjs/sagas-570f23ba.js.map +0 -1
  188. package/cjs/selectors-14caa813.js +0 -228
  189. package/cjs/selectors-14caa813.js.map +0 -1
  190. package/cjs/version-34d91f68.js.map +0 -1
  191. package/esm/App-83107d7e.js.map +0 -1
  192. package/esm/ChangePassword.container-76fd5e9b.js.map +0 -1
  193. package/esm/ContensisDeliveryApi-fe57a037.js.map +0 -1
  194. package/esm/CookieConstants-3d3b6531.js +0 -6
  195. package/esm/CookieConstants-3d3b6531.js.map +0 -1
  196. package/esm/RouteLoader-29fd689a.js.map +0 -1
  197. package/esm/ToJs-df57f31d.js.map +0 -1
  198. package/esm/_commonjsHelpers-1789f0cf.js.map +0 -1
  199. package/esm/forms.js +0 -5984
  200. package/esm/forms.js.map +0 -1
  201. package/esm/reducers-aa8cef1e.js +0 -234
  202. package/esm/reducers-aa8cef1e.js.map +0 -1
  203. package/esm/sagas-07e82e18.js +0 -2083
  204. package/esm/sagas-07e82e18.js.map +0 -1
  205. package/esm/selectors-691caf02.js +0 -186
  206. package/esm/selectors-691caf02.js.map +0 -1
  207. package/esm/version-3d9911e2.js.map +0 -1
  208. package/models/forms/index.d.ts +0 -1
  209. /package/models/{redux/appstate.d.ts → models/AppState.d.ts} +0 -0
@@ -1,36 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  var effects = require('@redux-saga/core/effects');
4
- var reducers = require('./reducers-73a03ef4.js');
5
- var ToJs = require('./ToJs-a8d8f3f0.js');
6
- var selectors = require('./selectors-14caa813.js');
4
+ var selectors = require('./selectors-wCs5fHD4.js');
5
+ var ToJs = require('./ToJs-C9jwV7YB.js');
7
6
  var mapJson = require('jsonpath-mapper');
8
7
  var to = require('await-to-js');
9
- var CookieConstants = require('./CookieConstants-000427db.js');
8
+ var CookieHelper_class = require('./CookieHelper.class-BoY5TrIi.js');
10
9
  var reactCookie = require('react-cookie');
11
10
  var reactRedux = require('react-redux');
12
11
 
13
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
-
15
- function _interopNamespace(e) {
16
- if (e && e.__esModule) return e;
17
- var n = Object.create(null);
18
- if (e) {
19
- Object.keys(e).forEach(function (k) {
20
- if (k !== 'default') {
21
- var d = Object.getOwnPropertyDescriptor(e, k);
22
- Object.defineProperty(n, k, d.get ? d : {
23
- enumerable: true,
24
- get: function () { return e[k]; }
25
- });
26
- }
27
- });
28
- }
29
- n["default"] = e;
30
- return Object.freeze(n);
31
- }
12
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
32
13
 
33
- var mapJson__default = /*#__PURE__*/_interopDefaultLegacy(mapJson);
14
+ var mapJson__default = /*#__PURE__*/_interopDefault(mapJson);
34
15
 
35
16
  const findContentTypeMapping = (ContentTypeMappings, contentTypeId) => ContentTypeMappings.find(ct => ct.contentTypeID === contentTypeId);
36
17
 
@@ -45,9 +26,8 @@ const clientCredentials = {
45
26
  }) => refreshTokenExpiryDate.toISOString(),
46
27
  contensisClassicToken: 'contensisClassicToken'
47
28
  };
48
- var mapClientCredentials = (obj => mapJson__default["default"](obj, clientCredentials));
29
+ var mapClientCredentials = obj => mapJson__default.default(obj, clientCredentials);
49
30
 
50
- // import { Client } from 'contensis-management-api';
51
31
  const getManagementApiClient = async ({
52
32
  bearerToken,
53
33
  bearerTokenExpiryDate,
@@ -57,14 +37,10 @@ const getManagementApiClient = async ({
57
37
  username,
58
38
  password
59
39
  }) => {
60
- const rootUrl = SERVERS.api || SERVERS.cms;
61
- /* global SERVERS */
62
-
63
- const projectId = PROJECTS[0].id;
64
- /* global PROJECTS */
40
+ const rootUrl = SERVERS.cms || SERVERS.api; /* global SERVERS */
41
+ const projectId = PROJECTS[0].id; /* global PROJECTS */
65
42
 
66
43
  let config = {};
67
-
68
44
  if (refreshToken) {
69
45
  config = {
70
46
  clientType: 'contensis_classic_refresh_token',
@@ -81,19 +57,17 @@ const getManagementApiClient = async ({
81
57
  }
82
58
  };
83
59
  }
84
-
85
60
  let {
86
61
  Client
87
- } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('contensis-management-api')); });
88
-
62
+ } = await import('contensis-management-api');
89
63
  if (typeof window === 'undefined') {
90
64
  const {
91
65
  UniversalClient
92
- } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('contensis-management-api')); });
66
+ } = await import('contensis-management-api');
93
67
  Client = UniversalClient;
94
68
  }
95
-
96
- const client = Client.create({ ...config,
69
+ const client = Client.create({
70
+ ...config,
97
71
  projectId,
98
72
  rootUrl
99
73
  });
@@ -106,11 +80,8 @@ const getManagementApiClient = async ({
106
80
  };
107
81
 
108
82
  const context$1 = typeof window != 'undefined' ? window : global;
109
- const requireOidc = process.env.NODE_ENV === 'development' ? WSFED_LOGIN === 'true'
110
- /* global WSFED_LOGIN */
111
- : context$1.WSFED_LOGIN === 'true';
112
- const servers = SERVERS;
113
- /* global SERVERS */
83
+ const requireOidc = process.env.NODE_ENV === 'development' ? WSFED_LOGIN === 'true' /* global WSFED_LOGIN */ : context$1.WSFED_LOGIN === 'true';
84
+ const servers = SERVERS; /* global SERVERS */
114
85
 
115
86
  const userManagerConfig = typeof window !== 'undefined' ? {
116
87
  authority: `${servers.cms}/authenticate/`,
@@ -126,162 +97,23 @@ const createUserManager = async config => {
126
97
  try {
127
98
  const {
128
99
  UserManager
129
- } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
130
- /* webpackChunkName: "oidcclient" */
131
- 'oidc-client')); });
100
+ } = await import(/* webpackChunkName: "oidcclient" */'oidc-client');
132
101
  return new UserManager(config);
133
102
  } catch (e) {
134
103
  console.error('Exception in createUserManager: ', e);
135
104
  }
136
- } else return {};
105
+ } else return;
137
106
  };
138
107
 
139
- /* eslint-disable require-atomic-updates */
108
+ var _LoginHelper;
140
109
  const context = typeof window != 'undefined' ? window : global;
141
110
  class LoginHelper {
142
111
  constructor(cookies) {
143
- this.cookies = void 0;
144
- this.cookies = cookies;
145
- }
146
-
147
- SetLoginCookies({
148
- contensisClassicToken,
149
- refreshToken
150
- }) {
151
- console.info('SetLoginCookies:', CookieConstants.LOGIN_COOKIE, contensisClassicToken, CookieConstants.REFRESH_TOKEN_COOKIE, refreshToken);
152
- if (contensisClassicToken) this.cookies.SetCookie(CookieConstants.LOGIN_COOKIE, contensisClassicToken);
153
- if (refreshToken) this.cookies.SetCookie(CookieConstants.REFRESH_TOKEN_COOKIE, refreshToken);
154
- }
155
-
156
- GetCachedCredentials() {
157
- return {
158
- bearerToken: null,
159
- bearerTokenExpiryDate: null,
160
- refreshToken: this.cookies.GetCookie(CookieConstants.REFRESH_TOKEN_COOKIE),
161
- refreshTokenExpiryDate: null,
162
- contensisClassicToken: this.cookies.GetCookie(CookieConstants.LOGIN_COOKIE)
163
- };
112
+ this.cookies = cookies || new CookieHelper_class.CookieHelper();
164
113
  }
165
-
166
- ClearCachedCredentials() {
167
- this.cookies.DeleteCookie(CookieConstants.LOGIN_COOKIE);
168
- this.cookies.DeleteCookie(CookieConstants.REFRESH_TOKEN_COOKIE);
169
-
170
- if (LoginHelper.WSFED_LOGIN && typeof window !== 'undefined') {
171
- // remove any oidc keys left over in localStorage
172
- const {
173
- localStorage
174
- } = window;
175
- const keys = [];
176
-
177
- for (let i = 0; i < localStorage.length; i++) {
178
- const key = localStorage.key(i);
179
- if (typeof key === 'string' && key.startsWith('oidc.')) keys.push(localStorage.key(i));
180
- }
181
-
182
- keys.forEach(key => localStorage.removeItem(key));
183
- }
184
- }
185
-
186
- async LoginUser({
187
- username,
188
- password,
189
- clientCredentials
190
- }) {
191
- let credentials = clientCredentials;
192
- let authenticationState = {
193
- clientCredentials: null,
194
- isAuthenticated: false,
195
- isAuthenticationError: false,
196
- isError: false
197
- };
198
- let transientClient;
199
- let user;
200
-
201
- if (username && password) {
202
- // Get a management client with username and password
203
- transientClient = await getManagementApiClient({
204
- username,
205
- password
206
- }); // Ensure the client has requested a bearer token
207
-
208
- const [loginError, clientBearerToken] = await to.to(transientClient.ensureBearerToken()); // Problem getting token with username and password
209
-
210
- if (loginError) {
211
- authenticationState = {
212
- clientCredentials: null,
213
- errorMessage: loginError.message || null,
214
- isAuthenticated: false,
215
- isAuthenticationError: loginError.name.includes('ContensisAuthenticationError'),
216
- isError: true
217
- };
218
- this.ClearCachedCredentials();
219
- } // Got a token using username and password
220
-
221
-
222
- if (clientBearerToken) {
223
- // Set credentials so we can continue to GetUserDetails
224
- credentials = mapClientCredentials(transientClient);
225
- this.SetLoginCookies(credentials);
226
- authenticationState = {
227
- clientCredentials: credentials,
228
- isAuthenticated: true,
229
- isAuthenticationError: false,
230
- isError: false
231
- };
232
- }
233
- } // If we have credentials supplied by a successful username and password login
234
- // or clientCredentials supplied in the options argument we can continue to
235
- // fetch the user's details
236
-
237
-
238
- if (credentials) {
239
- const client = transientClient || (await getManagementApiClient(credentials));
240
- const [error, userDetails] = await LoginHelper.GetUserDetails(client);
241
-
242
- if (error) {
243
- authenticationState = {
244
- clientCredentials: null,
245
- errorMessage: error.message,
246
- isAuthenticated: false,
247
- isAuthenticationError: false,
248
- isError: true
249
- };
250
- this.ClearCachedCredentials();
251
- } else {
252
- // Ensure we get latest refreshToken and contensisClassicToken from the latest client
253
- const latestCredentials = mapClientCredentials(client);
254
- this.SetLoginCookies(latestCredentials);
255
- user = userDetails;
256
- authenticationState = {
257
- clientCredentials: latestCredentials,
258
- isAuthenticated: true,
259
- isAuthenticationError: false,
260
- isError: false
261
- };
262
- }
263
- }
264
-
265
- return {
266
- authenticationState,
267
- user
268
- };
269
- }
270
-
271
- LogoutUser(redirectPath) {
272
- this.ClearCachedCredentials();
273
-
274
- if (LoginHelper.WSFED_LOGIN) {
275
- LoginHelper.WsFedLogout(redirectPath);
276
- } else {
277
- if (redirectPath) LoginHelper.ClientRedirectToPath(redirectPath);else LoginHelper.ClientRedirectToSignInPage();
278
- }
279
- }
280
-
281
114
  static ClientRedirectToHome(location) {
282
115
  if (typeof window != 'undefined') {
283
116
  let url = '/';
284
-
285
117
  if (location) {
286
118
  const {
287
119
  search,
@@ -290,14 +122,11 @@ class LoginHelper {
290
122
  url = search ? `${url}${search}` : url;
291
123
  url = hash ? `${url}${hash}` : url;
292
124
  }
293
-
294
125
  window.location.href = url;
295
126
  }
296
127
  }
297
-
298
128
  static async ClientRedirectToSignInPage(redirectPath) {
299
129
  if (typeof location === 'undefined') return;
300
-
301
130
  if (LoginHelper.WSFED_LOGIN) {
302
131
  await LoginHelper.WsFedLogout();
303
132
  await LoginHelper.WsFedLogin();
@@ -308,56 +137,47 @@ class LoginHelper {
308
137
  if (typeof location !== 'undefined' && redirectPath !== LoginHelper.LOGIN_ROUTE) location.replace(url);
309
138
  }
310
139
  }
311
-
312
140
  static GetAccessDeniedRoute(originalPath) {
313
141
  let url = LoginHelper.ACCESS_DENIED_ROUTE;
314
142
  if (originalPath !== url && typeof originalPath === 'string') url = `${url}?original_uri=${originalPath}`;
315
143
  return url;
316
144
  }
317
-
318
145
  static ClientRedirectToAccessDeniedPage(originalPath) {
319
146
  if (typeof location !== 'undefined') location.href = LoginHelper.GetAccessDeniedRoute(originalPath);
320
147
  }
321
-
322
148
  static ClientRedirectToPath(redirectPath) {
323
149
  if (typeof redirectPath === 'string') {
324
150
  if (typeof location !== 'undefined') window.location.href = redirectPath;
325
151
  } else LoginHelper.ClientRedirectToHome();
326
152
  }
327
-
328
153
  static async WsFedLogin(redirectUri) {
329
154
  const userManager = await createUserManager(userManagerConfig);
330
- userManager.signinRedirect({
155
+ userManager === null || userManager === void 0 || userManager.signinRedirect({
331
156
  scope: 'openid',
332
157
  response_type: 'id_token',
333
158
  redirect_uri: redirectUri || window.location.toString()
334
159
  });
335
160
  }
336
-
337
161
  static RemoveSecurityTokenQuery() {
338
162
  const params = new URLSearchParams(window.location.search);
339
-
340
163
  if (params.has('securitytoken') || params.has('securityToken')) {
341
164
  params.delete('securitytoken');
342
165
  params.delete('securityToken');
343
- window.location = `${window.location.pathname}${params.toString() ? `?${params}` : ''}`;
166
+ window.location.href = `${window.location.pathname}${params.toString() ? `?${params}` : ''}`;
344
167
  }
345
168
  }
346
-
347
169
  static async WsFedLogout(redirectPath) {
348
170
  await fetch(`${LoginHelper.CMS_URL}/authenticate/logout?jsonResponseRequired=true`, {
349
171
  credentials: 'include'
350
172
  });
351
-
352
173
  if (redirectPath) {
353
- window.location = redirectPath;
174
+ window.location.href = redirectPath;
354
175
  } else {
355
176
  // Explicitly check and remove any stale
356
177
  // security token that may be in the query string
357
178
  LoginHelper.RemoveSecurityTokenQuery();
358
179
  }
359
180
  }
360
-
361
181
  static async GetCredentialsForSecurityToken(securityToken) {
362
182
  const [error, response] = await to.to(fetch(`${LoginHelper.CMS_URL}/REST/Contensis/Security/IsAuthenticated`, {
363
183
  method: 'POST',
@@ -372,7 +192,6 @@ class LoginHelper {
372
192
  if (error) return [{
373
193
  message: 'Failed to fetch credentials'
374
194
  }];
375
-
376
195
  if (response.ok) {
377
196
  const [parseError, body] = await to.to(response.json());
378
197
  if (parseError) return [parseError];
@@ -380,7 +199,6 @@ class LoginHelper {
380
199
  LogonResult,
381
200
  ApplicationData = []
382
201
  } = body;
383
-
384
202
  if (LogonResult !== 0) {
385
203
  console.info(`Security token is invalid - LogonResult: ${LogonResult}`);
386
204
  return [{
@@ -388,19 +206,16 @@ class LoginHelper {
388
206
  data: ApplicationData
389
207
  }];
390
208
  }
391
-
392
209
  if (ApplicationData.length > 0) {
393
210
  let refreshToken;
394
211
  ApplicationData.forEach(item => {
395
212
  if (item.Key === 'ContensisSecurityRefreshToken') refreshToken = item.Value;
396
213
  });
397
-
398
214
  if (!refreshToken) {
399
215
  return [{
400
216
  message: 'Fetch credentials: Unable to find ContensisSecurityRefreshToken'
401
217
  }];
402
218
  }
403
-
404
219
  return [undefined, refreshToken];
405
220
  } else {
406
221
  return [{
@@ -412,8 +227,11 @@ class LoginHelper {
412
227
  message: `Fetch credentials error: ${response.status} ${response.statusText}`
413
228
  }];
414
229
  }
415
- } // static isZengentiStaff(email) {
230
+ }
231
+
232
+ // static isZengentiStaff(email) {
416
233
  // const emailRefs = ['@zengenti', '@contensis'];
234
+
417
235
  // return emailRefs.some(emailRef => {
418
236
  // if (email.includes(emailRef)) {
419
237
  // return true;
@@ -421,49 +239,166 @@ class LoginHelper {
421
239
  // });
422
240
  // }
423
241
 
242
+ SetLoginCookies({
243
+ bearerToken,
244
+ contensisClassicToken,
245
+ refreshToken
246
+ }) {
247
+ if (bearerToken) this.cookies.SetCookie(CookieHelper_class.BEARER_TOKEN_COOKIE, bearerToken);
248
+ if (contensisClassicToken) this.cookies.SetCookie(CookieHelper_class.LOGIN_COOKIE, contensisClassicToken);
249
+ if (refreshToken) this.cookies.SetCookie(CookieHelper_class.REFRESH_TOKEN_COOKIE, refreshToken);
250
+ }
251
+ GetCachedCredentials() {
252
+ return {
253
+ bearerToken: null,
254
+ bearerTokenExpiryDate: null,
255
+ refreshToken: this.cookies.GetCookie(CookieHelper_class.REFRESH_TOKEN_COOKIE),
256
+ refreshTokenExpiryDate: null,
257
+ contensisClassicToken: this.cookies.GetCookie(CookieHelper_class.LOGIN_COOKIE),
258
+ securityToken: null
259
+ };
260
+ }
261
+ ClearCachedCredentials() {
262
+ this.cookies.DeleteCookie(CookieHelper_class.LOGIN_COOKIE);
263
+ this.cookies.DeleteCookie(CookieHelper_class.REFRESH_TOKEN_COOKIE);
264
+ this.cookies.DeleteCookie(CookieHelper_class.BEARER_TOKEN_COOKIE); // additional cookie used by @contensis/forms package
265
+
266
+ if (LoginHelper.WSFED_LOGIN && typeof window !== 'undefined') {
267
+ // remove any oidc keys left over in localStorage
268
+ const {
269
+ localStorage
270
+ } = window;
271
+ const keys = [];
272
+ for (let i = 0; i < localStorage.length; i++) {
273
+ const key = localStorage.key(i);
274
+ if (typeof key === 'string' && key.startsWith('oidc.')) keys.push(key);
275
+ }
276
+ keys.forEach(key => localStorage.removeItem(key));
277
+ }
278
+ }
279
+ async LoginUser({
280
+ username,
281
+ password,
282
+ clientCredentials
283
+ }) {
284
+ let credentials = clientCredentials;
285
+ let authenticationState = {
286
+ clientCredentials: null,
287
+ isAuthenticated: false,
288
+ isAuthenticationError: false,
289
+ isError: false
290
+ };
291
+ let transientClient = null;
292
+ let user;
293
+ if (username && password) {
294
+ // Get a management client with username and password
295
+ transientClient = await getManagementApiClient({
296
+ username,
297
+ password
298
+ });
299
+
300
+ // Ensure the client has requested a bearer token
301
+ const [loginError, clientBearerToken] = await to.to(transientClient.ensureBearerToken());
424
302
 
303
+ // Problem getting token with username and password
304
+ if (loginError) {
305
+ authenticationState = {
306
+ clientCredentials: null,
307
+ errorMessage: loginError.message || null,
308
+ isAuthenticated: false,
309
+ isAuthenticationError: loginError.name.includes('ContensisAuthenticationError'),
310
+ isError: true
311
+ };
312
+ this.ClearCachedCredentials();
313
+ }
314
+
315
+ // Got a token using username and password
316
+ if (clientBearerToken) {
317
+ // Set credentials so we can continue to GetUserDetails
318
+ const clientCredentials = mapClientCredentials(transientClient);
319
+ this.SetLoginCookies(clientCredentials);
320
+ authenticationState = {
321
+ clientCredentials,
322
+ isAuthenticated: true,
323
+ isAuthenticationError: false,
324
+ isError: false
325
+ };
326
+ credentials = clientCredentials;
327
+ }
328
+ }
329
+
330
+ // If we have credentials supplied by a successful username and password login
331
+ // or clientCredentials supplied in the options argument we can continue to
332
+ // fetch the user's details
333
+ if (credentials) {
334
+ const client = transientClient || (await getManagementApiClient(credentials));
335
+ const [error, userDetails] = await LoginHelper.GetUserDetails(client);
336
+ if (error) {
337
+ authenticationState = {
338
+ clientCredentials: null,
339
+ errorMessage: error.message,
340
+ isAuthenticated: false,
341
+ isAuthenticationError: false,
342
+ isError: true
343
+ };
344
+ this.ClearCachedCredentials();
345
+ } else {
346
+ // Ensure we get latest refreshToken and contensisClassicToken from the latest client
347
+ const latestCredentials = mapClientCredentials(client);
348
+ this.SetLoginCookies(latestCredentials);
349
+ user = userDetails;
350
+ authenticationState = {
351
+ clientCredentials: latestCredentials,
352
+ isAuthenticated: true,
353
+ isAuthenticationError: false,
354
+ isError: false
355
+ };
356
+ }
357
+ }
358
+ return {
359
+ authenticationState,
360
+ user
361
+ };
362
+ }
363
+ LogoutUser(redirectPath) {
364
+ this.ClearCachedCredentials();
365
+ if (LoginHelper.WSFED_LOGIN) {
366
+ LoginHelper.WsFedLogout(redirectPath);
367
+ } else {
368
+ if (redirectPath) LoginHelper.ClientRedirectToPath(redirectPath);else LoginHelper.ClientRedirectToSignInPage();
369
+ }
370
+ }
425
371
  }
426
- LoginHelper.CMS_URL = SERVERS.cms
427
- /* global SERVERS */
428
- ;
429
- LoginHelper.WSFED_LOGIN = process.env.NODE_ENV === 'development' ? WSFED_LOGIN === 'true'
430
- /* global WSFED_LOGIN */
431
- : context.WSFED_LOGIN === 'true';
372
+ _LoginHelper = LoginHelper;
373
+ LoginHelper.CMS_URL = SERVERS.cms /* global SERVERS */;
374
+ LoginHelper.WSFED_LOGIN = process.env.NODE_ENV === 'development' ? WSFED_LOGIN === 'true' /* global WSFED_LOGIN */ : context.WSFED_LOGIN === 'true';
432
375
  LoginHelper.LOGIN_ROUTE = '/account/login';
433
376
  LoginHelper.ACCESS_DENIED_ROUTE = '/account/access-denied';
434
-
435
- LoginHelper.withCookies = cookieHelper => new LoginHelper(cookieHelper);
436
-
377
+ LoginHelper.withCookies = cookieHelper => new _LoginHelper(cookieHelper);
437
378
  LoginHelper.GetUserDetails = async client => {
438
- let userError,
439
- groupsError,
440
- user = {},
441
- groupsResult;
442
- [userError, user] = await to.to(client.security.users.getCurrent());
443
-
379
+ const [userError, user] = await to.to(client.security.users.getCurrent());
444
380
  if (user && user.id) {
445
- [groupsError, groupsResult] = await to.to(client.security.users.getUserGroups({
381
+ const [groupsError, groupsResult] = await to.to(client.security.users.getUserGroups({
446
382
  userId: user.id,
447
383
  includeInherited: true,
448
384
  pageOptions: {
449
385
  pageSize: 100
450
386
  }
451
- })); // Set groups attribute in user object to be the items
387
+ }));
388
+ // Set groups attribute in user object to be the items
452
389
  // array from the getUserGroups result
390
+ if (groupsResult && groupsResult.items) user.groups = groupsResult.items;
453
391
 
454
- if (groupsResult && groupsResult.items) user.groups = groupsResult.items; //If groups call fails then log the error but allow the user to login still
455
- // eslint-disable-next-line no-console
392
+ // If groups call fails then log the error but allow the user to login still
456
393
 
457
394
  if (groupsError) console.log(groupsError);
458
395
  }
459
-
460
396
  return [userError, user];
461
397
  };
462
398
 
463
- const loginSagas = [effects.takeEvery(reducers.LOGIN_USER, loginUserSaga), effects.takeEvery(reducers.LOGOUT_USER, logoutUserSaga), effects.takeEvery(reducers.VALIDATE_USER, validateUserSaga), effects.takeEvery(reducers.SET_AUTHENTICATION_STATE, redirectAfterSuccessfulLoginSaga)];
399
+ const loginSagas = [effects.takeEvery(selectors.LOGIN_USER, loginUserSaga), effects.takeEvery(selectors.LOGOUT_USER, logoutUserSaga), effects.takeEvery(selectors.VALIDATE_USER, validateUserSaga), effects.takeEvery(selectors.SET_AUTHENTICATION_STATE, redirectAfterSuccessfulLoginSaga)];
464
400
  function* handleRequiresLoginSaga(action) {
465
401
  var _entry$sys;
466
-
467
402
  const {
468
403
  cookies,
469
404
  entry,
@@ -474,41 +409,43 @@ function* handleRequiresLoginSaga(action) {
474
409
  },
475
410
  staticRoute
476
411
  } = action;
477
- let userLoggedIn = yield effects.select(ToJs.selectUserIsAuthenticated); // Check for a securityToken in querystring
412
+ let userLoggedIn = yield effects.select(ToJs.selectUserIsAuthenticated);
478
413
 
414
+ // Check for a securityToken in querystring
479
415
  const currentQs = selectors.queryParams(yield effects.select(selectors.selectCurrentSearch));
480
- const securityToken = currentQs.securityToken || currentQs.securitytoken; // Check if any of the defined routes have "requireLogin" attribute
416
+ const securityToken = currentQs.securityToken || currentQs.securitytoken;
481
417
 
418
+ // Check if any of the defined routes have "requireLogin" attribute
482
419
  const {
483
420
  requireLogin: authRoute
484
421
  } = staticRoute && staticRoute.route || {};
485
422
  const {
486
423
  requireLogin: authContentType
487
- } = entry && findContentTypeMapping(ContentTypeMappings, entry === null || entry === void 0 ? void 0 : (_entry$sys = entry.sys) === null || _entry$sys === void 0 ? void 0 : _entry$sys.contentTypeId) || {}; // If requireLogin, authRoute or authContentType has been specified as an
488
- // array of groups we can merge all the arrays and match on any group supplied
424
+ } = entry && findContentTypeMapping(ContentTypeMappings, entry === null || entry === void 0 || (_entry$sys = entry.sys) === null || _entry$sys === void 0 ? void 0 : _entry$sys.contentTypeId) || {};
489
425
 
426
+ // If requireLogin, authRoute or authContentType has been specified as an
427
+ // array of groups we can merge all the arrays and match on any group supplied
490
428
  const routeRequiresGroups = [...(Array.isArray(authContentType) && authContentType || []), ...(Array.isArray(authRoute) && authRoute || []), ...(Array.isArray(requireLogin) && requireLogin || [])];
491
429
  const routeRequiresLogin = !!authContentType || !!authRoute || !!requireLogin;
492
-
493
430
  if (!userLoggedIn) {
494
431
  // If cookies or securityToken are found on any route change
495
432
  // always validate and login the user
496
433
  if (routeRequiresLogin) {
497
- console.info(`Route requires login: ${path}`); // If routeRequiresLogin do a blocking call that returns userLoggedIn
498
-
434
+ console.info(`Route requires login: ${path}`);
435
+ // If routeRequiresLogin do a blocking call that returns userLoggedIn
499
436
  userLoggedIn = yield effects.call(validateUserSaga, {
500
437
  cookies,
501
438
  securityToken
502
439
  });
503
440
  console.info(`User logged in: ${userLoggedIn}`);
504
- } // otherwise do a non blocking put to handle validation in the background
441
+ }
442
+ // otherwise do a non blocking put to handle validation in the background
505
443
  else yield effects.put({
506
- type: reducers.VALIDATE_USER,
444
+ type: selectors.VALIDATE_USER,
507
445
  cookies,
508
446
  securityToken
509
447
  });
510
448
  }
511
-
512
449
  if (routeRequiresLogin) {
513
450
  // If a security token is in the querystring and we are not already
514
451
  // logged in something is wrong and we won't bother going on another redirect loop
@@ -520,33 +457,29 @@ function* handleRequiresLoginSaga(action) {
520
457
  if (!groupMatch) LoginHelper.ClientRedirectToAccessDeniedPage(action.location.pathname);
521
458
  }
522
459
  }
523
-
524
460
  return userLoggedIn;
525
461
  }
526
-
527
462
  function* validateUserSaga({
528
463
  cookies,
529
464
  securityToken
530
465
  }) {
531
- const login = LoginHelper.withCookies(cookies); // Check for refreshToken in cookies
532
-
466
+ const login = LoginHelper.withCookies(cookies);
467
+ // Check for refreshToken in cookies
533
468
  let clientCredentials = login.GetCachedCredentials();
534
-
535
469
  if (securityToken || clientCredentials.securityToken || clientCredentials.refreshToken) {
536
470
  // We only attempt to validate the user if one of the stored
537
471
  // tokens are found, in this case we set loading state manually
538
472
  // so we don't need to set and unset loading if there are no stored
539
473
  yield effects.put({
540
- type: reducers.SET_AUTHENTICATION_STATE,
474
+ type: selectors.SET_AUTHENTICATION_STATE,
541
475
  authenticationState: {
542
476
  isLoading: true
543
477
  }
544
- }); // If we have just a security token we will call a CMS endpoint
478
+ });
479
+ // If we have just a security token we will call a CMS endpoint
545
480
  // and provide us with a RefreshToken cookie we can use during login
546
-
547
481
  if (securityToken || clientCredentials.securityToken && !clientCredentials.refreshToken) {
548
482
  const [error, refreshToken] = yield LoginHelper.GetCredentialsForSecurityToken(securityToken || clientCredentials.securityToken);
549
-
550
483
  if (refreshToken) {
551
484
  // Set cookies and reload values
552
485
  login.SetLoginCookies({
@@ -555,20 +488,19 @@ function* validateUserSaga({
555
488
  });
556
489
  clientCredentials = login.GetCachedCredentials();
557
490
  }
558
-
559
491
  if (error) {
560
492
  login.ClearCachedCredentials();
561
493
  yield effects.put({
562
- type: reducers.SET_AUTHENTICATION_STATE,
494
+ type: selectors.SET_AUTHENTICATION_STATE,
563
495
  authenticationState: {
564
496
  isError: true,
565
497
  errorMessage: (error === null || error === void 0 ? void 0 : error.message) || error && 'toString' in error && error.toString()
566
498
  }
567
499
  });
568
500
  }
569
- } // Log the user in if a refreshToken is found
570
-
501
+ }
571
502
 
503
+ // Log the user in if a refreshToken is found
572
504
  if (clientCredentials.refreshToken) {
573
505
  console.info(`Login user with refreshToken ${clientCredentials.refreshToken}`);
574
506
  yield effects.call(loginUserSaga, {
@@ -576,12 +508,11 @@ function* validateUserSaga({
576
508
  cookies: login.cookies
577
509
  });
578
510
  }
579
- } // Tell any callers have we successfully logged in?
580
-
511
+ }
581
512
 
513
+ // Tell any callers have we successfully logged in?
582
514
  return yield effects.select(ToJs.selectUserIsAuthenticated);
583
515
  }
584
-
585
516
  function* loginUserSaga(action = {}) {
586
517
  const {
587
518
  username,
@@ -589,10 +520,11 @@ function* loginUserSaga(action = {}) {
589
520
  clientCredentials,
590
521
  cookies
591
522
  } = action;
592
- const login = LoginHelper.withCookies(cookies); // If a WSFED_LOGIN site has dispatched the loginUser action
593
- // just redirect them to the Identity Provider sign in
523
+ const login = LoginHelper.withCookies(cookies);
594
524
 
595
- if (action.type === reducers.LOGIN_USER && LoginHelper.WSFED_LOGIN) LoginHelper.ClientRedirectToSignInPage();
525
+ // If a WSFED_LOGIN site has dispatched the loginUser action
526
+ // just redirect them to the Identity Provider sign in
527
+ if (action.type === selectors.LOGIN_USER && LoginHelper.WSFED_LOGIN) LoginHelper.ClientRedirectToSignInPage();
596
528
  const {
597
529
  authenticationState,
598
530
  user
@@ -602,57 +534,52 @@ function* loginUserSaga(action = {}) {
602
534
  clientCredentials
603
535
  });
604
536
  yield effects.put({
605
- type: reducers.SET_AUTHENTICATION_STATE,
537
+ type: selectors.SET_AUTHENTICATION_STATE,
606
538
  authenticationState,
607
539
  user
608
540
  });
609
541
  }
610
-
611
542
  const removeHostnamePart = path => {
612
543
  // eslint-disable-next-line no-console
613
544
  console.log(path);
614
- const relativePath = '/' + path.split('/').splice(3).join('/'); // eslint-disable-next-line no-console
615
-
545
+ const relativePath = '/' + path.split('/').splice(3).join('/');
546
+ // eslint-disable-next-line no-console
616
547
  console.log(relativePath);
617
548
  return relativePath;
618
549
  };
619
-
620
550
  function* redirectAfterSuccessfulLoginSaga() {
621
551
  const isLoggedIn = yield effects.select(ToJs.selectUserIsAuthenticated);
622
552
  const {
623
553
  redirect_uri: redirectPath,
624
554
  ReturnURL: assetRedirectPath
625
555
  } = selectors.queryParams(yield effects.select(selectors.selectCurrentSearch));
626
-
627
556
  if (isLoggedIn && assetRedirectPath && typeof window != 'undefined') {
628
- const path = removeHostnamePart(assetRedirectPath); // This has to be a hard href to get the app to
557
+ const path = removeHostnamePart(assetRedirectPath);
558
+ // This has to be a hard href to get the app to
629
559
  // leave React and hit the server for the IIS hosted assets
630
-
631
- window.location.href = path; // yield put(setRoute(path)); // does not work in this scenario
560
+ window.location.href = path;
561
+ // yield put(setRoute(path)); // does not work in this scenario
632
562
  } else if (isLoggedIn && redirectPath) {
633
563
  yield effects.put(selectors.setRoute(redirectPath));
634
564
  }
635
565
  }
636
-
637
566
  function* logoutUserSaga({
638
567
  redirectPath,
639
568
  cookies
640
569
  }) {
641
570
  yield effects.put({
642
- type: reducers.SET_AUTHENTICATION_STATE,
571
+ type: selectors.SET_AUTHENTICATION_STATE,
643
572
  user: null
644
573
  });
645
574
  yield LoginHelper.withCookies(cookies).LogoutUser(redirectPath);
646
575
  }
647
-
648
576
  function* refreshSecurityToken() {
649
577
  const clientCredentials = yield effects.select(ToJs.selectClientCredentials, 'js');
650
-
651
578
  if (Object.keys(clientCredentials).length > 0) {
652
579
  const client = yield getManagementApiClient(clientCredentials);
653
580
  yield client.authenticate();
654
581
  yield effects.put({
655
- type: reducers.SET_AUTHENTICATION_STATE,
582
+ type: selectors.SET_AUTHENTICATION_STATE,
656
583
  authenticationState: {
657
584
  clientCredentials: mapClientCredentials(client)
658
585
  }
@@ -660,26 +587,26 @@ function* refreshSecurityToken() {
660
587
  }
661
588
  }
662
589
 
663
- const loginUser = (username, password, cookies) => selectors.action(reducers.LOGIN_USER, {
590
+ const loginUser = (username, password, cookies) => selectors.action(selectors.LOGIN_USER, {
664
591
  username,
665
592
  password,
666
593
  cookies
667
594
  });
668
- const logoutUser = (redirectPath, cookies) => selectors.action(reducers.LOGOUT_USER, {
595
+ const logoutUser = (redirectPath, cookies) => selectors.action(selectors.LOGOUT_USER, {
669
596
  redirectPath,
670
597
  cookies
671
598
  });
672
- const registerUser = (user, mappers) => selectors.action(reducers.REGISTER_USER, {
599
+ const registerUser = (user, mappers) => selectors.action(selectors.REGISTER_USER, {
673
600
  user,
674
601
  mappers
675
602
  });
676
- const requestPasswordReset = userEmailObject => selectors.action(reducers.REQUEST_USER_PASSWORD_RESET, {
603
+ const requestPasswordReset = userEmailObject => selectors.action(selectors.REQUEST_USER_PASSWORD_RESET, {
677
604
  userEmailObject
678
605
  });
679
- const resetPassword = resetPasswordObject => selectors.action(reducers.RESET_USER_PASSWORD, {
606
+ const resetPassword = resetPasswordObject => selectors.action(selectors.RESET_USER_PASSWORD, {
680
607
  resetPasswordObject
681
608
  });
682
- const changePassword = (userId, currentPassword, newPassword) => selectors.action(reducers.CHANGE_USER_PASSWORD, {
609
+ const changePassword = (userId, currentPassword, newPassword) => selectors.action(selectors.CHANGE_USER_PASSWORD, {
683
610
  userId,
684
611
  currentPassword,
685
612
  newPassword
@@ -687,16 +614,16 @@ const changePassword = (userId, currentPassword, newPassword) => selectors.actio
687
614
 
688
615
  var actions = /*#__PURE__*/Object.freeze({
689
616
  __proto__: null,
617
+ changePassword: changePassword,
690
618
  loginUser: loginUser,
691
619
  logoutUser: logoutUser,
692
620
  registerUser: registerUser,
693
621
  requestPasswordReset: requestPasswordReset,
694
- resetPassword: resetPassword,
695
- changePassword: changePassword
622
+ resetPassword: resetPassword
696
623
  });
697
624
 
698
625
  const useLogin = () => {
699
- const cookies = new ToJs.CookieHelper(...reactCookie.useCookies());
626
+ const cookies = new CookieHelper_class.CookieHelper(...reactCookie.useCookies());
700
627
  const dispatch = reactRedux.useDispatch();
701
628
  const select = reactRedux.useSelector;
702
629
  return {
@@ -724,7 +651,6 @@ const LoginContainer = ({
724
651
  const userProps = useLogin();
725
652
  return children(userProps);
726
653
  };
727
-
728
654
  LoginContainer.propTypes = {};
729
655
  var Login_container = ToJs.toJS(LoginContainer);
730
656
 
@@ -747,7 +673,6 @@ const RegistrationContainer = ({
747
673
  const userProps = useRegistration();
748
674
  return children(userProps);
749
675
  };
750
-
751
676
  RegistrationContainer.propTypes = {};
752
677
  var Registration_container = ToJs.toJS(RegistrationContainer);
753
678
 
@@ -776,7 +701,6 @@ const ForgotPasswordContainer = ({
776
701
  const userProps = useForgotPassword();
777
702
  return children(userProps);
778
703
  };
779
-
780
704
  ForgotPasswordContainer.propTypes = {};
781
705
  var ForgotPassword_container = ToJs.toJS(ForgotPasswordContainer);
782
706
 
@@ -800,7 +724,6 @@ const ChangePasswordContainer = ({
800
724
  const userProps = useChangePassword();
801
725
  return children(userProps);
802
726
  };
803
-
804
727
  ChangePasswordContainer.propTypes = {};
805
728
  var ChangePassword_container = ToJs.toJS(ChangePasswordContainer);
806
729
 
@@ -822,4 +745,4 @@ exports.useChangePassword = useChangePassword;
822
745
  exports.useForgotPassword = useForgotPassword;
823
746
  exports.useLogin = useLogin;
824
747
  exports.useRegistration = useRegistration;
825
- //# sourceMappingURL=ChangePassword.container-ae35785e.js.map
748
+ //# sourceMappingURL=ChangePassword.container-642SYfpS.js.map