@zengenti/contensis-react-base 3.0.0-beta.6 → 3.0.0-beta.62
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 +4 -4
- package/cjs/{App-3324f784.js → App-6e2518eb.js} +204 -174
- package/cjs/App-6e2518eb.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 +16 -21
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +3583 -38
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +4114 -195
- 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-8cf21563.js +2038 -0
- package/cjs/sagas-8cf21563.js.map +1 -0
- package/cjs/search.js +280 -1907
- 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-b3e55cdf.js} +28 -20
- package/cjs/version-b3e55cdf.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-5efba16c.js} +204 -175
- package/esm/App-5efba16c.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 +17 -22
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +3581 -37
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +4114 -198
- 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-a22fc54a.js +1952 -0
- package/esm/sagas-a22fc54a.js.map +1 -0
- package/esm/search.js +240 -1848
- 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-16aa83eb.js → version-470f0b15.js} +27 -20
- package/esm/version-470f0b15.js.map +1 -0
- package/esm/version-6dd7b2cd.js +15 -0
- package/esm/version-6dd7b2cd.js.map +1 -0
- package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +1 -1
- package/models/forms/index.d.ts +2 -0
- 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/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-lock.json +2690 -3400
- package/package.json +60 -55
- 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/README.md
CHANGED
|
@@ -6,15 +6,15 @@ Handles web app routing with Contensis Site View and component rendering based o
|
|
|
6
6
|
|
|
7
7
|
## Upgrade notes (older projects)
|
|
8
8
|
|
|
9
|
-
### React 17 (
|
|
9
|
+
### React 17 (v3.0+)
|
|
10
10
|
|
|
11
11
|
This version introduces React v17. React is very sensitive to having multiple versions installed at the same time.
|
|
12
12
|
|
|
13
|
-
Many projects upgrading to
|
|
13
|
+
Many projects upgrading to v3.0 of `contensis-react-base` are likely to be using an older version of Storybook which when installed along with React 17 results in multiple versions of React being installed and resulting in the app not rendering giving a react console error.
|
|
14
14
|
|
|
15
15
|
You will need to upgrade your version of Storybook to be >= 6.1 which has support for React 17. [Further reading](https://storybook.js.org/blog/storybook-6-1/)
|
|
16
16
|
|
|
17
|
-
TLDR: Storybook have provided a simple way to upgrade. Run `npx sb upgrade` when upgrading to
|
|
17
|
+
TLDR: Storybook have provided a simple way to upgrade. Run `npx sb upgrade` when upgrading to v3.0 of `contensis-react-base`. You should also ensure you are running the latest version of webpack or webpack@4 to prevent futher errors when loading Storybook.
|
|
18
18
|
|
|
19
19
|
If you are still getting react errors after this, check your project for other dependencies to remove/update that rely on older versions of react
|
|
20
20
|
|
|
@@ -109,7 +109,7 @@ All models are exported with the default package `@zengenti/contensis-react-base
|
|
|
109
109
|
|
|
110
110
|
When importing Types to use in your own TypeScript project, try to always use the root import path e.g. `import { ModelName } from '@zengenti/contensis-react-base';`
|
|
111
111
|
|
|
112
|
-
## Loadable components (
|
|
112
|
+
## Loadable components (v3.0+)
|
|
113
113
|
|
|
114
114
|
We have switched to using `@loadable/components` for our code splitting and to get the best experience, so should you. You will need to swap out the existing `react-loadable` Babel and Webpack plugins and then convert your existing `react-loadable` code to use their `@loadable/components` syntax. [Read more here](https://loadable-components.com/docs/component-splitting/)
|
|
115
115
|
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
var history$1 = require('history');
|
|
4
4
|
var effects = require('@redux-saga/core/effects');
|
|
5
5
|
var contensisDeliveryApi = require('contensis-delivery-api');
|
|
6
|
-
var actions = require('./actions-
|
|
7
|
-
var version = require('./version-
|
|
8
|
-
var version$1 = require('./version-
|
|
9
|
-
var selectors = require('./selectors-
|
|
6
|
+
var actions = require('./actions-8dc9e8de.js');
|
|
7
|
+
var version = require('./version-b3e55cdf.js');
|
|
8
|
+
var version$1 = require('./version-eba6d09b.js');
|
|
9
|
+
var selectors = require('./selectors-656da4b7.js');
|
|
10
10
|
var log = require('loglevel');
|
|
11
|
-
var login = require('./login-
|
|
11
|
+
var login = require('./login-6b9de6a1.js');
|
|
12
12
|
var awaitToJs = require('await-to-js');
|
|
13
|
-
var reducers = require('./reducers-
|
|
14
|
-
var ToJs = require('./ToJs-
|
|
13
|
+
var reducers = require('./reducers-3a4f8971.js');
|
|
14
|
+
var ToJs = require('./ToJs-a9a8522b.js');
|
|
15
15
|
var React = require('react');
|
|
16
16
|
require('react-hot-loader');
|
|
17
17
|
require('jsonpath-mapper');
|
|
18
18
|
require('query-string');
|
|
19
|
-
var RouteLoader = require('./RouteLoader-
|
|
19
|
+
var RouteLoader = require('./RouteLoader-2675e1c9.js');
|
|
20
20
|
|
|
21
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
22
|
|
|
@@ -41,13 +41,9 @@ function _interopNamespace(e) {
|
|
|
41
41
|
var log__namespace = /*#__PURE__*/_interopNamespace(log);
|
|
42
42
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
43
43
|
|
|
44
|
-
const selectedHistory = typeof window !== 'undefined' ? history$1.createBrowserHistory : history$1.createMemoryHistory;
|
|
45
|
-
const history = (options = {}) => selectedHistory(options);
|
|
46
|
-
const browserHistory = selectedHistory();
|
|
47
|
-
|
|
48
44
|
const storeSurrogateKeys = response => {
|
|
49
45
|
const keys = response.headers.get ? response.headers.get('surrogate-key') : response.headers.map['surrogate-key'];
|
|
50
|
-
if (keys) version.reduxStore.dispatch(actions.setSurrogateKeys(keys));
|
|
46
|
+
if (keys) version.reduxStore === null || version.reduxStore === void 0 ? void 0 : version.reduxStore.dispatch(actions.setSurrogateKeys(keys, response.url));
|
|
51
47
|
};
|
|
52
48
|
|
|
53
49
|
const getClientConfig = project => {
|
|
@@ -58,7 +54,7 @@ const getClientConfig = project => {
|
|
|
58
54
|
|
|
59
55
|
if (project) {
|
|
60
56
|
config.projectId = project;
|
|
61
|
-
} //
|
|
57
|
+
} // we only want the surrogate key header in a server context
|
|
62
58
|
|
|
63
59
|
|
|
64
60
|
if (typeof window === 'undefined') {
|
|
@@ -236,6 +232,11 @@ class CachedSearch {
|
|
|
236
232
|
return this.request(project + JSON.stringify(query) + linkDepth.toString(), () => client.entries.search(query, linkDepth));
|
|
237
233
|
}
|
|
238
234
|
|
|
235
|
+
searchUsingPost(query, linkDepth = 0, project = '', env) {
|
|
236
|
+
const client = contensisDeliveryApi.Client.create(getClientConfig(project));
|
|
237
|
+
return this.request(project + JSON.stringify(query) + linkDepth.toString(), () => client.entries.searchUsingPost(query, linkDepth));
|
|
238
|
+
}
|
|
239
|
+
|
|
239
240
|
get(id, linkDepth, versionStatus, project, env) {
|
|
240
241
|
const client = contensisDeliveryApi.Client.create(getClientConfig(project));
|
|
241
242
|
client.clientConfig.versionStatus = versionStatus;
|
|
@@ -292,32 +293,14 @@ class CachedSearch {
|
|
|
292
293
|
return this.cache.get(key);
|
|
293
294
|
}
|
|
294
295
|
|
|
295
|
-
extendTaxonomyNode(node) {
|
|
296
|
-
let id = this.getTaxonomyId(node);
|
|
297
|
-
this.taxonomyLookup[id] = node.key;
|
|
298
|
-
return { ...node,
|
|
299
|
-
id,
|
|
300
|
-
children: node.children ? node.children.map(n => this.extendTaxonomyNode(n)) : null
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
getTaxonomyId(node) {
|
|
305
|
-
if (node.key) {
|
|
306
|
-
let parts = node.key.split('/');
|
|
307
|
-
return parts[parts.length - 1];
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
return '';
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
getTaxonomyKey(id) {
|
|
314
|
-
return this.taxonomyLookup[id];
|
|
315
|
-
}
|
|
316
|
-
|
|
317
296
|
}
|
|
318
297
|
|
|
319
298
|
const cachedSearch = new CachedSearch();
|
|
320
299
|
|
|
300
|
+
const selectedHistory = typeof window !== 'undefined' ? history$1.createBrowserHistory : history$1.createMemoryHistory;
|
|
301
|
+
const history = (options = {}) => selectedHistory(options);
|
|
302
|
+
const browserHistory = selectedHistory();
|
|
303
|
+
|
|
321
304
|
const navigationSagas = [effects.takeEvery(version.GET_NODE_TREE, ensureNodeTreeSaga)];
|
|
322
305
|
function* ensureNodeTreeSaga(action) {
|
|
323
306
|
const state = yield effects.select();
|
|
@@ -404,7 +387,7 @@ function* getRouteSaga(action) {
|
|
|
404
387
|
let entry = null;
|
|
405
388
|
|
|
406
389
|
try {
|
|
407
|
-
var
|
|
390
|
+
var _pathNode2, _pathNode2$entry, _pathNode2$entry$sys, _pathNode3, _pathNode3$entry, _pathNode3$entry$sys;
|
|
408
391
|
|
|
409
392
|
const {
|
|
410
393
|
withEvents,
|
|
@@ -418,7 +401,9 @@ function* getRouteSaga(action) {
|
|
|
418
401
|
|
|
419
402
|
let pathNode = null,
|
|
420
403
|
ancestors = null,
|
|
421
|
-
|
|
404
|
+
children = [],
|
|
405
|
+
siblings = null;
|
|
406
|
+
let contentTypeMapping = {}; // These variables are the return values from
|
|
422
407
|
// calls to withEvents.onRouteLoad and onRouteLoaded
|
|
423
408
|
|
|
424
409
|
let appsays,
|
|
@@ -426,13 +411,9 @@ function* getRouteSaga(action) {
|
|
|
426
411
|
|
|
427
412
|
if (withEvents && withEvents.onRouteLoad) {
|
|
428
413
|
appsays = yield withEvents.onRouteLoad(action);
|
|
429
|
-
}
|
|
430
|
-
// if appsays customNavigation: { ... }, we will set doNavigation to the customNavigation object and check for child elements
|
|
431
|
-
// if appsays nothing we will set doNavigation to true and continue to do navigation calls
|
|
432
|
-
|
|
414
|
+
}
|
|
433
415
|
|
|
434
|
-
const
|
|
435
|
-
const entryLinkDepth = appsays && appsays.entryLinkDepth || 3;
|
|
416
|
+
const entryLinkDepth = appsays && appsays.entryLinkDepth !== undefined ? appsays.entryLinkDepth : 2;
|
|
436
417
|
const setContentTypeLimits = !!ContentTypeMappings.find(ct => ct.fields || ct.linkDepth || ct.nodeOptions);
|
|
437
418
|
const state = yield effects.select();
|
|
438
419
|
const routeEntry = selectors.selectRouteEntry(state, 'js');
|
|
@@ -440,8 +421,8 @@ function* getRouteSaga(action) {
|
|
|
440
421
|
const currentPath = action.path; //selectCurrentPath(state);
|
|
441
422
|
|
|
442
423
|
const deliveryApiStatus = version$1.selectVersionStatus(state);
|
|
443
|
-
const project = selectors.selectCurrentProject(state);
|
|
444
|
-
|
|
424
|
+
const project = selectors.selectCurrentProject(state); // const isHome = currentPath === '/';
|
|
425
|
+
|
|
445
426
|
const isPreview = currentPath && currentPath.startsWith('/preview/');
|
|
446
427
|
const defaultLang = appsays && appsays.defaultLang || 'en-GB';
|
|
447
428
|
|
|
@@ -466,130 +447,92 @@ function* getRouteSaga(action) {
|
|
|
466
447
|
type: actions.UPDATE_LOADING_STATE,
|
|
467
448
|
isLoading: false
|
|
468
449
|
});
|
|
469
|
-
} else yield effects.call(setRouteEntry, routeEntry, yield effects.select(selectors.selectCurrentNode), yield effects.select(selectors.selectCurrentAncestors));
|
|
450
|
+
} else yield effects.call(setRouteEntry, routeEntry, yield effects.select(selectors.selectCurrentNode), yield effects.select(selectors.selectCurrentAncestors), yield effects.select(selectors.selectCurrentSiblings));
|
|
470
451
|
} else {
|
|
471
|
-
// Handle
|
|
472
|
-
if (
|
|
473
|
-
|
|
452
|
+
// Handle preview routes
|
|
453
|
+
if (isPreview) {
|
|
454
|
+
let splitPath = currentPath.split('/');
|
|
455
|
+
let entryGuid = splitPath[2];
|
|
456
|
+
let language = defaultLang;
|
|
457
|
+
|
|
458
|
+
if (splitPath.length >= 3) {
|
|
459
|
+
//set lang key if available in the path, else use default lang
|
|
460
|
+
//assumes preview url on content type is: http://preview.ALIAS.contensis.cloud/preview/{GUID}/{LANG}
|
|
461
|
+
if (splitPath.length == 4) language = splitPath[3]; // According to product dev we cannot use Node API
|
|
462
|
+
// for previewing entries as it gives a response of []
|
|
463
|
+
// -- apparently it is not correct to request latest content
|
|
464
|
+
// with Node API
|
|
465
|
+
|
|
466
|
+
let previewEntry = yield deliveryApi.getClient(deliveryApiStatus, project).entries.get({
|
|
467
|
+
id: entryGuid,
|
|
468
|
+
language,
|
|
469
|
+
linkDepth: entryLinkDepth
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
if (previewEntry) {
|
|
473
|
+
pathNode = {
|
|
474
|
+
entry: previewEntry
|
|
475
|
+
};
|
|
476
|
+
({
|
|
477
|
+
entry
|
|
478
|
+
} = pathNode || {});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
} else {
|
|
482
|
+
var _pathNode, _pathNode$entry, _pathNode$entry$sys;
|
|
483
|
+
|
|
484
|
+
// Handle all other routes
|
|
485
|
+
pathNode = yield cachedSearch.getNode({
|
|
474
486
|
depth: 0,
|
|
475
|
-
|
|
476
|
-
|
|
487
|
+
path: currentPath,
|
|
488
|
+
entryFields: setContentTypeLimits ? ['sys.contentTypeId', 'sys.id'] : '*',
|
|
489
|
+
entryLinkDepth: setContentTypeLimits ? 0 : entryLinkDepth,
|
|
477
490
|
language: defaultLang,
|
|
478
491
|
versionStatus: deliveryApiStatus
|
|
479
492
|
}, project);
|
|
480
493
|
({
|
|
481
494
|
entry
|
|
482
495
|
} = pathNode || {});
|
|
483
|
-
} else {
|
|
484
|
-
// Handle preview routes
|
|
485
|
-
if (isPreview) {
|
|
486
|
-
let splitPath = currentPath.split('/');
|
|
487
|
-
let entryGuid = splitPath[2];
|
|
488
|
-
let language = defaultLang;
|
|
489
|
-
|
|
490
|
-
if (splitPath.length >= 3) {
|
|
491
|
-
//set lang key if available in the path, else use default lang
|
|
492
|
-
//assumes preview url on content type is: http://preview.ALIAS.contensis.cloud/preview/{GUID}/{LANG}
|
|
493
|
-
if (splitPath.length == 4) language = splitPath[3]; // According to product dev we cannot use Node API
|
|
494
|
-
// for previewing entries as it gives a response of []
|
|
495
|
-
// -- apparently it is not correct to request latest content
|
|
496
|
-
// with Node API
|
|
497
|
-
|
|
498
|
-
let previewEntry = yield deliveryApi.getClient(deliveryApiStatus, project).entries.get({
|
|
499
|
-
id: entryGuid,
|
|
500
|
-
language,
|
|
501
|
-
linkDepth: entryLinkDepth
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
if (previewEntry) {
|
|
505
|
-
pathNode = {
|
|
506
|
-
entry: previewEntry
|
|
507
|
-
};
|
|
508
|
-
({
|
|
509
|
-
entry
|
|
510
|
-
} = pathNode || {});
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
} else {
|
|
514
|
-
// Handle all other routes
|
|
515
|
-
const childrenDepth = doNavigation === true || doNavigation.children === true ? 1 : doNavigation && doNavigation.children || 0;
|
|
516
|
-
pathNode = yield cachedSearch.getNode({
|
|
517
|
-
depth: childrenDepth,
|
|
518
|
-
path: currentPath,
|
|
519
|
-
entryFields: setContentTypeLimits ? ['sys.contentTypeId', 'sys.id'] : '*',
|
|
520
|
-
entryLinkDepth: setContentTypeLimits ? 0 : entryLinkDepth,
|
|
521
|
-
language: defaultLang,
|
|
522
|
-
versionStatus: deliveryApiStatus
|
|
523
|
-
}, project);
|
|
524
|
-
({
|
|
525
|
-
entry
|
|
526
|
-
} = pathNode || {});
|
|
527
|
-
|
|
528
|
-
if (setContentTypeLimits && pathNode && pathNode.entry && pathNode.entry.sys && pathNode.entry.sys.id) {
|
|
529
|
-
// Get fields[] and linkDepth from ContentTypeMapping to get the entry data
|
|
530
|
-
// at a specified depth with specified fields
|
|
531
|
-
const {
|
|
532
|
-
fields,
|
|
533
|
-
linkDepth,
|
|
534
|
-
nodeOptions = {}
|
|
535
|
-
} = login.findContentTypeMapping(ContentTypeMappings, pathNode.entry.sys.contentTypeId) || {};
|
|
536
|
-
const query = routeEntryByFieldsQuery(pathNode.entry.sys.id, pathNode.entry.sys.language, fields, deliveryApiStatus);
|
|
537
|
-
const payload = yield cachedSearch.search(query, linkDepth || entryLinkDepth || 0, project);
|
|
538
|
-
|
|
539
|
-
if (payload && payload.items && payload.items.length > 0) {
|
|
540
|
-
pathNode.entry = entry = payload.items[0];
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
if (childrenDepth > 0 || nodeOptions.children) {
|
|
544
|
-
const childrenOptions = nodeOptions.children || {}; // We need to make a separate call for child nodes if the first node query has been
|
|
545
|
-
// limited by linkDepth or fields[]
|
|
546
|
-
|
|
547
|
-
const childNodes = yield cachedSearch.getChildren({
|
|
548
|
-
id: pathNode.id,
|
|
549
|
-
entryFields: childrenOptions.fields || fields || '*',
|
|
550
|
-
entryLinkDepth: childrenOptions.linkDepth || linkDepth || entryLinkDepth || 0,
|
|
551
|
-
language: defaultLang,
|
|
552
|
-
versionStatus: deliveryApiStatus
|
|
553
|
-
});
|
|
554
|
-
|
|
555
|
-
if (childNodes) {
|
|
556
|
-
pathNode.children = childNodes;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
if (pathNode && pathNode.id) {
|
|
563
|
-
if (doNavigation === true || doNavigation.ancestors) {
|
|
564
|
-
try {
|
|
565
|
-
ancestors = yield cachedSearch.getAncestors({
|
|
566
|
-
id: pathNode.id,
|
|
567
|
-
language: defaultLang,
|
|
568
|
-
versionStatus: deliveryApiStatus
|
|
569
|
-
}, project);
|
|
570
|
-
} catch (ex) {
|
|
571
|
-
log__namespace.info('Problem fetching ancestors', ex);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
496
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
497
|
+
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) {
|
|
498
|
+
var _payload$items;
|
|
499
|
+
|
|
500
|
+
// Get fields[] and linkDepth from ContentTypeMapping to get the entry data
|
|
501
|
+
// and current node's ordinates at a specified depth with specified fields
|
|
502
|
+
contentTypeMapping = login.findContentTypeMapping(ContentTypeMappings, pathNode.entry.sys.contentTypeId) || {};
|
|
503
|
+
const {
|
|
504
|
+
fields,
|
|
505
|
+
linkDepth
|
|
506
|
+
} = contentTypeMapping;
|
|
507
|
+
const query = routeEntryByFieldsQuery(pathNode.entry.sys.id, pathNode.entry.sys.language, fields, deliveryApiStatus);
|
|
508
|
+
const payload = yield cachedSearch.search(query, typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth || 0, project);
|
|
509
|
+
|
|
510
|
+
if ((payload === null || payload === void 0 ? void 0 : (_payload$items = payload.items) === null || _payload$items === void 0 ? void 0 : _payload$items.length) > 0) {
|
|
511
|
+
pathNode.entry = entry = payload.items[0];
|
|
585
512
|
}
|
|
586
513
|
}
|
|
587
|
-
}
|
|
514
|
+
} // make calls to fetch node ancestors, children,
|
|
515
|
+
// siblings or entire node tree
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
[ancestors, children, siblings] = yield effects.call(resolveCurrentNodeOrdinates, {
|
|
519
|
+
appsays,
|
|
520
|
+
contentTypeMapping,
|
|
521
|
+
language: defaultLang,
|
|
522
|
+
path: currentPath,
|
|
523
|
+
pathNode,
|
|
524
|
+
project,
|
|
525
|
+
versionStatus: deliveryApiStatus
|
|
526
|
+
});
|
|
527
|
+
if (children) pathNode.children = children;
|
|
588
528
|
}
|
|
589
529
|
|
|
590
|
-
const
|
|
530
|
+
const {
|
|
531
|
+
entryMapper,
|
|
532
|
+
injectRedux
|
|
533
|
+
} = login.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
|
|
591
534
|
|
|
592
|
-
if (
|
|
535
|
+
if (injectRedux) yield effects.call(reduxInjectorSaga, injectRedux);
|
|
593
536
|
|
|
594
537
|
if (withEvents && withEvents.onRouteLoaded) {
|
|
595
538
|
// Check if the app has provided a requireLogin boolean flag or groups array
|
|
@@ -609,16 +552,6 @@ function* getRouteSaga(action) {
|
|
|
609
552
|
});
|
|
610
553
|
}
|
|
611
554
|
|
|
612
|
-
if (pathNode && pathNode.entry && pathNode.entry.sys && pathNode.entry.sys.id) {
|
|
613
|
-
entry = pathNode.entry;
|
|
614
|
-
const {
|
|
615
|
-
entryMapper
|
|
616
|
-
} = contentTypeMapping;
|
|
617
|
-
yield effects.call(setRouteEntry, entry, pathNode, ancestors, siblings, entryMapper, false, appsays && appsays.refetchNode);
|
|
618
|
-
} else {
|
|
619
|
-
if (staticRoute) yield effects.call(setRouteEntry, null, pathNode, ancestors, siblings);else yield effects.call(do404);
|
|
620
|
-
}
|
|
621
|
-
|
|
622
555
|
if (!appsays || !appsays.preventScrollTop) {
|
|
623
556
|
// Scroll into View
|
|
624
557
|
if (typeof window !== 'undefined') {
|
|
@@ -628,13 +561,13 @@ function* getRouteSaga(action) {
|
|
|
628
561
|
}
|
|
629
562
|
}
|
|
630
563
|
|
|
631
|
-
if (
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
564
|
+
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) {
|
|
565
|
+
var _appsays;
|
|
566
|
+
|
|
567
|
+
entry = pathNode.entry;
|
|
568
|
+
yield effects.call(setRouteEntry, entry, pathNode, ancestors, siblings, entryMapper, false, (_appsays = appsays) === null || _appsays === void 0 ? void 0 : _appsays.refetchNode);
|
|
636
569
|
} else {
|
|
637
|
-
yield effects.call(
|
|
570
|
+
if (staticRoute) yield effects.call(setRouteEntry, null, pathNode, ancestors, siblings);else yield effects.call(do404);
|
|
638
571
|
}
|
|
639
572
|
} catch (e) {
|
|
640
573
|
log__namespace.error(...['Error running route saga:', e, e.stack]);
|
|
@@ -642,6 +575,102 @@ function* getRouteSaga(action) {
|
|
|
642
575
|
}
|
|
643
576
|
}
|
|
644
577
|
|
|
578
|
+
function* resolveCurrentNodeOrdinates({
|
|
579
|
+
appsays,
|
|
580
|
+
contentTypeMapping,
|
|
581
|
+
language,
|
|
582
|
+
path,
|
|
583
|
+
pathNode,
|
|
584
|
+
project,
|
|
585
|
+
versionStatus
|
|
586
|
+
}) {
|
|
587
|
+
const apiCall = [() => null, () => null, () => null, () => null]; // if appsays customNavigation: true, we will set doNavigation to false
|
|
588
|
+
// if appsays customNavigation: { ... }, we will set doNavigation to the customNavigation object and check for child elements
|
|
589
|
+
// if appsays nothing we will set doNavigation to true and continue to do navigation calls
|
|
590
|
+
|
|
591
|
+
const doNavigation = !appsays || ((appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) === true ? false : (appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) || true);
|
|
592
|
+
const {
|
|
593
|
+
entryLinkDepth = 0,
|
|
594
|
+
fields,
|
|
595
|
+
linkDepth,
|
|
596
|
+
nodeOptions = {}
|
|
597
|
+
} = contentTypeMapping;
|
|
598
|
+
|
|
599
|
+
if (pathNode && pathNode.id) {
|
|
600
|
+
if (doNavigation === true || doNavigation.ancestors) {
|
|
601
|
+
apiCall[0] = function* getAncestors() {
|
|
602
|
+
try {
|
|
603
|
+
return yield cachedSearch.getAncestors({
|
|
604
|
+
id: pathNode.id,
|
|
605
|
+
language,
|
|
606
|
+
versionStatus
|
|
607
|
+
}, project);
|
|
608
|
+
} catch (ex) {
|
|
609
|
+
log__namespace.info('Problem fetching ancestors', ex);
|
|
610
|
+
return [];
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
const childrenDepth = doNavigation === true || doNavigation.children === true ? 1 : doNavigation && doNavigation.children || 0;
|
|
616
|
+
|
|
617
|
+
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.children) === 'undefined' && childrenDepth > 0 || nodeOptions.children) {
|
|
618
|
+
const childrenOptions = typeof nodeOptions.children === 'boolean' ? {} : nodeOptions.children;
|
|
619
|
+
|
|
620
|
+
apiCall[1] = function* getChildren() {
|
|
621
|
+
try {
|
|
622
|
+
return yield cachedSearch.getNode({
|
|
623
|
+
depth: childrenOptions.depth !== undefined ? childrenOptions.depth : childrenDepth,
|
|
624
|
+
path,
|
|
625
|
+
entryFields: childrenOptions.fields || fields || undefined,
|
|
626
|
+
entryLinkDepth: typeof childrenOptions.linkDepth !== 'undefined' ? childrenOptions.linkDepth : typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth,
|
|
627
|
+
language,
|
|
628
|
+
versionStatus
|
|
629
|
+
}, project);
|
|
630
|
+
} catch (ex) {
|
|
631
|
+
log__namespace.info('Problem fetching children', ex);
|
|
632
|
+
return [];
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.siblings) === 'undefined' && doNavigation.siblings || nodeOptions.siblings) {
|
|
638
|
+
apiCall[2] = function* getSiblings() {
|
|
639
|
+
try {
|
|
640
|
+
var _nodeOptions$siblings, _nodeOptions$siblings2;
|
|
641
|
+
|
|
642
|
+
return yield cachedSearch.getSiblings({
|
|
643
|
+
id: pathNode.id,
|
|
644
|
+
entryFields: (nodeOptions === null || nodeOptions === void 0 ? void 0 : (_nodeOptions$siblings = nodeOptions.siblings) === null || _nodeOptions$siblings === void 0 ? void 0 : _nodeOptions$siblings.fields) || fields || undefined,
|
|
645
|
+
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,
|
|
646
|
+
includeInMenu: true,
|
|
647
|
+
language,
|
|
648
|
+
versionStatus
|
|
649
|
+
}, project);
|
|
650
|
+
} catch (ex) {
|
|
651
|
+
log__namespace.info('Problem fetching siblings', ex);
|
|
652
|
+
return [];
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const isTreeLoaded = yield effects.select(version.hasNavigationTree);
|
|
659
|
+
if (!isTreeLoaded && (doNavigation === true || doNavigation.tree)) apiCall[3] = function* getNodeTree() {
|
|
660
|
+
if (typeof window !== 'undefined') {
|
|
661
|
+
return yield effects.put({
|
|
662
|
+
type: version.GET_NODE_TREE,
|
|
663
|
+
treeDepth: doNavigation === true || !doNavigation.tree || doNavigation.tree === true ? 2 : doNavigation.tree
|
|
664
|
+
});
|
|
665
|
+
} else {
|
|
666
|
+
return yield effects.call(ensureNodeTreeSaga);
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
const [loadAncestors, loadChildren, loadSiblings, loadTree] = apiCall;
|
|
670
|
+
const [ancestors, nodeWithChildren, siblings] = yield effects.all([loadAncestors(), loadChildren(), loadSiblings(), loadTree()]);
|
|
671
|
+
return [ancestors, nodeWithChildren === null || nodeWithChildren === void 0 ? void 0 : nodeWithChildren.children, siblings];
|
|
672
|
+
}
|
|
673
|
+
|
|
645
674
|
function* setRouteEntry(entry, node, ancestors, siblings, entryMapper, notFound = false, remapEntry = false) {
|
|
646
675
|
const entrySys = entry && entry.sys || {};
|
|
647
676
|
const currentEntryId = yield effects.select(selectors.selectRouteEntryEntryId);
|
|
@@ -976,7 +1005,7 @@ function* changePasswordSaga(action) {
|
|
|
976
1005
|
yield effects.put({
|
|
977
1006
|
type: reducers.CHANGE_USER_PASSWORD_SENDING
|
|
978
1007
|
});
|
|
979
|
-
const clientCredentials = yield effects.select(ToJs.selectClientCredentials);
|
|
1008
|
+
const clientCredentials = yield effects.select(ToJs.selectClientCredentials, 'js');
|
|
980
1009
|
const client = yield login.getManagementApiClient({ ...clientCredentials
|
|
981
1010
|
});
|
|
982
1011
|
const [err, res] = yield awaitToJs.to(client.security.users.updatePassword(changePasswordObject));
|
|
@@ -1066,8 +1095,9 @@ const AppRoot = props => {
|
|
|
1066
1095
|
|
|
1067
1096
|
exports.AppRoot = AppRoot;
|
|
1068
1097
|
exports.browserHistory = browserHistory;
|
|
1098
|
+
exports.cachedSearch = cachedSearch;
|
|
1069
1099
|
exports.deliveryApi = deliveryApi;
|
|
1070
1100
|
exports.history = history;
|
|
1071
1101
|
exports.pickProject = pickProject;
|
|
1072
1102
|
exports.rootSaga = rootSaga;
|
|
1073
|
-
//# sourceMappingURL=App-
|
|
1103
|
+
//# sourceMappingURL=App-6e2518eb.js.map
|