@zengenti/contensis-react-base 3.0.0-beta.9 → 3.0.1-beta.1
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/README.md +128 -1
- package/cjs/{App-5d20127f.js → App-c5698b06.js} +229 -182
- package/cjs/App-c5698b06.js.map +1 -0
- package/cjs/{RouteLoader-df3de0cb.js → RouteLoader-3aa6456e.js} +47 -28
- package/cjs/RouteLoader-3aa6456e.js.map +1 -0
- package/cjs/{ToJs-697ace9f.js → ToJs-a9a8522b.js} +39 -34
- package/cjs/ToJs-a9a8522b.js.map +1 -0
- package/cjs/{actions-a24bf46e.js → actions-8dc9e8de.js} +5 -4
- package/cjs/actions-8dc9e8de.js.map +1 -0
- package/cjs/client.js +22 -44
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +3956 -136
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +547 -580
- package/cjs/forms.js.map +1 -1
- package/cjs/{fromJSLeaveImmer-65d26804.js → fromJSLeaveImmer-e74c673c.js} +2 -2
- package/cjs/fromJSLeaveImmer-e74c673c.js.map +1 -0
- package/cjs/{login-bc55ee33.js → login-6b9de6a1.js} +92 -55
- package/cjs/login-6b9de6a1.js.map +1 -0
- package/cjs/{reducers-fde41d6b.js → reducers-3a4f8971.js} +26 -25
- package/cjs/reducers-3a4f8971.js.map +1 -0
- package/cjs/redux.js +6 -5
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +5 -4
- package/cjs/routing.js.map +1 -1
- package/cjs/sagas-594b5ecd.js +2090 -0
- package/cjs/sagas-594b5ecd.js.map +1 -0
- package/cjs/search.js +296 -1915
- package/cjs/search.js.map +1 -1
- package/cjs/{selectors-0ec95076.js → selectors-656da4b7.js} +8 -3
- package/cjs/selectors-656da4b7.js.map +1 -0
- package/cjs/setCachingHeaders-ee619bdf.js +12 -0
- package/cjs/setCachingHeaders-ee619bdf.js.map +1 -0
- package/cjs/user.js +21 -12
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +17 -17
- package/cjs/util.js.map +1 -1
- package/cjs/{version-bf00e6d7.js → version-78dfc3bd.js} +35 -23
- package/cjs/version-78dfc3bd.js.map +1 -0
- package/cjs/{version-be0c7b7a.js → version-eba6d09b.js} +2 -2
- package/{esm/version-ad2ec52c.js.map → cjs/version-eba6d09b.js.map} +1 -1
- package/esm/{App-4224ba21.js → App-069378e0.js} +229 -183
- package/esm/App-069378e0.js.map +1 -0
- package/esm/{RouteLoader-027215f2.js → RouteLoader-5171c63f.js} +47 -28
- package/esm/RouteLoader-5171c63f.js.map +1 -0
- package/esm/{ToJs-46761960.js → ToJs-4e02a04d.js} +38 -32
- package/esm/ToJs-4e02a04d.js.map +1 -0
- package/esm/{actions-b949ef5c.js → actions-180948dd.js} +5 -4
- package/esm/actions-180948dd.js.map +1 -0
- package/esm/client.js +24 -27
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +3954 -135
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +547 -583
- package/esm/forms.js.map +1 -1
- package/esm/{fromJSLeaveImmer-e2f0f331.js → fromJSLeaveImmer-0114ffcf.js} +2 -2
- package/esm/fromJSLeaveImmer-0114ffcf.js.map +1 -0
- package/esm/{login-6eab4c94.js → login-508cac0f.js} +92 -55
- package/esm/login-508cac0f.js.map +1 -0
- package/esm/{reducers-d6c0edb1.js → reducers-8e5d6232.js} +26 -25
- package/esm/reducers-8e5d6232.js.map +1 -0
- package/esm/redux.js +8 -7
- package/esm/redux.js.map +1 -1
- package/esm/routing.js +5 -4
- package/esm/routing.js.map +1 -1
- package/esm/sagas-1f2b2aa0.js +2000 -0
- package/esm/sagas-1f2b2aa0.js.map +1 -0
- package/esm/search.js +252 -1856
- package/esm/search.js.map +1 -1
- package/esm/{selectors-8fca7fb2.js → selectors-a5e5835b.js} +9 -6
- package/esm/selectors-a5e5835b.js.map +1 -0
- package/esm/setCachingHeaders-d49060e1.js +10 -0
- package/esm/setCachingHeaders-d49060e1.js.map +1 -0
- package/esm/user.js +23 -14
- package/esm/user.js.map +1 -1
- package/esm/util.js +17 -17
- package/esm/util.js.map +1 -1
- package/esm/{version-ad2ec52c.js → version-2485e2fb.js} +2 -2
- package/{cjs/version-be0c7b7a.js.map → esm/version-2485e2fb.js.map} +1 -1
- package/esm/{version-3b4fe08d.js → version-e3a5ec66.js} +34 -23
- package/esm/version-e3a5ec66.js.map +1 -0
- package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +1 -1
- package/models/forms/index.d.ts +3 -1
- package/models/index.d.ts +1 -0
- package/models/redux/appstate.d.ts +5 -10
- package/models/redux/sagas/navigation.d.ts +1 -1
- package/models/redux/selectors/navigation.d.ts +2 -1
- package/models/routing/components/RouteLoader.d.ts +2 -19
- package/models/routing/redux/actions.d.ts +1 -1
- package/models/routing/redux/selectors.d.ts +1 -1
- package/models/routing/routes.d.ts +22 -4
- package/models/routing/util/expressions.d.ts +3 -2
- package/models/routing/util/queries.d.ts +1 -1
- package/models/search/containers/withListing.d.ts +1 -1
- package/models/search/containers/withSearch.d.ts +1 -1
- package/models/search/hooks/useFacets.hook.d.ts +3 -0
- package/models/search/hooks/useListing.hook.d.ts +3 -0
- package/models/search/hooks/useMinilist.hook.d.ts +2 -9
- package/models/search/index.d.ts +6 -2
- package/models/search/models/Queries.d.ts +8 -5
- package/models/search/models/Search.d.ts +60 -28
- package/models/search/models/SearchActions.d.ts +9 -5
- package/models/search/models/SearchProps.d.ts +52 -7
- package/models/search/models/SearchState.d.ts +5 -1
- package/models/search/models/index.d.ts +3 -1
- package/models/search/redux/actions.d.ts +5 -2
- package/models/search/redux/reducers.d.ts +230 -314
- package/models/search/redux/sagas.d.ts +11 -7
- package/models/search/redux/selectors.d.ts +21 -24
- package/models/search/redux/util.d.ts +1 -0
- package/models/search/search/ContensisDeliveryApi.d.ts +1 -0
- package/models/search/search/expressions.d.ts +5 -8
- package/models/search/{redux → search}/queries.d.ts +0 -0
- package/models/search/search/util.d.ts +14 -0
- package/models/search/transformations/entry-to-filteritem.mapper.d.ts +2 -1
- package/models/search/transformations/filter-to-filterexpression.mapper.d.ts +6 -0
- package/models/search/transformations/filters-to-filterexpressions.mapper.d.ts +3 -0
- package/models/search/transformations/index.d.ts +3 -0
- package/models/search/transformations/queryParams-to-customapi.mapper.d.ts +3 -0
- package/models/search/transformations/state-to-searchuri.d.ts +2 -13
- package/models/server/features/linkdepth-api/LinkDepthSearchService.d.ts +24 -0
- package/models/server/features/linkdepth-api/QueryLevelResults.d.ts +50 -0
- package/models/server/features/linkdepth-api/api.d.ts +12 -0
- package/models/server/features/linkdepth-api/events-api.config.d.ts +37 -0
- package/models/server/features/linkdepth-api/search.d.ts +31 -0
- package/models/server/features/linkdepth-api/util.d.ts +11 -0
- package/models/server/middleware/bundleManipulation.d.ts +2 -1
- package/models/server/util/bundles.d.ts +17 -21
- package/models/server/util/getVersionInfo.d.ts +1 -0
- package/models/server/util/headers.d.ts +3 -2
- package/models/user/components/Login.d.ts +1 -2
- package/models/user/components/LoginForm.d.ts +1 -2
- package/models/user/hocs/withLogin.d.ts +4 -2
- package/models/user/hocs/withRegistration.d.ts +2 -0
- package/models/user/hooks/useLogin.d.ts +5 -3
- package/models/user/redux/reducers.d.ts +4 -5
- package/models/user/redux/sagas/login.d.ts +11 -8
- package/models/user/redux/selectors.d.ts +12 -6
- package/models/user/util/LoginHelper.class.d.ts +4 -3
- package/models/util/ContensisDeliveryApi.d.ts +4 -4
- package/models/util/json-mapper.d.ts +9 -3
- package/models/util/merge.d.ts +1 -0
- package/package.json +61 -56
- package/CHANGELOG.md +0 -293
- package/cjs/App-5d20127f.js.map +0 -1
- package/cjs/RouteLoader-df3de0cb.js.map +0 -1
- package/cjs/ToJs-697ace9f.js.map +0 -1
- package/cjs/actions-a24bf46e.js.map +0 -1
- package/cjs/fromJSLeaveImmer-65d26804.js.map +0 -1
- package/cjs/login-bc55ee33.js.map +0 -1
- package/cjs/reducers-fde41d6b.js.map +0 -1
- package/cjs/selectors-0ec95076.js.map +0 -1
- package/cjs/version-bf00e6d7.js.map +0 -1
- package/esm/App-4224ba21.js.map +0 -1
- package/esm/RouteLoader-027215f2.js.map +0 -1
- package/esm/ToJs-46761960.js.map +0 -1
- package/esm/actions-b949ef5c.js.map +0 -1
- package/esm/fromJSLeaveImmer-e2f0f331.js.map +0 -1
- package/esm/login-6eab4c94.js.map +0 -1
- package/esm/reducers-d6c0edb1.js.map +0 -1
- package/esm/selectors-8fca7fb2.js.map +0 -1
- package/esm/version-3b4fe08d.js.map +0 -1
- package/models/search/transformations/filters-to-filterexpression.d.ts +0 -1
- package/models/search/transformations/filters-to-filterexpression.mapper.d.ts +0 -2
- package/models/server/features/caching/cacheHashing.d.ts +0 -1
- package/package-lock.json +0 -14093
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { createBrowserHistory, createMemoryHistory } from 'history';
|
|
2
2
|
import { takeEvery, select, put, call, all } from '@redux-saga/core/effects';
|
|
3
|
-
import { Client, Op, Query } from 'contensis-delivery-api';
|
|
4
|
-
import { a as setSurrogateKeys, S as SET_NAVIGATION_PATH, b as SET_ROUTE, U as UPDATE_LOADING_STATE, c as SET_ENTRY, d as SET_ANCESTORS, e as SET_SIBLINGS, f as setRoute } from './actions-b949ef5c.js';
|
|
5
|
-
import { r as reduxStore, G as GET_NODE_TREE, h as hasNavigationTree, S as SET_NODE_TREE, b as GET_NODE_TREE_ERROR, i as injectRedux } from './version-3b4fe08d.js';
|
|
6
|
-
import { s as selectVersionStatus } from './version-ad2ec52c.js';
|
|
7
|
-
import { a as selectCurrentProject, s as selectRouteEntry, b as selectCurrentNode, c as selectCurrentAncestors, d as selectRouteEntryEntryId, e as selectRouteEntryLanguage, f as selectMappedEntry, q as queryParams, h as selectCurrentSearch } from './selectors-8fca7fb2.js';
|
|
8
3
|
import * as log from 'loglevel';
|
|
9
|
-
import {
|
|
4
|
+
import { Client, Op, Query } from 'contensis-delivery-api';
|
|
5
|
+
import { parse } from 'query-string';
|
|
6
|
+
import { a as setSurrogateKeys, S as SET_NAVIGATION_PATH, b as SET_ROUTE, U as UPDATE_LOADING_STATE, c as SET_ENTRY, d as SET_ANCESTORS, e as SET_SIBLINGS, f as setRoute } from './actions-180948dd.js';
|
|
7
|
+
import { r as reduxStore, G as GET_NODE_TREE, h as hasNavigationTree, S as SET_NODE_TREE, b as GET_NODE_TREE_ERROR, i as injectRedux } from './version-e3a5ec66.js';
|
|
8
|
+
import { s as selectVersionStatus } from './version-2485e2fb.js';
|
|
9
|
+
import { b as selectCurrentProject, a as selectRouteEntry, c as selectCurrentNode, d as selectCurrentAncestors, e as selectCurrentSiblings, f as selectRouteEntryEntryId, h as selectRouteEntryLanguage, i as selectMappedEntry, q as queryParams, j as selectCurrentSearch } from './selectors-a5e5835b.js';
|
|
10
|
+
import { f as findContentTypeMapping, h as handleRequiresLoginSaga, g as getManagementApiClient, l as loginSagas } from './login-508cac0f.js';
|
|
10
11
|
import { to } from 'await-to-js';
|
|
11
|
-
import { R as REGISTER_USER, a as REGISTER_USER_SUCCESS, b as REGISTER_USER_FAILED, c as REQUEST_USER_PASSWORD_RESET, d as RESET_USER_PASSWORD, C as CHANGE_USER_PASSWORD, e as REQUEST_USER_PASSWORD_RESET_SENDING, f as REQUEST_USER_PASSWORD_RESET_SUCCESS, g as REQUEST_USER_PASSWORD_RESET_ERROR, h as RESET_USER_PASSWORD_SENDING, i as RESET_USER_PASSWORD_SUCCESS, j as RESET_USER_PASSWORD_ERROR, k as CHANGE_USER_PASSWORD_ERROR, l as CHANGE_USER_PASSWORD_SENDING, m as CHANGE_USER_PASSWORD_SUCCESS } from './reducers-
|
|
12
|
-
import { s as selectClientCredentials } from './ToJs-
|
|
12
|
+
import { R as REGISTER_USER, a as REGISTER_USER_SUCCESS, b as REGISTER_USER_FAILED, c as REQUEST_USER_PASSWORD_RESET, d as RESET_USER_PASSWORD, C as CHANGE_USER_PASSWORD, e as REQUEST_USER_PASSWORD_RESET_SENDING, f as REQUEST_USER_PASSWORD_RESET_SUCCESS, g as REQUEST_USER_PASSWORD_RESET_ERROR, h as RESET_USER_PASSWORD_SENDING, i as RESET_USER_PASSWORD_SUCCESS, j as RESET_USER_PASSWORD_ERROR, k as CHANGE_USER_PASSWORD_ERROR, l as CHANGE_USER_PASSWORD_SENDING, m as CHANGE_USER_PASSWORD_SUCCESS } from './reducers-8e5d6232.js';
|
|
13
|
+
import { s as selectClientCredentials } from './ToJs-4e02a04d.js';
|
|
13
14
|
import React from 'react';
|
|
14
15
|
import 'react-hot-loader';
|
|
15
16
|
import 'jsonpath-mapper';
|
|
16
|
-
import '
|
|
17
|
-
import { R as RouteLoader } from './RouteLoader-027215f2.js';
|
|
18
|
-
|
|
19
|
-
const selectedHistory = typeof window !== 'undefined' ? createBrowserHistory : createMemoryHistory;
|
|
20
|
-
const history = (options = {}) => selectedHistory(options);
|
|
21
|
-
const browserHistory = selectedHistory();
|
|
17
|
+
import { R as RouteLoader } from './RouteLoader-5171c63f.js';
|
|
22
18
|
|
|
23
19
|
const storeSurrogateKeys = response => {
|
|
24
20
|
const keys = response.headers.get ? response.headers.get('surrogate-key') : response.headers.map['surrogate-key'];
|
|
25
|
-
if (keys) reduxStore.dispatch(setSurrogateKeys(keys));
|
|
21
|
+
if (keys) reduxStore === null || reduxStore === void 0 ? void 0 : reduxStore.dispatch(setSurrogateKeys(keys, response.url));
|
|
26
22
|
};
|
|
27
23
|
|
|
28
24
|
const getClientConfig = project => {
|
|
@@ -33,7 +29,7 @@ const getClientConfig = project => {
|
|
|
33
29
|
|
|
34
30
|
if (project) {
|
|
35
31
|
config.projectId = project;
|
|
36
|
-
} //
|
|
32
|
+
} // we only want the surrogate key header in a server context
|
|
37
33
|
|
|
38
34
|
|
|
39
35
|
if (typeof window === 'undefined') {
|
|
@@ -58,7 +54,15 @@ const getClientConfig = project => {
|
|
|
58
54
|
class DeliveryApi {
|
|
59
55
|
constructor() {
|
|
60
56
|
this.getClientSideVersionStatus = () => {
|
|
61
|
-
if (typeof window
|
|
57
|
+
if (typeof window !== 'undefined') {
|
|
58
|
+
// Allow overriding versionStatus with the querystring
|
|
59
|
+
const {
|
|
60
|
+
versionStatus
|
|
61
|
+
} = parse(window.location.search);
|
|
62
|
+
if (versionStatus) return versionStatus; // Client-side we will have a global variable set if rendered by SSR in production
|
|
63
|
+
|
|
64
|
+
if (typeof window.versionStatus !== 'undefined') return window.versionStatus; // For localhost development we can only work out versionStatus from the current hostname
|
|
65
|
+
|
|
62
66
|
const currentHostname = window.location.hostname;
|
|
63
67
|
return this.getVersionStatusFromHostname(currentHostname);
|
|
64
68
|
}
|
|
@@ -66,6 +70,14 @@ class DeliveryApi {
|
|
|
66
70
|
return null;
|
|
67
71
|
};
|
|
68
72
|
|
|
73
|
+
this.getServerSideVersionStatus = request => request.query.versionStatus || deliveryApi.getVersionStatusFromHeaders(request.headers) || deliveryApi.getVersionStatusFromHostname(request.hostname);
|
|
74
|
+
|
|
75
|
+
this.getVersionStatusFromHeaders = headers => {
|
|
76
|
+
const versionStatusHeader = headers['x-entry-versionstatus'];
|
|
77
|
+
if (typeof versionStatusHeader !== 'undefined') return versionStatusHeader;
|
|
78
|
+
return null;
|
|
79
|
+
};
|
|
80
|
+
|
|
69
81
|
this.getVersionStatusFromHostname = currentHostname => {
|
|
70
82
|
if (currentHostname.indexOf('localhost') > -1) return 'latest';
|
|
71
83
|
|
|
@@ -181,6 +193,7 @@ class LruCache {
|
|
|
181
193
|
|
|
182
194
|
remove(key) {
|
|
183
195
|
let node = this.map[key];
|
|
196
|
+
if (!node) return; // This is sometimes null and crashes the container without this check
|
|
184
197
|
|
|
185
198
|
if (node.prev) {
|
|
186
199
|
node.prev.next = node.next;
|
|
@@ -211,6 +224,11 @@ class CachedSearch {
|
|
|
211
224
|
return this.request(project + JSON.stringify(query) + linkDepth.toString(), () => client.entries.search(query, linkDepth));
|
|
212
225
|
}
|
|
213
226
|
|
|
227
|
+
searchUsingPost(query, linkDepth = 0, project = '', env) {
|
|
228
|
+
const client = Client.create(getClientConfig(project));
|
|
229
|
+
return this.request(project + JSON.stringify(query) + linkDepth.toString(), () => client.entries.searchUsingPost(query, linkDepth));
|
|
230
|
+
}
|
|
231
|
+
|
|
214
232
|
get(id, linkDepth, versionStatus, project, env) {
|
|
215
233
|
const client = Client.create(getClientConfig(project));
|
|
216
234
|
client.clientConfig.versionStatus = versionStatus;
|
|
@@ -267,32 +285,14 @@ class CachedSearch {
|
|
|
267
285
|
return this.cache.get(key);
|
|
268
286
|
}
|
|
269
287
|
|
|
270
|
-
extendTaxonomyNode(node) {
|
|
271
|
-
let id = this.getTaxonomyId(node);
|
|
272
|
-
this.taxonomyLookup[id] = node.key;
|
|
273
|
-
return { ...node,
|
|
274
|
-
id,
|
|
275
|
-
children: node.children ? node.children.map(n => this.extendTaxonomyNode(n)) : null
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
getTaxonomyId(node) {
|
|
280
|
-
if (node.key) {
|
|
281
|
-
let parts = node.key.split('/');
|
|
282
|
-
return parts[parts.length - 1];
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
return '';
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
getTaxonomyKey(id) {
|
|
289
|
-
return this.taxonomyLookup[id];
|
|
290
|
-
}
|
|
291
|
-
|
|
292
288
|
}
|
|
293
289
|
|
|
294
290
|
const cachedSearch = new CachedSearch();
|
|
295
291
|
|
|
292
|
+
const selectedHistory = typeof window !== 'undefined' ? createBrowserHistory : createMemoryHistory;
|
|
293
|
+
const history = (options = {}) => selectedHistory(options);
|
|
294
|
+
const browserHistory = selectedHistory();
|
|
295
|
+
|
|
296
296
|
const navigationSagas = [takeEvery(GET_NODE_TREE, ensureNodeTreeSaga)];
|
|
297
297
|
function* ensureNodeTreeSaga(action) {
|
|
298
298
|
const state = yield select();
|
|
@@ -317,6 +317,7 @@ function* ensureNodeTreeSaga(action) {
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
} catch (ex) {
|
|
320
|
+
log.error(...['Error running ensureNodeTreeSaga:', ex]);
|
|
320
321
|
yield put({
|
|
321
322
|
type: GET_NODE_TREE_ERROR,
|
|
322
323
|
error: ex.toString()
|
|
@@ -379,7 +380,7 @@ function* getRouteSaga(action) {
|
|
|
379
380
|
let entry = null;
|
|
380
381
|
|
|
381
382
|
try {
|
|
382
|
-
var
|
|
383
|
+
var _staticRoute$route, _staticRoute$route$pa, _staticRoute$route2, _staticRoute$route2$p, _pathNode2, _pathNode2$entry, _pathNode2$entry$sys, _pathNode3, _pathNode3$entry, _pathNode3$entry$sys;
|
|
383
384
|
|
|
384
385
|
const {
|
|
385
386
|
withEvents,
|
|
@@ -393,7 +394,9 @@ function* getRouteSaga(action) {
|
|
|
393
394
|
|
|
394
395
|
let pathNode = null,
|
|
395
396
|
ancestors = null,
|
|
396
|
-
|
|
397
|
+
children = [],
|
|
398
|
+
siblings = null;
|
|
399
|
+
let contentTypeMapping = {}; // These variables are the return values from
|
|
397
400
|
// calls to withEvents.onRouteLoad and onRouteLoaded
|
|
398
401
|
|
|
399
402
|
let appsays,
|
|
@@ -401,22 +404,20 @@ function* getRouteSaga(action) {
|
|
|
401
404
|
|
|
402
405
|
if (withEvents && withEvents.onRouteLoad) {
|
|
403
406
|
appsays = yield withEvents.onRouteLoad(action);
|
|
404
|
-
}
|
|
405
|
-
// if appsays customNavigation: { ... }, we will set doNavigation to the customNavigation object and check for child elements
|
|
406
|
-
// if appsays nothing we will set doNavigation to true and continue to do navigation calls
|
|
407
|
-
|
|
407
|
+
}
|
|
408
408
|
|
|
409
|
-
const
|
|
410
|
-
const
|
|
411
|
-
const
|
|
409
|
+
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;
|
|
410
|
+
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;
|
|
411
|
+
const entryLinkDepth = appsays && appsays.entryLinkDepth !== undefined ? appsays.entryLinkDepth : 2;
|
|
412
|
+
const setContentTypeLimits = (typeof staticRouteLinkDepth === 'undefined' || !staticRouteFields) && !!ContentTypeMappings.find(ct => ct.fields || ct.linkDepth || ct.nodeOptions);
|
|
412
413
|
const state = yield select();
|
|
413
414
|
const routeEntry = selectRouteEntry(state, 'js');
|
|
414
415
|
const routeNode = selectCurrentNode(state, 'js');
|
|
415
416
|
const currentPath = action.path; //selectCurrentPath(state);
|
|
416
417
|
|
|
417
418
|
const deliveryApiStatus = selectVersionStatus(state);
|
|
418
|
-
const project = selectCurrentProject(state);
|
|
419
|
-
|
|
419
|
+
const project = selectCurrentProject(state); // const isHome = currentPath === '/';
|
|
420
|
+
|
|
420
421
|
const isPreview = currentPath && currentPath.startsWith('/preview/');
|
|
421
422
|
const defaultLang = appsays && appsays.defaultLang || 'en-GB';
|
|
422
423
|
|
|
@@ -441,130 +442,89 @@ function* getRouteSaga(action) {
|
|
|
441
442
|
type: UPDATE_LOADING_STATE,
|
|
442
443
|
isLoading: false
|
|
443
444
|
});
|
|
444
|
-
} else yield call(setRouteEntry, routeEntry, yield select(selectCurrentNode), yield select(selectCurrentAncestors));
|
|
445
|
+
} else yield call(setRouteEntry, routeEntry, yield select(selectCurrentNode), yield select(selectCurrentAncestors), yield select(selectCurrentSiblings));
|
|
445
446
|
} else {
|
|
446
|
-
// Handle
|
|
447
|
-
if (
|
|
448
|
-
|
|
447
|
+
// Handle preview routes
|
|
448
|
+
if (isPreview) {
|
|
449
|
+
let splitPath = currentPath.split('/');
|
|
450
|
+
let entryGuid = splitPath[2];
|
|
451
|
+
let language = defaultLang;
|
|
452
|
+
|
|
453
|
+
if (splitPath.length >= 3) {
|
|
454
|
+
//set lang key if available in the path, else use default lang
|
|
455
|
+
//assumes preview url on content type is: http://preview.ALIAS.contensis.cloud/preview/{GUID}/{LANG}
|
|
456
|
+
if (splitPath.length == 4) language = splitPath[3]; // According to product dev we cannot use Node API
|
|
457
|
+
// for previewing entries as it gives a response of []
|
|
458
|
+
// -- apparently it is not correct to request latest content
|
|
459
|
+
// with Node API
|
|
460
|
+
|
|
461
|
+
let previewEntry = yield deliveryApi.getClient(deliveryApiStatus, project).entries.get({
|
|
462
|
+
id: entryGuid,
|
|
463
|
+
language,
|
|
464
|
+
linkDepth: entryLinkDepth
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
if (previewEntry) {
|
|
468
|
+
pathNode = {
|
|
469
|
+
entry: previewEntry
|
|
470
|
+
};
|
|
471
|
+
({
|
|
472
|
+
entry
|
|
473
|
+
} = pathNode || {});
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
} else {
|
|
477
|
+
var _pathNode, _pathNode$entry, _pathNode$entry$sys;
|
|
478
|
+
|
|
479
|
+
// Handle all other routes
|
|
480
|
+
pathNode = yield cachedSearch.getNode({
|
|
449
481
|
depth: 0,
|
|
450
|
-
|
|
451
|
-
|
|
482
|
+
path: currentPath,
|
|
483
|
+
entryFields: setContentTypeLimits ? ['sys.contentTypeId', 'sys.id'] : staticRouteFields || '*',
|
|
484
|
+
entryLinkDepth: setContentTypeLimits ? 0 : typeof staticRouteLinkDepth !== 'undefined' ? staticRouteLinkDepth : entryLinkDepth,
|
|
452
485
|
language: defaultLang,
|
|
453
486
|
versionStatus: deliveryApiStatus
|
|
454
487
|
}, project);
|
|
455
488
|
({
|
|
456
489
|
entry
|
|
457
490
|
} = pathNode || {});
|
|
458
|
-
} else {
|
|
459
|
-
// Handle preview routes
|
|
460
|
-
if (isPreview) {
|
|
461
|
-
let splitPath = currentPath.split('/');
|
|
462
|
-
let entryGuid = splitPath[2];
|
|
463
|
-
let language = defaultLang;
|
|
464
|
-
|
|
465
|
-
if (splitPath.length >= 3) {
|
|
466
|
-
//set lang key if available in the path, else use default lang
|
|
467
|
-
//assumes preview url on content type is: http://preview.ALIAS.contensis.cloud/preview/{GUID}/{LANG}
|
|
468
|
-
if (splitPath.length == 4) language = splitPath[3]; // According to product dev we cannot use Node API
|
|
469
|
-
// for previewing entries as it gives a response of []
|
|
470
|
-
// -- apparently it is not correct to request latest content
|
|
471
|
-
// with Node API
|
|
472
|
-
|
|
473
|
-
let previewEntry = yield deliveryApi.getClient(deliveryApiStatus, project).entries.get({
|
|
474
|
-
id: entryGuid,
|
|
475
|
-
language,
|
|
476
|
-
linkDepth: entryLinkDepth
|
|
477
|
-
});
|
|
478
|
-
|
|
479
|
-
if (previewEntry) {
|
|
480
|
-
pathNode = {
|
|
481
|
-
entry: previewEntry
|
|
482
|
-
};
|
|
483
|
-
({
|
|
484
|
-
entry
|
|
485
|
-
} = pathNode || {});
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
} else {
|
|
489
|
-
// Handle all other routes
|
|
490
|
-
const childrenDepth = doNavigation === true || doNavigation.children === true ? 1 : doNavigation && doNavigation.children || 0;
|
|
491
|
-
pathNode = yield cachedSearch.getNode({
|
|
492
|
-
depth: childrenDepth,
|
|
493
|
-
path: currentPath,
|
|
494
|
-
entryFields: setContentTypeLimits ? ['sys.contentTypeId', 'sys.id'] : '*',
|
|
495
|
-
entryLinkDepth: setContentTypeLimits ? 0 : entryLinkDepth,
|
|
496
|
-
language: defaultLang,
|
|
497
|
-
versionStatus: deliveryApiStatus
|
|
498
|
-
}, project);
|
|
499
|
-
({
|
|
500
|
-
entry
|
|
501
|
-
} = pathNode || {});
|
|
502
|
-
|
|
503
|
-
if (setContentTypeLimits && pathNode && pathNode.entry && pathNode.entry.sys && pathNode.entry.sys.id) {
|
|
504
|
-
// Get fields[] and linkDepth from ContentTypeMapping to get the entry data
|
|
505
|
-
// at a specified depth with specified fields
|
|
506
|
-
const {
|
|
507
|
-
fields,
|
|
508
|
-
linkDepth,
|
|
509
|
-
nodeOptions = {}
|
|
510
|
-
} = findContentTypeMapping(ContentTypeMappings, pathNode.entry.sys.contentTypeId) || {};
|
|
511
|
-
const query = routeEntryByFieldsQuery(pathNode.entry.sys.id, pathNode.entry.sys.language, fields, deliveryApiStatus);
|
|
512
|
-
const payload = yield cachedSearch.search(query, linkDepth || entryLinkDepth || 0, project);
|
|
513
|
-
|
|
514
|
-
if (payload && payload.items && payload.items.length > 0) {
|
|
515
|
-
pathNode.entry = entry = payload.items[0];
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
if (childrenDepth > 0 || nodeOptions.children) {
|
|
519
|
-
const childrenOptions = nodeOptions.children || {}; // We need to make a separate call for child nodes if the first node query has been
|
|
520
|
-
// limited by linkDepth or fields[]
|
|
521
|
-
|
|
522
|
-
const childNodes = yield cachedSearch.getChildren({
|
|
523
|
-
id: pathNode.id,
|
|
524
|
-
entryFields: childrenOptions.fields || fields || '*',
|
|
525
|
-
entryLinkDepth: childrenOptions.linkDepth || linkDepth || entryLinkDepth || 0,
|
|
526
|
-
language: defaultLang,
|
|
527
|
-
versionStatus: deliveryApiStatus
|
|
528
|
-
});
|
|
529
|
-
|
|
530
|
-
if (childNodes) {
|
|
531
|
-
pathNode.children = childNodes;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
491
|
|
|
537
|
-
if (pathNode &&
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
if (
|
|
551
|
-
|
|
552
|
-
siblings = yield cachedSearch.getSiblings({
|
|
553
|
-
id: pathNode.id,
|
|
554
|
-
language: defaultLang,
|
|
555
|
-
versionStatus: deliveryApiStatus
|
|
556
|
-
}, project);
|
|
557
|
-
} catch (ex) {
|
|
558
|
-
log.info('Problem fetching siblings', ex);
|
|
559
|
-
}
|
|
492
|
+
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) {
|
|
493
|
+
var _payload$items;
|
|
494
|
+
|
|
495
|
+
// Get fields[] and linkDepth from ContentTypeMapping to get the entry data
|
|
496
|
+
// and current node's ordinates at a specified depth with specified fields
|
|
497
|
+
contentTypeMapping = findContentTypeMapping(ContentTypeMappings, pathNode.entry.sys.contentTypeId) || {};
|
|
498
|
+
const {
|
|
499
|
+
fields,
|
|
500
|
+
linkDepth
|
|
501
|
+
} = contentTypeMapping;
|
|
502
|
+
const query = routeEntryByFieldsQuery(pathNode.entry.sys.id, pathNode.entry.sys.language, fields, deliveryApiStatus);
|
|
503
|
+
const payload = yield cachedSearch.search(query, typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth || 0, project);
|
|
504
|
+
|
|
505
|
+
if ((payload === null || payload === void 0 ? void 0 : (_payload$items = payload.items) === null || _payload$items === void 0 ? void 0 : _payload$items.length) > 0) {
|
|
506
|
+
pathNode.entry = entry = payload.items[0];
|
|
560
507
|
}
|
|
561
508
|
}
|
|
562
|
-
}
|
|
509
|
+
} // make calls to fetch node ancestors, children,
|
|
510
|
+
// siblings or entire node tree
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
[ancestors, children, siblings] = yield call(resolveCurrentNodeOrdinates, {
|
|
514
|
+
appsays,
|
|
515
|
+
contentTypeMapping,
|
|
516
|
+
language: defaultLang,
|
|
517
|
+
path: currentPath,
|
|
518
|
+
pathNode,
|
|
519
|
+
project,
|
|
520
|
+
versionStatus: deliveryApiStatus
|
|
521
|
+
});
|
|
522
|
+
if (children) pathNode.children = children;
|
|
563
523
|
}
|
|
564
524
|
|
|
565
|
-
const
|
|
525
|
+
const resolvedContentTypeMapping = 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
|
|
566
526
|
|
|
567
|
-
if (
|
|
527
|
+
if (resolvedContentTypeMapping.injectRedux) yield call(reduxInjectorSaga, resolvedContentTypeMapping.injectRedux);
|
|
568
528
|
|
|
569
529
|
if (withEvents && withEvents.onRouteLoaded) {
|
|
570
530
|
// Check if the app has provided a requireLogin boolean flag or groups array
|
|
@@ -584,37 +544,123 @@ function* getRouteSaga(action) {
|
|
|
584
544
|
});
|
|
585
545
|
}
|
|
586
546
|
|
|
587
|
-
if (
|
|
547
|
+
if (!appsays || !appsays.preventScrollTop) {
|
|
548
|
+
// Scroll into View
|
|
549
|
+
if (typeof window !== 'undefined') window.scrollTo(0, 0);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
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) {
|
|
553
|
+
var _staticRoute$route3, _staticRoute$route3$f, _appsays;
|
|
554
|
+
|
|
588
555
|
entry = pathNode.entry;
|
|
589
|
-
|
|
590
|
-
entryMapper
|
|
591
|
-
} = contentTypeMapping;
|
|
592
|
-
yield call(setRouteEntry, entry, pathNode, ancestors, siblings, entryMapper, false, appsays && appsays.refetchNode);
|
|
556
|
+
yield call(setRouteEntry, 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);
|
|
593
557
|
} else {
|
|
594
558
|
if (staticRoute) yield call(setRouteEntry, null, pathNode, ancestors, siblings);else yield call(do404);
|
|
595
559
|
}
|
|
560
|
+
} catch (e) {
|
|
561
|
+
log.error(...['Error running route saga:', e, e.stack]);
|
|
562
|
+
yield call(do500, e);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
596
565
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
566
|
+
function* resolveCurrentNodeOrdinates({
|
|
567
|
+
appsays,
|
|
568
|
+
contentTypeMapping,
|
|
569
|
+
language,
|
|
570
|
+
path,
|
|
571
|
+
pathNode,
|
|
572
|
+
project,
|
|
573
|
+
versionStatus
|
|
574
|
+
}) {
|
|
575
|
+
const apiCall = [() => null, () => null, () => null, () => null]; // if appsays customNavigation: true, we will set doNavigation to false
|
|
576
|
+
// if appsays customNavigation: { ... }, we will set doNavigation to the customNavigation object and check for child elements
|
|
577
|
+
// if appsays nothing we will set doNavigation to true and continue to do navigation calls
|
|
578
|
+
|
|
579
|
+
const doNavigation = !appsays || ((appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) === true ? false : (appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) || true);
|
|
580
|
+
const {
|
|
581
|
+
entryLinkDepth = 0,
|
|
582
|
+
fields,
|
|
583
|
+
linkDepth,
|
|
584
|
+
nodeOptions = {}
|
|
585
|
+
} = contentTypeMapping;
|
|
586
|
+
|
|
587
|
+
if (pathNode && pathNode.id) {
|
|
588
|
+
if (doNavigation === true || doNavigation.ancestors) {
|
|
589
|
+
apiCall[0] = function* getAncestors() {
|
|
590
|
+
try {
|
|
591
|
+
return yield cachedSearch.getAncestors({
|
|
592
|
+
id: pathNode.id,
|
|
593
|
+
language,
|
|
594
|
+
versionStatus
|
|
595
|
+
}, project);
|
|
596
|
+
} catch (ex) {
|
|
597
|
+
log.info('Problem fetching ancestors', ex);
|
|
598
|
+
return [];
|
|
599
|
+
}
|
|
600
|
+
};
|
|
604
601
|
}
|
|
605
602
|
|
|
606
|
-
|
|
607
|
-
|
|
603
|
+
const childrenDepth = doNavigation === true || doNavigation.children === true ? 1 : doNavigation && doNavigation.children || 0;
|
|
604
|
+
|
|
605
|
+
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.children) === 'undefined' && childrenDepth > 0 || nodeOptions.children) {
|
|
606
|
+
const childrenOptions = typeof nodeOptions.children === 'boolean' ? {} : nodeOptions.children;
|
|
607
|
+
|
|
608
|
+
apiCall[1] = function* getChildren() {
|
|
609
|
+
try {
|
|
610
|
+
return yield cachedSearch.getNode({
|
|
611
|
+
depth: childrenOptions.depth !== undefined ? childrenOptions.depth : childrenDepth,
|
|
612
|
+
path,
|
|
613
|
+
entryFields: childrenOptions.fields || fields || undefined,
|
|
614
|
+
entryLinkDepth: typeof childrenOptions.linkDepth !== 'undefined' ? childrenOptions.linkDepth : typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth,
|
|
615
|
+
language,
|
|
616
|
+
versionStatus
|
|
617
|
+
}, project);
|
|
618
|
+
} catch (ex) {
|
|
619
|
+
log.info('Problem fetching children', ex);
|
|
620
|
+
return [];
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.siblings) === 'undefined' && doNavigation.siblings || nodeOptions.siblings) {
|
|
626
|
+
apiCall[2] = function* getSiblings() {
|
|
627
|
+
try {
|
|
628
|
+
var _nodeOptions$siblings, _nodeOptions$siblings2;
|
|
629
|
+
|
|
630
|
+
return yield cachedSearch.getSiblings({
|
|
631
|
+
id: pathNode.id,
|
|
632
|
+
entryFields: (nodeOptions === null || nodeOptions === void 0 ? void 0 : (_nodeOptions$siblings = nodeOptions.siblings) === null || _nodeOptions$siblings === void 0 ? void 0 : _nodeOptions$siblings.fields) || fields || undefined,
|
|
633
|
+
entryLinkDepth: typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : (_nodeOptions$siblings2 = nodeOptions.siblings) === null || _nodeOptions$siblings2 === void 0 ? void 0 : _nodeOptions$siblings2.linkDepth) !== 'undefined' ? nodeOptions.siblings.linkDepth : typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth,
|
|
634
|
+
includeInMenu: true,
|
|
635
|
+
language,
|
|
636
|
+
versionStatus
|
|
637
|
+
}, project);
|
|
638
|
+
} catch (ex) {
|
|
639
|
+
log.info('Problem fetching siblings', ex);
|
|
640
|
+
return [];
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
const isTreeLoaded = yield select(hasNavigationTree);
|
|
647
|
+
if (!isTreeLoaded && (doNavigation === true || doNavigation.tree)) apiCall[3] = function* getNodeTree() {
|
|
648
|
+
const treeDepth = doNavigation === true || !doNavigation.tree || doNavigation.tree === true ? 2 : doNavigation.tree;
|
|
649
|
+
|
|
650
|
+
if (typeof window !== 'undefined') {
|
|
651
|
+
return yield put({
|
|
608
652
|
type: GET_NODE_TREE,
|
|
609
|
-
treeDepth
|
|
653
|
+
treeDepth
|
|
610
654
|
});
|
|
611
655
|
} else {
|
|
612
|
-
yield call(ensureNodeTreeSaga
|
|
656
|
+
return yield call(ensureNodeTreeSaga, {
|
|
657
|
+
treeDepth
|
|
658
|
+
});
|
|
613
659
|
}
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
660
|
+
};
|
|
661
|
+
const [loadAncestors, loadChildren, loadSiblings, loadTree] = apiCall;
|
|
662
|
+
const [ancestors, nodeWithChildren, siblings] = yield all([loadAncestors(), loadChildren(), loadSiblings(), loadTree()]);
|
|
663
|
+
return [ancestors, nodeWithChildren === null || nodeWithChildren === void 0 ? void 0 : nodeWithChildren.children, siblings];
|
|
618
664
|
}
|
|
619
665
|
|
|
620
666
|
function* setRouteEntry(entry, node, ancestors, siblings, entryMapper, notFound = false, remapEntry = false) {
|
|
@@ -951,7 +997,7 @@ function* changePasswordSaga(action) {
|
|
|
951
997
|
yield put({
|
|
952
998
|
type: CHANGE_USER_PASSWORD_SENDING
|
|
953
999
|
});
|
|
954
|
-
const clientCredentials = yield select(selectClientCredentials);
|
|
1000
|
+
const clientCredentials = yield select(selectClientCredentials, 'js');
|
|
955
1001
|
const client = yield getManagementApiClient({ ...clientCredentials
|
|
956
1002
|
});
|
|
957
1003
|
const [err, res] = yield to(client.security.users.updatePassword(changePasswordObject));
|
|
@@ -1039,5 +1085,5 @@ const AppRoot = props => {
|
|
|
1039
1085
|
return /*#__PURE__*/React.createElement(RouteLoader, props);
|
|
1040
1086
|
};
|
|
1041
1087
|
|
|
1042
|
-
export { AppRoot as A, browserHistory as b, deliveryApi as d, history as h, pickProject as p, rootSaga as r };
|
|
1043
|
-
//# sourceMappingURL=App-
|
|
1088
|
+
export { AppRoot as A, browserHistory as b, cachedSearch as c, deliveryApi as d, history as h, pickProject as p, rootSaga as r };
|
|
1089
|
+
//# sourceMappingURL=App-069378e0.js.map
|