@zengenti/contensis-react-base 4.0.0-beta.8 → 4.0.0
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-CNylISW7.js} +546 -104
- package/cjs/App-CNylISW7.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-MfcvdfDR.js} +32 -74
- package/cjs/ContensisDeliveryApi-MfcvdfDR.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-DJeM8cym.js} +17 -9
- package/cjs/RouteLoader-DJeM8cym.js.map +1 -0
- package/cjs/SSRContext-tMufQDHY.js +116 -0
- package/cjs/SSRContext-tMufQDHY.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 +63 -65
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +223 -132
- 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-BCy9u6zA.js} +523 -370
- package/cjs/sagas-BCy9u6zA.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-B7SJs5Hf.js} +64 -5
- package/cjs/store-B7SJs5Hf.js.map +1 -0
- package/cjs/urls-DGZlAs0y.js +25 -0
- package/cjs/urls-DGZlAs0y.js.map +1 -0
- package/cjs/user.js +20 -17
- package/cjs/user.js.map +1 -1
- package/cjs/util-eOjxDjxF.js +148 -0
- package/cjs/util-eOjxDjxF.js.map +1 -0
- package/cjs/util.js +80 -22
- package/cjs/util.js.map +1 -1
- 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/cjs/{version-B7XFkBhY.js → version-yjHMrfVz.js} +15 -16
- package/cjs/version-yjHMrfVz.js.map +1 -0
- package/esm/{App-DLZweVSp.js → App-Bvs7Km54.js} +507 -66
- package/esm/App-Bvs7Km54.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-LWYXevZ1.js} +30 -67
- package/esm/ContensisDeliveryApi-LWYXevZ1.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-CzrlySZf.js} +14 -6
- package/esm/RouteLoader-CzrlySZf.js.map +1 -0
- package/esm/SSRContext-Bxtg1KGv.js +106 -0
- package/esm/SSRContext-Bxtg1KGv.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 +63 -64
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +216 -127
- 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-Fr9yRduO.js} +511 -357
- package/esm/sagas-Fr9yRduO.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-B4IrBYHm.js} +64 -6
- package/esm/store-B4IrBYHm.js.map +1 -0
- package/esm/urls-tLxo_skx.js +22 -0
- package/esm/urls-tLxo_skx.js.map +1 -0
- package/esm/user.js +9 -6
- package/esm/user.js.map +1 -1
- package/esm/util-Bl2u6LpY.js +136 -0
- package/esm/util-Bl2u6LpY.js.map +1 -0
- package/esm/util.js +58 -14
- package/esm/util.js.map +1 -1
- 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/esm/{version-BlsI7hX2.js → version-CA9Mdm3A.js} +16 -16
- package/esm/version-CA9Mdm3A.js.map +1 -0
- 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 +1 -2
- 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 +6 -1
- package/models/models/EntryMapper.d.ts +2 -1
- 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/RouteNode.d.ts +4 -2
- package/models/models/SSRContext.d.ts +4 -4
- package/models/models/StaticRoute.d.ts +12 -1
- 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 +14 -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/components.styled/Login.styled.d.ts +1 -1
- package/models/user/components.styled/LoginForm.styled.d.ts +1 -1
- 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/errors.d.ts +16 -0
- package/models/util/index.d.ts +7 -2
- package/models/util/subsite.d.ts +12 -0
- package/models/util/urls.d.ts +1 -2
- package/models/util/useIsClient.d.ts +6 -0
- package/package.json +37 -39
- 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
|
@@ -3,21 +3,34 @@
|
|
|
3
3
|
var history$1 = require('history');
|
|
4
4
|
var effects = require('@redux-saga/core/effects');
|
|
5
5
|
var log = require('loglevel');
|
|
6
|
-
var store = require('./store-
|
|
7
|
-
var version = require('./version-
|
|
6
|
+
var store = require('./store-B7SJs5Hf.js');
|
|
7
|
+
var version = require('./version-yjHMrfVz.js');
|
|
8
8
|
var to = require('await-to-js');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
9
|
+
var createSagaMiddleware = require('redux-saga');
|
|
10
|
+
var contensisDeliveryApi = require('contensis-delivery-api');
|
|
11
|
+
var slice = require('./slice-5xJMH24n.js');
|
|
12
|
+
var selectors$1 = require('./selectors-BrxJ8-F8.js');
|
|
13
|
+
var version$1 = require('./version-rFG9Y6_B.js');
|
|
14
|
+
var ContensisDeliveryApi = require('./ContensisDeliveryApi-MfcvdfDR.js');
|
|
12
15
|
var React = require('react');
|
|
13
16
|
require('react-cookie');
|
|
14
17
|
require('react-redux');
|
|
18
|
+
require('./VersionInfo-zFPsvS8q.js');
|
|
19
|
+
require('react-helmet-async');
|
|
15
20
|
require('jsonpath-mapper');
|
|
16
|
-
var contensisDeliveryApi = require('contensis-delivery-api');
|
|
17
|
-
var ToJs = require('./ToJs-C9jwV7YB.js');
|
|
18
|
-
require('query-string');
|
|
19
21
|
require('react-router-dom');
|
|
20
|
-
var
|
|
22
|
+
var selectors = require('./selectors-DAQR0uZa.js');
|
|
23
|
+
var ChangePassword_container = require('./ChangePassword.container-C4Du3Wb1.js');
|
|
24
|
+
require('./sagas-BCy9u6zA.js');
|
|
25
|
+
require('reselect');
|
|
26
|
+
require('immer');
|
|
27
|
+
require('deep-equal');
|
|
28
|
+
require('deepmerge');
|
|
29
|
+
var util = require('./util-eOjxDjxF.js');
|
|
30
|
+
require('contensis-core-api');
|
|
31
|
+
var matchGroups = require('./matchGroups-dqONU-vY.js');
|
|
32
|
+
var RouteLoader = require('./RouteLoader-DJeM8cym.js');
|
|
33
|
+
require('query-string');
|
|
21
34
|
|
|
22
35
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
36
|
|
|
@@ -43,6 +56,60 @@ var log__namespace = /*#__PURE__*/_interopNamespace(log);
|
|
|
43
56
|
var to__default = /*#__PURE__*/_interopDefault(to);
|
|
44
57
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
45
58
|
|
|
59
|
+
const isApiError = e => !!e && typeof e === 'object' && 'status' in e && 'statusText' in e;
|
|
60
|
+
const isPlainError = e => !!e && typeof e === 'object' && 'message' in e && typeof e.message === 'string';
|
|
61
|
+
const logError = (prefix, e) => {
|
|
62
|
+
var _e$data;
|
|
63
|
+
const message = isApiError(e) ? `${prefix} ${e.status} "${((_e$data = e.data) === null || _e$data === void 0 ? void 0 : _e$data.message) || ''}" url: ${e.url || ''}` : isPlainError(e) ? `${prefix} "${(e === null || e === void 0 ? void 0 : e.message) || e}"${e !== null && e !== void 0 && e.stack ? `\n${e.stack}` : ''}` : `${prefix} "${e}"`;
|
|
64
|
+
log.error(message);
|
|
65
|
+
};
|
|
66
|
+
const shorten = (str, maxLength = 120, endWeight = 0.6) => {
|
|
67
|
+
if (!str || str.length <= maxLength) return str;
|
|
68
|
+
const charsToShow = maxLength - 3;
|
|
69
|
+
const back = Math.floor(charsToShow * endWeight);
|
|
70
|
+
const front = charsToShow - back;
|
|
71
|
+
return `${str.slice(0, front)}...${str.slice(str.length - back)}`;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const deparameterise = path => {
|
|
75
|
+
return path.replace(/\/:\w+\??/g, '');
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** Create static routes for routes with specified locales */
|
|
79
|
+
const createLocaleRoutes = routes => {
|
|
80
|
+
const localeRoutes = {};
|
|
81
|
+
for (const route of routes.StaticRoutes) {
|
|
82
|
+
// If the route has defined locales, create entries for each locale
|
|
83
|
+
if (route.i18n && route.path) {
|
|
84
|
+
for (const [language, path] of Object.entries(route.i18n)) {
|
|
85
|
+
// We already have a locale route, so just append the language and path
|
|
86
|
+
const deparameterisedPath = deparameterise(route.path);
|
|
87
|
+
const deparameterisedLocalePath = deparameterise(path);
|
|
88
|
+
if (localeRoutes[deparameterisedPath]) localeRoutes[deparameterisedPath][language] = deparameterisedLocalePath;
|
|
89
|
+
// Otherwise, create a new entry for this route path
|
|
90
|
+
else localeRoutes[deparameterisedPath] = {
|
|
91
|
+
[language]: deparameterisedLocalePath
|
|
92
|
+
};
|
|
93
|
+
if (deparameterise(route.path) !== deparameterisedLocalePath) {
|
|
94
|
+
// I think we are OK to mutate here as this is only run once on app init
|
|
95
|
+
// we can change this if needed later
|
|
96
|
+
routes.StaticRoutes.push({
|
|
97
|
+
...route,
|
|
98
|
+
path,
|
|
99
|
+
// Add the path with any parameters included
|
|
100
|
+
language,
|
|
101
|
+
i18n: undefined
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
// Just set the language on the existing route instead of creating a duplicate
|
|
105
|
+
route.language = language;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return localeRoutes;
|
|
111
|
+
};
|
|
112
|
+
|
|
46
113
|
// Create a history depending on the environment
|
|
47
114
|
const selectedHistory = typeof window !== 'undefined' ? history$1.createBrowserHistory : history$1.createMemoryHistory;
|
|
48
115
|
const history = (options = {}) => selectedHistory(options);
|
|
@@ -55,12 +122,17 @@ function* ensureNodeTreeSaga(action) {
|
|
|
55
122
|
language,
|
|
56
123
|
project,
|
|
57
124
|
versionStatus,
|
|
125
|
+
subsitePath,
|
|
58
126
|
treeDepth
|
|
59
127
|
} = action;
|
|
60
128
|
const state = yield effects.select();
|
|
61
129
|
try {
|
|
62
130
|
if (!version.hasNavigationTree(state)) {
|
|
63
|
-
const nodes = yield api.
|
|
131
|
+
const nodes = subsitePath ? yield api.getNode({
|
|
132
|
+
path: subsitePath,
|
|
133
|
+
depth: treeDepth || 0,
|
|
134
|
+
language
|
|
135
|
+
}, project) : yield api.getRootNode({
|
|
64
136
|
depth: treeDepth || 0,
|
|
65
137
|
language
|
|
66
138
|
}, versionStatus, project);
|
|
@@ -84,6 +156,238 @@ function* ensureNodeTreeSaga(action) {
|
|
|
84
156
|
}
|
|
85
157
|
}
|
|
86
158
|
|
|
159
|
+
const i18nSagas = [effects.takeEvery(slice.actions.INIT_LOCALES.type, getProjectLanguages), effects.takeEvery(slice.actions.UPDATE_LANGUAGE.type, updateLanguage), effects.takeEvery(slice.actions.SET_LANGUAGE.type, setLanguageRoute)];
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Resolve the current route language based on the entry, node, static route or path
|
|
163
|
+
* Is called directly from the routing saga as soon as an entry or node has been fetched
|
|
164
|
+
*/
|
|
165
|
+
function* resolveCurrentRouteLanguage({
|
|
166
|
+
entry,
|
|
167
|
+
node
|
|
168
|
+
}) {
|
|
169
|
+
var _entry$sys, _staticRoute$route;
|
|
170
|
+
const currentLanguage = yield effects.select(selectors.selectCurrentLanguage);
|
|
171
|
+
const staticRoute = yield effects.select(selectors$1.selectStaticRoute);
|
|
172
|
+
let nextLanguage = currentLanguage;
|
|
173
|
+
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 {
|
|
174
|
+
var _currentPath$split$fi;
|
|
175
|
+
// attempt to infer language from the path
|
|
176
|
+
const currentPath = yield effects.select(selectors$1.selectCurrentPath);
|
|
177
|
+
|
|
178
|
+
// path is normally lowercase
|
|
179
|
+
const firstPathSegment = (_currentPath$split$fi = currentPath.split('/').find(segment => segment.length)) === null || _currentPath$split$fi === void 0 ? void 0 : _currentPath$split$fi.toLowerCase();
|
|
180
|
+
const locales = yield effects.select(selectors.selectLocales);
|
|
181
|
+
const matchedLanguage = Object.keys(locales).find(lang => lang.toLowerCase() === firstPathSegment);
|
|
182
|
+
// matched a supported language in the path
|
|
183
|
+
if (matchedLanguage) nextLanguage = matchedLanguage;else
|
|
184
|
+
// falling back to primary language
|
|
185
|
+
nextLanguage = yield effects.select(selectors.selectPrimaryLanguage);
|
|
186
|
+
}
|
|
187
|
+
if (nextLanguage && nextLanguage !== currentLanguage) {
|
|
188
|
+
const dictionary = yield effects.call(resolveDictionaryForLanguage, nextLanguage);
|
|
189
|
+
yield effects.put(slice.actions.SET_LANGUAGE({
|
|
190
|
+
language: nextLanguage,
|
|
191
|
+
dictionary
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Resolve the current dictionary for route language either using a supplied resolver
|
|
198
|
+
* function or directly derive from the locales stored in state
|
|
199
|
+
* Is called directly any time the language is changed
|
|
200
|
+
*/
|
|
201
|
+
function* resolveDictionaryForLanguage(language) {
|
|
202
|
+
let dictionary = yield effects.select(selectors.selectDictionary);
|
|
203
|
+
// try and resolve a dictionary for this language
|
|
204
|
+
const resolver = yield effects.select(selectors.selectDictionaryResolver);
|
|
205
|
+
if (typeof resolver === 'function') {
|
|
206
|
+
try {
|
|
207
|
+
// dynamic import of dictionary file
|
|
208
|
+
const loadedDictionary = yield effects.call(resolver, language);
|
|
209
|
+
dictionary = loadedDictionary;
|
|
210
|
+
} catch (error) {
|
|
211
|
+
console.error(`No dictionary resolved for language ${language}`, error);
|
|
212
|
+
}
|
|
213
|
+
} else {
|
|
214
|
+
// Load dictionary from locales in state
|
|
215
|
+
const locales = yield effects.select(selectors.selectLocales);
|
|
216
|
+
if (locales && locales[language]) {
|
|
217
|
+
dictionary = locales[language];
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return dictionary;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Side effects triggered from updating the language via dispatched action
|
|
225
|
+
* in language switching components, including resolving the next route,
|
|
226
|
+
* update the dictionary and subsequently redirect if needed
|
|
227
|
+
*/
|
|
228
|
+
function* updateLanguage({
|
|
229
|
+
payload: {
|
|
230
|
+
language,
|
|
231
|
+
redirect,
|
|
232
|
+
fallbackPath
|
|
233
|
+
}
|
|
234
|
+
}) {
|
|
235
|
+
const currentLanguage = yield effects.select(selectors.selectCurrentLanguage);
|
|
236
|
+
if (language === currentLanguage) {
|
|
237
|
+
// no change needed
|
|
238
|
+
return;
|
|
239
|
+
} else {
|
|
240
|
+
const dictionary = language !== currentLanguage ? yield effects.call(resolveDictionaryForLanguage, language) : yield effects.select(selectors.selectDictionary);
|
|
241
|
+
const uri = yield effects.call(resolveNextLanguageRoute, {
|
|
242
|
+
language,
|
|
243
|
+
redirect,
|
|
244
|
+
fallbackPath
|
|
245
|
+
});
|
|
246
|
+
yield effects.put(slice.actions.SET_LANGUAGE({
|
|
247
|
+
language,
|
|
248
|
+
dictionary: dictionary != null ? dictionary : undefined,
|
|
249
|
+
redirect: redirect !== false ? uri : undefined
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** Handle any route redirection after we have set the language */
|
|
255
|
+
function* setLanguageRoute({
|
|
256
|
+
payload
|
|
257
|
+
}) {
|
|
258
|
+
if (payload !== null && payload !== void 0 && payload.redirect) {
|
|
259
|
+
const currentPath = yield effects.select(selectors$1.selectCurrentPath);
|
|
260
|
+
if (payload.redirect === currentPath) {
|
|
261
|
+
// already on the correct path, no need to redirect
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
yield effects.put(selectors$1.setRoute(payload.redirect));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** Determine the correct route uri when the language changes */
|
|
269
|
+
function* resolveNextLanguageRoute({
|
|
270
|
+
language,
|
|
271
|
+
redirect,
|
|
272
|
+
fallbackPath
|
|
273
|
+
}) {
|
|
274
|
+
// have they supplied the route to go to?
|
|
275
|
+
if (typeof redirect === 'string') {
|
|
276
|
+
return redirect;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// is this an entry or a static route?
|
|
280
|
+
const availableLanguages = yield effects.select(selectors$1.selectRouteEntryAvailableLanguages);
|
|
281
|
+
if (availableLanguages.find(l => l.toLowerCase() === language.toLowerCase())) {
|
|
282
|
+
// if entry, get the uri for this language variation from the api
|
|
283
|
+
const entryUri = yield effects.call(getEntryUriForLanguage, {
|
|
284
|
+
entryId: yield effects.select(selectors$1.selectRouteEntryID),
|
|
285
|
+
language
|
|
286
|
+
});
|
|
287
|
+
if (entryUri) {
|
|
288
|
+
return entryUri;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// if static route, get the uri from the routes config
|
|
293
|
+
const staticRouteUri = yield effects.call(getStaticRouteUri, {
|
|
294
|
+
language
|
|
295
|
+
});
|
|
296
|
+
if (staticRouteUri) {
|
|
297
|
+
return staticRouteUri;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// if all else fails, fallback to the supplied fallback path or homepage
|
|
301
|
+
return fallbackPath || `/${language.toLowerCase()}`;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/** Check any current static route for a language variation we have stored in i18n.routes */
|
|
305
|
+
function* getStaticRouteUri({
|
|
306
|
+
language
|
|
307
|
+
}) {
|
|
308
|
+
const staticRoute = yield effects.select(selectors$1.selectStaticRoute);
|
|
309
|
+
if (staticRoute !== null && staticRoute !== void 0 && staticRoute.route.path) {
|
|
310
|
+
var _Object$entries$find;
|
|
311
|
+
// Routes can have parameters such as `/:facet?` we need to deparameterise
|
|
312
|
+
// so we can check against our stored locale routes
|
|
313
|
+
const deparameterisedPath = deparameterise(staticRoute.route.path);
|
|
314
|
+
const localeRoutes = yield effects.select(selectors.selectLocaleRoutes);
|
|
315
|
+
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];
|
|
316
|
+
const routeLocales = localeRoutes[deparameterisedPath] || localeRoutes[originalPath || ''];
|
|
317
|
+
const routeUri = routeLocales === null || routeLocales === void 0 ? void 0 : routeLocales[language];
|
|
318
|
+
return routeUri;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Run when the app initiates locales, populating supported languages from the config
|
|
324
|
+
* or fetching from the project if not provided
|
|
325
|
+
*/
|
|
326
|
+
function* getProjectLanguages({
|
|
327
|
+
payload
|
|
328
|
+
}) {
|
|
329
|
+
const stateLocales = yield effects.select(selectors.selectLocales);
|
|
330
|
+
if (stateLocales && Object.keys(stateLocales).length > 0)
|
|
331
|
+
// Locales already set in state, no need to fetch again
|
|
332
|
+
return;
|
|
333
|
+
const locales = {};
|
|
334
|
+
let primaryLanguage = payload.primaryLanguage;
|
|
335
|
+
const supportedLanguages = [...(payload.supportedLanguages || [])];
|
|
336
|
+
if (supportedLanguages !== null && supportedLanguages !== void 0 && supportedLanguages.length) {
|
|
337
|
+
// If supported languages are provided in config, use these
|
|
338
|
+
for (const supportedLanguage of supportedLanguages) {
|
|
339
|
+
locales[supportedLanguage] = {};
|
|
340
|
+
}
|
|
341
|
+
} else {
|
|
342
|
+
// Fallback to getting languages from the project
|
|
343
|
+
const [error, project] = yield to__default.default(ContensisDeliveryApi.cachedSearch.getClient().project.get());
|
|
344
|
+
if (error) {
|
|
345
|
+
console.error('Problem fetching project languages:', error);
|
|
346
|
+
} else if (project) {
|
|
347
|
+
var _project$primaryLangu;
|
|
348
|
+
for (const supportedLanguage of project.supportedLanguages || []) {
|
|
349
|
+
locales[supportedLanguage] = {};
|
|
350
|
+
supportedLanguages.push(supportedLanguage);
|
|
351
|
+
}
|
|
352
|
+
// Set primary language from project if we have it
|
|
353
|
+
primaryLanguage = (_project$primaryLangu = project.primaryLanguage) != null ? _project$primaryLangu : primaryLanguage;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (Object.keys(locales).length === 0) {
|
|
357
|
+
// Ensure at least the primary language is included
|
|
358
|
+
locales[payload.primaryLanguage] = {};
|
|
359
|
+
supportedLanguages.push(payload.primaryLanguage);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Only commit if we have locales to set or we will end up in an infinite loop
|
|
363
|
+
if (Object.keys(locales).length) yield effects.put(slice.actions.SET_LOCALES({
|
|
364
|
+
...payload,
|
|
365
|
+
primaryLanguage,
|
|
366
|
+
supportedLanguages,
|
|
367
|
+
locales
|
|
368
|
+
}));
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Run a Delivery API query to get the uri for the chosen language variation of this entryId
|
|
373
|
+
* */
|
|
374
|
+
function* getEntryUriForLanguage({
|
|
375
|
+
entryId,
|
|
376
|
+
language
|
|
377
|
+
}) {
|
|
378
|
+
try {
|
|
379
|
+
const versionStatus = yield effects.select(version$1.selectVersionStatus);
|
|
380
|
+
const query = new contensisDeliveryApi.Query(contensisDeliveryApi.Op.equalTo('sys.id', entryId), contensisDeliveryApi.Op.equalTo('sys.language', language), contensisDeliveryApi.Op.equalTo('sys.versionStatus', versionStatus));
|
|
381
|
+
query.fields = ['sys.uri'];
|
|
382
|
+
query.pageSize = 1;
|
|
383
|
+
const result = yield ContensisDeliveryApi.cachedSearch.search(query);
|
|
384
|
+
return result.items.length ? result.items[0].sys.uri : null;
|
|
385
|
+
} catch (error) {
|
|
386
|
+
console.error('Error fetching language variations:', error);
|
|
387
|
+
yield effects.put(slice.actions.GET_ENTRY_URI_ERROR(error));
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
87
391
|
const sys = {
|
|
88
392
|
versionStatus: 'sys.versionStatus'
|
|
89
393
|
};
|
|
@@ -106,7 +410,89 @@ const routeEntryByFieldsQuery = (id, language = 'en-GB', contentTypeId = '', fie
|
|
|
106
410
|
return query;
|
|
107
411
|
};
|
|
108
412
|
|
|
109
|
-
|
|
413
|
+
function* reduxInjectorSaga(injectorFn) {
|
|
414
|
+
if (typeof injectorFn === 'function') {
|
|
415
|
+
const {
|
|
416
|
+
key,
|
|
417
|
+
reducer,
|
|
418
|
+
saga
|
|
419
|
+
} = yield injectorFn();
|
|
420
|
+
version.injectRedux({
|
|
421
|
+
key,
|
|
422
|
+
reducer,
|
|
423
|
+
saga
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* @description Asynchronously load and inject assets related to Search
|
|
430
|
+
*/
|
|
431
|
+
const importSearchAssets = () => Promise.resolve().then(function () { return require('./search.js'); });
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Invokes the Search saga if:
|
|
435
|
+
* - `searchOptions` is present on `staticRoute` or `contentTypeRoute`
|
|
436
|
+
* - `searchOptions` is provided by the consumer app
|
|
437
|
+
* - and path starts with one of `onPaths: ['/search']`
|
|
438
|
+
* - or a `facet` or `listingType` is present in provided `searchOptions`
|
|
439
|
+
*
|
|
440
|
+
* A `config` is required if we want to inject the redux reducer here, sagas are injected automatically
|
|
441
|
+
*/
|
|
442
|
+
function* handleSearchSaga({
|
|
443
|
+
location,
|
|
444
|
+
params,
|
|
445
|
+
routeSearchOptions,
|
|
446
|
+
searchOptions,
|
|
447
|
+
ssr
|
|
448
|
+
}) {
|
|
449
|
+
// Merge supplied mappers with route-supplied mappers taking precedence
|
|
450
|
+
const mappers = {
|
|
451
|
+
results: e => e,
|
|
452
|
+
...((searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.mappers) || {}),
|
|
453
|
+
...((routeSearchOptions === null || routeSearchOptions === void 0 ? void 0 : routeSearchOptions.mappers) || {})
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
// Merge all other search options with route-supplied options taking precedence
|
|
457
|
+
const {
|
|
458
|
+
onPaths = ['/search'],
|
|
459
|
+
...searchOpts
|
|
460
|
+
} = {
|
|
461
|
+
...(routeSearchOptions || {}),
|
|
462
|
+
...(searchOptions || {})
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// Check do we meet conditions to run the search saga
|
|
466
|
+
const invokeSearch = onPaths.find(p => location.pathname.startsWith(p)) || searchOpts.composition || searchOpts.facet || searchOpts.listingType;
|
|
467
|
+
|
|
468
|
+
// An empty routeSearchOptions object can be used to import assets and load config for a minilist
|
|
469
|
+
const importAssets = routeSearchOptions;
|
|
470
|
+
if (importAssets || invokeSearch) {
|
|
471
|
+
// Async load search assets
|
|
472
|
+
const {
|
|
473
|
+
reducer,
|
|
474
|
+
sagas,
|
|
475
|
+
setRouteFilters
|
|
476
|
+
} = yield importSearchAssets();
|
|
477
|
+
|
|
478
|
+
// Inject search reducer and sagas
|
|
479
|
+
yield effects.call(reduxInjectorSaga, async () => ({
|
|
480
|
+
key: 'search',
|
|
481
|
+
reducer: searchOpts.config && reducer(searchOpts.config),
|
|
482
|
+
saga: sagas
|
|
483
|
+
}));
|
|
484
|
+
if (invokeSearch) yield effects.call(setRouteFilters, {
|
|
485
|
+
params,
|
|
486
|
+
ssr,
|
|
487
|
+
...searchOpts,
|
|
488
|
+
mappers
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const error = (e, message) => logError(`[routeSaga]${message ? ` ${message}` : ''}`, e);
|
|
494
|
+
let livePreviewTask = null;
|
|
495
|
+
const routingSagas = [effects.takeEvery(selectors$1.SET_NAVIGATION_PATH, getRouteSaga), effects.takeEvery(selectors$1.SET_ROUTE, setRouteSaga)];
|
|
110
496
|
|
|
111
497
|
/**
|
|
112
498
|
* To navigate / push a specific route via redux middleware
|
|
@@ -124,7 +510,7 @@ function* setRouteSaga(action) {
|
|
|
124
510
|
function* getRouteSaga(action) {
|
|
125
511
|
let entry = null;
|
|
126
512
|
try {
|
|
127
|
-
var _staticRoute$route, _staticRoute$route2, _staticRoute$route3, _staticRoute$route4, _appsays, _appsays2, _appsays3, _pathNode3, _pathNode4;
|
|
513
|
+
var _staticRoute$route, _staticRoute$route2, _staticRoute$route3, _staticRoute$route4, _appsays, _appsays2, _appsays3, _pathNode3, _pathNode4, _pathNode5;
|
|
128
514
|
const {
|
|
129
515
|
withEvents,
|
|
130
516
|
routes: {
|
|
@@ -133,7 +519,8 @@ function* getRouteSaga(action) {
|
|
|
133
519
|
staticRoute,
|
|
134
520
|
// get api instance from ssr context that is connected to the specific request in ssr
|
|
135
521
|
ssr: {
|
|
136
|
-
api
|
|
522
|
+
api,
|
|
523
|
+
subsitePath
|
|
137
524
|
}
|
|
138
525
|
} = action;
|
|
139
526
|
|
|
@@ -150,7 +537,8 @@ function* getRouteSaga(action) {
|
|
|
150
537
|
// These variables are the return values from
|
|
151
538
|
// calls to withEvents.onRouteLoad and onRouteLoaded
|
|
152
539
|
let appsays,
|
|
153
|
-
requireLogin = false
|
|
540
|
+
requireLogin = false,
|
|
541
|
+
searchOptions = false;
|
|
154
542
|
if (withEvents && withEvents.onRouteLoad) {
|
|
155
543
|
appsays = yield withEvents.onRouteLoad(action);
|
|
156
544
|
}
|
|
@@ -168,14 +556,16 @@ function* getRouteSaga(action) {
|
|
|
168
556
|
const setStaticRouteLimits = typeof linkDepth !== 'undefined' || fields || fieldLinkDepths;
|
|
169
557
|
const setContentTypeLimits = !!ContentTypeMappings.find(ct => ct.fields || ct.linkDepth || ct.nodeOptions || ct.fieldLinkDepths);
|
|
170
558
|
const state = yield effects.select();
|
|
171
|
-
const routeEntry = selectors.selectRouteEntry(state, 'js');
|
|
172
|
-
const routeNode = selectors.selectCurrentNode(state, 'js');
|
|
559
|
+
const routeEntry = selectors$1.selectRouteEntry(state, 'js');
|
|
560
|
+
const routeNode = selectors$1.selectCurrentNode(state, 'js');
|
|
173
561
|
const currentPath = action.path; //selectCurrentPath(state);
|
|
562
|
+
const contentPath = action.contentPath;
|
|
174
563
|
const deliveryApiStatus = version$1.selectVersionStatus(state);
|
|
175
|
-
const project = selectors.selectCurrentProject(state);
|
|
564
|
+
const project = selectors$1.selectCurrentProject(state);
|
|
176
565
|
// const isHome = currentPath === '/';
|
|
177
566
|
const isPreview = currentPath && currentPath.startsWith('/preview/');
|
|
178
|
-
const
|
|
567
|
+
const currentLanguage = selectors.selectCurrentLanguage(state);
|
|
568
|
+
const defaultLang = appsays && appsays.defaultLang || currentLanguage || 'en-GB';
|
|
179
569
|
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)) {
|
|
180
570
|
var _staticRoute$route5;
|
|
181
571
|
// To prevent erroneous 404s and wasted network calls, this covers
|
|
@@ -188,18 +578,11 @@ function* getRouteSaga(action) {
|
|
|
188
578
|
entry: null
|
|
189
579
|
};
|
|
190
580
|
pathNode.entry = entry = routeEntry;
|
|
191
|
-
//Do nothing, the entry is allready the right one.
|
|
192
|
-
// yield put({
|
|
193
|
-
// type: SET_ENTRY,
|
|
194
|
-
// entry,
|
|
195
|
-
// node: routeNode,
|
|
196
|
-
// isLoading: false,
|
|
197
|
-
// });
|
|
198
581
|
yield effects.put({
|
|
199
|
-
type: selectors.UPDATE_LOADING_STATE,
|
|
582
|
+
type: selectors$1.UPDATE_LOADING_STATE,
|
|
200
583
|
isLoading: false
|
|
201
584
|
});
|
|
202
|
-
} else yield effects.call(setRouteEntry, currentPath, routeEntry, yield effects.select(selectors.selectCurrentNode), yield effects.select(selectors.selectCurrentAncestors), yield effects.select(selectors.selectCurrentSiblings));
|
|
585
|
+
} else yield effects.call(setRouteEntry, currentPath, routeEntry, yield effects.select(selectors$1.selectCurrentNode), yield effects.select(selectors$1.selectCurrentAncestors), yield effects.select(selectors$1.selectCurrentSiblings));
|
|
203
586
|
} else {
|
|
204
587
|
var _staticRoute$route6;
|
|
205
588
|
// Handle preview routes
|
|
@@ -215,7 +598,6 @@ function* getRouteSaga(action) {
|
|
|
215
598
|
// for previewing entries as it gives a response of []
|
|
216
599
|
// -- apparently it is not correct to request latest content
|
|
217
600
|
// with Node API
|
|
218
|
-
|
|
219
601
|
let previewEntry = yield api.getClient(deliveryApiStatus, project).entries.get({
|
|
220
602
|
id: entryGuid,
|
|
221
603
|
language,
|
|
@@ -238,11 +620,13 @@ function* getRouteSaga(action) {
|
|
|
238
620
|
// Resolve the complete entry with the node if we are setting limits in a static route
|
|
239
621
|
[nodeError, pathNode] = yield to__default.default(api.getNode({
|
|
240
622
|
depth: 0,
|
|
241
|
-
path:
|
|
623
|
+
path: contentPath,
|
|
242
624
|
entryFields: setStaticRouteLimits ? fields || '*' : setContentTypeLimits ? ['sys.contentTypeId', 'sys.id'] : '*',
|
|
243
625
|
entryLinkDepth: setStaticRouteLimits && typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth || 0,
|
|
244
626
|
entryFieldLinkDepths: setStaticRouteLimits ? fieldLinkDepths : setContentTypeLimits ? undefined : entryFieldLinkDepths,
|
|
245
|
-
language
|
|
627
|
+
// language parameter is not used when resolving a node by path
|
|
628
|
+
// https://www.contensis.com/help-and-docs/apis/delivery-http/navigation/nodes/get-a-node-by-path
|
|
629
|
+
// language: defaultLang,
|
|
246
630
|
versionStatus: deliveryApiStatus
|
|
247
631
|
}, project));
|
|
248
632
|
if (nodeError) {
|
|
@@ -309,25 +693,43 @@ function* getRouteSaga(action) {
|
|
|
309
693
|
appsays,
|
|
310
694
|
contentTypeMapping: contentTypeMapping || (staticRoute === null || staticRoute === void 0 || (_staticRoute$route6 = staticRoute.route) === null || _staticRoute$route6 === void 0 ? void 0 : _staticRoute$route6.fetchNode) || {},
|
|
311
695
|
language: defaultLang,
|
|
312
|
-
path:
|
|
696
|
+
path: contentPath,
|
|
313
697
|
pathNode,
|
|
314
698
|
project,
|
|
699
|
+
subsitePath,
|
|
315
700
|
versionStatus: deliveryApiStatus
|
|
316
701
|
});
|
|
317
702
|
if (children) pathNode.children = children;
|
|
318
703
|
}
|
|
319
|
-
|
|
704
|
+
|
|
705
|
+
// We initially listened for SET_ENTRY to complete before
|
|
706
|
+
// resolving the current route language, but this meant
|
|
707
|
+
// that the language change was not captured in time for the SSR response
|
|
708
|
+
yield effects.call(resolveCurrentRouteLanguage, {
|
|
709
|
+
entry: (_pathNode3 = pathNode) === null || _pathNode3 === void 0 ? void 0 : _pathNode3.entry,
|
|
710
|
+
node: pathNode
|
|
711
|
+
});
|
|
712
|
+
const contentTypeRoute = ChangePassword_container.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);
|
|
320
713
|
|
|
321
714
|
// Inject redux { key, reducer, saga } provided by ContentTypeMapping
|
|
322
|
-
if (
|
|
715
|
+
if (contentTypeRoute !== null && contentTypeRoute !== void 0 && contentTypeRoute.injectRedux) yield effects.call(reduxInjectorSaga, contentTypeRoute.injectRedux);
|
|
716
|
+
|
|
717
|
+
// Have we defined search options in the route configuration (for triggering search)
|
|
718
|
+
const routeSearchOptions = ChangePassword_container.getSearchOptions(staticRoute, contentTypeRoute);
|
|
719
|
+
const params = util.routeParams(staticRoute, action.location);
|
|
323
720
|
if (withEvents && withEvents.onRouteLoaded) {
|
|
324
721
|
// Check if the app has provided a requireLogin boolean flag or groups array
|
|
325
722
|
// in addition to checking if requireLogin is set in the route definition
|
|
723
|
+
// The app can provide an object to invoke the search saga
|
|
326
724
|
({
|
|
327
|
-
requireLogin
|
|
725
|
+
requireLogin,
|
|
726
|
+
searchOptions
|
|
328
727
|
} = (yield withEvents.onRouteLoaded({
|
|
329
728
|
...action,
|
|
330
|
-
|
|
729
|
+
contentTypeRoute,
|
|
730
|
+
entry,
|
|
731
|
+
params,
|
|
732
|
+
searchOptions: routeSearchOptions
|
|
331
733
|
})) || {});
|
|
332
734
|
}
|
|
333
735
|
if (requireLogin !== false) {
|
|
@@ -338,22 +740,74 @@ function* getRouteSaga(action) {
|
|
|
338
740
|
requireLogin
|
|
339
741
|
});
|
|
340
742
|
}
|
|
743
|
+
if (searchOptions || routeSearchOptions) yield effects.call(handleSearchSaga, {
|
|
744
|
+
...action,
|
|
745
|
+
params,
|
|
746
|
+
routeSearchOptions,
|
|
747
|
+
searchOptions
|
|
748
|
+
});
|
|
341
749
|
if (!appsays || !appsays.preventScrollTop) {
|
|
342
750
|
// Scroll into View
|
|
343
751
|
if (typeof window !== 'undefined') window.scrollTo(0, 0);
|
|
344
752
|
}
|
|
345
|
-
if ((
|
|
753
|
+
if ((_pathNode5 = pathNode) !== null && _pathNode5 !== void 0 && (_pathNode5 = _pathNode5.entry) !== null && _pathNode5 !== void 0 && (_pathNode5 = _pathNode5.sys) !== null && _pathNode5 !== void 0 && _pathNode5.id) {
|
|
346
754
|
var _appsays4;
|
|
755
|
+
if (params.livePreview && typeof window !== 'undefined') {
|
|
756
|
+
if (livePreviewTask) yield effects.cancel(livePreviewTask);
|
|
757
|
+
livePreviewTask = yield effects.fork(watchLivePreviewSaga, {
|
|
758
|
+
ancestors,
|
|
759
|
+
appsays,
|
|
760
|
+
contentTypeRoute,
|
|
761
|
+
currentPath,
|
|
762
|
+
entry,
|
|
763
|
+
entryMapper,
|
|
764
|
+
pathNode,
|
|
765
|
+
siblings
|
|
766
|
+
});
|
|
767
|
+
}
|
|
347
768
|
entry = pathNode.entry;
|
|
348
|
-
yield effects.call(setRouteEntry, currentPath, entry, pathNode, ancestors, siblings, entryMapper ||
|
|
769
|
+
yield effects.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);
|
|
349
770
|
} else {
|
|
350
771
|
if (staticRoute) yield effects.call(setRouteEntry, currentPath, null, pathNode, ancestors, siblings);else yield effects.call(do404);
|
|
351
772
|
}
|
|
352
773
|
} catch (e) {
|
|
353
|
-
|
|
774
|
+
error(e);
|
|
354
775
|
yield effects.call(do500, e);
|
|
355
776
|
}
|
|
356
777
|
}
|
|
778
|
+
function createLivePreviewChannel() {
|
|
779
|
+
return createSagaMiddleware.eventChannel(emit => {
|
|
780
|
+
const handler = e => {
|
|
781
|
+
var _e$data;
|
|
782
|
+
// console.log('Received message in live preview channel', e.data);
|
|
783
|
+
if (((_e$data = e.data) === null || _e$data === void 0 ? void 0 : _e$data.type) === 'LIVE_ENTRY_UPDATE') emit(e.data);
|
|
784
|
+
};
|
|
785
|
+
window.addEventListener('message', handler);
|
|
786
|
+
return () => window.removeEventListener('message', handler);
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
function* watchLivePreviewSaga(context) {
|
|
790
|
+
const channel = createLivePreviewChannel();
|
|
791
|
+
try {
|
|
792
|
+
while (true) {
|
|
793
|
+
var _context$contentTypeR;
|
|
794
|
+
const data = yield effects.take(channel);
|
|
795
|
+
console.log('Handling live preview update', data);
|
|
796
|
+
const entry = yield effects.select(selectors$1.selectRouteEntry);
|
|
797
|
+
yield effects.call(setRouteEntry, context.currentPath, {
|
|
798
|
+
...entry,
|
|
799
|
+
...data.payload
|
|
800
|
+
}, context.pathNode, null,
|
|
801
|
+
// ancestors unchanged
|
|
802
|
+
null,
|
|
803
|
+
// siblings unchanged
|
|
804
|
+
context.entryMapper || ((_context$contentTypeR = context.contentTypeRoute) === null || _context$contentTypeR === void 0 ? void 0 : _context$contentTypeR.entryMapper), false, true // we need to remap the entry here
|
|
805
|
+
);
|
|
806
|
+
}
|
|
807
|
+
} finally {
|
|
808
|
+
if (yield effects.cancelled()) channel.close();
|
|
809
|
+
}
|
|
810
|
+
}
|
|
357
811
|
function* resolveCurrentNodeOrdinates(action) {
|
|
358
812
|
const {
|
|
359
813
|
api,
|
|
@@ -363,6 +817,7 @@ function* resolveCurrentNodeOrdinates(action) {
|
|
|
363
817
|
path,
|
|
364
818
|
pathNode,
|
|
365
819
|
project,
|
|
820
|
+
subsitePath,
|
|
366
821
|
versionStatus
|
|
367
822
|
} = action;
|
|
368
823
|
const apiCall = [() => null, () => null, () => null, () => null];
|
|
@@ -385,10 +840,11 @@ function* resolveCurrentNodeOrdinates(action) {
|
|
|
385
840
|
return yield api.getAncestors({
|
|
386
841
|
id: pathNode.id,
|
|
387
842
|
language,
|
|
388
|
-
versionStatus
|
|
843
|
+
versionStatus,
|
|
844
|
+
startLevel: (subsitePath || '').split('/').length
|
|
389
845
|
}, project);
|
|
390
846
|
} catch (ex) {
|
|
391
|
-
|
|
847
|
+
error(ex, 'Problem fetching ancestors');
|
|
392
848
|
return [];
|
|
393
849
|
}
|
|
394
850
|
};
|
|
@@ -408,7 +864,7 @@ function* resolveCurrentNodeOrdinates(action) {
|
|
|
408
864
|
versionStatus
|
|
409
865
|
}, project);
|
|
410
866
|
} catch (ex) {
|
|
411
|
-
|
|
867
|
+
error(ex, 'Problem fetching children');
|
|
412
868
|
return [];
|
|
413
869
|
}
|
|
414
870
|
};
|
|
@@ -427,7 +883,7 @@ function* resolveCurrentNodeOrdinates(action) {
|
|
|
427
883
|
versionStatus
|
|
428
884
|
}, project);
|
|
429
885
|
} catch (ex) {
|
|
430
|
-
|
|
886
|
+
error(ex, 'Problem fetching siblings');
|
|
431
887
|
return [];
|
|
432
888
|
}
|
|
433
889
|
};
|
|
@@ -459,16 +915,16 @@ function* setRouteEntry(currentPath, entry, node, ancestors, siblings, entryMapp
|
|
|
459
915
|
// Update a window global to provide the preview toolbar
|
|
460
916
|
// an updated entry id in client-side navigation
|
|
461
917
|
if (typeof window !== 'undefined') window.ContensisEntryId = entrySys.id;
|
|
462
|
-
const currentEntryId = yield effects.select(selectors.selectRouteEntryEntryId);
|
|
463
|
-
const currentEntryLang = yield effects.select(selectors.selectRouteEntryLanguage);
|
|
464
|
-
const mappedEntry = !entryMapper ? null : currentEntryId === entrySys.id && currentEntryLang === entrySys.language && remapEntry === false ? (yield effects.select(selectors.selectMappedEntry, 'js')) || {} : yield mapRouteEntry(entryMapper, {
|
|
918
|
+
const currentEntryId = yield effects.select(selectors$1.selectRouteEntryEntryId);
|
|
919
|
+
const currentEntryLang = yield effects.select(selectors$1.selectRouteEntryLanguage);
|
|
920
|
+
const mappedEntry = !entryMapper ? null : currentEntryId === entrySys.id && currentEntryLang === entrySys.language && remapEntry === false ? (yield effects.select(selectors$1.selectMappedEntry, 'js')) || {} : yield mapRouteEntry(entryMapper, {
|
|
465
921
|
...node,
|
|
466
922
|
entry,
|
|
467
923
|
ancestors,
|
|
468
924
|
siblings
|
|
469
925
|
});
|
|
470
926
|
yield effects.all([effects.put({
|
|
471
|
-
type: selectors.SET_ENTRY,
|
|
927
|
+
type: selectors$1.SET_ENTRY,
|
|
472
928
|
id: entrySys.id,
|
|
473
929
|
currentPath,
|
|
474
930
|
entry,
|
|
@@ -476,10 +932,10 @@ function* setRouteEntry(currentPath, entry, node, ancestors, siblings, entryMapp
|
|
|
476
932
|
node,
|
|
477
933
|
notFound
|
|
478
934
|
}), ancestors && effects.put({
|
|
479
|
-
type: selectors.SET_ANCESTORS,
|
|
935
|
+
type: selectors$1.SET_ANCESTORS,
|
|
480
936
|
ancestors
|
|
481
937
|
}), siblings && effects.put({
|
|
482
|
-
type: selectors.SET_SIBLINGS,
|
|
938
|
+
type: selectors$1.SET_SIBLINGS,
|
|
483
939
|
siblings
|
|
484
940
|
})]);
|
|
485
941
|
}
|
|
@@ -491,7 +947,7 @@ function* mapRouteEntry(entryMapper, node) {
|
|
|
491
947
|
return mappedEntry;
|
|
492
948
|
}
|
|
493
949
|
} catch (e) {
|
|
494
|
-
|
|
950
|
+
error(e, 'Error in entryMapper:');
|
|
495
951
|
throw e;
|
|
496
952
|
}
|
|
497
953
|
return;
|
|
@@ -499,14 +955,14 @@ function* mapRouteEntry(entryMapper, node) {
|
|
|
499
955
|
function* do404() {
|
|
500
956
|
yield effects.call(clientReloadHitServer);
|
|
501
957
|
yield effects.put({
|
|
502
|
-
type: selectors.SET_ENTRY,
|
|
958
|
+
type: selectors$1.SET_ENTRY,
|
|
503
959
|
id: null,
|
|
504
960
|
entry: null,
|
|
505
961
|
notFound: true
|
|
506
962
|
});
|
|
507
963
|
}
|
|
508
964
|
function* clientReloadHitServer() {
|
|
509
|
-
const stateEntry = yield effects.select(selectors.selectRouteEntry);
|
|
965
|
+
const stateEntry = yield effects.select(selectors$1.selectRouteEntry);
|
|
510
966
|
|
|
511
967
|
// If in client and there is a stateEntry.sys field reload the page,
|
|
512
968
|
// on the 2nd load stateEntry.sys should be null at this point,
|
|
@@ -517,7 +973,7 @@ function* clientReloadHitServer() {
|
|
|
517
973
|
}
|
|
518
974
|
function* do500(error) {
|
|
519
975
|
yield effects.put({
|
|
520
|
-
type: selectors.SET_ENTRY,
|
|
976
|
+
type: selectors$1.SET_ENTRY,
|
|
521
977
|
id: null,
|
|
522
978
|
entry: null,
|
|
523
979
|
notFound: true,
|
|
@@ -526,22 +982,8 @@ function* do500(error) {
|
|
|
526
982
|
statusCode: error && error.status ? error.status : 500
|
|
527
983
|
});
|
|
528
984
|
}
|
|
529
|
-
function* reduxInjectorSaga(injectorFn) {
|
|
530
|
-
if (typeof injectorFn === 'function') {
|
|
531
|
-
const {
|
|
532
|
-
key,
|
|
533
|
-
reducer,
|
|
534
|
-
saga
|
|
535
|
-
} = yield injectorFn();
|
|
536
|
-
version.injectRedux({
|
|
537
|
-
key,
|
|
538
|
-
reducer,
|
|
539
|
-
saga
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
985
|
|
|
544
|
-
const registerSagas = [effects.takeEvery(selectors.REGISTER_USER, registerSaga), effects.takeEvery(selectors.REGISTER_USER_SUCCESS, redirectSaga)];
|
|
986
|
+
const registerSagas = [effects.takeEvery(selectors$1.REGISTER_USER, registerSaga), effects.takeEvery(selectors$1.REGISTER_USER_SUCCESS, redirectSaga)];
|
|
545
987
|
function* registerSaga({
|
|
546
988
|
user,
|
|
547
989
|
mappers
|
|
@@ -573,13 +1015,13 @@ function* registerSaga({
|
|
|
573
1015
|
}
|
|
574
1016
|
// Update user object with mappedResponse or responseBody
|
|
575
1017
|
yield effects.put({
|
|
576
|
-
type: selectors.REGISTER_USER_SUCCESS,
|
|
1018
|
+
type: selectors$1.REGISTER_USER_SUCCESS,
|
|
577
1019
|
user: mappedResponse || responseBody
|
|
578
1020
|
});
|
|
579
1021
|
} else {
|
|
580
1022
|
// OK response but unable to parse the response body
|
|
581
1023
|
yield effects.put({
|
|
582
|
-
type: selectors.REGISTER_USER_FAILED,
|
|
1024
|
+
type: selectors$1.REGISTER_USER_FAILED,
|
|
583
1025
|
error: {
|
|
584
1026
|
message: 'Unable to parse the created user from the register service response'
|
|
585
1027
|
}
|
|
@@ -597,18 +1039,18 @@ function* registerSaga({
|
|
|
597
1039
|
error.status = response.status;
|
|
598
1040
|
}
|
|
599
1041
|
yield effects.put({
|
|
600
|
-
type: selectors.REGISTER_USER_FAILED,
|
|
1042
|
+
type: selectors$1.REGISTER_USER_FAILED,
|
|
601
1043
|
error
|
|
602
1044
|
});
|
|
603
1045
|
}
|
|
604
1046
|
}
|
|
605
1047
|
function* redirectSaga() {
|
|
606
1048
|
// Check if querystring contains a redirect_uri
|
|
607
|
-
const currentQs = selectors.queryParams(yield effects.select(selectors.selectCurrentSearch));
|
|
1049
|
+
const currentQs = selectors$1.queryParams(yield effects.select(selectors$1.selectCurrentSearch));
|
|
608
1050
|
const redirectUri = currentQs.redirect_uri || currentQs.redirect;
|
|
609
1051
|
|
|
610
1052
|
// We must use redux based navigation to preserve the registration state
|
|
611
|
-
if (redirectUri) yield effects.put(selectors.setRoute(redirectUri));
|
|
1053
|
+
if (redirectUri) yield effects.put(selectors$1.setRoute(redirectUri));
|
|
612
1054
|
}
|
|
613
1055
|
|
|
614
1056
|
const PAP_URL = 'https://pap.zengenti.com';
|
|
@@ -676,11 +1118,11 @@ async function api(url, options) {
|
|
|
676
1118
|
});
|
|
677
1119
|
}
|
|
678
1120
|
|
|
679
|
-
const resetPasswordSagas = [effects.takeEvery(selectors.REQUEST_USER_PASSWORD_RESET, requestPasswordResetSaga), effects.takeEvery(selectors.RESET_USER_PASSWORD, resetPasswordSaga), effects.takeEvery(selectors.CHANGE_USER_PASSWORD, changePasswordSaga)];
|
|
1121
|
+
const resetPasswordSagas = [effects.takeEvery(selectors$1.REQUEST_USER_PASSWORD_RESET, requestPasswordResetSaga), effects.takeEvery(selectors$1.RESET_USER_PASSWORD, resetPasswordSaga), effects.takeEvery(selectors$1.CHANGE_USER_PASSWORD, changePasswordSaga)];
|
|
680
1122
|
function* requestPasswordResetSaga(action) {
|
|
681
1123
|
const userEmailObject = action.userEmailObject;
|
|
682
1124
|
yield effects.put({
|
|
683
|
-
type: selectors.REQUEST_USER_PASSWORD_RESET_SENDING
|
|
1125
|
+
type: selectors$1.REQUEST_USER_PASSWORD_RESET_SENDING
|
|
684
1126
|
});
|
|
685
1127
|
if (userEmailObject && userEmailObject.userEmail) {
|
|
686
1128
|
try {
|
|
@@ -688,29 +1130,29 @@ function* requestPasswordResetSaga(action) {
|
|
|
688
1130
|
if (passwordResetRequestResponse) {
|
|
689
1131
|
if (!passwordResetRequestResponse.error) {
|
|
690
1132
|
yield effects.put({
|
|
691
|
-
type: selectors.REQUEST_USER_PASSWORD_RESET_SUCCESS
|
|
1133
|
+
type: selectors$1.REQUEST_USER_PASSWORD_RESET_SUCCESS
|
|
692
1134
|
});
|
|
693
1135
|
} else {
|
|
694
1136
|
yield effects.put({
|
|
695
|
-
type: selectors.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
1137
|
+
type: selectors$1.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
696
1138
|
error: passwordResetRequestResponse.error.message
|
|
697
1139
|
});
|
|
698
1140
|
}
|
|
699
1141
|
} else {
|
|
700
1142
|
yield effects.put({
|
|
701
|
-
type: selectors.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
1143
|
+
type: selectors$1.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
702
1144
|
error: 'No response from server'
|
|
703
1145
|
});
|
|
704
1146
|
}
|
|
705
1147
|
} catch (error) {
|
|
706
1148
|
yield effects.put({
|
|
707
|
-
type: selectors.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
1149
|
+
type: selectors$1.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
708
1150
|
error: error && error.toString()
|
|
709
1151
|
});
|
|
710
1152
|
}
|
|
711
1153
|
} else {
|
|
712
1154
|
yield effects.put({
|
|
713
|
-
type: selectors.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
1155
|
+
type: selectors$1.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
714
1156
|
error: 'Invalid object'
|
|
715
1157
|
});
|
|
716
1158
|
}
|
|
@@ -718,7 +1160,7 @@ function* requestPasswordResetSaga(action) {
|
|
|
718
1160
|
function* resetPasswordSaga(action) {
|
|
719
1161
|
const resetPasswordObject = action.resetPasswordObject;
|
|
720
1162
|
yield effects.put({
|
|
721
|
-
type: selectors.RESET_USER_PASSWORD_SENDING
|
|
1163
|
+
type: selectors$1.RESET_USER_PASSWORD_SENDING
|
|
722
1164
|
});
|
|
723
1165
|
if (resetPasswordObject.token && resetPasswordObject.password) {
|
|
724
1166
|
try {
|
|
@@ -726,30 +1168,30 @@ function* resetPasswordSaga(action) {
|
|
|
726
1168
|
if (resetPasswordResponse) {
|
|
727
1169
|
if (!resetPasswordResponse.error) {
|
|
728
1170
|
yield effects.put({
|
|
729
|
-
type: selectors.RESET_USER_PASSWORD_SUCCESS
|
|
1171
|
+
type: selectors$1.RESET_USER_PASSWORD_SUCCESS
|
|
730
1172
|
});
|
|
731
1173
|
} else {
|
|
732
1174
|
const error = resetPasswordResponse.error.data && resetPasswordResponse.error.data.length > 0 && resetPasswordResponse.error.data[0].message || resetPasswordResponse.error.message;
|
|
733
1175
|
yield effects.put({
|
|
734
|
-
type: selectors.RESET_USER_PASSWORD_ERROR,
|
|
1176
|
+
type: selectors$1.RESET_USER_PASSWORD_ERROR,
|
|
735
1177
|
error
|
|
736
1178
|
});
|
|
737
1179
|
}
|
|
738
1180
|
} else {
|
|
739
1181
|
yield effects.put({
|
|
740
|
-
type: selectors.RESET_USER_PASSWORD_ERROR,
|
|
1182
|
+
type: selectors$1.RESET_USER_PASSWORD_ERROR,
|
|
741
1183
|
error: 'No response from server'
|
|
742
1184
|
});
|
|
743
1185
|
}
|
|
744
1186
|
} catch (error) {
|
|
745
1187
|
yield effects.put({
|
|
746
|
-
type: selectors.RESET_USER_PASSWORD_ERROR,
|
|
1188
|
+
type: selectors$1.RESET_USER_PASSWORD_ERROR,
|
|
747
1189
|
error: error && error.toString()
|
|
748
1190
|
});
|
|
749
1191
|
}
|
|
750
1192
|
} else {
|
|
751
1193
|
yield effects.put({
|
|
752
|
-
type: selectors.RESET_USER_PASSWORD_ERROR,
|
|
1194
|
+
type: selectors$1.RESET_USER_PASSWORD_ERROR,
|
|
753
1195
|
error: 'Invalid object'
|
|
754
1196
|
});
|
|
755
1197
|
}
|
|
@@ -761,7 +1203,7 @@ function* resetPasswordSaga(action) {
|
|
|
761
1203
|
function* changePasswordSaga(action) {
|
|
762
1204
|
if (!action || !action.userId || !action.currentPassword || !action.newPassword) {
|
|
763
1205
|
yield effects.put({
|
|
764
|
-
type: selectors.CHANGE_USER_PASSWORD_ERROR,
|
|
1206
|
+
type: selectors$1.CHANGE_USER_PASSWORD_ERROR,
|
|
765
1207
|
error: 'Invalid action object sent to changePassword saga'
|
|
766
1208
|
});
|
|
767
1209
|
return;
|
|
@@ -773,9 +1215,9 @@ function* changePasswordSaga(action) {
|
|
|
773
1215
|
new: action.newPassword
|
|
774
1216
|
};
|
|
775
1217
|
yield effects.put({
|
|
776
|
-
type: selectors.CHANGE_USER_PASSWORD_SENDING
|
|
1218
|
+
type: selectors$1.CHANGE_USER_PASSWORD_SENDING
|
|
777
1219
|
});
|
|
778
|
-
const clientCredentials = yield effects.select(
|
|
1220
|
+
const clientCredentials = yield effects.select(matchGroups.selectClientCredentials, 'js');
|
|
779
1221
|
const client = yield ChangePassword_container.getManagementApiClient({
|
|
780
1222
|
...clientCredentials
|
|
781
1223
|
});
|
|
@@ -784,22 +1226,17 @@ function* changePasswordSaga(action) {
|
|
|
784
1226
|
var _err$data, _err$data2;
|
|
785
1227
|
const error = (err === null || err === void 0 || (_err$data = err.data) === null || _err$data === void 0 || (_err$data = _err$data.data) === null || _err$data === void 0 ? void 0 : _err$data.length) > 0 && err.data.data[0].message || (err === null || err === void 0 || (_err$data2 = err.data) === null || _err$data2 === void 0 ? void 0 : _err$data2.message);
|
|
786
1228
|
yield effects.put({
|
|
787
|
-
type: selectors.CHANGE_USER_PASSWORD_ERROR,
|
|
1229
|
+
type: selectors$1.CHANGE_USER_PASSWORD_ERROR,
|
|
788
1230
|
error
|
|
789
1231
|
});
|
|
790
1232
|
return;
|
|
791
1233
|
}
|
|
792
|
-
|
|
793
|
-
// // eslint-disable-next-line no-console
|
|
794
|
-
// console.log(changePasswordObject);
|
|
795
|
-
// // eslint-disable-next-line no-console
|
|
796
|
-
// console.log(userCredentialsObject);
|
|
797
1234
|
yield effects.put({
|
|
798
|
-
type: selectors.CHANGE_USER_PASSWORD_SUCCESS
|
|
1235
|
+
type: selectors$1.CHANGE_USER_PASSWORD_SUCCESS
|
|
799
1236
|
});
|
|
800
1237
|
} catch (error) {
|
|
801
1238
|
yield effects.put({
|
|
802
|
-
type: selectors.CHANGE_USER_PASSWORD_ERROR,
|
|
1239
|
+
type: selectors$1.CHANGE_USER_PASSWORD_ERROR,
|
|
803
1240
|
error: error && error.toString()
|
|
804
1241
|
});
|
|
805
1242
|
}
|
|
@@ -807,13 +1244,16 @@ function* changePasswordSaga(action) {
|
|
|
807
1244
|
|
|
808
1245
|
const userSagas = [...ChangePassword_container.loginSagas, ...registerSagas, ...resetPasswordSagas];
|
|
809
1246
|
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
1247
|
+
var rootSaga = (featureSagas = []) => {
|
|
1248
|
+
return [...i18nSagas, ...routingSagas, ...navigationSagas, ...userSagas, ...featureSagas];
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1251
|
+
// export default function (featureSagas: Effect[] = []) {
|
|
1252
|
+
// return function* rootSaga() {
|
|
1253
|
+
// const subSagas = [...routingSagas, ...navigationSagas, ...userSagas];
|
|
1254
|
+
// yield all([...subSagas, ...featureSagas]);
|
|
1255
|
+
// };
|
|
1256
|
+
// }
|
|
817
1257
|
|
|
818
1258
|
const servers = SERVERS; /* global SERVERS */
|
|
819
1259
|
const alias = servers.alias.toLowerCase();
|
|
@@ -860,7 +1300,9 @@ const AppRoot = props => {
|
|
|
860
1300
|
|
|
861
1301
|
exports.AppRoot = AppRoot;
|
|
862
1302
|
exports.browserHistory = browserHistory;
|
|
1303
|
+
exports.createLocaleRoutes = createLocaleRoutes;
|
|
863
1304
|
exports.history = history;
|
|
864
1305
|
exports.pickProject = pickProject;
|
|
865
1306
|
exports.rootSaga = rootSaga;
|
|
866
|
-
|
|
1307
|
+
exports.shorten = shorten;
|
|
1308
|
+
//# sourceMappingURL=App-CNylISW7.js.map
|