@zengenti/contensis-react-base 3.0.0-beta.7 → 3.0.0-beta.72
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 +1 -1
- package/cjs/{App-3324f784.js → App-80a696bc.js} +210 -179
- package/cjs/App-80a696bc.js.map +1 -0
- package/cjs/{RouteLoader-c7957b14.js → RouteLoader-2675e1c9.js} +31 -23
- package/cjs/RouteLoader-2675e1c9.js.map +1 -0
- package/cjs/ToJs-a9a8522b.js +129 -0
- package/cjs/ToJs-a9a8522b.js.map +1 -0
- package/cjs/VersionInfo-4c9dfa6a.js +181 -0
- package/cjs/VersionInfo-4c9dfa6a.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 +17 -22
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +3761 -156
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +181 -100
- package/cjs/forms.js.map +1 -1
- package/cjs/{fromJSLeaveImmer-c00d597f.js → fromJSLeaveImmer-e74c673c.js} +2 -16
- package/cjs/fromJSLeaveImmer-e74c673c.js.map +1 -0
- package/cjs/{login-c810cc4c.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-24f5607f.js +2052 -0
- package/cjs/sagas-24f5607f.js.map +1 -0
- package/cjs/search.js +283 -1909
- 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/user.js +21 -12
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +55 -212
- package/cjs/util.js.map +1 -1
- package/cjs/{version-4f0f5fa6.js → version-330551f5.js} +34 -22
- package/cjs/version-330551f5.js.map +1 -0
- package/cjs/{version-085d203d.js → version-eba6d09b.js} +5 -5
- package/cjs/version-eba6d09b.js.map +1 -0
- package/esm/{App-1b05ab11.js → App-af0670fa.js} +210 -180
- package/esm/App-af0670fa.js.map +1 -0
- package/esm/{RouteLoader-e5f0e8cb.js → RouteLoader-f96a61c1.js} +31 -23
- package/esm/RouteLoader-f96a61c1.js.map +1 -0
- package/esm/ToJs-affd73f1.js +99 -0
- package/esm/ToJs-affd73f1.js.map +1 -0
- package/esm/VersionInfo-f5403b09.js +172 -0
- package/esm/VersionInfo-f5403b09.js.map +1 -0
- package/esm/{actions-927d9698.js → actions-fcfc8704.js} +5 -4
- package/esm/actions-fcfc8704.js.map +1 -0
- package/esm/client.js +18 -23
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +3759 -155
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +182 -102
- package/esm/forms.js.map +1 -1
- package/esm/{fromJSLeaveImmer-392af4e3.js → fromJSLeaveImmer-0114ffcf.js} +2 -16
- package/esm/fromJSLeaveImmer-0114ffcf.js.map +1 -0
- package/esm/{login-f8ba3aeb.js → login-ca2dc2f7.js} +92 -55
- package/esm/login-ca2dc2f7.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-489c29ca.js +1966 -0
- package/esm/sagas-489c29ca.js.map +1 -0
- package/esm/search.js +243 -1850
- package/esm/search.js.map +1 -1
- package/esm/{selectors-b98d5c76.js → selectors-337be432.js} +7 -4
- package/esm/selectors-337be432.js.map +1 -0
- package/esm/user.js +23 -14
- package/esm/user.js.map +1 -1
- package/esm/util.js +54 -209
- package/esm/util.js.map +1 -1
- package/esm/version-6dd7b2cd.js +15 -0
- package/esm/version-6dd7b2cd.js.map +1 -0
- package/esm/{version-16aa83eb.js → version-c7268214.js} +33 -22
- package/esm/version-c7268214.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/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 +9 -3
- 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 +4 -1
- 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 +4 -3
- 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 +2 -1
- package/models/search/redux/reducers.d.ts +230 -314
- package/models/search/redux/sagas.d.ts +5 -5
- package/models/search/redux/selectors.d.ts +19 -22
- package/models/search/search/ContensisDeliveryApi.d.ts +1 -0
- package/models/search/search/expressions.d.ts +3 -6
- package/models/search/{redux → search}/queries.d.ts +0 -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/api.d.ts +12 -0
- package/models/server/features/linkdepth-api/events-api.config.d.ts +37 -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 +4 -2
- package/models/user/hooks/useChangePassword.d.ts +5 -5
- package/models/user/hooks/useForgotPassword.d.ts +6 -6
- package/models/user/hooks/useLogin.d.ts +9 -45
- package/models/user/hooks/useRegistration.d.ts +4 -4
- 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 +33 -71
- package/models/user/util/LoginHelper.class.d.ts +4 -3
- package/models/util/ContensisDeliveryApi.d.ts +1 -3
- package/models/util/json-mapper.d.ts +9 -3
- package/models/util/merge.d.ts +1 -0
- package/package.json +60 -55
- package/CHANGELOG.md +0 -293
- package/cjs/App-3324f784.js.map +0 -1
- package/cjs/RouteLoader-c7957b14.js.map +0 -1
- package/cjs/ToJs-a38fa20e.js +0 -230
- package/cjs/ToJs-a38fa20e.js.map +0 -1
- package/cjs/actions-a24bf46e.js.map +0 -1
- package/cjs/fromJSLeaveImmer-c00d597f.js.map +0 -1
- package/cjs/login-c810cc4c.js.map +0 -1
- package/cjs/reducers-fde41d6b.js.map +0 -1
- package/cjs/selectors-0ec95076.js.map +0 -1
- package/cjs/version-085d203d.js.map +0 -1
- package/cjs/version-4f0f5fa6.js.map +0 -1
- package/esm/App-1b05ab11.js.map +0 -1
- package/esm/RouteLoader-e5f0e8cb.js.map +0 -1
- package/esm/ToJs-879a5a85.js +0 -199
- package/esm/ToJs-879a5a85.js.map +0 -1
- package/esm/actions-927d9698.js.map +0 -1
- package/esm/fromJSLeaveImmer-392af4e3.js.map +0 -1
- package/esm/login-f8ba3aeb.js.map +0 -1
- package/esm/reducers-d6c0edb1.js.map +0 -1
- package/esm/selectors-b98d5c76.js.map +0 -1
- package/esm/version-16aa83eb.js.map +0 -1
- package/esm/version-3833e8b5.js +0 -15
- package/esm/version-3833e8b5.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-927d9698.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-16aa83eb.js';
|
|
6
|
-
import { s as selectVersionStatus } from './version-3833e8b5.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-b98d5c76.js';
|
|
8
3
|
import * as log from 'loglevel';
|
|
9
|
-
import {
|
|
4
|
+
import { Client, Op, Query } from 'contensis-delivery-api';
|
|
5
|
+
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-fcfc8704.js';
|
|
6
|
+
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-c7268214.js';
|
|
7
|
+
import { s as selectVersionStatus } from './version-6dd7b2cd.js';
|
|
8
|
+
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-337be432.js';
|
|
9
|
+
import { f as findContentTypeMapping, h as handleRequiresLoginSaga, g as getManagementApiClient, l as loginSagas } from './login-ca2dc2f7.js';
|
|
10
10
|
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-
|
|
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-8e5d6232.js';
|
|
12
|
+
import { s as selectClientCredentials } from './ToJs-affd73f1.js';
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import 'react-hot-loader';
|
|
15
15
|
import 'jsonpath-mapper';
|
|
16
16
|
import 'query-string';
|
|
17
|
-
import { R as RouteLoader } from './RouteLoader-
|
|
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-f96a61c1.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') {
|
|
@@ -211,6 +207,11 @@ class CachedSearch {
|
|
|
211
207
|
return this.request(project + JSON.stringify(query) + linkDepth.toString(), () => client.entries.search(query, linkDepth));
|
|
212
208
|
}
|
|
213
209
|
|
|
210
|
+
searchUsingPost(query, linkDepth = 0, project = '', env) {
|
|
211
|
+
const client = Client.create(getClientConfig(project));
|
|
212
|
+
return this.request(project + JSON.stringify(query) + linkDepth.toString(), () => client.entries.searchUsingPost(query, linkDepth));
|
|
213
|
+
}
|
|
214
|
+
|
|
214
215
|
get(id, linkDepth, versionStatus, project, env) {
|
|
215
216
|
const client = Client.create(getClientConfig(project));
|
|
216
217
|
client.clientConfig.versionStatus = versionStatus;
|
|
@@ -267,32 +268,14 @@ class CachedSearch {
|
|
|
267
268
|
return this.cache.get(key);
|
|
268
269
|
}
|
|
269
270
|
|
|
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
271
|
}
|
|
293
272
|
|
|
294
273
|
const cachedSearch = new CachedSearch();
|
|
295
274
|
|
|
275
|
+
const selectedHistory = typeof window !== 'undefined' ? createBrowserHistory : createMemoryHistory;
|
|
276
|
+
const history = (options = {}) => selectedHistory(options);
|
|
277
|
+
const browserHistory = selectedHistory();
|
|
278
|
+
|
|
296
279
|
const navigationSagas = [takeEvery(GET_NODE_TREE, ensureNodeTreeSaga)];
|
|
297
280
|
function* ensureNodeTreeSaga(action) {
|
|
298
281
|
const state = yield select();
|
|
@@ -317,6 +300,7 @@ function* ensureNodeTreeSaga(action) {
|
|
|
317
300
|
}
|
|
318
301
|
}
|
|
319
302
|
} catch (ex) {
|
|
303
|
+
log.error(...['Error running ensureNodeTreeSaga:', ex]);
|
|
320
304
|
yield put({
|
|
321
305
|
type: GET_NODE_TREE_ERROR,
|
|
322
306
|
error: ex.toString()
|
|
@@ -379,7 +363,7 @@ function* getRouteSaga(action) {
|
|
|
379
363
|
let entry = null;
|
|
380
364
|
|
|
381
365
|
try {
|
|
382
|
-
var
|
|
366
|
+
var _pathNode2, _pathNode2$entry, _pathNode2$entry$sys, _pathNode3, _pathNode3$entry, _pathNode3$entry$sys;
|
|
383
367
|
|
|
384
368
|
const {
|
|
385
369
|
withEvents,
|
|
@@ -393,7 +377,9 @@ function* getRouteSaga(action) {
|
|
|
393
377
|
|
|
394
378
|
let pathNode = null,
|
|
395
379
|
ancestors = null,
|
|
396
|
-
|
|
380
|
+
children = [],
|
|
381
|
+
siblings = null;
|
|
382
|
+
let contentTypeMapping = {}; // These variables are the return values from
|
|
397
383
|
// calls to withEvents.onRouteLoad and onRouteLoaded
|
|
398
384
|
|
|
399
385
|
let appsays,
|
|
@@ -401,13 +387,9 @@ function* getRouteSaga(action) {
|
|
|
401
387
|
|
|
402
388
|
if (withEvents && withEvents.onRouteLoad) {
|
|
403
389
|
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
|
-
|
|
390
|
+
}
|
|
408
391
|
|
|
409
|
-
const
|
|
410
|
-
const entryLinkDepth = appsays && appsays.entryLinkDepth || 3;
|
|
392
|
+
const entryLinkDepth = appsays && appsays.entryLinkDepth !== undefined ? appsays.entryLinkDepth : 2;
|
|
411
393
|
const setContentTypeLimits = !!ContentTypeMappings.find(ct => ct.fields || ct.linkDepth || ct.nodeOptions);
|
|
412
394
|
const state = yield select();
|
|
413
395
|
const routeEntry = selectRouteEntry(state, 'js');
|
|
@@ -415,8 +397,8 @@ function* getRouteSaga(action) {
|
|
|
415
397
|
const currentPath = action.path; //selectCurrentPath(state);
|
|
416
398
|
|
|
417
399
|
const deliveryApiStatus = selectVersionStatus(state);
|
|
418
|
-
const project = selectCurrentProject(state);
|
|
419
|
-
|
|
400
|
+
const project = selectCurrentProject(state); // const isHome = currentPath === '/';
|
|
401
|
+
|
|
420
402
|
const isPreview = currentPath && currentPath.startsWith('/preview/');
|
|
421
403
|
const defaultLang = appsays && appsays.defaultLang || 'en-GB';
|
|
422
404
|
|
|
@@ -441,130 +423,92 @@ function* getRouteSaga(action) {
|
|
|
441
423
|
type: UPDATE_LOADING_STATE,
|
|
442
424
|
isLoading: false
|
|
443
425
|
});
|
|
444
|
-
} else yield call(setRouteEntry, routeEntry, yield select(selectCurrentNode), yield select(selectCurrentAncestors));
|
|
426
|
+
} else yield call(setRouteEntry, routeEntry, yield select(selectCurrentNode), yield select(selectCurrentAncestors), yield select(selectCurrentSiblings));
|
|
445
427
|
} else {
|
|
446
|
-
// Handle
|
|
447
|
-
if (
|
|
448
|
-
|
|
428
|
+
// Handle preview routes
|
|
429
|
+
if (isPreview) {
|
|
430
|
+
let splitPath = currentPath.split('/');
|
|
431
|
+
let entryGuid = splitPath[2];
|
|
432
|
+
let language = defaultLang;
|
|
433
|
+
|
|
434
|
+
if (splitPath.length >= 3) {
|
|
435
|
+
//set lang key if available in the path, else use default lang
|
|
436
|
+
//assumes preview url on content type is: http://preview.ALIAS.contensis.cloud/preview/{GUID}/{LANG}
|
|
437
|
+
if (splitPath.length == 4) language = splitPath[3]; // According to product dev we cannot use Node API
|
|
438
|
+
// for previewing entries as it gives a response of []
|
|
439
|
+
// -- apparently it is not correct to request latest content
|
|
440
|
+
// with Node API
|
|
441
|
+
|
|
442
|
+
let previewEntry = yield deliveryApi.getClient(deliveryApiStatus, project).entries.get({
|
|
443
|
+
id: entryGuid,
|
|
444
|
+
language,
|
|
445
|
+
linkDepth: entryLinkDepth
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
if (previewEntry) {
|
|
449
|
+
pathNode = {
|
|
450
|
+
entry: previewEntry
|
|
451
|
+
};
|
|
452
|
+
({
|
|
453
|
+
entry
|
|
454
|
+
} = pathNode || {});
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
} else {
|
|
458
|
+
var _pathNode, _pathNode$entry, _pathNode$entry$sys;
|
|
459
|
+
|
|
460
|
+
// Handle all other routes
|
|
461
|
+
pathNode = yield cachedSearch.getNode({
|
|
449
462
|
depth: 0,
|
|
450
|
-
|
|
451
|
-
|
|
463
|
+
path: currentPath,
|
|
464
|
+
entryFields: setContentTypeLimits ? ['sys.contentTypeId', 'sys.id'] : '*',
|
|
465
|
+
entryLinkDepth: setContentTypeLimits ? 0 : entryLinkDepth,
|
|
452
466
|
language: defaultLang,
|
|
453
467
|
versionStatus: deliveryApiStatus
|
|
454
468
|
}, project);
|
|
455
469
|
({
|
|
456
470
|
entry
|
|
457
471
|
} = 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
472
|
|
|
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
|
-
}
|
|
473
|
+
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) {
|
|
474
|
+
var _payload$items;
|
|
475
|
+
|
|
476
|
+
// Get fields[] and linkDepth from ContentTypeMapping to get the entry data
|
|
477
|
+
// and current node's ordinates at a specified depth with specified fields
|
|
478
|
+
contentTypeMapping = findContentTypeMapping(ContentTypeMappings, pathNode.entry.sys.contentTypeId) || {};
|
|
479
|
+
const {
|
|
480
|
+
fields,
|
|
481
|
+
linkDepth
|
|
482
|
+
} = contentTypeMapping;
|
|
483
|
+
const query = routeEntryByFieldsQuery(pathNode.entry.sys.id, pathNode.entry.sys.language, fields, deliveryApiStatus);
|
|
484
|
+
const payload = yield cachedSearch.search(query, typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth || 0, project);
|
|
485
|
+
|
|
486
|
+
if ((payload === null || payload === void 0 ? void 0 : (_payload$items = payload.items) === null || _payload$items === void 0 ? void 0 : _payload$items.length) > 0) {
|
|
487
|
+
pathNode.entry = entry = payload.items[0];
|
|
560
488
|
}
|
|
561
489
|
}
|
|
562
|
-
}
|
|
490
|
+
} // make calls to fetch node ancestors, children,
|
|
491
|
+
// siblings or entire node tree
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
[ancestors, children, siblings] = yield call(resolveCurrentNodeOrdinates, {
|
|
495
|
+
appsays,
|
|
496
|
+
contentTypeMapping,
|
|
497
|
+
language: defaultLang,
|
|
498
|
+
path: currentPath,
|
|
499
|
+
pathNode,
|
|
500
|
+
project,
|
|
501
|
+
versionStatus: deliveryApiStatus
|
|
502
|
+
});
|
|
503
|
+
if (children) pathNode.children = children;
|
|
563
504
|
}
|
|
564
505
|
|
|
565
|
-
const
|
|
506
|
+
const {
|
|
507
|
+
entryMapper,
|
|
508
|
+
injectRedux
|
|
509
|
+
} = 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
510
|
|
|
567
|
-
if (
|
|
511
|
+
if (injectRedux) yield call(reduxInjectorSaga, injectRedux);
|
|
568
512
|
|
|
569
513
|
if (withEvents && withEvents.onRouteLoaded) {
|
|
570
514
|
// Check if the app has provided a requireLogin boolean flag or groups array
|
|
@@ -584,37 +528,123 @@ function* getRouteSaga(action) {
|
|
|
584
528
|
});
|
|
585
529
|
}
|
|
586
530
|
|
|
587
|
-
if (
|
|
531
|
+
if (!appsays || !appsays.preventScrollTop) {
|
|
532
|
+
// Scroll into View
|
|
533
|
+
if (typeof window !== 'undefined') window.scrollTo(0, 0);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
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) {
|
|
537
|
+
var _appsays;
|
|
538
|
+
|
|
588
539
|
entry = pathNode.entry;
|
|
589
|
-
|
|
590
|
-
entryMapper
|
|
591
|
-
} = contentTypeMapping;
|
|
592
|
-
yield call(setRouteEntry, entry, pathNode, ancestors, siblings, entryMapper, false, appsays && appsays.refetchNode);
|
|
540
|
+
yield call(setRouteEntry, entry, pathNode, ancestors, siblings, entryMapper, false, (_appsays = appsays) === null || _appsays === void 0 ? void 0 : _appsays.refetchNode);
|
|
593
541
|
} else {
|
|
594
542
|
if (staticRoute) yield call(setRouteEntry, null, pathNode, ancestors, siblings);else yield call(do404);
|
|
595
543
|
}
|
|
544
|
+
} catch (e) {
|
|
545
|
+
log.error(...['Error running route saga:', e, e.stack]);
|
|
546
|
+
yield call(do500, e);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
596
549
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
550
|
+
function* resolveCurrentNodeOrdinates({
|
|
551
|
+
appsays,
|
|
552
|
+
contentTypeMapping,
|
|
553
|
+
language,
|
|
554
|
+
path,
|
|
555
|
+
pathNode,
|
|
556
|
+
project,
|
|
557
|
+
versionStatus
|
|
558
|
+
}) {
|
|
559
|
+
const apiCall = [() => null, () => null, () => null, () => null]; // if appsays customNavigation: true, we will set doNavigation to false
|
|
560
|
+
// if appsays customNavigation: { ... }, we will set doNavigation to the customNavigation object and check for child elements
|
|
561
|
+
// if appsays nothing we will set doNavigation to true and continue to do navigation calls
|
|
562
|
+
|
|
563
|
+
const doNavigation = !appsays || ((appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) === true ? false : (appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) || true);
|
|
564
|
+
const {
|
|
565
|
+
entryLinkDepth = 0,
|
|
566
|
+
fields,
|
|
567
|
+
linkDepth,
|
|
568
|
+
nodeOptions = {}
|
|
569
|
+
} = contentTypeMapping;
|
|
570
|
+
|
|
571
|
+
if (pathNode && pathNode.id) {
|
|
572
|
+
if (doNavigation === true || doNavigation.ancestors) {
|
|
573
|
+
apiCall[0] = function* getAncestors() {
|
|
574
|
+
try {
|
|
575
|
+
return yield cachedSearch.getAncestors({
|
|
576
|
+
id: pathNode.id,
|
|
577
|
+
language,
|
|
578
|
+
versionStatus
|
|
579
|
+
}, project);
|
|
580
|
+
} catch (ex) {
|
|
581
|
+
log.info('Problem fetching ancestors', ex);
|
|
582
|
+
return [];
|
|
583
|
+
}
|
|
584
|
+
};
|
|
604
585
|
}
|
|
605
586
|
|
|
606
|
-
|
|
607
|
-
|
|
587
|
+
const childrenDepth = doNavigation === true || doNavigation.children === true ? 1 : doNavigation && doNavigation.children || 0;
|
|
588
|
+
|
|
589
|
+
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.children) === 'undefined' && childrenDepth > 0 || nodeOptions.children) {
|
|
590
|
+
const childrenOptions = typeof nodeOptions.children === 'boolean' ? {} : nodeOptions.children;
|
|
591
|
+
|
|
592
|
+
apiCall[1] = function* getChildren() {
|
|
593
|
+
try {
|
|
594
|
+
return yield cachedSearch.getNode({
|
|
595
|
+
depth: childrenOptions.depth !== undefined ? childrenOptions.depth : childrenDepth,
|
|
596
|
+
path,
|
|
597
|
+
entryFields: childrenOptions.fields || fields || undefined,
|
|
598
|
+
entryLinkDepth: typeof childrenOptions.linkDepth !== 'undefined' ? childrenOptions.linkDepth : typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth,
|
|
599
|
+
language,
|
|
600
|
+
versionStatus
|
|
601
|
+
}, project);
|
|
602
|
+
} catch (ex) {
|
|
603
|
+
log.info('Problem fetching children', ex);
|
|
604
|
+
return [];
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.siblings) === 'undefined' && doNavigation.siblings || nodeOptions.siblings) {
|
|
610
|
+
apiCall[2] = function* getSiblings() {
|
|
611
|
+
try {
|
|
612
|
+
var _nodeOptions$siblings, _nodeOptions$siblings2;
|
|
613
|
+
|
|
614
|
+
return yield cachedSearch.getSiblings({
|
|
615
|
+
id: pathNode.id,
|
|
616
|
+
entryFields: (nodeOptions === null || nodeOptions === void 0 ? void 0 : (_nodeOptions$siblings = nodeOptions.siblings) === null || _nodeOptions$siblings === void 0 ? void 0 : _nodeOptions$siblings.fields) || fields || undefined,
|
|
617
|
+
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,
|
|
618
|
+
includeInMenu: true,
|
|
619
|
+
language,
|
|
620
|
+
versionStatus
|
|
621
|
+
}, project);
|
|
622
|
+
} catch (ex) {
|
|
623
|
+
log.info('Problem fetching siblings', ex);
|
|
624
|
+
return [];
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
const isTreeLoaded = yield select(hasNavigationTree);
|
|
631
|
+
if (!isTreeLoaded && (doNavigation === true || doNavigation.tree)) apiCall[3] = function* getNodeTree() {
|
|
632
|
+
const treeDepth = doNavigation === true || !doNavigation.tree || doNavigation.tree === true ? 2 : doNavigation.tree;
|
|
633
|
+
|
|
634
|
+
if (typeof window !== 'undefined') {
|
|
635
|
+
return yield put({
|
|
608
636
|
type: GET_NODE_TREE,
|
|
609
|
-
treeDepth
|
|
637
|
+
treeDepth
|
|
610
638
|
});
|
|
611
639
|
} else {
|
|
612
|
-
yield call(ensureNodeTreeSaga
|
|
640
|
+
return yield call(ensureNodeTreeSaga, {
|
|
641
|
+
treeDepth
|
|
642
|
+
});
|
|
613
643
|
}
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
644
|
+
};
|
|
645
|
+
const [loadAncestors, loadChildren, loadSiblings, loadTree] = apiCall;
|
|
646
|
+
const [ancestors, nodeWithChildren, siblings] = yield all([loadAncestors(), loadChildren(), loadSiblings(), loadTree()]);
|
|
647
|
+
return [ancestors, nodeWithChildren === null || nodeWithChildren === void 0 ? void 0 : nodeWithChildren.children, siblings];
|
|
618
648
|
}
|
|
619
649
|
|
|
620
650
|
function* setRouteEntry(entry, node, ancestors, siblings, entryMapper, notFound = false, remapEntry = false) {
|
|
@@ -951,7 +981,7 @@ function* changePasswordSaga(action) {
|
|
|
951
981
|
yield put({
|
|
952
982
|
type: CHANGE_USER_PASSWORD_SENDING
|
|
953
983
|
});
|
|
954
|
-
const clientCredentials = yield select(selectClientCredentials);
|
|
984
|
+
const clientCredentials = yield select(selectClientCredentials, 'js');
|
|
955
985
|
const client = yield getManagementApiClient({ ...clientCredentials
|
|
956
986
|
});
|
|
957
987
|
const [err, res] = yield to(client.security.users.updatePassword(changePasswordObject));
|
|
@@ -1039,5 +1069,5 @@ const AppRoot = props => {
|
|
|
1039
1069
|
return /*#__PURE__*/React.createElement(RouteLoader, props);
|
|
1040
1070
|
};
|
|
1041
1071
|
|
|
1042
|
-
export { AppRoot as A, browserHistory as b, deliveryApi as d, history as h, pickProject as p, rootSaga as r };
|
|
1043
|
-
//# sourceMappingURL=App-
|
|
1072
|
+
export { AppRoot as A, browserHistory as b, cachedSearch as c, deliveryApi as d, history as h, pickProject as p, rootSaga as r };
|
|
1073
|
+
//# sourceMappingURL=App-af0670fa.js.map
|