@zengenti/contensis-react-base 3.0.0-beta.7 → 3.0.0-beta.70
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-0c10c9fa.js} +210 -175
- package/cjs/App-0c10c9fa.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 +3698 -142
- 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-d7b18a4f.js} +210 -176
- package/esm/App-d7b18a4f.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 +3698 -143
- 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/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-lock.json +2427 -4114
- package/package.json +59 -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
|
@@ -14,7 +14,7 @@ Many projects upgrading to v3.0 of `contensis-react-base` are likely to be using
|
|
|
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
|
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
var history$1 = require('history');
|
|
4
4
|
var effects = require('@redux-saga/core/effects');
|
|
5
|
-
var contensisDeliveryApi = require('contensis-delivery-api');
|
|
6
|
-
var actions = require('./actions-a24bf46e.js');
|
|
7
|
-
var version = require('./version-4f0f5fa6.js');
|
|
8
|
-
var version$1 = require('./version-085d203d.js');
|
|
9
|
-
var selectors = require('./selectors-0ec95076.js');
|
|
10
5
|
var log = require('loglevel');
|
|
11
|
-
var
|
|
6
|
+
var contensisDeliveryApi = require('contensis-delivery-api');
|
|
7
|
+
var actions = require('./actions-8dc9e8de.js');
|
|
8
|
+
var version = require('./version-330551f5.js');
|
|
9
|
+
var version$1 = require('./version-eba6d09b.js');
|
|
10
|
+
var selectors = require('./selectors-656da4b7.js');
|
|
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();
|
|
@@ -342,6 +325,7 @@ function* ensureNodeTreeSaga(action) {
|
|
|
342
325
|
}
|
|
343
326
|
}
|
|
344
327
|
} catch (ex) {
|
|
328
|
+
log__namespace.error(...['Error running ensureNodeTreeSaga:', ex]);
|
|
345
329
|
yield effects.put({
|
|
346
330
|
type: version.GET_NODE_TREE_ERROR,
|
|
347
331
|
error: ex.toString()
|
|
@@ -404,7 +388,7 @@ function* getRouteSaga(action) {
|
|
|
404
388
|
let entry = null;
|
|
405
389
|
|
|
406
390
|
try {
|
|
407
|
-
var
|
|
391
|
+
var _pathNode2, _pathNode2$entry, _pathNode2$entry$sys, _pathNode3, _pathNode3$entry, _pathNode3$entry$sys;
|
|
408
392
|
|
|
409
393
|
const {
|
|
410
394
|
withEvents,
|
|
@@ -418,7 +402,9 @@ function* getRouteSaga(action) {
|
|
|
418
402
|
|
|
419
403
|
let pathNode = null,
|
|
420
404
|
ancestors = null,
|
|
421
|
-
|
|
405
|
+
children = [],
|
|
406
|
+
siblings = null;
|
|
407
|
+
let contentTypeMapping = {}; // These variables are the return values from
|
|
422
408
|
// calls to withEvents.onRouteLoad and onRouteLoaded
|
|
423
409
|
|
|
424
410
|
let appsays,
|
|
@@ -426,13 +412,9 @@ function* getRouteSaga(action) {
|
|
|
426
412
|
|
|
427
413
|
if (withEvents && withEvents.onRouteLoad) {
|
|
428
414
|
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
|
-
|
|
415
|
+
}
|
|
433
416
|
|
|
434
|
-
const
|
|
435
|
-
const entryLinkDepth = appsays && appsays.entryLinkDepth || 3;
|
|
417
|
+
const entryLinkDepth = appsays && appsays.entryLinkDepth !== undefined ? appsays.entryLinkDepth : 2;
|
|
436
418
|
const setContentTypeLimits = !!ContentTypeMappings.find(ct => ct.fields || ct.linkDepth || ct.nodeOptions);
|
|
437
419
|
const state = yield effects.select();
|
|
438
420
|
const routeEntry = selectors.selectRouteEntry(state, 'js');
|
|
@@ -440,8 +422,8 @@ function* getRouteSaga(action) {
|
|
|
440
422
|
const currentPath = action.path; //selectCurrentPath(state);
|
|
441
423
|
|
|
442
424
|
const deliveryApiStatus = version$1.selectVersionStatus(state);
|
|
443
|
-
const project = selectors.selectCurrentProject(state);
|
|
444
|
-
|
|
425
|
+
const project = selectors.selectCurrentProject(state); // const isHome = currentPath === '/';
|
|
426
|
+
|
|
445
427
|
const isPreview = currentPath && currentPath.startsWith('/preview/');
|
|
446
428
|
const defaultLang = appsays && appsays.defaultLang || 'en-GB';
|
|
447
429
|
|
|
@@ -466,130 +448,92 @@ function* getRouteSaga(action) {
|
|
|
466
448
|
type: actions.UPDATE_LOADING_STATE,
|
|
467
449
|
isLoading: false
|
|
468
450
|
});
|
|
469
|
-
} else yield effects.call(setRouteEntry, routeEntry, yield effects.select(selectors.selectCurrentNode), yield effects.select(selectors.selectCurrentAncestors));
|
|
451
|
+
} else yield effects.call(setRouteEntry, routeEntry, yield effects.select(selectors.selectCurrentNode), yield effects.select(selectors.selectCurrentAncestors), yield effects.select(selectors.selectCurrentSiblings));
|
|
470
452
|
} else {
|
|
471
|
-
// Handle
|
|
472
|
-
if (
|
|
473
|
-
|
|
453
|
+
// Handle preview routes
|
|
454
|
+
if (isPreview) {
|
|
455
|
+
let splitPath = currentPath.split('/');
|
|
456
|
+
let entryGuid = splitPath[2];
|
|
457
|
+
let language = defaultLang;
|
|
458
|
+
|
|
459
|
+
if (splitPath.length >= 3) {
|
|
460
|
+
//set lang key if available in the path, else use default lang
|
|
461
|
+
//assumes preview url on content type is: http://preview.ALIAS.contensis.cloud/preview/{GUID}/{LANG}
|
|
462
|
+
if (splitPath.length == 4) language = splitPath[3]; // According to product dev we cannot use Node API
|
|
463
|
+
// for previewing entries as it gives a response of []
|
|
464
|
+
// -- apparently it is not correct to request latest content
|
|
465
|
+
// with Node API
|
|
466
|
+
|
|
467
|
+
let previewEntry = yield deliveryApi.getClient(deliveryApiStatus, project).entries.get({
|
|
468
|
+
id: entryGuid,
|
|
469
|
+
language,
|
|
470
|
+
linkDepth: entryLinkDepth
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
if (previewEntry) {
|
|
474
|
+
pathNode = {
|
|
475
|
+
entry: previewEntry
|
|
476
|
+
};
|
|
477
|
+
({
|
|
478
|
+
entry
|
|
479
|
+
} = pathNode || {});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
} else {
|
|
483
|
+
var _pathNode, _pathNode$entry, _pathNode$entry$sys;
|
|
484
|
+
|
|
485
|
+
// Handle all other routes
|
|
486
|
+
pathNode = yield cachedSearch.getNode({
|
|
474
487
|
depth: 0,
|
|
475
|
-
|
|
476
|
-
|
|
488
|
+
path: currentPath,
|
|
489
|
+
entryFields: setContentTypeLimits ? ['sys.contentTypeId', 'sys.id'] : '*',
|
|
490
|
+
entryLinkDepth: setContentTypeLimits ? 0 : entryLinkDepth,
|
|
477
491
|
language: defaultLang,
|
|
478
492
|
versionStatus: deliveryApiStatus
|
|
479
493
|
}, project);
|
|
480
494
|
({
|
|
481
495
|
entry
|
|
482
496
|
} = 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
497
|
|
|
562
|
-
if (pathNode &&
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
if (
|
|
576
|
-
|
|
577
|
-
siblings = yield cachedSearch.getSiblings({
|
|
578
|
-
id: pathNode.id,
|
|
579
|
-
language: defaultLang,
|
|
580
|
-
versionStatus: deliveryApiStatus
|
|
581
|
-
}, project);
|
|
582
|
-
} catch (ex) {
|
|
583
|
-
log__namespace.info('Problem fetching siblings', ex);
|
|
584
|
-
}
|
|
498
|
+
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) {
|
|
499
|
+
var _payload$items;
|
|
500
|
+
|
|
501
|
+
// Get fields[] and linkDepth from ContentTypeMapping to get the entry data
|
|
502
|
+
// and current node's ordinates at a specified depth with specified fields
|
|
503
|
+
contentTypeMapping = login.findContentTypeMapping(ContentTypeMappings, pathNode.entry.sys.contentTypeId) || {};
|
|
504
|
+
const {
|
|
505
|
+
fields,
|
|
506
|
+
linkDepth
|
|
507
|
+
} = contentTypeMapping;
|
|
508
|
+
const query = routeEntryByFieldsQuery(pathNode.entry.sys.id, pathNode.entry.sys.language, fields, deliveryApiStatus);
|
|
509
|
+
const payload = yield cachedSearch.search(query, typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth || 0, project);
|
|
510
|
+
|
|
511
|
+
if ((payload === null || payload === void 0 ? void 0 : (_payload$items = payload.items) === null || _payload$items === void 0 ? void 0 : _payload$items.length) > 0) {
|
|
512
|
+
pathNode.entry = entry = payload.items[0];
|
|
585
513
|
}
|
|
586
514
|
}
|
|
587
|
-
}
|
|
515
|
+
} // make calls to fetch node ancestors, children,
|
|
516
|
+
// siblings or entire node tree
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
[ancestors, children, siblings] = yield effects.call(resolveCurrentNodeOrdinates, {
|
|
520
|
+
appsays,
|
|
521
|
+
contentTypeMapping,
|
|
522
|
+
language: defaultLang,
|
|
523
|
+
path: currentPath,
|
|
524
|
+
pathNode,
|
|
525
|
+
project,
|
|
526
|
+
versionStatus: deliveryApiStatus
|
|
527
|
+
});
|
|
528
|
+
if (children) pathNode.children = children;
|
|
588
529
|
}
|
|
589
530
|
|
|
590
|
-
const
|
|
531
|
+
const {
|
|
532
|
+
entryMapper,
|
|
533
|
+
injectRedux
|
|
534
|
+
} = 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
535
|
|
|
592
|
-
if (
|
|
536
|
+
if (injectRedux) yield effects.call(reduxInjectorSaga, injectRedux);
|
|
593
537
|
|
|
594
538
|
if (withEvents && withEvents.onRouteLoaded) {
|
|
595
539
|
// Check if the app has provided a requireLogin boolean flag or groups array
|
|
@@ -609,16 +553,6 @@ function* getRouteSaga(action) {
|
|
|
609
553
|
});
|
|
610
554
|
}
|
|
611
555
|
|
|
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
556
|
if (!appsays || !appsays.preventScrollTop) {
|
|
623
557
|
// Scroll into View
|
|
624
558
|
if (typeof window !== 'undefined') {
|
|
@@ -628,13 +562,13 @@ function* getRouteSaga(action) {
|
|
|
628
562
|
}
|
|
629
563
|
}
|
|
630
564
|
|
|
631
|
-
if (
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
565
|
+
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) {
|
|
566
|
+
var _appsays;
|
|
567
|
+
|
|
568
|
+
entry = pathNode.entry;
|
|
569
|
+
yield effects.call(setRouteEntry, entry, pathNode, ancestors, siblings, entryMapper, false, (_appsays = appsays) === null || _appsays === void 0 ? void 0 : _appsays.refetchNode);
|
|
636
570
|
} else {
|
|
637
|
-
yield effects.call(
|
|
571
|
+
if (staticRoute) yield effects.call(setRouteEntry, null, pathNode, ancestors, siblings);else yield effects.call(do404);
|
|
638
572
|
}
|
|
639
573
|
} catch (e) {
|
|
640
574
|
log__namespace.error(...['Error running route saga:', e, e.stack]);
|
|
@@ -642,6 +576,106 @@ function* getRouteSaga(action) {
|
|
|
642
576
|
}
|
|
643
577
|
}
|
|
644
578
|
|
|
579
|
+
function* resolveCurrentNodeOrdinates({
|
|
580
|
+
appsays,
|
|
581
|
+
contentTypeMapping,
|
|
582
|
+
language,
|
|
583
|
+
path,
|
|
584
|
+
pathNode,
|
|
585
|
+
project,
|
|
586
|
+
versionStatus
|
|
587
|
+
}) {
|
|
588
|
+
const apiCall = [() => null, () => null, () => null, () => null]; // if appsays customNavigation: true, we will set doNavigation to false
|
|
589
|
+
// if appsays customNavigation: { ... }, we will set doNavigation to the customNavigation object and check for child elements
|
|
590
|
+
// if appsays nothing we will set doNavigation to true and continue to do navigation calls
|
|
591
|
+
|
|
592
|
+
const doNavigation = !appsays || ((appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) === true ? false : (appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) || true);
|
|
593
|
+
const {
|
|
594
|
+
entryLinkDepth = 0,
|
|
595
|
+
fields,
|
|
596
|
+
linkDepth,
|
|
597
|
+
nodeOptions = {}
|
|
598
|
+
} = contentTypeMapping;
|
|
599
|
+
|
|
600
|
+
if (pathNode && pathNode.id) {
|
|
601
|
+
if (doNavigation === true || doNavigation.ancestors) {
|
|
602
|
+
apiCall[0] = function* getAncestors() {
|
|
603
|
+
try {
|
|
604
|
+
return yield cachedSearch.getAncestors({
|
|
605
|
+
id: pathNode.id,
|
|
606
|
+
language,
|
|
607
|
+
versionStatus
|
|
608
|
+
}, project);
|
|
609
|
+
} catch (ex) {
|
|
610
|
+
log__namespace.info('Problem fetching ancestors', ex);
|
|
611
|
+
return [];
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
const childrenDepth = doNavigation === true || doNavigation.children === true ? 1 : doNavigation && doNavigation.children || 0;
|
|
617
|
+
|
|
618
|
+
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.children) === 'undefined' && childrenDepth > 0 || nodeOptions.children) {
|
|
619
|
+
const childrenOptions = typeof nodeOptions.children === 'boolean' ? {} : nodeOptions.children;
|
|
620
|
+
|
|
621
|
+
apiCall[1] = function* getChildren() {
|
|
622
|
+
try {
|
|
623
|
+
return yield cachedSearch.getNode({
|
|
624
|
+
depth: childrenOptions.depth !== undefined ? childrenOptions.depth : childrenDepth,
|
|
625
|
+
path,
|
|
626
|
+
entryFields: childrenOptions.fields || fields || undefined,
|
|
627
|
+
entryLinkDepth: typeof childrenOptions.linkDepth !== 'undefined' ? childrenOptions.linkDepth : typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth,
|
|
628
|
+
language,
|
|
629
|
+
versionStatus
|
|
630
|
+
}, project);
|
|
631
|
+
} catch (ex) {
|
|
632
|
+
log__namespace.info('Problem fetching children', ex);
|
|
633
|
+
return [];
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.siblings) === 'undefined' && doNavigation.siblings || nodeOptions.siblings) {
|
|
639
|
+
apiCall[2] = function* getSiblings() {
|
|
640
|
+
try {
|
|
641
|
+
var _nodeOptions$siblings, _nodeOptions$siblings2;
|
|
642
|
+
|
|
643
|
+
return yield cachedSearch.getSiblings({
|
|
644
|
+
id: pathNode.id,
|
|
645
|
+
entryFields: (nodeOptions === null || nodeOptions === void 0 ? void 0 : (_nodeOptions$siblings = nodeOptions.siblings) === null || _nodeOptions$siblings === void 0 ? void 0 : _nodeOptions$siblings.fields) || fields || undefined,
|
|
646
|
+
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,
|
|
647
|
+
includeInMenu: true,
|
|
648
|
+
language,
|
|
649
|
+
versionStatus
|
|
650
|
+
}, project);
|
|
651
|
+
} catch (ex) {
|
|
652
|
+
log__namespace.info('Problem fetching siblings', ex);
|
|
653
|
+
return [];
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
const isTreeLoaded = yield effects.select(version.hasNavigationTree);
|
|
660
|
+
if (!isTreeLoaded && (doNavigation === true || doNavigation.tree)) apiCall[3] = function* getNodeTree() {
|
|
661
|
+
const treeDepth = doNavigation === true || !doNavigation.tree || doNavigation.tree === true ? 2 : doNavigation.tree;
|
|
662
|
+
|
|
663
|
+
if (typeof window !== 'undefined') {
|
|
664
|
+
return yield effects.put({
|
|
665
|
+
type: version.GET_NODE_TREE,
|
|
666
|
+
treeDepth
|
|
667
|
+
});
|
|
668
|
+
} else {
|
|
669
|
+
return yield effects.call(ensureNodeTreeSaga, {
|
|
670
|
+
treeDepth
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
const [loadAncestors, loadChildren, loadSiblings, loadTree] = apiCall;
|
|
675
|
+
const [ancestors, nodeWithChildren, siblings] = yield effects.all([loadAncestors(), loadChildren(), loadSiblings(), loadTree()]);
|
|
676
|
+
return [ancestors, nodeWithChildren === null || nodeWithChildren === void 0 ? void 0 : nodeWithChildren.children, siblings];
|
|
677
|
+
}
|
|
678
|
+
|
|
645
679
|
function* setRouteEntry(entry, node, ancestors, siblings, entryMapper, notFound = false, remapEntry = false) {
|
|
646
680
|
const entrySys = entry && entry.sys || {};
|
|
647
681
|
const currentEntryId = yield effects.select(selectors.selectRouteEntryEntryId);
|
|
@@ -976,7 +1010,7 @@ function* changePasswordSaga(action) {
|
|
|
976
1010
|
yield effects.put({
|
|
977
1011
|
type: reducers.CHANGE_USER_PASSWORD_SENDING
|
|
978
1012
|
});
|
|
979
|
-
const clientCredentials = yield effects.select(ToJs.selectClientCredentials);
|
|
1013
|
+
const clientCredentials = yield effects.select(ToJs.selectClientCredentials, 'js');
|
|
980
1014
|
const client = yield login.getManagementApiClient({ ...clientCredentials
|
|
981
1015
|
});
|
|
982
1016
|
const [err, res] = yield awaitToJs.to(client.security.users.updatePassword(changePasswordObject));
|
|
@@ -1066,8 +1100,9 @@ const AppRoot = props => {
|
|
|
1066
1100
|
|
|
1067
1101
|
exports.AppRoot = AppRoot;
|
|
1068
1102
|
exports.browserHistory = browserHistory;
|
|
1103
|
+
exports.cachedSearch = cachedSearch;
|
|
1069
1104
|
exports.deliveryApi = deliveryApi;
|
|
1070
1105
|
exports.history = history;
|
|
1071
1106
|
exports.pickProject = pickProject;
|
|
1072
1107
|
exports.rootSaga = rootSaga;
|
|
1073
|
-
//# sourceMappingURL=App-
|
|
1108
|
+
//# sourceMappingURL=App-0c10c9fa.js.map
|