@zengenti/contensis-react-base 4.0.0-beta.6 → 4.0.0-beta.60
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 +14 -1
- package/cjs/{App-vZrUfVgQ.js → App-Dr56ZsQj.js} +476 -99
- package/cjs/App-Dr56ZsQj.js.map +1 -0
- package/cjs/{ChangePassword.container-ECjEXixF.js → ChangePassword.container-C4Du3Wb1.js} +57 -50
- package/cjs/ChangePassword.container-C4Du3Wb1.js.map +1 -0
- package/cjs/{SSRContext-DVj_QAC1.js → ContensisDeliveryApi-gN3_MHEl.js} +32 -74
- package/cjs/ContensisDeliveryApi-gN3_MHEl.js.map +1 -0
- package/cjs/CookieConstants-DfPiWCRZ.js +12 -0
- package/cjs/CookieConstants-DfPiWCRZ.js.map +1 -0
- package/{esm/CookieHelper.class-FTURFpz3.js → cjs/CookieHelper.class-Det3qfdU.js} +4 -6
- package/cjs/CookieHelper.class-Det3qfdU.js.map +1 -0
- package/cjs/{RouteLoader-D5Yg7EB5.js → RouteLoader-Bbt-nG3v.js} +13 -8
- package/cjs/RouteLoader-Bbt-nG3v.js.map +1 -0
- package/cjs/SSRContext-DotLlTQc.js +116 -0
- package/cjs/SSRContext-DotLlTQc.js.map +1 -0
- package/cjs/ToJs-BsWqWjdm.js +23 -0
- package/cjs/ToJs-BsWqWjdm.js.map +1 -0
- package/cjs/{VersionInfo-B_dKCubg.js → VersionInfo-zFPsvS8q.js} +3 -25
- package/cjs/VersionInfo-zFPsvS8q.js.map +1 -0
- package/cjs/client.js +62 -64
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +235 -127
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/i18n.js +75 -0
- package/cjs/i18n.js.map +1 -0
- package/cjs/{ToJs-C9jwV7YB.js → matchGroups-dqONU-vY.js} +2 -22
- package/cjs/matchGroups-dqONU-vY.js.map +1 -0
- package/cjs/redux.js +8 -6
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +15 -7
- package/cjs/routing.js.map +1 -1
- package/cjs/{sagas-CbZhaRNd.js → sagas-OfBUtx74.js} +523 -370
- package/cjs/sagas-OfBUtx74.js.map +1 -0
- package/cjs/search.js +54 -29
- package/cjs/search.js.map +1 -1
- package/cjs/{selectors-wCs5fHD4.js → selectors-BrxJ8-F8.js} +27 -6
- package/cjs/selectors-BrxJ8-F8.js.map +1 -0
- package/cjs/selectors-DAQR0uZa.js +18 -0
- package/cjs/selectors-DAQR0uZa.js.map +1 -0
- package/cjs/slice-5xJMH24n.js +69 -0
- package/cjs/slice-5xJMH24n.js.map +1 -0
- package/cjs/{store-D07FOXvM.js → store-Dn7vP6G0.js} +52 -4
- package/cjs/store-Dn7vP6G0.js.map +1 -0
- package/cjs/urls-DVIwGZmd.js +25 -0
- package/cjs/urls-DVIwGZmd.js.map +1 -0
- package/cjs/user.js +20 -17
- package/cjs/user.js.map +1 -1
- package/cjs/util-wQwG9vit.js +148 -0
- package/cjs/util-wQwG9vit.js.map +1 -0
- package/cjs/util.js +80 -22
- package/cjs/util.js.map +1 -1
- package/cjs/{version-B7XFkBhY.js → version-2FamXHhj.js} +15 -16
- package/cjs/version-2FamXHhj.js.map +1 -0
- package/cjs/{version-CM-bJ62L.js → version-rFG9Y6_B.js} +2 -2
- package/cjs/{version-CM-bJ62L.js.map → version-rFG9Y6_B.js.map} +1 -1
- package/esm/{App-DLZweVSp.js → App-CrCf7gso.js} +436 -60
- package/esm/App-CrCf7gso.js.map +1 -0
- package/esm/{ChangePassword.container-BgzIy8dA.js → ChangePassword.container-CUBtn82K.js} +19 -13
- package/esm/ChangePassword.container-CUBtn82K.js.map +1 -0
- package/esm/{SSRContext-BE8ElZ3X.js → ContensisDeliveryApi-CvEoOLCl.js} +30 -67
- package/esm/ContensisDeliveryApi-CvEoOLCl.js.map +1 -0
- package/esm/CookieConstants-DEmbwzYr.js +7 -0
- package/esm/CookieConstants-DEmbwzYr.js.map +1 -0
- package/{cjs/CookieHelper.class-C3Eqoze9.js → esm/CookieHelper.class-C6rTRl_1.js} +2 -14
- package/esm/CookieHelper.class-C6rTRl_1.js.map +1 -0
- package/esm/{RouteLoader-xeQBXywk.js → RouteLoader-BpHhiAlL.js} +10 -5
- package/esm/RouteLoader-BpHhiAlL.js.map +1 -0
- package/esm/SSRContext-CYxBWky3.js +106 -0
- package/esm/SSRContext-CYxBWky3.js.map +1 -0
- package/esm/ToJs-BnRRHk6f.js +17 -0
- package/esm/ToJs-BnRRHk6f.js.map +1 -0
- package/esm/{VersionInfo-Cno7K0OA.js → VersionInfo-By2ZCZOh.js} +4 -24
- package/esm/VersionInfo-By2ZCZOh.js.map +1 -0
- package/esm/client.js +62 -63
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +227 -121
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/i18n.js +64 -0
- package/esm/i18n.js.map +1 -0
- package/esm/{ToJs-CNzfvyxJ.js → matchGroups-_w8BwzCC.js} +3 -18
- package/esm/matchGroups-_w8BwzCC.js.map +1 -0
- package/esm/redux.js +11 -8
- package/esm/redux.js.map +1 -1
- package/esm/routing.js +14 -7
- package/esm/routing.js.map +1 -1
- package/esm/{sagas-xJU-zOpn.js → sagas-BZWjx5by.js} +511 -357
- package/esm/sagas-BZWjx5by.js.map +1 -0
- package/esm/search.js +73 -47
- package/esm/search.js.map +1 -1
- package/esm/{selectors-DO2ocdOp.js → selectors-8ROQrTd7.js} +25 -7
- package/esm/selectors-8ROQrTd7.js.map +1 -0
- package/esm/selectors-DcmvOeX2.js +10 -0
- package/esm/selectors-DcmvOeX2.js.map +1 -0
- package/esm/slice-C6JLQik8.js +63 -0
- package/esm/slice-C6JLQik8.js.map +1 -0
- package/esm/{store-3u0RzHZ0.js → store-DSjRYsM2.js} +52 -5
- package/esm/store-DSjRYsM2.js.map +1 -0
- package/esm/urls-DfCisos-.js +22 -0
- package/esm/urls-DfCisos-.js.map +1 -0
- package/esm/user.js +9 -6
- package/esm/user.js.map +1 -1
- package/esm/util-BafFLYzn.js +136 -0
- package/esm/util-BafFLYzn.js.map +1 -0
- package/esm/util.js +58 -14
- package/esm/util.js.map +1 -1
- package/esm/{version-BlsI7hX2.js → version-B75wA6Te.js} +16 -16
- package/esm/version-B75wA6Te.js.map +1 -0
- package/esm/{version-wnf-TITV.js → version-BQAL8sQO.js} +2 -2
- package/esm/{version-wnf-TITV.js.map → version-BQAL8sQO.js.map} +1 -1
- package/i18n/package.json +5 -0
- package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +1 -1
- package/models/app/pages/VersionInfo/components/VersionInfo.styled.d.ts +0 -1
- package/models/i18n/index.d.ts +5 -0
- package/models/i18n/redux/sagas.d.ts +19 -0
- package/models/i18n/redux/selectors.d.ts +11 -0
- package/models/i18n/redux/slice.d.ts +198 -0
- package/models/i18n/routes.d.ts +8 -0
- package/models/i18n/useI18n.hook.d.ts +20 -0
- package/models/index.d.ts +1 -0
- package/models/models/AppState.d.ts +2 -0
- package/models/models/ContentTypeMapping.d.ts +5 -0
- package/models/models/Locales.d.ts +11 -0
- package/models/models/MatchedRoute.d.ts +5 -1
- package/models/models/RouteComponent.d.ts +0 -1
- package/models/models/SSRContext.d.ts +4 -4
- package/models/models/StaticRoute.d.ts +11 -0
- package/models/models/WithEvents.d.ts +8 -0
- package/models/models/config/AppConfig.d.ts +2 -0
- package/models/models/config/I18n.d.ts +38 -0
- package/models/models/config/ServerConfig.d.ts +3 -0
- package/models/redux/index.d.ts +2 -1
- package/models/redux/sagas/index.d.ts +3 -1
- package/models/redux/sagas/injector.d.ts +13 -0
- package/models/redux/store/injectors/index.d.ts +26 -0
- package/models/redux/store/injectors/inject.d.ts +24 -0
- package/models/redux/store/injectors/util.d.ts +2 -0
- package/models/redux/store/store.d.ts +13 -4
- package/models/redux/util.d.ts +1 -1
- package/models/routing/components/RouteLoader.d.ts +3 -3
- package/models/routing/httpContext.d.ts +0 -1
- package/models/routing/index.d.ts +1 -0
- package/models/routing/redux/actions.d.ts +1 -1
- package/models/routing/redux/invokeSearch.d.ts +22 -0
- package/models/routing/redux/selectors.d.ts +47 -4
- package/models/routing/util/expressions.d.ts +1 -1
- package/models/routing/util/find-contenttype-mapping.d.ts +3 -1
- package/models/search/containers/withListing.d.ts +1 -1
- package/models/search/containers/withSearch.d.ts +1 -1
- package/models/search/models/Queries.d.ts +3 -5
- package/models/search/models/Search.d.ts +43 -13
- package/models/search/models/SearchActions.d.ts +61 -18
- package/models/search/models/SearchProps.d.ts +11 -10
- package/models/search/models/SearchState.d.ts +23 -2
- package/models/search/models/SearchUtil.d.ts +3 -3
- package/models/search/redux/getIn.d.ts +2 -2
- package/models/search/redux/reducers.d.ts +3 -4
- package/models/search/redux/sagas.d.ts +13 -14
- package/models/search/redux/schema.d.ts +3 -3
- package/models/search/redux/selectors.d.ts +64 -42
- package/models/search/redux/util.d.ts +10 -1
- package/models/search/search/ContensisDeliveryApi.d.ts +6 -26
- package/models/search/search/expressions.d.ts +6 -4
- package/models/search/search/util.d.ts +9 -7
- package/models/search/transformations/state-to-queryparams.mapper.d.ts +1 -1
- package/models/server/features/linkdepth-api/search.d.ts +1 -1
- package/models/server/features/response-handler/render-stream.d.ts +2 -4
- package/models/server/features/static-assets/index.d.ts +4 -3
- package/models/server/internalServer.d.ts +1 -2
- package/models/server/middleware/subsiteDebug.d.ts +11 -0
- package/models/server/root.d.ts +3 -0
- package/models/server/util/bundles.d.ts +9 -9
- package/models/server/util/jsx.d.ts +2 -14
- package/models/user/hocs/withRegistration.d.ts +1 -1
- package/models/util/CachedDeliveryApi.d.ts +8 -2
- package/models/util/ContensisDeliveryApi.d.ts +2 -4
- package/models/util/NoSSR.d.ts +6 -0
- package/models/util/SSRContext.d.ts +3 -19
- package/models/util/donotuse_useHistory.d.ts +6 -0
- package/models/util/index.d.ts +6 -1
- package/models/util/subsite.d.ts +12 -0
- package/models/util/useIsClient.d.ts +6 -0
- package/package.json +39 -38
- package/cjs/App-vZrUfVgQ.js.map +0 -1
- package/cjs/ChangePassword.container-ECjEXixF.js.map +0 -1
- package/cjs/CookieHelper.class-C3Eqoze9.js.map +0 -1
- package/cjs/RouteLoader-D5Yg7EB5.js.map +0 -1
- package/cjs/SSRContext-DVj_QAC1.js.map +0 -1
- package/cjs/ToJs-C9jwV7YB.js.map +0 -1
- package/cjs/VersionInfo-B_dKCubg.js.map +0 -1
- package/cjs/sagas-CbZhaRNd.js.map +0 -1
- package/cjs/selectors-wCs5fHD4.js.map +0 -1
- package/cjs/store-D07FOXvM.js.map +0 -1
- package/cjs/version-B7XFkBhY.js.map +0 -1
- package/esm/App-DLZweVSp.js.map +0 -1
- package/esm/ChangePassword.container-BgzIy8dA.js.map +0 -1
- package/esm/CookieHelper.class-FTURFpz3.js.map +0 -1
- package/esm/RouteLoader-xeQBXywk.js.map +0 -1
- package/esm/SSRContext-BE8ElZ3X.js.map +0 -1
- package/esm/ToJs-CNzfvyxJ.js.map +0 -1
- package/esm/VersionInfo-Cno7K0OA.js.map +0 -1
- package/esm/sagas-xJU-zOpn.js.map +0 -1
- package/esm/selectors-DO2ocdOp.js.map +0 -1
- package/esm/store-3u0RzHZ0.js.map +0 -1
- package/esm/version-BlsI7hX2.js.map +0 -1
- package/models/redux/store/injectors.d.ts +0 -31
- package/models/search/search/ToJs.d.ts +0 -4
|
@@ -1,21 +1,72 @@
|
|
|
1
1
|
import { createBrowserHistory, createMemoryHistory } from 'history';
|
|
2
2
|
import { takeEvery, select, put, call, all } from '@redux-saga/core/effects';
|
|
3
3
|
import * as log from 'loglevel';
|
|
4
|
-
import { G as GET_NODE_TREE, b as SET_NODE_TREE, d as GET_NODE_TREE_ERROR } from './store-
|
|
5
|
-
import { h as hasNavigationTree,
|
|
4
|
+
import { G as GET_NODE_TREE, b as SET_NODE_TREE, d as GET_NODE_TREE_ERROR } from './store-DSjRYsM2.js';
|
|
5
|
+
import { h as hasNavigationTree, b as injectRedux } from './version-B75wA6Te.js';
|
|
6
6
|
import to, { to as to$1 } from 'await-to-js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { Query, Op } from 'contensis-delivery-api';
|
|
8
|
+
import { a as actions } from './slice-C6JLQik8.js';
|
|
9
|
+
import { o as selectCurrentPath, G as setRoute, K as selectRouteEntryAvailableLanguages, M as selectRouteEntryID, N as selectStaticRoute, y as SET_NAVIGATION_PATH, x as SET_ROUTE, j as selectRouteEntry, O as selectCurrentNode, f as selectCurrentProject, z as UPDATE_LOADING_STATE, P as selectCurrentAncestors, Q as selectCurrentSiblings, T as selectRouteEntryEntryId, W as selectRouteEntryLanguage, n as selectMappedEntry, A as SET_ENTRY, B as SET_ANCESTORS, w as SET_SIBLINGS, R as REGISTER_USER, X as REGISTER_USER_SUCCESS, Y as REGISTER_USER_FAILED, E as queryParams, F as selectCurrentSearch, H as REQUEST_USER_PASSWORD_RESET, I as RESET_USER_PASSWORD, J as CHANGE_USER_PASSWORD, Z as REQUEST_USER_PASSWORD_RESET_SENDING, _ as REQUEST_USER_PASSWORD_RESET_SUCCESS, $ as REQUEST_USER_PASSWORD_RESET_ERROR, a0 as RESET_USER_PASSWORD_SENDING, a1 as RESET_USER_PASSWORD_SUCCESS, a2 as RESET_USER_PASSWORD_ERROR, a3 as CHANGE_USER_PASSWORD_ERROR, a4 as CHANGE_USER_PASSWORD_SENDING, a5 as CHANGE_USER_PASSWORD_SUCCESS } from './selectors-8ROQrTd7.js';
|
|
10
|
+
import { s as selectVersionStatus } from './version-BQAL8sQO.js';
|
|
11
|
+
import { c as cachedSearch } from './ContensisDeliveryApi-CvEoOLCl.js';
|
|
10
12
|
import React from 'react';
|
|
11
13
|
import 'react-cookie';
|
|
12
14
|
import 'react-redux';
|
|
15
|
+
import './VersionInfo-By2ZCZOh.js';
|
|
16
|
+
import 'react-helmet-async';
|
|
13
17
|
import 'jsonpath-mapper';
|
|
14
|
-
import { Op, Query } from 'contensis-delivery-api';
|
|
15
|
-
import { l as selectClientCredentials } from './ToJs-CNzfvyxJ.js';
|
|
16
|
-
import 'query-string';
|
|
17
18
|
import 'react-router-dom';
|
|
18
|
-
import { a as
|
|
19
|
+
import { s as selectCurrentLanguage, a as selectDictionary, c as selectLocaleRoutes, b as selectLocales, f as selectDictionaryResolver, d as selectPrimaryLanguage } from './selectors-DcmvOeX2.js';
|
|
20
|
+
import { h as handleRequiresLoginSaga, L as LoginHelper, i as findContentTypeMapping, j as getSearchOptions, k as getManagementApiClient, m as loginSagas } from './ChangePassword.container-CUBtn82K.js';
|
|
21
|
+
import './sagas-BZWjx5by.js';
|
|
22
|
+
import 'reselect';
|
|
23
|
+
import 'immer';
|
|
24
|
+
import 'deep-equal';
|
|
25
|
+
import 'deepmerge';
|
|
26
|
+
import { r as routeParams } from './util-BafFLYzn.js';
|
|
27
|
+
import 'contensis-core-api';
|
|
28
|
+
import { l as selectClientCredentials } from './matchGroups-_w8BwzCC.js';
|
|
29
|
+
import { a as RouteLoader } from './RouteLoader-BpHhiAlL.js';
|
|
30
|
+
import 'query-string';
|
|
31
|
+
|
|
32
|
+
const deparameterise = path => {
|
|
33
|
+
return path.replace(/\/:\w+\??/g, '');
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** Create static routes for routes with specified locales */
|
|
37
|
+
const createLocaleRoutes = routes => {
|
|
38
|
+
const localeRoutes = {};
|
|
39
|
+
for (const route of routes.StaticRoutes) {
|
|
40
|
+
// If the route has defined locales, create entries for each locale
|
|
41
|
+
if (route.i18n && route.path) {
|
|
42
|
+
for (const [language, path] of Object.entries(route.i18n)) {
|
|
43
|
+
// We already have a locale route, so just append the language and path
|
|
44
|
+
const deparameterisedPath = deparameterise(route.path);
|
|
45
|
+
const deparameterisedLocalePath = deparameterise(path);
|
|
46
|
+
if (localeRoutes[deparameterisedPath]) localeRoutes[deparameterisedPath][language] = deparameterisedLocalePath;
|
|
47
|
+
// Otherwise, create a new entry for this route path
|
|
48
|
+
else localeRoutes[deparameterisedPath] = {
|
|
49
|
+
[language]: deparameterisedLocalePath
|
|
50
|
+
};
|
|
51
|
+
if (deparameterise(route.path) !== deparameterisedLocalePath) {
|
|
52
|
+
// I think we are OK to mutate here as this is only run once on app init
|
|
53
|
+
// we can change this if needed later
|
|
54
|
+
routes.StaticRoutes.push({
|
|
55
|
+
...route,
|
|
56
|
+
path,
|
|
57
|
+
// Add the path with any parameters included
|
|
58
|
+
language,
|
|
59
|
+
i18n: undefined
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
// Just set the language on the existing route instead of creating a duplicate
|
|
63
|
+
route.language = language;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return localeRoutes;
|
|
69
|
+
};
|
|
19
70
|
|
|
20
71
|
// Create a history depending on the environment
|
|
21
72
|
const selectedHistory = typeof window !== 'undefined' ? createBrowserHistory : createMemoryHistory;
|
|
@@ -29,12 +80,17 @@ function* ensureNodeTreeSaga(action) {
|
|
|
29
80
|
language,
|
|
30
81
|
project,
|
|
31
82
|
versionStatus,
|
|
83
|
+
subsitePath,
|
|
32
84
|
treeDepth
|
|
33
85
|
} = action;
|
|
34
86
|
const state = yield select();
|
|
35
87
|
try {
|
|
36
88
|
if (!hasNavigationTree(state)) {
|
|
37
|
-
const nodes = yield api.
|
|
89
|
+
const nodes = subsitePath ? yield api.getNode({
|
|
90
|
+
path: subsitePath,
|
|
91
|
+
depth: treeDepth || 0,
|
|
92
|
+
language
|
|
93
|
+
}, project) : yield api.getRootNode({
|
|
38
94
|
depth: treeDepth || 0,
|
|
39
95
|
language
|
|
40
96
|
}, versionStatus, project);
|
|
@@ -58,6 +114,238 @@ function* ensureNodeTreeSaga(action) {
|
|
|
58
114
|
}
|
|
59
115
|
}
|
|
60
116
|
|
|
117
|
+
const i18nSagas = [takeEvery(actions.INIT_LOCALES.type, getProjectLanguages), takeEvery(actions.UPDATE_LANGUAGE.type, updateLanguage), takeEvery(actions.SET_LANGUAGE.type, setLanguageRoute)];
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Resolve the current route language based on the entry, node, static route or path
|
|
121
|
+
* Is called directly from the routing saga as soon as an entry or node has been fetched
|
|
122
|
+
*/
|
|
123
|
+
function* resolveCurrentRouteLanguage({
|
|
124
|
+
entry,
|
|
125
|
+
node
|
|
126
|
+
}) {
|
|
127
|
+
var _entry$sys, _staticRoute$route;
|
|
128
|
+
const currentLanguage = yield select(selectCurrentLanguage);
|
|
129
|
+
const staticRoute = yield select(selectStaticRoute);
|
|
130
|
+
let nextLanguage = currentLanguage;
|
|
131
|
+
if (entry !== null && entry !== void 0 && (_entry$sys = entry.sys) !== null && _entry$sys !== void 0 && _entry$sys.language) nextLanguage = entry.sys.language;else if (node !== null && node !== void 0 && node.language) nextLanguage = node.language;else if (staticRoute !== null && staticRoute !== void 0 && (_staticRoute$route = staticRoute.route) !== null && _staticRoute$route !== void 0 && _staticRoute$route.language) nextLanguage = staticRoute.route.language;else {
|
|
132
|
+
var _currentPath$split$fi;
|
|
133
|
+
// attempt to infer language from the path
|
|
134
|
+
const currentPath = yield select(selectCurrentPath);
|
|
135
|
+
|
|
136
|
+
// path is normally lowercase
|
|
137
|
+
const firstPathSegment = (_currentPath$split$fi = currentPath.split('/').find(segment => segment.length)) === null || _currentPath$split$fi === void 0 ? void 0 : _currentPath$split$fi.toLowerCase();
|
|
138
|
+
const locales = yield select(selectLocales);
|
|
139
|
+
const matchedLanguage = Object.keys(locales).find(lang => lang.toLowerCase() === firstPathSegment);
|
|
140
|
+
// matched a supported language in the path
|
|
141
|
+
if (matchedLanguage) nextLanguage = matchedLanguage;else
|
|
142
|
+
// falling back to primary language
|
|
143
|
+
nextLanguage = yield select(selectPrimaryLanguage);
|
|
144
|
+
}
|
|
145
|
+
if (nextLanguage && nextLanguage !== currentLanguage) {
|
|
146
|
+
const dictionary = yield call(resolveDictionaryForLanguage, nextLanguage);
|
|
147
|
+
yield put(actions.SET_LANGUAGE({
|
|
148
|
+
language: nextLanguage,
|
|
149
|
+
dictionary
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Resolve the current dictionary for route language either using a supplied resolver
|
|
156
|
+
* function or directly derive from the locales stored in state
|
|
157
|
+
* Is called directly any time the language is changed
|
|
158
|
+
*/
|
|
159
|
+
function* resolveDictionaryForLanguage(language) {
|
|
160
|
+
let dictionary = yield select(selectDictionary);
|
|
161
|
+
// try and resolve a dictionary for this language
|
|
162
|
+
const resolver = yield select(selectDictionaryResolver);
|
|
163
|
+
if (typeof resolver === 'function') {
|
|
164
|
+
try {
|
|
165
|
+
// dynamic import of dictionary file
|
|
166
|
+
const loadedDictionary = yield call(resolver, language);
|
|
167
|
+
dictionary = loadedDictionary;
|
|
168
|
+
} catch (error) {
|
|
169
|
+
console.error(`No dictionary resolved for language ${language}`, error);
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
// Load dictionary from locales in state
|
|
173
|
+
const locales = yield select(selectLocales);
|
|
174
|
+
if (locales && locales[language]) {
|
|
175
|
+
dictionary = locales[language];
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return dictionary;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Side effects triggered from updating the language via dispatched action
|
|
183
|
+
* in language switching components, including resolving the next route,
|
|
184
|
+
* update the dictionary and subsequently redirect if needed
|
|
185
|
+
*/
|
|
186
|
+
function* updateLanguage({
|
|
187
|
+
payload: {
|
|
188
|
+
language,
|
|
189
|
+
redirect,
|
|
190
|
+
fallbackPath
|
|
191
|
+
}
|
|
192
|
+
}) {
|
|
193
|
+
const currentLanguage = yield select(selectCurrentLanguage);
|
|
194
|
+
if (language === currentLanguage) {
|
|
195
|
+
// no change needed
|
|
196
|
+
return;
|
|
197
|
+
} else {
|
|
198
|
+
const dictionary = language !== currentLanguage ? yield call(resolveDictionaryForLanguage, language) : yield select(selectDictionary);
|
|
199
|
+
const uri = yield call(resolveNextLanguageRoute, {
|
|
200
|
+
language,
|
|
201
|
+
redirect,
|
|
202
|
+
fallbackPath
|
|
203
|
+
});
|
|
204
|
+
yield put(actions.SET_LANGUAGE({
|
|
205
|
+
language,
|
|
206
|
+
dictionary: dictionary != null ? dictionary : undefined,
|
|
207
|
+
redirect: redirect !== false ? uri : undefined
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Handle any route redirection after we have set the language */
|
|
213
|
+
function* setLanguageRoute({
|
|
214
|
+
payload
|
|
215
|
+
}) {
|
|
216
|
+
if (payload !== null && payload !== void 0 && payload.redirect) {
|
|
217
|
+
const currentPath = yield select(selectCurrentPath);
|
|
218
|
+
if (payload.redirect === currentPath) {
|
|
219
|
+
// already on the correct path, no need to redirect
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
yield put(setRoute(payload.redirect));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** Determine the correct route uri when the language changes */
|
|
227
|
+
function* resolveNextLanguageRoute({
|
|
228
|
+
language,
|
|
229
|
+
redirect,
|
|
230
|
+
fallbackPath
|
|
231
|
+
}) {
|
|
232
|
+
// have they supplied the route to go to?
|
|
233
|
+
if (typeof redirect === 'string') {
|
|
234
|
+
return redirect;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// is this an entry or a static route?
|
|
238
|
+
const availableLanguages = yield select(selectRouteEntryAvailableLanguages);
|
|
239
|
+
if (availableLanguages.find(l => l.toLowerCase() === language.toLowerCase())) {
|
|
240
|
+
// if entry, get the uri for this language variation from the api
|
|
241
|
+
const entryUri = yield call(getEntryUriForLanguage, {
|
|
242
|
+
entryId: yield select(selectRouteEntryID),
|
|
243
|
+
language
|
|
244
|
+
});
|
|
245
|
+
if (entryUri) {
|
|
246
|
+
return entryUri;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// if static route, get the uri from the routes config
|
|
251
|
+
const staticRouteUri = yield call(getStaticRouteUri, {
|
|
252
|
+
language
|
|
253
|
+
});
|
|
254
|
+
if (staticRouteUri) {
|
|
255
|
+
return staticRouteUri;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// if all else fails, fallback to the supplied fallback path or homepage
|
|
259
|
+
return fallbackPath || `/${language.toLowerCase()}`;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** Check any current static route for a language variation we have stored in i18n.routes */
|
|
263
|
+
function* getStaticRouteUri({
|
|
264
|
+
language
|
|
265
|
+
}) {
|
|
266
|
+
const staticRoute = yield select(selectStaticRoute);
|
|
267
|
+
if (staticRoute !== null && staticRoute !== void 0 && staticRoute.route.path) {
|
|
268
|
+
var _Object$entries$find;
|
|
269
|
+
// Routes can have parameters such as `/:facet?` we need to deparameterise
|
|
270
|
+
// so we can check against our stored locale routes
|
|
271
|
+
const deparameterisedPath = deparameterise(staticRoute.route.path);
|
|
272
|
+
const localeRoutes = yield select(selectLocaleRoutes);
|
|
273
|
+
const originalPath = (_Object$entries$find = Object.entries(localeRoutes || {}).find(([, locales]) => Object.values(locales).includes(deparameterisedPath))) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0];
|
|
274
|
+
const routeLocales = localeRoutes[deparameterisedPath] || localeRoutes[originalPath || ''];
|
|
275
|
+
const routeUri = routeLocales === null || routeLocales === void 0 ? void 0 : routeLocales[language];
|
|
276
|
+
return routeUri;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Run when the app initiates locales, populating supported languages from the config
|
|
282
|
+
* or fetching from the project if not provided
|
|
283
|
+
*/
|
|
284
|
+
function* getProjectLanguages({
|
|
285
|
+
payload
|
|
286
|
+
}) {
|
|
287
|
+
const stateLocales = yield select(selectLocales);
|
|
288
|
+
if (stateLocales && Object.keys(stateLocales).length > 0)
|
|
289
|
+
// Locales already set in state, no need to fetch again
|
|
290
|
+
return;
|
|
291
|
+
const locales = {};
|
|
292
|
+
let primaryLanguage = payload.primaryLanguage;
|
|
293
|
+
const supportedLanguages = [...(payload.supportedLanguages || [])];
|
|
294
|
+
if (supportedLanguages !== null && supportedLanguages !== void 0 && supportedLanguages.length) {
|
|
295
|
+
// If supported languages are provided in config, use these
|
|
296
|
+
for (const supportedLanguage of supportedLanguages) {
|
|
297
|
+
locales[supportedLanguage] = {};
|
|
298
|
+
}
|
|
299
|
+
} else {
|
|
300
|
+
// Fallback to getting languages from the project
|
|
301
|
+
const [error, project] = yield to(cachedSearch.getClient().project.get());
|
|
302
|
+
if (error) {
|
|
303
|
+
console.error('Problem fetching project languages:', error);
|
|
304
|
+
} else if (project) {
|
|
305
|
+
var _project$primaryLangu;
|
|
306
|
+
for (const supportedLanguage of project.supportedLanguages || []) {
|
|
307
|
+
locales[supportedLanguage] = {};
|
|
308
|
+
supportedLanguages.push(supportedLanguage);
|
|
309
|
+
}
|
|
310
|
+
// Set primary language from project if we have it
|
|
311
|
+
primaryLanguage = (_project$primaryLangu = project.primaryLanguage) != null ? _project$primaryLangu : primaryLanguage;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (Object.keys(locales).length === 0) {
|
|
315
|
+
// Ensure at least the primary language is included
|
|
316
|
+
locales[payload.primaryLanguage] = {};
|
|
317
|
+
supportedLanguages.push(payload.primaryLanguage);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Only commit if we have locales to set or we will end up in an infinite loop
|
|
321
|
+
if (Object.keys(locales).length) yield put(actions.SET_LOCALES({
|
|
322
|
+
...payload,
|
|
323
|
+
primaryLanguage,
|
|
324
|
+
supportedLanguages,
|
|
325
|
+
locales
|
|
326
|
+
}));
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Run a Delivery API query to get the uri for the chosen language variation of this entryId
|
|
331
|
+
* */
|
|
332
|
+
function* getEntryUriForLanguage({
|
|
333
|
+
entryId,
|
|
334
|
+
language
|
|
335
|
+
}) {
|
|
336
|
+
try {
|
|
337
|
+
const versionStatus = yield select(selectVersionStatus);
|
|
338
|
+
const query = new Query(Op.equalTo('sys.id', entryId), Op.equalTo('sys.language', language), Op.equalTo('sys.versionStatus', versionStatus));
|
|
339
|
+
query.fields = ['sys.uri'];
|
|
340
|
+
query.pageSize = 1;
|
|
341
|
+
const result = yield cachedSearch.search(query);
|
|
342
|
+
return result.items.length ? result.items[0].sys.uri : null;
|
|
343
|
+
} catch (error) {
|
|
344
|
+
console.error('Error fetching language variations:', error);
|
|
345
|
+
yield put(actions.GET_ENTRY_URI_ERROR(error));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
61
349
|
const sys = {
|
|
62
350
|
versionStatus: 'sys.versionStatus'
|
|
63
351
|
};
|
|
@@ -80,6 +368,86 @@ const routeEntryByFieldsQuery = (id, language = 'en-GB', contentTypeId = '', fie
|
|
|
80
368
|
return query;
|
|
81
369
|
};
|
|
82
370
|
|
|
371
|
+
function* reduxInjectorSaga(injectorFn) {
|
|
372
|
+
if (typeof injectorFn === 'function') {
|
|
373
|
+
const {
|
|
374
|
+
key,
|
|
375
|
+
reducer,
|
|
376
|
+
saga
|
|
377
|
+
} = yield injectorFn();
|
|
378
|
+
injectRedux({
|
|
379
|
+
key,
|
|
380
|
+
reducer,
|
|
381
|
+
saga
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* @description Asynchronously load and inject assets related to Search
|
|
388
|
+
*/
|
|
389
|
+
const importSearchAssets = () => import('./search.js');
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Invokes the Search saga if:
|
|
393
|
+
* - `searchOptions` is present on `staticRoute` or `contentTypeRoute`
|
|
394
|
+
* - `searchOptions` is provided by the consumer app
|
|
395
|
+
* - and path starts with one of `onPaths: ['/search']`
|
|
396
|
+
* - or a `facet` or `listingType` is present in provided `searchOptions`
|
|
397
|
+
*
|
|
398
|
+
* A `config` is required if we want to inject the redux reducer here, sagas are injected automatically
|
|
399
|
+
*/
|
|
400
|
+
function* handleSearchSaga({
|
|
401
|
+
location,
|
|
402
|
+
params,
|
|
403
|
+
routeSearchOptions,
|
|
404
|
+
searchOptions,
|
|
405
|
+
ssr
|
|
406
|
+
}) {
|
|
407
|
+
// Merge supplied mappers with route-supplied mappers taking precedence
|
|
408
|
+
const mappers = {
|
|
409
|
+
results: e => e,
|
|
410
|
+
...((searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.mappers) || {}),
|
|
411
|
+
...((routeSearchOptions === null || routeSearchOptions === void 0 ? void 0 : routeSearchOptions.mappers) || {})
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
// Merge all other search options with route-supplied options taking precedence
|
|
415
|
+
const {
|
|
416
|
+
onPaths = ['/search'],
|
|
417
|
+
...searchOpts
|
|
418
|
+
} = {
|
|
419
|
+
...(routeSearchOptions || {}),
|
|
420
|
+
...(searchOptions || {})
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
// Check do we meet conditions to run the search saga
|
|
424
|
+
const invokeSearch = onPaths.find(p => location.pathname.startsWith(p)) || searchOpts.composition || searchOpts.facet || searchOpts.listingType;
|
|
425
|
+
|
|
426
|
+
// An empty routeSearchOptions object can be used to import assets and load config for a minilist
|
|
427
|
+
const importAssets = routeSearchOptions;
|
|
428
|
+
if (importAssets || invokeSearch) {
|
|
429
|
+
// Async load search assets
|
|
430
|
+
const {
|
|
431
|
+
reducer,
|
|
432
|
+
sagas,
|
|
433
|
+
setRouteFilters
|
|
434
|
+
} = yield importSearchAssets();
|
|
435
|
+
|
|
436
|
+
// Inject search reducer and sagas
|
|
437
|
+
yield call(reduxInjectorSaga, async () => ({
|
|
438
|
+
key: 'search',
|
|
439
|
+
reducer: searchOpts.config && reducer(searchOpts.config),
|
|
440
|
+
saga: sagas
|
|
441
|
+
}));
|
|
442
|
+
if (invokeSearch) yield call(setRouteFilters, {
|
|
443
|
+
params,
|
|
444
|
+
ssr,
|
|
445
|
+
...searchOpts,
|
|
446
|
+
mappers
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
83
451
|
const routingSagas = [takeEvery(SET_NAVIGATION_PATH, getRouteSaga), takeEvery(SET_ROUTE, setRouteSaga)];
|
|
84
452
|
|
|
85
453
|
/**
|
|
@@ -98,7 +466,7 @@ function* setRouteSaga(action) {
|
|
|
98
466
|
function* getRouteSaga(action) {
|
|
99
467
|
let entry = null;
|
|
100
468
|
try {
|
|
101
|
-
var _staticRoute$route, _staticRoute$route2, _staticRoute$route3, _staticRoute$route4, _appsays, _appsays2, _appsays3, _pathNode3, _pathNode4;
|
|
469
|
+
var _staticRoute$route, _staticRoute$route2, _staticRoute$route3, _staticRoute$route4, _appsays, _appsays2, _appsays3, _pathNode3, _pathNode4, _pathNode5;
|
|
102
470
|
const {
|
|
103
471
|
withEvents,
|
|
104
472
|
routes: {
|
|
@@ -107,7 +475,8 @@ function* getRouteSaga(action) {
|
|
|
107
475
|
staticRoute,
|
|
108
476
|
// get api instance from ssr context that is connected to the specific request in ssr
|
|
109
477
|
ssr: {
|
|
110
|
-
api
|
|
478
|
+
api,
|
|
479
|
+
subsitePath
|
|
111
480
|
}
|
|
112
481
|
} = action;
|
|
113
482
|
|
|
@@ -124,7 +493,8 @@ function* getRouteSaga(action) {
|
|
|
124
493
|
// These variables are the return values from
|
|
125
494
|
// calls to withEvents.onRouteLoad and onRouteLoaded
|
|
126
495
|
let appsays,
|
|
127
|
-
requireLogin = false
|
|
496
|
+
requireLogin = false,
|
|
497
|
+
searchOptions = false;
|
|
128
498
|
if (withEvents && withEvents.onRouteLoad) {
|
|
129
499
|
appsays = yield withEvents.onRouteLoad(action);
|
|
130
500
|
}
|
|
@@ -145,11 +515,13 @@ function* getRouteSaga(action) {
|
|
|
145
515
|
const routeEntry = selectRouteEntry(state, 'js');
|
|
146
516
|
const routeNode = selectCurrentNode(state, 'js');
|
|
147
517
|
const currentPath = action.path; //selectCurrentPath(state);
|
|
518
|
+
const contentPath = action.contentPath;
|
|
148
519
|
const deliveryApiStatus = selectVersionStatus(state);
|
|
149
520
|
const project = selectCurrentProject(state);
|
|
150
521
|
// const isHome = currentPath === '/';
|
|
151
522
|
const isPreview = currentPath && currentPath.startsWith('/preview/');
|
|
152
|
-
const
|
|
523
|
+
const currentLanguage = selectCurrentLanguage(state);
|
|
524
|
+
const defaultLang = appsays && appsays.defaultLang || currentLanguage || 'en-GB';
|
|
153
525
|
if (!isPreview && ((_appsays2 = appsays) !== null && _appsays2 !== void 0 && _appsays2.customRouting || staticRoute && !staticRoute.route.fetchNode || routeEntry && action.statePath === action.path && ((_appsays3 = appsays) === null || _appsays3 === void 0 ? void 0 : _appsays3.refetchNode) !== true)) {
|
|
154
526
|
var _staticRoute$route5;
|
|
155
527
|
// To prevent erroneous 404s and wasted network calls, this covers
|
|
@@ -162,13 +534,6 @@ function* getRouteSaga(action) {
|
|
|
162
534
|
entry: null
|
|
163
535
|
};
|
|
164
536
|
pathNode.entry = entry = routeEntry;
|
|
165
|
-
//Do nothing, the entry is allready the right one.
|
|
166
|
-
// yield put({
|
|
167
|
-
// type: SET_ENTRY,
|
|
168
|
-
// entry,
|
|
169
|
-
// node: routeNode,
|
|
170
|
-
// isLoading: false,
|
|
171
|
-
// });
|
|
172
537
|
yield put({
|
|
173
538
|
type: UPDATE_LOADING_STATE,
|
|
174
539
|
isLoading: false
|
|
@@ -189,7 +554,6 @@ function* getRouteSaga(action) {
|
|
|
189
554
|
// for previewing entries as it gives a response of []
|
|
190
555
|
// -- apparently it is not correct to request latest content
|
|
191
556
|
// with Node API
|
|
192
|
-
|
|
193
557
|
let previewEntry = yield api.getClient(deliveryApiStatus, project).entries.get({
|
|
194
558
|
id: entryGuid,
|
|
195
559
|
language,
|
|
@@ -212,11 +576,13 @@ function* getRouteSaga(action) {
|
|
|
212
576
|
// Resolve the complete entry with the node if we are setting limits in a static route
|
|
213
577
|
[nodeError, pathNode] = yield to(api.getNode({
|
|
214
578
|
depth: 0,
|
|
215
|
-
path:
|
|
579
|
+
path: contentPath,
|
|
216
580
|
entryFields: setStaticRouteLimits ? fields || '*' : setContentTypeLimits ? ['sys.contentTypeId', 'sys.id'] : '*',
|
|
217
581
|
entryLinkDepth: setStaticRouteLimits && typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth || 0,
|
|
218
582
|
entryFieldLinkDepths: setStaticRouteLimits ? fieldLinkDepths : setContentTypeLimits ? undefined : entryFieldLinkDepths,
|
|
219
|
-
language
|
|
583
|
+
// language parameter is not used when resolving a node by path
|
|
584
|
+
// https://www.contensis.com/help-and-docs/apis/delivery-http/navigation/nodes/get-a-node-by-path
|
|
585
|
+
// language: defaultLang,
|
|
220
586
|
versionStatus: deliveryApiStatus
|
|
221
587
|
}, project));
|
|
222
588
|
if (nodeError) {
|
|
@@ -283,25 +649,43 @@ function* getRouteSaga(action) {
|
|
|
283
649
|
appsays,
|
|
284
650
|
contentTypeMapping: contentTypeMapping || (staticRoute === null || staticRoute === void 0 || (_staticRoute$route6 = staticRoute.route) === null || _staticRoute$route6 === void 0 ? void 0 : _staticRoute$route6.fetchNode) || {},
|
|
285
651
|
language: defaultLang,
|
|
286
|
-
path:
|
|
652
|
+
path: contentPath,
|
|
287
653
|
pathNode,
|
|
288
654
|
project,
|
|
655
|
+
subsitePath,
|
|
289
656
|
versionStatus: deliveryApiStatus
|
|
290
657
|
});
|
|
291
658
|
if (children) pathNode.children = children;
|
|
292
659
|
}
|
|
293
|
-
|
|
660
|
+
|
|
661
|
+
// We initially listened for SET_ENTRY to complete before
|
|
662
|
+
// resolving the current route language, but this meant
|
|
663
|
+
// that the language change was not captured in time for the SSR response
|
|
664
|
+
yield call(resolveCurrentRouteLanguage, {
|
|
665
|
+
entry: (_pathNode3 = pathNode) === null || _pathNode3 === void 0 ? void 0 : _pathNode3.entry,
|
|
666
|
+
node: pathNode
|
|
667
|
+
});
|
|
668
|
+
const contentTypeRoute = findContentTypeMapping(ContentTypeMappings, (_pathNode4 = pathNode) === null || _pathNode4 === void 0 || (_pathNode4 = _pathNode4.entry) === null || _pathNode4 === void 0 || (_pathNode4 = _pathNode4.sys) === null || _pathNode4 === void 0 ? void 0 : _pathNode4.contentTypeId);
|
|
294
669
|
|
|
295
670
|
// Inject redux { key, reducer, saga } provided by ContentTypeMapping
|
|
296
|
-
if (
|
|
671
|
+
if (contentTypeRoute !== null && contentTypeRoute !== void 0 && contentTypeRoute.injectRedux) yield call(reduxInjectorSaga, contentTypeRoute.injectRedux);
|
|
672
|
+
|
|
673
|
+
// Have we defined search options in the route configuration (for triggering search)
|
|
674
|
+
const routeSearchOptions = getSearchOptions(staticRoute, contentTypeRoute);
|
|
675
|
+
const params = routeParams(staticRoute, action.location);
|
|
297
676
|
if (withEvents && withEvents.onRouteLoaded) {
|
|
298
677
|
// Check if the app has provided a requireLogin boolean flag or groups array
|
|
299
678
|
// in addition to checking if requireLogin is set in the route definition
|
|
679
|
+
// The app can provide an object to invoke the search saga
|
|
300
680
|
({
|
|
301
|
-
requireLogin
|
|
681
|
+
requireLogin,
|
|
682
|
+
searchOptions
|
|
302
683
|
} = (yield withEvents.onRouteLoaded({
|
|
303
684
|
...action,
|
|
304
|
-
|
|
685
|
+
contentTypeRoute,
|
|
686
|
+
entry,
|
|
687
|
+
params,
|
|
688
|
+
searchOptions: routeSearchOptions
|
|
305
689
|
})) || {});
|
|
306
690
|
}
|
|
307
691
|
if (requireLogin !== false) {
|
|
@@ -312,14 +696,20 @@ function* getRouteSaga(action) {
|
|
|
312
696
|
requireLogin
|
|
313
697
|
});
|
|
314
698
|
}
|
|
699
|
+
if (searchOptions || routeSearchOptions) yield call(handleSearchSaga, {
|
|
700
|
+
...action,
|
|
701
|
+
params,
|
|
702
|
+
routeSearchOptions,
|
|
703
|
+
searchOptions
|
|
704
|
+
});
|
|
315
705
|
if (!appsays || !appsays.preventScrollTop) {
|
|
316
706
|
// Scroll into View
|
|
317
707
|
if (typeof window !== 'undefined') window.scrollTo(0, 0);
|
|
318
708
|
}
|
|
319
|
-
if ((
|
|
709
|
+
if ((_pathNode5 = pathNode) !== null && _pathNode5 !== void 0 && (_pathNode5 = _pathNode5.entry) !== null && _pathNode5 !== void 0 && (_pathNode5 = _pathNode5.sys) !== null && _pathNode5 !== void 0 && _pathNode5.id) {
|
|
320
710
|
var _appsays4;
|
|
321
711
|
entry = pathNode.entry;
|
|
322
|
-
yield call(setRouteEntry, currentPath, entry, pathNode, ancestors, siblings, entryMapper ||
|
|
712
|
+
yield call(setRouteEntry, currentPath, entry, pathNode, ancestors, siblings, entryMapper || (contentTypeRoute === null || contentTypeRoute === void 0 ? void 0 : contentTypeRoute.entryMapper), false, (_appsays4 = appsays) === null || _appsays4 === void 0 ? void 0 : _appsays4.refetchNode);
|
|
323
713
|
} else {
|
|
324
714
|
if (staticRoute) yield call(setRouteEntry, currentPath, null, pathNode, ancestors, siblings);else yield call(do404);
|
|
325
715
|
}
|
|
@@ -337,6 +727,7 @@ function* resolveCurrentNodeOrdinates(action) {
|
|
|
337
727
|
path,
|
|
338
728
|
pathNode,
|
|
339
729
|
project,
|
|
730
|
+
subsitePath,
|
|
340
731
|
versionStatus
|
|
341
732
|
} = action;
|
|
342
733
|
const apiCall = [() => null, () => null, () => null, () => null];
|
|
@@ -359,7 +750,8 @@ function* resolveCurrentNodeOrdinates(action) {
|
|
|
359
750
|
return yield api.getAncestors({
|
|
360
751
|
id: pathNode.id,
|
|
361
752
|
language,
|
|
362
|
-
versionStatus
|
|
753
|
+
versionStatus,
|
|
754
|
+
startLevel: (subsitePath || '').split('/').length
|
|
363
755
|
}, project);
|
|
364
756
|
} catch (ex) {
|
|
365
757
|
log.info('Problem fetching ancestors', ex);
|
|
@@ -500,20 +892,6 @@ function* do500(error) {
|
|
|
500
892
|
statusCode: error && error.status ? error.status : 500
|
|
501
893
|
});
|
|
502
894
|
}
|
|
503
|
-
function* reduxInjectorSaga(injectorFn) {
|
|
504
|
-
if (typeof injectorFn === 'function') {
|
|
505
|
-
const {
|
|
506
|
-
key,
|
|
507
|
-
reducer,
|
|
508
|
-
saga
|
|
509
|
-
} = yield injectorFn();
|
|
510
|
-
injectRedux({
|
|
511
|
-
key,
|
|
512
|
-
reducer,
|
|
513
|
-
saga
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
895
|
|
|
518
896
|
const registerSagas = [takeEvery(REGISTER_USER, registerSaga), takeEvery(REGISTER_USER_SUCCESS, redirectSaga)];
|
|
519
897
|
function* registerSaga({
|
|
@@ -763,11 +1141,6 @@ function* changePasswordSaga(action) {
|
|
|
763
1141
|
});
|
|
764
1142
|
return;
|
|
765
1143
|
}
|
|
766
|
-
|
|
767
|
-
// // eslint-disable-next-line no-console
|
|
768
|
-
// console.log(changePasswordObject);
|
|
769
|
-
// // eslint-disable-next-line no-console
|
|
770
|
-
// console.log(userCredentialsObject);
|
|
771
1144
|
yield put({
|
|
772
1145
|
type: CHANGE_USER_PASSWORD_SUCCESS
|
|
773
1146
|
});
|
|
@@ -781,13 +1154,16 @@ function* changePasswordSaga(action) {
|
|
|
781
1154
|
|
|
782
1155
|
const userSagas = [...loginSagas, ...registerSagas, ...resetPasswordSagas];
|
|
783
1156
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
1157
|
+
var rootSaga = (featureSagas = []) => {
|
|
1158
|
+
return [...i18nSagas, ...routingSagas, ...navigationSagas, ...userSagas, ...featureSagas];
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
// export default function (featureSagas: Effect[] = []) {
|
|
1162
|
+
// return function* rootSaga() {
|
|
1163
|
+
// const subSagas = [...routingSagas, ...navigationSagas, ...userSagas];
|
|
1164
|
+
// yield all([...subSagas, ...featureSagas]);
|
|
1165
|
+
// };
|
|
1166
|
+
// }
|
|
791
1167
|
|
|
792
1168
|
const servers = SERVERS; /* global SERVERS */
|
|
793
1169
|
const alias = servers.alias.toLowerCase();
|
|
@@ -832,5 +1208,5 @@ const AppRoot = props => {
|
|
|
832
1208
|
return /*#__PURE__*/React.createElement(RouteLoader, props);
|
|
833
1209
|
};
|
|
834
1210
|
|
|
835
|
-
export { AppRoot as A, browserHistory as b, history as h, pickProject as p, rootSaga as r };
|
|
836
|
-
//# sourceMappingURL=App-
|
|
1211
|
+
export { AppRoot as A, browserHistory as b, createLocaleRoutes as c, history as h, pickProject as p, rootSaga as r };
|
|
1212
|
+
//# sourceMappingURL=App-CrCf7gso.js.map
|