@zengenti/contensis-react-base 3.1.0 → 4.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/{App-7ff737fa.js → App-b56aca04.js} +139 -94
- package/cjs/{App-7ff737fa.js.map → App-b56aca04.js.map} +1 -1
- package/cjs/{ChangePassword.container-a617190b.js → ChangePassword.container-ae35785e.js} +120 -62
- package/{esm/ChangePassword.container-ae0f9ce4.js.map → cjs/ChangePassword.container-ae35785e.js.map} +1 -1
- package/cjs/{ContensisDeliveryApi-9e32960d.js → ContensisDeliveryApi-4fcf049d.js} +71 -17
- package/{esm/ContensisDeliveryApi-c66b0cc3.js.map → cjs/ContensisDeliveryApi-4fcf049d.js.map} +1 -1
- package/cjs/CookieConstants-000427db.js.map +1 -1
- package/cjs/RouteLoader-c06dccd5.js +321 -0
- package/cjs/RouteLoader-c06dccd5.js.map +1 -0
- package/cjs/{ToJs-149fc5e1.js → ToJs-a8d8f3f0.js} +14 -6
- package/cjs/{ToJs-149fc5e1.js.map → ToJs-a8d8f3f0.js.map} +1 -1
- package/cjs/client.js +52 -22
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +277 -140
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +717 -228
- package/cjs/forms.js.map +1 -1
- package/cjs/{fromJSLeaveImmer-7c363211.js → fromJSLeaveImmer-e74c673c.js} +4 -1
- package/cjs/{fromJSLeaveImmer-7c363211.js.map → fromJSLeaveImmer-e74c673c.js.map} +1 -1
- package/cjs/{reducers-9afb5f89.js → reducers-73a03ef4.js} +31 -10
- package/cjs/{reducers-9afb5f89.js.map → reducers-73a03ef4.js.map} +1 -1
- package/cjs/redux.js +4 -5
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +6 -5
- package/cjs/routing.js.map +1 -1
- package/cjs/{sagas-e04b94c1.js → sagas-570f23ba.js} +286 -187
- package/cjs/{sagas-e04b94c1.js.map → sagas-570f23ba.js.map} +1 -1
- package/cjs/search.js +82 -56
- package/cjs/search.js.map +1 -1
- package/cjs/{selectors-46b689d0.js → selectors-14caa813.js} +6 -1
- package/cjs/selectors-14caa813.js.map +1 -0
- package/cjs/urls-6fcaf4c6.js.map +1 -1
- package/cjs/user.js +9 -4
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +55 -35
- package/cjs/util.js.map +1 -1
- package/cjs/{version-79a027cb.js → version-34d91f68.js} +60 -26
- package/cjs/version-34d91f68.js.map +1 -0
- package/cjs/{version-afd4f77e.js → version-a410c88e.js} +6 -3
- package/cjs/{version-afd4f77e.js.map → version-a410c88e.js.map} +1 -1
- package/esm/{App-ff944c78.js → App-83107d7e.js} +137 -92
- package/esm/{App-ff944c78.js.map → App-83107d7e.js.map} +1 -1
- package/esm/{ChangePassword.container-ae0f9ce4.js → ChangePassword.container-76fd5e9b.js} +120 -62
- package/{cjs/ChangePassword.container-a617190b.js.map → esm/ChangePassword.container-76fd5e9b.js.map} +1 -1
- package/esm/{ContensisDeliveryApi-c66b0cc3.js → ContensisDeliveryApi-fe57a037.js} +71 -17
- package/{cjs/ContensisDeliveryApi-9e32960d.js.map → esm/ContensisDeliveryApi-fe57a037.js.map} +1 -1
- package/esm/CookieConstants-3d3b6531.js.map +1 -1
- package/esm/RouteLoader-29fd689a.js +310 -0
- package/esm/RouteLoader-29fd689a.js.map +1 -0
- package/esm/{ToJs-ae860aad.js → ToJs-df57f31d.js} +14 -6
- package/esm/{ToJs-ae860aad.js.map → ToJs-df57f31d.js.map} +1 -1
- package/esm/client.js +52 -23
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +272 -137
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +717 -228
- package/esm/forms.js.map +1 -1
- package/esm/{fromJSLeaveImmer-e2dacd63.js → fromJSLeaveImmer-0114ffcf.js} +4 -1
- package/esm/{fromJSLeaveImmer-e2dacd63.js.map → fromJSLeaveImmer-0114ffcf.js.map} +1 -1
- package/esm/{reducers-3d5c37d1.js → reducers-aa8cef1e.js} +31 -10
- package/esm/{reducers-3d5c37d1.js.map → reducers-aa8cef1e.js.map} +1 -1
- package/esm/redux.js +7 -8
- package/esm/redux.js.map +1 -1
- package/esm/routing.js +3 -5
- package/esm/routing.js.map +1 -1
- package/esm/{sagas-933a8fc8.js → sagas-07e82e18.js} +239 -139
- package/esm/{sagas-933a8fc8.js.map → sagas-07e82e18.js.map} +1 -1
- package/esm/search.js +83 -57
- package/esm/search.js.map +1 -1
- package/esm/{selectors-01074974.js → selectors-691caf02.js} +6 -1
- package/esm/selectors-691caf02.js.map +1 -0
- package/esm/urls-eac9a747.js.map +1 -1
- package/esm/user.js +11 -6
- package/esm/user.js.map +1 -1
- package/esm/util.js +55 -35
- package/esm/util.js.map +1 -1
- package/esm/{version-346a9787.js → version-3d9911e2.js} +60 -26
- package/esm/version-3d9911e2.js.map +1 -0
- package/esm/{version-0fbd1b82.js → version-9f29becb.js} +6 -3
- package/esm/{version-0fbd1b82.js.map → version-9f29becb.js.map} +1 -1
- package/models/app/App.d.ts +3 -3
- package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +5 -3
- package/models/redux/appstate.d.ts +2 -3
- package/models/redux/store/history.d.ts +2 -2
- package/models/routing/components/Loading.d.ts +2 -2
- package/models/routing/components/NotFound.d.ts +2 -2
- package/models/routing/components/Redirect.d.ts +5 -0
- package/models/routing/components/StaticRouteLoader.d.ts +6 -0
- package/models/routing/components/Status.d.ts +1 -1
- package/models/routing/httpContext.d.ts +7 -0
- package/models/routing/index.d.ts +3 -0
- package/models/routing/redux/actions.d.ts +2 -3
- package/models/routing/routes.d.ts +11 -5
- package/models/user/components/Login.d.ts +2 -1
- package/models/user/components/LoginForm.d.ts +2 -1
- package/models/user/components/LogoutForm.d.ts +2 -1
- package/models/user/containers/ChangePassword.container.d.ts +1 -1
- package/models/user/containers/ForgotPassword.container.d.ts +1 -1
- package/models/user/containers/Login.container.d.ts +1 -1
- package/models/user/containers/Registration.container.d.ts +1 -1
- package/models/user/hocs/withLogin.d.ts +2 -1
- package/models/user/hocs/withRegistration.d.ts +1 -1
- package/models/util/ContensisDeliveryApi.d.ts +0 -1
- package/models/util/ToJs.d.ts +1 -1
- package/models/util/mergeStaticRoutes.d.ts +1 -0
- package/package.json +7 -10
- package/cjs/RouteLoader-049e81e5.js +0 -203
- package/cjs/RouteLoader-049e81e5.js.map +0 -1
- package/cjs/selectors-46b689d0.js.map +0 -1
- package/cjs/version-79a027cb.js.map +0 -1
- package/esm/RouteLoader-02eef6d9.js +0 -197
- package/esm/RouteLoader-02eef6d9.js.map +0 -1
- package/esm/selectors-01074974.js.map +0 -1
- package/esm/version-346a9787.js.map +0 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var require$$1 = require('history');
|
|
4
4
|
var effects = require('@redux-saga/core/effects');
|
|
5
5
|
var log = require('loglevel');
|
|
6
|
-
var ContensisDeliveryApi = require('./ContensisDeliveryApi-
|
|
7
|
-
var version = require('./version-
|
|
8
|
-
var version$1 = require('./version-
|
|
9
|
-
var selectors = require('./selectors-
|
|
6
|
+
var ContensisDeliveryApi = require('./ContensisDeliveryApi-4fcf049d.js');
|
|
7
|
+
var version = require('./version-34d91f68.js');
|
|
8
|
+
var version$1 = require('./version-a410c88e.js');
|
|
9
|
+
var selectors = require('./selectors-14caa813.js');
|
|
10
10
|
var to = require('await-to-js');
|
|
11
|
-
var ChangePassword_container = require('./ChangePassword.container-
|
|
11
|
+
var ChangePassword_container = require('./ChangePassword.container-ae35785e.js');
|
|
12
12
|
var React = require('react');
|
|
13
13
|
require('react-cookie');
|
|
14
14
|
require('react-redux');
|
|
15
15
|
require('jsonpath-mapper');
|
|
16
|
-
var reducers = require('./reducers-
|
|
16
|
+
var reducers = require('./reducers-73a03ef4.js');
|
|
17
17
|
var contensisDeliveryApi = require('contensis-delivery-api');
|
|
18
|
-
var ToJs = require('./ToJs-
|
|
19
|
-
require('react-hot-loader');
|
|
18
|
+
var ToJs = require('./ToJs-a8d8f3f0.js');
|
|
20
19
|
require('query-string');
|
|
21
|
-
|
|
20
|
+
require('react-router-dom');
|
|
21
|
+
var RouteLoader = require('./RouteLoader-c06dccd5.js');
|
|
22
22
|
|
|
23
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
24
|
|
|
@@ -44,14 +44,14 @@ var log__namespace = /*#__PURE__*/_interopNamespace(log);
|
|
|
44
44
|
var to__default = /*#__PURE__*/_interopDefaultLegacy(to);
|
|
45
45
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
const selectedHistory = typeof window !== 'undefined' ? history$1.createBrowserHistory : history$1.createMemoryHistory;
|
|
47
|
+
const selectedHistory = typeof window !== 'undefined' ? require$$1.createBrowserHistory : require$$1.createMemoryHistory;
|
|
49
48
|
const history = (options = {}) => selectedHistory(options);
|
|
50
49
|
const browserHistory = selectedHistory();
|
|
51
50
|
|
|
52
51
|
const navigationSagas = [effects.takeEvery(version.GET_NODE_TREE, ensureNodeTreeSaga)];
|
|
53
52
|
function* ensureNodeTreeSaga(action) {
|
|
54
53
|
const state = yield effects.select();
|
|
54
|
+
|
|
55
55
|
try {
|
|
56
56
|
if (!version$1.hasNavigationTree(state)) {
|
|
57
57
|
const deliveryApiVersionStatus = yield effects.select(version.selectVersionStatus);
|
|
@@ -60,6 +60,7 @@ function* ensureNodeTreeSaga(action) {
|
|
|
60
60
|
depth: action.treeDepth || 0,
|
|
61
61
|
language: action.language
|
|
62
62
|
});
|
|
63
|
+
|
|
63
64
|
if (nodes) {
|
|
64
65
|
yield effects.put({
|
|
65
66
|
type: version.SET_NODE_TREE,
|
|
@@ -106,6 +107,7 @@ const fieldExpression = (field, value, operator = 'equalTo', weight = null) => {
|
|
|
106
107
|
const defaultExpressions = versionStatus => {
|
|
107
108
|
return [contensisDeliveryApi.Op.equalTo(Fields.sys.versionStatus, versionStatus)];
|
|
108
109
|
};
|
|
110
|
+
|
|
109
111
|
const equalToOrIn = (field, arr, operator = 'equalTo') => arr.length === 0 ? [] : arr.length === 1 ? [contensisDeliveryApi.Op[operator](field, arr[0])] : [contensisDeliveryApi.Op.in(field, ...arr)];
|
|
110
112
|
|
|
111
113
|
const routeEntryByFieldsQuery = (id, language = 'en-GB', fields = [], versionStatus = 'published') => {
|
|
@@ -115,11 +117,11 @@ const routeEntryByFieldsQuery = (id, language = 'en-GB', fields = [], versionSta
|
|
|
115
117
|
};
|
|
116
118
|
|
|
117
119
|
const routingSagas = [effects.takeEvery(selectors.SET_NAVIGATION_PATH, getRouteSaga), effects.takeEvery(selectors.SET_ROUTE, setRouteSaga)];
|
|
118
|
-
|
|
119
120
|
/**
|
|
120
121
|
* To navigate / push a specific route via redux middleware
|
|
121
122
|
* @param {path, state} action
|
|
122
123
|
*/
|
|
124
|
+
|
|
123
125
|
function* setRouteSaga(action) {
|
|
124
126
|
yield effects.put({
|
|
125
127
|
type: 'CALL_HISTORY_METHOD',
|
|
@@ -129,10 +131,13 @@ function* setRouteSaga(action) {
|
|
|
129
131
|
}
|
|
130
132
|
});
|
|
131
133
|
}
|
|
134
|
+
|
|
132
135
|
function* getRouteSaga(action) {
|
|
133
136
|
let entry = null;
|
|
137
|
+
|
|
134
138
|
try {
|
|
135
139
|
var _staticRoute$route, _staticRoute$route$pa, _staticRoute$route2, _staticRoute$route2$p, _pathNode2, _pathNode2$entry, _pathNode2$entry$sys, _pathNode3, _pathNode3$entry, _pathNode3$entry$sys;
|
|
140
|
+
|
|
136
141
|
const {
|
|
137
142
|
withEvents,
|
|
138
143
|
routes: {
|
|
@@ -141,25 +146,24 @@ function* getRouteSaga(action) {
|
|
|
141
146
|
staticRoute,
|
|
142
147
|
cookies
|
|
143
148
|
} = action;
|
|
144
|
-
const api = ContensisDeliveryApi.cachedSearchWithCookies(cookies.raw);
|
|
149
|
+
const api = ContensisDeliveryApi.cachedSearchWithCookies(cookies.raw); // Inject redux { key, reducer, saga } provided by staticRoute
|
|
145
150
|
|
|
146
|
-
|
|
147
|
-
if (staticRoute && staticRoute.route.injectRedux) yield effects.call(reduxInjectorSaga, staticRoute.route.injectRedux);
|
|
151
|
+
if (staticRoute && staticRoute.route.injectRedux) yield effects.call(reduxInjectorSaga, staticRoute.route.injectRedux); // Variables we will pass to setRouteEntry
|
|
148
152
|
|
|
149
|
-
// Variables we will pass to setRouteEntry
|
|
150
153
|
let pathNode = null,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
let contentTypeMapping = {};
|
|
155
|
-
|
|
156
|
-
// These variables are the return values from
|
|
154
|
+
ancestors = null,
|
|
155
|
+
children = [],
|
|
156
|
+
siblings = null;
|
|
157
|
+
let contentTypeMapping = {}; // These variables are the return values from
|
|
157
158
|
// calls to withEvents.onRouteLoad and onRouteLoaded
|
|
159
|
+
|
|
158
160
|
let appsays,
|
|
159
|
-
|
|
161
|
+
requireLogin = false;
|
|
162
|
+
|
|
160
163
|
if (withEvents && withEvents.onRouteLoad) {
|
|
161
164
|
appsays = yield withEvents.onRouteLoad(action);
|
|
162
165
|
}
|
|
166
|
+
|
|
163
167
|
const staticRouteLinkDepth = staticRoute === null || staticRoute === void 0 ? void 0 : (_staticRoute$route = staticRoute.route) === null || _staticRoute$route === void 0 ? void 0 : (_staticRoute$route$pa = _staticRoute$route.params) === null || _staticRoute$route$pa === void 0 ? void 0 : _staticRoute$route$pa.linkDepth;
|
|
164
168
|
const staticRouteFields = staticRoute === null || staticRoute === void 0 ? void 0 : (_staticRoute$route2 = staticRoute.route) === null || _staticRoute$route2 === void 0 ? void 0 : (_staticRoute$route2$p = _staticRoute$route2.params) === null || _staticRoute$route2$p === void 0 ? void 0 : _staticRoute$route2$p.fields;
|
|
165
169
|
const entryLinkDepth = appsays && appsays.entryLinkDepth !== undefined ? appsays.entryLinkDepth : 2;
|
|
@@ -168,29 +172,30 @@ function* getRouteSaga(action) {
|
|
|
168
172
|
const routeEntry = selectors.selectRouteEntry(state, 'js');
|
|
169
173
|
const routeNode = selectors.selectCurrentNode(state, 'js');
|
|
170
174
|
const currentPath = action.path; //selectCurrentPath(state);
|
|
175
|
+
|
|
171
176
|
const deliveryApiStatus = version.selectVersionStatus(state);
|
|
172
|
-
const project = selectors.selectCurrentProject(state);
|
|
173
|
-
|
|
177
|
+
const project = selectors.selectCurrentProject(state); // const isHome = currentPath === '/';
|
|
178
|
+
|
|
174
179
|
const isPreview = currentPath && currentPath.startsWith('/preview/');
|
|
175
180
|
const defaultLang = appsays && appsays.defaultLang || 'en-GB';
|
|
181
|
+
|
|
176
182
|
if (!isPreview && (appsays && appsays.customRouting || staticRoute && !staticRoute.route.fetchNode || routeEntry && action.statePath === action.path && (appsays && appsays.refetchNode) !== true)) {
|
|
177
183
|
// To prevent erroneous 404s and wasted network calls, this covers
|
|
178
184
|
// - appsays customRouting and does SET_ENTRY etc. via the consuming app
|
|
179
185
|
// - all staticRoutes (where custom 'route.fetchNode' attribute is falsey)
|
|
180
186
|
// - standard Contensis SiteView Routing where we already have that entry in state
|
|
181
187
|
if (routeEntry && (!staticRoute || staticRoute.route && staticRoute.route.fetchNode)) {
|
|
182
|
-
pathNode = {
|
|
183
|
-
...routeNode,
|
|
188
|
+
pathNode = { ...routeNode,
|
|
184
189
|
entry: null
|
|
185
190
|
};
|
|
186
|
-
pathNode.entry = entry = routeEntry;
|
|
187
|
-
//Do nothing, the entry is allready the right one.
|
|
191
|
+
pathNode.entry = entry = routeEntry; //Do nothing, the entry is allready the right one.
|
|
188
192
|
// yield put({
|
|
189
193
|
// type: SET_ENTRY,
|
|
190
194
|
// entry,
|
|
191
195
|
// node: routeNode,
|
|
192
196
|
// isLoading: false,
|
|
193
197
|
// });
|
|
198
|
+
|
|
194
199
|
yield effects.put({
|
|
195
200
|
type: selectors.UPDATE_LOADING_STATE,
|
|
196
201
|
isLoading: false
|
|
@@ -202,11 +207,11 @@ function* getRouteSaga(action) {
|
|
|
202
207
|
let splitPath = currentPath.split('/');
|
|
203
208
|
let entryGuid = splitPath[2];
|
|
204
209
|
let language = defaultLang;
|
|
210
|
+
|
|
205
211
|
if (splitPath.length >= 3) {
|
|
206
212
|
//set lang key if available in the path, else use default lang
|
|
207
213
|
//assumes preview url on content type is: http://preview.ALIAS.contensis.cloud/preview/{GUID}/{LANG}
|
|
208
|
-
if (splitPath.length == 4) language = splitPath[3];
|
|
209
|
-
// According to product dev we cannot use Node API
|
|
214
|
+
if (splitPath.length == 4) language = splitPath[3]; // According to product dev we cannot use Node API
|
|
210
215
|
// for previewing entries as it gives a response of []
|
|
211
216
|
// -- apparently it is not correct to request latest content
|
|
212
217
|
// with Node API
|
|
@@ -216,6 +221,7 @@ function* getRouteSaga(action) {
|
|
|
216
221
|
language,
|
|
217
222
|
linkDepth: entryLinkDepth
|
|
218
223
|
});
|
|
224
|
+
|
|
219
225
|
if (previewEntry) {
|
|
220
226
|
pathNode = {
|
|
221
227
|
entry: previewEntry
|
|
@@ -227,6 +233,7 @@ function* getRouteSaga(action) {
|
|
|
227
233
|
}
|
|
228
234
|
} else {
|
|
229
235
|
var _pathNode, _pathNode$entry, _pathNode$entry$sys;
|
|
236
|
+
|
|
230
237
|
// Handle all other routes
|
|
231
238
|
let nodeError = undefined;
|
|
232
239
|
[nodeError, pathNode] = yield to__default["default"](api.getNode({
|
|
@@ -237,16 +244,17 @@ function* getRouteSaga(action) {
|
|
|
237
244
|
language: defaultLang,
|
|
238
245
|
versionStatus: deliveryApiStatus
|
|
239
246
|
}, project));
|
|
247
|
+
|
|
240
248
|
if (nodeError) {
|
|
241
249
|
if ([401, 403].includes(nodeError.status)) {
|
|
242
250
|
// Capture specific auth errors with the delivery api
|
|
243
251
|
// and fire the user down the handleRequiresLoginSaga
|
|
244
252
|
// If auth was successful via a refreshToken we need to reload the page
|
|
245
253
|
// to run this getRouteSaga again with the security token cookie
|
|
246
|
-
const userLoggedIn = yield effects.call(ChangePassword_container.handleRequiresLoginSaga, {
|
|
247
|
-
...action,
|
|
254
|
+
const userLoggedIn = yield effects.call(ChangePassword_container.handleRequiresLoginSaga, { ...action,
|
|
248
255
|
requireLogin: true
|
|
249
256
|
});
|
|
257
|
+
|
|
250
258
|
if (userLoggedIn && nodeError.status === 401) {
|
|
251
259
|
// Reload the route so we can re-run the routing request now the
|
|
252
260
|
// authentication cookies are written
|
|
@@ -264,8 +272,10 @@ function* getRouteSaga(action) {
|
|
|
264
272
|
} else ({
|
|
265
273
|
entry
|
|
266
274
|
} = pathNode || {});
|
|
275
|
+
|
|
267
276
|
if (setContentTypeLimits && (_pathNode = pathNode) !== null && _pathNode !== void 0 && (_pathNode$entry = _pathNode.entry) !== null && _pathNode$entry !== void 0 && (_pathNode$entry$sys = _pathNode$entry.sys) !== null && _pathNode$entry$sys !== void 0 && _pathNode$entry$sys.id) {
|
|
268
277
|
var _payload$items;
|
|
278
|
+
|
|
269
279
|
// Get fields[] and linkDepth from ContentTypeMapping to get the entry data
|
|
270
280
|
// and current node's ordinates at a specified depth with specified fields
|
|
271
281
|
contentTypeMapping = ChangePassword_container.findContentTypeMapping(ContentTypeMappings, pathNode.entry.sys.contentTypeId) || {};
|
|
@@ -275,14 +285,15 @@ function* getRouteSaga(action) {
|
|
|
275
285
|
} = contentTypeMapping;
|
|
276
286
|
const query = routeEntryByFieldsQuery(pathNode.entry.sys.id, pathNode.entry.sys.language, fields, deliveryApiStatus);
|
|
277
287
|
const payload = yield api.search(query, typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth || 0, project);
|
|
288
|
+
|
|
278
289
|
if ((payload === null || payload === void 0 ? void 0 : (_payload$items = payload.items) === null || _payload$items === void 0 ? void 0 : _payload$items.length) > 0) {
|
|
279
290
|
pathNode.entry = entry = payload.items[0];
|
|
280
291
|
}
|
|
281
292
|
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// make calls to fetch node ancestors, children,
|
|
293
|
+
} // make calls to fetch node ancestors, children,
|
|
285
294
|
// siblings or entire node tree
|
|
295
|
+
|
|
296
|
+
|
|
286
297
|
[ancestors, children, siblings] = yield effects.call(resolveCurrentNodeOrdinates, {
|
|
287
298
|
api,
|
|
288
299
|
appsays,
|
|
@@ -295,34 +306,37 @@ function* getRouteSaga(action) {
|
|
|
295
306
|
});
|
|
296
307
|
if (children) pathNode.children = children;
|
|
297
308
|
}
|
|
298
|
-
const resolvedContentTypeMapping = ChangePassword_container.findContentTypeMapping(ContentTypeMappings, (_pathNode2 = pathNode) === null || _pathNode2 === void 0 ? void 0 : (_pathNode2$entry = _pathNode2.entry) === null || _pathNode2$entry === void 0 ? void 0 : (_pathNode2$entry$sys = _pathNode2$entry.sys) === null || _pathNode2$entry$sys === void 0 ? void 0 : _pathNode2$entry$sys.contentTypeId) || {};
|
|
299
309
|
|
|
300
|
-
// Inject redux { key, reducer, saga } provided by ContentTypeMapping
|
|
310
|
+
const resolvedContentTypeMapping = ChangePassword_container.findContentTypeMapping(ContentTypeMappings, (_pathNode2 = pathNode) === null || _pathNode2 === void 0 ? void 0 : (_pathNode2$entry = _pathNode2.entry) === null || _pathNode2$entry === void 0 ? void 0 : (_pathNode2$entry$sys = _pathNode2$entry.sys) === null || _pathNode2$entry$sys === void 0 ? void 0 : _pathNode2$entry$sys.contentTypeId) || {}; // Inject redux { key, reducer, saga } provided by ContentTypeMapping
|
|
311
|
+
|
|
301
312
|
if (resolvedContentTypeMapping.injectRedux) yield effects.call(reduxInjectorSaga, resolvedContentTypeMapping.injectRedux);
|
|
313
|
+
|
|
302
314
|
if (withEvents && withEvents.onRouteLoaded) {
|
|
303
315
|
// Check if the app has provided a requireLogin boolean flag or groups array
|
|
304
316
|
// in addition to checking if requireLogin is set in the route definition
|
|
305
317
|
({
|
|
306
318
|
requireLogin
|
|
307
|
-
} = (yield withEvents.onRouteLoaded({
|
|
308
|
-
...action,
|
|
319
|
+
} = (yield withEvents.onRouteLoaded({ ...action,
|
|
309
320
|
entry
|
|
310
321
|
})) || {});
|
|
311
322
|
}
|
|
323
|
+
|
|
312
324
|
if (requireLogin !== false) {
|
|
313
325
|
// Do not call the login feature saga if requireLogin is false
|
|
314
|
-
yield effects.call(ChangePassword_container.handleRequiresLoginSaga, {
|
|
315
|
-
...action,
|
|
326
|
+
yield effects.call(ChangePassword_container.handleRequiresLoginSaga, { ...action,
|
|
316
327
|
entry,
|
|
317
328
|
requireLogin
|
|
318
329
|
});
|
|
319
330
|
}
|
|
331
|
+
|
|
320
332
|
if (!appsays || !appsays.preventScrollTop) {
|
|
321
333
|
// Scroll into View
|
|
322
334
|
if (typeof window !== 'undefined') window.scrollTo(0, 0);
|
|
323
335
|
}
|
|
336
|
+
|
|
324
337
|
if ((_pathNode3 = pathNode) !== null && _pathNode3 !== void 0 && (_pathNode3$entry = _pathNode3.entry) !== null && _pathNode3$entry !== void 0 && (_pathNode3$entry$sys = _pathNode3$entry.sys) !== null && _pathNode3$entry$sys !== void 0 && _pathNode3$entry$sys.id) {
|
|
325
338
|
var _staticRoute$route3, _staticRoute$route3$f, _appsays;
|
|
339
|
+
|
|
326
340
|
entry = pathNode.entry;
|
|
327
341
|
yield effects.call(setRouteEntry, currentPath, entry, pathNode, ancestors, siblings, (staticRoute === null || staticRoute === void 0 ? void 0 : (_staticRoute$route3 = staticRoute.route) === null || _staticRoute$route3 === void 0 ? void 0 : (_staticRoute$route3$f = _staticRoute$route3.fetchNode) === null || _staticRoute$route3$f === void 0 ? void 0 : _staticRoute$route3$f.entryMapper) || resolvedContentTypeMapping.entryMapper, false, (_appsays = appsays) === null || _appsays === void 0 ? void 0 : _appsays.refetchNode);
|
|
328
342
|
} else {
|
|
@@ -333,6 +347,7 @@ function* getRouteSaga(action) {
|
|
|
333
347
|
yield effects.call(do500, e);
|
|
334
348
|
}
|
|
335
349
|
}
|
|
350
|
+
|
|
336
351
|
function* resolveCurrentNodeOrdinates({
|
|
337
352
|
api,
|
|
338
353
|
appsays,
|
|
@@ -343,11 +358,10 @@ function* resolveCurrentNodeOrdinates({
|
|
|
343
358
|
project,
|
|
344
359
|
versionStatus
|
|
345
360
|
}) {
|
|
346
|
-
const apiCall = [() => null, () => null, () => null, () => null];
|
|
347
|
-
|
|
348
|
-
// if appsays customNavigation: true, we will set doNavigation to false
|
|
361
|
+
const apiCall = [() => null, () => null, () => null, () => null]; // if appsays customNavigation: true, we will set doNavigation to false
|
|
349
362
|
// if appsays customNavigation: { ... }, we will set doNavigation to the customNavigation object and check for child elements
|
|
350
363
|
// if appsays nothing we will set doNavigation to true and continue to do navigation calls
|
|
364
|
+
|
|
351
365
|
const doNavigation = !appsays || ((appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) === true ? false : (appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) || true);
|
|
352
366
|
const {
|
|
353
367
|
entryLinkDepth = 0,
|
|
@@ -355,6 +369,7 @@ function* resolveCurrentNodeOrdinates({
|
|
|
355
369
|
linkDepth,
|
|
356
370
|
nodeOptions = {}
|
|
357
371
|
} = contentTypeMapping;
|
|
372
|
+
|
|
358
373
|
if (pathNode && pathNode.id) {
|
|
359
374
|
if (doNavigation === true || doNavigation.ancestors) {
|
|
360
375
|
apiCall[0] = function* getAncestors() {
|
|
@@ -370,9 +385,12 @@ function* resolveCurrentNodeOrdinates({
|
|
|
370
385
|
}
|
|
371
386
|
};
|
|
372
387
|
}
|
|
388
|
+
|
|
373
389
|
const childrenDepth = doNavigation === true || doNavigation.children === true ? 1 : doNavigation && doNavigation.children || 0;
|
|
390
|
+
|
|
374
391
|
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.children) === 'undefined' && childrenDepth > 0 || nodeOptions.children) {
|
|
375
392
|
const childrenOptions = typeof nodeOptions.children === 'boolean' ? {} : nodeOptions.children;
|
|
393
|
+
|
|
376
394
|
apiCall[1] = function* getChildren() {
|
|
377
395
|
try {
|
|
378
396
|
return yield api.getNode({
|
|
@@ -389,10 +407,12 @@ function* resolveCurrentNodeOrdinates({
|
|
|
389
407
|
}
|
|
390
408
|
};
|
|
391
409
|
}
|
|
410
|
+
|
|
392
411
|
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.siblings) === 'undefined' && doNavigation.siblings || nodeOptions.siblings) {
|
|
393
412
|
apiCall[2] = function* getSiblings() {
|
|
394
413
|
try {
|
|
395
414
|
var _nodeOptions$siblings, _nodeOptions$siblings2;
|
|
415
|
+
|
|
396
416
|
return yield api.getSiblings({
|
|
397
417
|
id: pathNode.id,
|
|
398
418
|
entryFields: (nodeOptions === null || nodeOptions === void 0 ? void 0 : (_nodeOptions$siblings = nodeOptions.siblings) === null || _nodeOptions$siblings === void 0 ? void 0 : _nodeOptions$siblings.fields) || fields || undefined,
|
|
@@ -408,9 +428,11 @@ function* resolveCurrentNodeOrdinates({
|
|
|
408
428
|
};
|
|
409
429
|
}
|
|
410
430
|
}
|
|
431
|
+
|
|
411
432
|
const isTreeLoaded = yield effects.select(version$1.hasNavigationTree);
|
|
412
433
|
if (!isTreeLoaded && (doNavigation === true || doNavigation.tree)) apiCall[3] = function* getNodeTree() {
|
|
413
434
|
const treeDepth = doNavigation === true || !doNavigation.tree || doNavigation.tree === true ? 2 : doNavigation.tree;
|
|
435
|
+
|
|
414
436
|
if (typeof window !== 'undefined') {
|
|
415
437
|
return yield effects.put({
|
|
416
438
|
type: version.GET_NODE_TREE,
|
|
@@ -428,16 +450,15 @@ function* resolveCurrentNodeOrdinates({
|
|
|
428
450
|
const [ancestors, nodeWithChildren, siblings] = yield effects.all([loadAncestors(), loadChildren(), loadSiblings(), loadTree()]);
|
|
429
451
|
return [ancestors, nodeWithChildren === null || nodeWithChildren === void 0 ? void 0 : nodeWithChildren.children, siblings];
|
|
430
452
|
}
|
|
431
|
-
function* setRouteEntry(currentPath, entry, node, ancestors, siblings, entryMapper, notFound = false, remapEntry = false) {
|
|
432
|
-
const entrySys = entry && entry.sys || {};
|
|
433
453
|
|
|
434
|
-
|
|
454
|
+
function* setRouteEntry(currentPath, entry, node, ancestors, siblings, entryMapper, notFound = false, remapEntry = false) {
|
|
455
|
+
const entrySys = entry && entry.sys || {}; // Update a window global to provide the preview toolbar
|
|
435
456
|
// an updated entry id in client-side navigation
|
|
457
|
+
|
|
436
458
|
if (typeof window !== 'undefined') window.ContensisEntryId = entrySys.id;
|
|
437
459
|
const currentEntryId = yield effects.select(selectors.selectRouteEntryEntryId);
|
|
438
460
|
const currentEntryLang = yield effects.select(selectors.selectRouteEntryLanguage);
|
|
439
|
-
const mappedEntry = currentEntryId === entrySys.id && currentEntryLang === entrySys.language && remapEntry === false ? (yield effects.select(selectors.selectMappedEntry, 'js')) || {} : yield mapRouteEntry(entryMapper, {
|
|
440
|
-
...node,
|
|
461
|
+
const mappedEntry = currentEntryId === entrySys.id && currentEntryLang === entrySys.language && remapEntry === false ? (yield effects.select(selectors.selectMappedEntry, 'js')) || {} : yield mapRouteEntry(entryMapper, { ...node,
|
|
441
462
|
entry,
|
|
442
463
|
ancestors,
|
|
443
464
|
siblings
|
|
@@ -458,6 +479,7 @@ function* setRouteEntry(currentPath, entry, node, ancestors, siblings, entryMapp
|
|
|
458
479
|
siblings
|
|
459
480
|
})]);
|
|
460
481
|
}
|
|
482
|
+
|
|
461
483
|
function* mapRouteEntry(entryMapper, node) {
|
|
462
484
|
try {
|
|
463
485
|
if (typeof entryMapper === 'function') {
|
|
@@ -468,8 +490,10 @@ function* mapRouteEntry(entryMapper, node) {
|
|
|
468
490
|
} catch (e) {
|
|
469
491
|
log__namespace.error(...['Error running entryMapper:', e, e.stack]);
|
|
470
492
|
}
|
|
493
|
+
|
|
471
494
|
return;
|
|
472
495
|
}
|
|
496
|
+
|
|
473
497
|
function* do404() {
|
|
474
498
|
yield effects.call(clientReloadHitServer);
|
|
475
499
|
yield effects.put({
|
|
@@ -479,16 +503,17 @@ function* do404() {
|
|
|
479
503
|
notFound: true
|
|
480
504
|
});
|
|
481
505
|
}
|
|
482
|
-
function* clientReloadHitServer() {
|
|
483
|
-
const stateEntry = yield effects.select(selectors.selectRouteEntry);
|
|
484
506
|
|
|
485
|
-
|
|
507
|
+
function* clientReloadHitServer() {
|
|
508
|
+
const stateEntry = yield effects.select(selectors.selectRouteEntry); // If in client and there is a stateEntry.sys field reload the page,
|
|
486
509
|
// on the 2nd load stateEntry.sys should be null at this point,
|
|
487
510
|
// we do not wish to reload again and get stuck in an infinite reloading loop
|
|
511
|
+
|
|
488
512
|
if (typeof window !== 'undefined' && (stateEntry !== null && stateEntry !== void 0 && stateEntry.sys || null)) {
|
|
489
513
|
window.location.reload();
|
|
490
514
|
}
|
|
491
515
|
}
|
|
516
|
+
|
|
492
517
|
function* do500(error) {
|
|
493
518
|
yield effects.put({
|
|
494
519
|
type: selectors.SET_ENTRY,
|
|
@@ -500,6 +525,7 @@ function* do500(error) {
|
|
|
500
525
|
statusCode: error && error.status ? error.status : 500
|
|
501
526
|
});
|
|
502
527
|
}
|
|
528
|
+
|
|
503
529
|
function* reduxInjectorSaga(injectorFn) {
|
|
504
530
|
if (typeof injectorFn === 'function') {
|
|
505
531
|
const {
|
|
@@ -516,18 +542,19 @@ function* reduxInjectorSaga(injectorFn) {
|
|
|
516
542
|
}
|
|
517
543
|
|
|
518
544
|
const registerSagas = [effects.takeEvery(reducers.REGISTER_USER, registerSaga), effects.takeEvery(reducers.REGISTER_USER_SUCCESS, redirectSaga)];
|
|
545
|
+
|
|
519
546
|
function* registerSaga({
|
|
520
547
|
user,
|
|
521
548
|
mappers
|
|
522
549
|
}) {
|
|
523
|
-
let requestBody = user;
|
|
524
|
-
// Allow use of request mapper to take a user object
|
|
550
|
+
let requestBody = user; // Allow use of request mapper to take a user object
|
|
525
551
|
// of any format and return the payload for the api request
|
|
552
|
+
|
|
526
553
|
if (mappers && mappers.request && typeof mappers.request === 'function') {
|
|
527
554
|
requestBody = yield mappers.request(user);
|
|
528
|
-
}
|
|
555
|
+
} // Make POST call to register API
|
|
556
|
+
|
|
529
557
|
|
|
530
|
-
// Make POST call to register API
|
|
531
558
|
const response = yield fetch('/account/register', {
|
|
532
559
|
method: 'POST',
|
|
533
560
|
headers: {
|
|
@@ -536,16 +563,19 @@ function* registerSaga({
|
|
|
536
563
|
},
|
|
537
564
|
body: JSON.stringify(requestBody)
|
|
538
565
|
});
|
|
566
|
+
|
|
539
567
|
if (response.ok) {
|
|
540
568
|
let mappedResponse;
|
|
541
569
|
const [, responseBody] = yield to.to(response.json());
|
|
570
|
+
|
|
542
571
|
if (responseBody) {
|
|
543
572
|
// Allow use of response mapper to convert the successful user object
|
|
544
573
|
// from the api response body into a user object of any format
|
|
545
574
|
if (mappers && mappers.response && typeof mappers.response === 'function') {
|
|
546
575
|
mappedResponse = yield mappers.response(responseBody);
|
|
547
|
-
}
|
|
548
|
-
|
|
576
|
+
} // Update user object with mappedResponse or responseBody
|
|
577
|
+
|
|
578
|
+
|
|
549
579
|
yield effects.put({
|
|
550
580
|
type: reducers.REGISTER_USER_SUCCESS,
|
|
551
581
|
user: mappedResponse || responseBody
|
|
@@ -564,24 +594,25 @@ function* registerSaga({
|
|
|
564
594
|
// or status codes echoed from the responses received from
|
|
565
595
|
// management api when registering the user
|
|
566
596
|
const [, errorResponse] = yield to.to(response.json());
|
|
567
|
-
const error = errorResponse && errorResponse.error || errorResponse || {};
|
|
568
|
-
|
|
597
|
+
const error = errorResponse && errorResponse.error || errorResponse || {}; // Get something meaningful from the response if there is no message in the body
|
|
598
|
+
|
|
569
599
|
if (!error.message) {
|
|
570
600
|
error.message = `Registration service: ${response.statusText}`;
|
|
571
601
|
error.status = response.status;
|
|
572
602
|
}
|
|
603
|
+
|
|
573
604
|
yield effects.put({
|
|
574
605
|
type: reducers.REGISTER_USER_FAILED,
|
|
575
606
|
error
|
|
576
607
|
});
|
|
577
608
|
}
|
|
578
609
|
}
|
|
610
|
+
|
|
579
611
|
function* redirectSaga() {
|
|
580
612
|
// Check if querystring contains a redirect_uri
|
|
581
613
|
const currentQs = selectors.queryParams(yield effects.select(selectors.selectCurrentSearch));
|
|
582
|
-
const redirectUri = currentQs.redirect_uri || currentQs.redirect;
|
|
614
|
+
const redirectUri = currentQs.redirect_uri || currentQs.redirect; // We must use redux based navigation to preserve the registration state
|
|
583
615
|
|
|
584
|
-
// We must use redux based navigation to preserve the registration state
|
|
585
616
|
if (redirectUri) yield effects.put(selectors.setRoute(redirectUri));
|
|
586
617
|
}
|
|
587
618
|
|
|
@@ -599,36 +630,36 @@ const BASE_OPTIONS = {
|
|
|
599
630
|
};
|
|
600
631
|
class UserHelper {
|
|
601
632
|
static async GetUsersEnvironments(securityToken) {
|
|
602
|
-
const options = {
|
|
603
|
-
...BASE_OPTIONS,
|
|
633
|
+
const options = { ...BASE_OPTIONS,
|
|
604
634
|
headers: {
|
|
605
635
|
'x-security-token': securityToken
|
|
606
636
|
}
|
|
607
637
|
};
|
|
608
638
|
return await UserHelper.get(USER_ENVS_URL, options);
|
|
609
639
|
}
|
|
640
|
+
|
|
610
641
|
static async ResendUserVerification(userEmail) {
|
|
611
|
-
const options = {
|
|
612
|
-
...BASE_OPTIONS
|
|
642
|
+
const options = { ...BASE_OPTIONS
|
|
613
643
|
};
|
|
614
644
|
return await UserHelper.get(`/${USER_RESEND_VERIFICATION_URI}?user=${userEmail}`, options);
|
|
615
645
|
}
|
|
646
|
+
|
|
616
647
|
static async RequestPasswordReset(userEmailObject) {
|
|
617
|
-
const options = {
|
|
618
|
-
...BASE_OPTIONS,
|
|
648
|
+
const options = { ...BASE_OPTIONS,
|
|
619
649
|
body: JSON.stringify(userEmailObject)
|
|
620
650
|
};
|
|
621
651
|
options.method = 'POST';
|
|
622
652
|
return await UserHelper.get(`/${USER_REQUEST_PASSWORD_RESET_URI}`, options);
|
|
623
653
|
}
|
|
654
|
+
|
|
624
655
|
static async ResetPassword(resetPasswordObject) {
|
|
625
|
-
const options = {
|
|
626
|
-
...BASE_OPTIONS,
|
|
656
|
+
const options = { ...BASE_OPTIONS,
|
|
627
657
|
body: JSON.stringify(resetPasswordObject)
|
|
628
658
|
};
|
|
629
659
|
options.method = 'POST';
|
|
630
660
|
return await UserHelper.get(`/${USER_RESET_PASSWORD_URI}`, options);
|
|
631
661
|
}
|
|
662
|
+
|
|
632
663
|
static async get(url, options = BASE_OPTIONS) {
|
|
633
664
|
try {
|
|
634
665
|
const responseBody = await api(url, options);
|
|
@@ -641,7 +672,9 @@ class UserHelper {
|
|
|
641
672
|
};
|
|
642
673
|
}
|
|
643
674
|
}
|
|
675
|
+
|
|
644
676
|
}
|
|
677
|
+
|
|
645
678
|
async function api(url, options) {
|
|
646
679
|
return fetch(url, options).then(async response => {
|
|
647
680
|
return response.json().then(data => data);
|
|
@@ -651,14 +684,17 @@ async function api(url, options) {
|
|
|
651
684
|
}
|
|
652
685
|
|
|
653
686
|
const resetPasswordSagas = [effects.takeEvery(reducers.REQUEST_USER_PASSWORD_RESET, requestPasswordResetSaga), effects.takeEvery(reducers.RESET_USER_PASSWORD, resetPasswordSaga), effects.takeEvery(reducers.CHANGE_USER_PASSWORD, changePasswordSaga)];
|
|
687
|
+
|
|
654
688
|
function* requestPasswordResetSaga(action) {
|
|
655
689
|
const userEmailObject = action.userEmailObject;
|
|
656
690
|
yield effects.put({
|
|
657
691
|
type: reducers.REQUEST_USER_PASSWORD_RESET_SENDING
|
|
658
692
|
});
|
|
693
|
+
|
|
659
694
|
if (userEmailObject && userEmailObject.userEmail) {
|
|
660
695
|
try {
|
|
661
696
|
const passwordResetRequestResponse = yield UserHelper.RequestPasswordReset(userEmailObject);
|
|
697
|
+
|
|
662
698
|
if (passwordResetRequestResponse) {
|
|
663
699
|
if (!passwordResetRequestResponse.error) {
|
|
664
700
|
yield effects.put({
|
|
@@ -689,14 +725,17 @@ function* requestPasswordResetSaga(action) {
|
|
|
689
725
|
});
|
|
690
726
|
}
|
|
691
727
|
}
|
|
728
|
+
|
|
692
729
|
function* resetPasswordSaga(action) {
|
|
693
730
|
const resetPasswordObject = action.resetPasswordObject;
|
|
694
731
|
yield effects.put({
|
|
695
732
|
type: reducers.RESET_USER_PASSWORD_SENDING
|
|
696
733
|
});
|
|
734
|
+
|
|
697
735
|
if (resetPasswordObject.token && resetPasswordObject.password) {
|
|
698
736
|
try {
|
|
699
737
|
const resetPasswordResponse = yield UserHelper.ResetPassword(resetPasswordObject);
|
|
738
|
+
|
|
700
739
|
if (resetPasswordResponse) {
|
|
701
740
|
if (!resetPasswordResponse.error) {
|
|
702
741
|
yield effects.put({
|
|
@@ -727,11 +766,11 @@ function* resetPasswordSaga(action) {
|
|
|
727
766
|
error: 'Invalid object'
|
|
728
767
|
});
|
|
729
768
|
}
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
// userId
|
|
769
|
+
} // userId
|
|
733
770
|
// existingPassword
|
|
734
771
|
// newPassword
|
|
772
|
+
|
|
773
|
+
|
|
735
774
|
function* changePasswordSaga(action) {
|
|
736
775
|
if (!action || !action.userId || !action.currentPassword || !action.newPassword) {
|
|
737
776
|
yield effects.put({
|
|
@@ -740,6 +779,7 @@ function* changePasswordSaga(action) {
|
|
|
740
779
|
});
|
|
741
780
|
return;
|
|
742
781
|
}
|
|
782
|
+
|
|
743
783
|
try {
|
|
744
784
|
const changePasswordObject = {
|
|
745
785
|
userId: action.userId,
|
|
@@ -750,24 +790,25 @@ function* changePasswordSaga(action) {
|
|
|
750
790
|
type: reducers.CHANGE_USER_PASSWORD_SENDING
|
|
751
791
|
});
|
|
752
792
|
const clientCredentials = yield effects.select(ToJs.selectClientCredentials, 'js');
|
|
753
|
-
const client = yield ChangePassword_container.getManagementApiClient({
|
|
754
|
-
...clientCredentials
|
|
793
|
+
const client = yield ChangePassword_container.getManagementApiClient({ ...clientCredentials
|
|
755
794
|
});
|
|
756
795
|
const [err, res] = yield to.to(client.security.users.updatePassword(changePasswordObject));
|
|
796
|
+
|
|
757
797
|
if (err) {
|
|
758
798
|
var _err$data, _err$data$data, _err$data2;
|
|
799
|
+
|
|
759
800
|
const error = (err === null || err === void 0 ? void 0 : (_err$data = err.data) === null || _err$data === void 0 ? void 0 : (_err$data$data = _err$data.data) === null || _err$data$data === void 0 ? void 0 : _err$data$data.length) > 0 && err.data.data[0].message || (err === null || err === void 0 ? void 0 : (_err$data2 = err.data) === null || _err$data2 === void 0 ? void 0 : _err$data2.message);
|
|
760
801
|
yield effects.put({
|
|
761
802
|
type: reducers.CHANGE_USER_PASSWORD_ERROR,
|
|
762
803
|
error
|
|
763
804
|
});
|
|
764
805
|
return;
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
// // eslint-disable-next-line no-console
|
|
806
|
+
} // // eslint-disable-next-line no-console
|
|
768
807
|
// console.log(changePasswordObject);
|
|
769
808
|
// // eslint-disable-next-line no-console
|
|
770
809
|
// console.log(userCredentialsObject);
|
|
810
|
+
|
|
811
|
+
|
|
771
812
|
yield effects.put({
|
|
772
813
|
type: reducers.CHANGE_USER_PASSWORD_SUCCESS
|
|
773
814
|
});
|
|
@@ -789,32 +830,35 @@ function rootSaga (featureSagas = []) {
|
|
|
789
830
|
};
|
|
790
831
|
}
|
|
791
832
|
|
|
792
|
-
const servers = SERVERS;
|
|
833
|
+
const servers = SERVERS;
|
|
834
|
+
/* global SERVERS */
|
|
835
|
+
|
|
793
836
|
const alias = servers.alias.toLowerCase();
|
|
794
|
-
const publicUri = PUBLIC_URI;
|
|
795
|
-
|
|
837
|
+
const publicUri = PUBLIC_URI;
|
|
838
|
+
/* global PUBLIC_URI */
|
|
796
839
|
|
|
840
|
+
const projects = PROJECTS;
|
|
841
|
+
/* global PROJECTS */
|
|
797
842
|
// return a projectId via the request hostname
|
|
843
|
+
|
|
798
844
|
const pickProject = (hostname, query) => {
|
|
799
845
|
// if localhost we can only infer via a querystring, and take your word for it
|
|
800
846
|
if (hostname == 'localhost') {
|
|
801
847
|
return query && query.p || projects[0].id;
|
|
802
|
-
}
|
|
848
|
+
} // if hostname is the actual public uri we can return the first project from the list
|
|
849
|
+
|
|
803
850
|
|
|
804
|
-
// if hostname is the actual public uri we can return the first project from the list
|
|
805
851
|
if (hostname == publicUri) {
|
|
806
852
|
return projects[0].id;
|
|
807
853
|
}
|
|
808
|
-
let project = 'unknown';
|
|
809
854
|
|
|
810
|
-
// // go through all the defined projects
|
|
855
|
+
let project = 'unknown'; // // go through all the defined projects
|
|
811
856
|
// Object.entries(projects).map(([, p]) => {
|
|
812
|
-
const p = projects[0];
|
|
813
857
|
|
|
814
|
-
// check if we're accessing via the project's public uri
|
|
815
|
-
|
|
858
|
+
const p = projects[0]; // check if we're accessing via the project's public uri
|
|
859
|
+
|
|
860
|
+
if (hostname.includes(p.publicUri)) project = p.id; // the url structure is different for website (we don't prefix)
|
|
816
861
|
|
|
817
|
-
// the url structure is different for website (we don't prefix)
|
|
818
862
|
if (p.id.startsWith('website')) {
|
|
819
863
|
// check for internal and external hostnames
|
|
820
864
|
// we check live and preview distinctly so our rule does not clash with
|
|
@@ -823,8 +867,9 @@ const pickProject = (hostname, query) => {
|
|
|
823
867
|
} else {
|
|
824
868
|
// check for internal and external hostnames, prefixed with the projectId
|
|
825
869
|
if (hostname.includes(`${p.id.toLowerCase()}-${alias}.cloud.contensis.com`) || hostname.includes(`${p.id.toLowerCase()}.${alias}.contensis.cloud`)) project = p.id;
|
|
826
|
-
}
|
|
827
|
-
|
|
870
|
+
} // });
|
|
871
|
+
|
|
872
|
+
|
|
828
873
|
return project === 'unknown' ? p.id : project;
|
|
829
874
|
};
|
|
830
875
|
|
|
@@ -837,4 +882,4 @@ exports.browserHistory = browserHistory;
|
|
|
837
882
|
exports.history = history;
|
|
838
883
|
exports.pickProject = pickProject;
|
|
839
884
|
exports.rootSaga = rootSaga;
|
|
840
|
-
//# sourceMappingURL=App-
|
|
885
|
+
//# sourceMappingURL=App-b56aca04.js.map
|