@zengenti/contensis-react-base 3.1.1-beta.8 → 3.2.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 +36 -0
- package/cjs/{App-4c9e6d1b.js → App-8a2f85d5.js} +90 -74
- package/cjs/App-8a2f85d5.js.map +1 -0
- package/cjs/{ChangePassword.container-15acbce2.js → ChangePassword.container-efcb1fcd.js} +27 -28
- package/cjs/ChangePassword.container-efcb1fcd.js.map +1 -0
- package/{esm/ToJs-48b1f586.js → cjs/CookieHelper.class-34994aa1.js} +11 -97
- package/cjs/CookieHelper.class-34994aa1.js.map +1 -0
- package/cjs/{RouteLoader-190ac009.js → RouteLoader-4fb33db9.js} +10 -6
- package/cjs/RouteLoader-4fb33db9.js.map +1 -0
- package/cjs/{ContensisDeliveryApi-d63b3d39.js → SSRContext-433c53e4.js} +103 -42
- package/cjs/SSRContext-433c53e4.js.map +1 -0
- package/cjs/ToJs-7f965106.js +128 -0
- package/cjs/ToJs-7f965106.js.map +1 -0
- package/cjs/client.js +20 -20
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +44 -34
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +54 -14
- package/cjs/forms.js.map +1 -1
- package/cjs/redux.js +16 -16
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +13 -4
- package/cjs/routing.js.map +1 -1
- package/cjs/{sagas-e04b94c1.js → sagas-4e8b68f0.js} +8 -4
- package/cjs/sagas-4e8b68f0.js.map +1 -0
- package/cjs/search.js +1 -1
- package/cjs/{selectors-8e56cc34.js → selectors-e3f1fd85.js} +240 -3
- package/cjs/selectors-e3f1fd85.js.map +1 -0
- package/cjs/{version-bb4a3418.js → store-665c229b.js} +7 -23
- package/cjs/store-665c229b.js.map +1 -0
- package/cjs/user.js +9 -10
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +14 -10
- package/cjs/util.js.map +1 -1
- package/cjs/{version-c2a37225.js → version-3b05d6c8.js} +17 -17
- package/cjs/{version-c2a37225.js.map → version-3b05d6c8.js.map} +1 -1
- package/cjs/version-7b43af3e.js +20 -0
- package/cjs/version-7b43af3e.js.map +1 -0
- package/esm/{App-b8c75933.js → App-91d81f0c.js} +59 -43
- package/esm/App-91d81f0c.js.map +1 -0
- package/esm/{ChangePassword.container-6a1c60f3.js → ChangePassword.container-96dab474.js} +4 -5
- package/esm/ChangePassword.container-96dab474.js.map +1 -0
- package/{cjs/ToJs-374a7fbd.js → esm/CookieHelper.class-6d649751.js} +5 -129
- package/esm/CookieHelper.class-6d649751.js.map +1 -0
- package/esm/{RouteLoader-487b5a9b.js → RouteLoader-94ca1c51.js} +10 -6
- package/esm/RouteLoader-94ca1c51.js.map +1 -0
- package/esm/{ContensisDeliveryApi-7b71bb3e.js → SSRContext-88841734.js} +95 -41
- package/esm/SSRContext-88841734.js.map +1 -0
- package/esm/ToJs-67b34be1.js +98 -0
- package/esm/ToJs-67b34be1.js.map +1 -0
- package/esm/client.js +18 -18
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +31 -21
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +54 -14
- package/esm/forms.js.map +1 -1
- package/esm/redux.js +7 -7
- package/esm/routing.js +13 -4
- package/esm/routing.js.map +1 -1
- package/esm/{sagas-933a8fc8.js → sagas-66c305a8.js} +8 -4
- package/esm/sagas-66c305a8.js.map +1 -0
- package/esm/search.js +2 -2
- package/esm/selectors-d2bdfe22.js +396 -0
- package/esm/selectors-d2bdfe22.js.map +1 -0
- package/esm/{version-f6660b69.js → store-f524c50d.js} +4 -16
- package/esm/store-f524c50d.js.map +1 -0
- package/esm/user.js +7 -8
- package/esm/user.js.map +1 -1
- package/esm/util.js +6 -5
- package/esm/util.js.map +1 -1
- package/esm/version-7f50b694.js +15 -0
- package/esm/version-7f50b694.js.map +1 -0
- package/esm/{version-5a0b9406.js → version-dcc28b32.js} +3 -3
- package/esm/{version-5a0b9406.js.map → version-dcc28b32.js.map} +1 -1
- package/models/app/App.d.ts +1 -1
- package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +1 -1
- package/models/client/client.d.ts +1 -1
- package/models/index.d.ts +1 -2
- package/models/models/AppRouteProps.d.ts +11 -0
- package/models/{redux/appstate.d.ts → models/AppState.d.ts} +1 -1
- package/models/models/ContentTypeMapping.d.ts +29 -0
- package/models/models/EntryMapper.d.ts +3 -0
- package/models/models/GetRouteActionArgs.d.ts +15 -0
- package/models/models/ReduxInjector.d.ts +5 -0
- package/models/models/RequireLogin.d.ts +6 -0
- package/models/models/RouteComponent.d.ts +2 -0
- package/models/models/RouteComponentProps.d.ts +9 -0
- package/models/models/RouteLoaderProps.d.ts +6 -0
- package/models/models/RouteNode.d.ts +5 -0
- package/models/models/SSRContext.d.ts +11 -0
- package/models/models/StaticRoute.d.ts +28 -0
- package/models/models/WithEvents.d.ts +29 -0
- package/models/models/config/AppConfig.d.ts +12 -0
- package/models/{config.d.ts → models/config/ServerConfig.d.ts} +2 -12
- package/models/models/config/StateType.d.ts +1 -0
- package/models/models/config/index.d.ts +3 -0
- package/models/models/index.d.ts +15 -0
- package/models/redux/sagas/navigation.d.ts +1 -3
- package/models/redux/store/injectors.d.ts +4 -4
- package/models/redux/store/store.d.ts +1 -2
- package/models/routing/components/RouteLoader.d.ts +1 -1
- package/models/routing/redux/actions.d.ts +2 -3
- package/models/routing/redux/selectors.d.ts +2 -2
- package/models/routing/util/find-contenttype-mapping.d.ts +1 -1
- package/models/routing/util/queries.d.ts +2 -2
- package/models/search/models/Queries.d.ts +2 -1
- package/models/search/models/Search.d.ts +3 -0
- package/models/search/search/ContensisDeliveryApi.d.ts +2 -2
- package/models/server/features/caching/cacheDuration.schema.d.ts +1 -0
- package/models/server/features/linkdepth-api/search.d.ts +1 -1
- package/models/server/internalServer.d.ts +1 -1
- package/models/server/util/bundles.d.ts +1 -1
- package/models/server/util/headers.d.ts +1 -1
- package/models/server/webApp.d.ts +1 -1
- package/models/user/redux/selectors.d.ts +1 -2
- package/models/user/util/matchGroups.d.ts +1 -1
- package/models/util/CachedDeliveryApi.d.ts +11 -10
- package/models/util/ContensisDeliveryApi.d.ts +9 -6
- package/models/util/SSRContext.d.ts +30 -0
- package/models/util/index.d.ts +1 -0
- package/models/util/json-mapper.d.ts +1 -2
- package/package.json +3 -3
- package/cjs/App-4c9e6d1b.js.map +0 -1
- package/cjs/ChangePassword.container-15acbce2.js.map +0 -1
- package/cjs/ContensisDeliveryApi-d63b3d39.js.map +0 -1
- package/cjs/CookieConstants-000427db.js +0 -10
- package/cjs/CookieConstants-000427db.js.map +0 -1
- package/cjs/RouteLoader-190ac009.js.map +0 -1
- package/cjs/ToJs-374a7fbd.js.map +0 -1
- package/cjs/reducers-ea1b2dc0.js +0 -236
- package/cjs/reducers-ea1b2dc0.js.map +0 -1
- package/cjs/sagas-e04b94c1.js.map +0 -1
- package/cjs/selectors-8e56cc34.js.map +0 -1
- package/cjs/version-bb4a3418.js.map +0 -1
- package/esm/App-b8c75933.js.map +0 -1
- package/esm/ChangePassword.container-6a1c60f3.js.map +0 -1
- package/esm/ContensisDeliveryApi-7b71bb3e.js.map +0 -1
- package/esm/CookieConstants-3d3b6531.js +0 -6
- package/esm/CookieConstants-3d3b6531.js.map +0 -1
- package/esm/RouteLoader-487b5a9b.js.map +0 -1
- package/esm/ToJs-48b1f586.js.map +0 -1
- package/esm/reducers-919da5e0.js +0 -213
- package/esm/reducers-919da5e0.js.map +0 -1
- package/esm/sagas-933a8fc8.js.map +0 -1
- package/esm/selectors-1f0cc787.js +0 -182
- package/esm/selectors-1f0cc787.js.map +0 -1
- package/esm/version-f6660b69.js.map +0 -1
- package/models/routing/routes.d.ts +0 -127
package/README.md
CHANGED
|
@@ -126,6 +126,42 @@ https://www.conventionalcommits.org/en/v1.0.0/#summary
|
|
|
126
126
|
|
|
127
127
|
# Changelog
|
|
128
128
|
|
|
129
|
+
#### 3.2.0 (2024-04-26)
|
|
130
|
+
|
|
131
|
+
##### New Features
|
|
132
|
+
|
|
133
|
+
* add support for new delivery api search parameter `fieldLinkDepths` (3f6d1def)
|
|
134
|
+
* introduce `SSRContext` allowing us to hold and access request-scope references throughout the component tree and use these refs in backing code reliably scoped to the current request (915e9f97)
|
|
135
|
+
|
|
136
|
+
##### Bug Fixes
|
|
137
|
+
|
|
138
|
+
* cache invalidation - surrogate key count inconsistencies in high concurrent load scenario (915e9f97)
|
|
139
|
+
* Routing sagas - childrenOptions object undefined if nodeOptions.children not specified, meaning children saga would error with global children customNavigation setting (55b389b5)
|
|
140
|
+
* restore delivery api response handler to handle 200 responses only due to inconsistent behaviour in non-ok fetch responses (5f69d2db)
|
|
141
|
+
* add `any_update` header in SSR for any page request with any delivery api errors (3d404e4f)
|
|
142
|
+
* correct syntax for last immutable fix (f415a487)
|
|
143
|
+
* add server startup option `enableSsrCookies` as processing cookies in ssr can cause authentication information to become cached (67b0d011)
|
|
144
|
+
* undefined error in ssr when using immutable state type (afd2f147)
|
|
145
|
+
* undefined error on Redux in server features (e1e4842a)
|
|
146
|
+
* need to provide path attribute when using `universal-cookie` package (95fe9f12)
|
|
147
|
+
* Reset user state to prevent user details from being cached in SSR response (f8fb5bfe)
|
|
148
|
+
* allow CookieHelper fallback to browser cookies when cookies args not provided (457c4f56)
|
|
149
|
+
* prevent mutation of DELIVERY_API_CONFIG when building client config (cafbe5e1)
|
|
150
|
+
|
|
151
|
+
##### Performance Improvements
|
|
152
|
+
|
|
153
|
+
* remove surrogateKeys routing key from serialised redux state in ssr (749782bc)
|
|
154
|
+
|
|
155
|
+
##### Refactors
|
|
156
|
+
|
|
157
|
+
* remove redundant types files (dac4cf52)
|
|
158
|
+
* consolidate typescript types in models folder (de959949)
|
|
159
|
+
* convert user login JS code to TypeScript (75ef4e0c)
|
|
160
|
+
|
|
161
|
+
##### Code Style Changes
|
|
162
|
+
|
|
163
|
+
* fix return types in store creation (f611e88c)
|
|
164
|
+
|
|
129
165
|
#### 3.1.0 (2024-01-18)
|
|
130
166
|
|
|
131
167
|
##### New Features
|
|
@@ -3,22 +3,21 @@
|
|
|
3
3
|
var history$1 = require('history');
|
|
4
4
|
var effects = require('@redux-saga/core/effects');
|
|
5
5
|
var log = require('loglevel');
|
|
6
|
-
var
|
|
7
|
-
var version = require('./version-
|
|
8
|
-
var version$1 = require('./version-c2a37225.js');
|
|
9
|
-
var selectors = require('./selectors-8e56cc34.js');
|
|
6
|
+
var store = require('./store-665c229b.js');
|
|
7
|
+
var version = require('./version-3b05d6c8.js');
|
|
10
8
|
var to = require('await-to-js');
|
|
11
|
-
var
|
|
9
|
+
var selectors = require('./selectors-e3f1fd85.js');
|
|
10
|
+
var version$1 = require('./version-7b43af3e.js');
|
|
11
|
+
var ChangePassword_container = require('./ChangePassword.container-efcb1fcd.js');
|
|
12
12
|
var React = require('react');
|
|
13
13
|
require('react-cookie');
|
|
14
14
|
require('react-redux');
|
|
15
15
|
require('jsonpath-mapper');
|
|
16
|
-
var reducers = require('./reducers-ea1b2dc0.js');
|
|
17
16
|
var contensisDeliveryApi = require('contensis-delivery-api');
|
|
18
|
-
var ToJs = require('./ToJs-
|
|
17
|
+
var ToJs = require('./ToJs-7f965106.js');
|
|
19
18
|
require('react-hot-loader');
|
|
20
19
|
require('query-string');
|
|
21
|
-
var RouteLoader = require('./RouteLoader-
|
|
20
|
+
var RouteLoader = require('./RouteLoader-4fb33db9.js');
|
|
22
21
|
|
|
23
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
23
|
|
|
@@ -49,32 +48,37 @@ const selectedHistory = typeof window !== 'undefined' ? history$1.createBrowserH
|
|
|
49
48
|
const history = (options = {}) => selectedHistory(options);
|
|
50
49
|
const browserHistory = selectedHistory();
|
|
51
50
|
|
|
52
|
-
const navigationSagas = [effects.takeEvery(
|
|
51
|
+
const navigationSagas = [effects.takeEvery(store.GET_NODE_TREE, ensureNodeTreeSaga)];
|
|
53
52
|
function* ensureNodeTreeSaga(action) {
|
|
53
|
+
const {
|
|
54
|
+
api,
|
|
55
|
+
language,
|
|
56
|
+
project,
|
|
57
|
+
versionStatus,
|
|
58
|
+
treeDepth
|
|
59
|
+
} = action;
|
|
54
60
|
const state = yield effects.select();
|
|
55
61
|
try {
|
|
56
|
-
if (!version
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
language: action.language
|
|
62
|
-
});
|
|
62
|
+
if (!version.hasNavigationTree(state)) {
|
|
63
|
+
const nodes = yield api.getRootNode({
|
|
64
|
+
depth: treeDepth || 0,
|
|
65
|
+
language
|
|
66
|
+
}, versionStatus, project);
|
|
63
67
|
if (nodes) {
|
|
64
68
|
yield effects.put({
|
|
65
|
-
type:
|
|
69
|
+
type: store.SET_NODE_TREE,
|
|
66
70
|
nodes
|
|
67
71
|
});
|
|
68
72
|
} else {
|
|
69
73
|
yield effects.put({
|
|
70
|
-
type:
|
|
74
|
+
type: store.GET_NODE_TREE_ERROR
|
|
71
75
|
});
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
} catch (ex) {
|
|
75
79
|
log__namespace.error(...['Error running ensureNodeTreeSaga:', ex]);
|
|
76
80
|
yield effects.put({
|
|
77
|
-
type:
|
|
81
|
+
type: store.GET_NODE_TREE_ERROR,
|
|
78
82
|
error: ex.toString()
|
|
79
83
|
});
|
|
80
84
|
}
|
|
@@ -108,9 +112,10 @@ const defaultExpressions = versionStatus => {
|
|
|
108
112
|
};
|
|
109
113
|
const equalToOrIn = (field, arr, operator = 'equalTo') => arr.length === 0 ? [] : arr.length === 1 ? [contensisDeliveryApi.Op[operator](field, arr[0])] : [contensisDeliveryApi.Op.in(field, ...arr)];
|
|
110
114
|
|
|
111
|
-
const routeEntryByFieldsQuery = (id, language = 'en-GB', fields = [], versionStatus = 'published') => {
|
|
115
|
+
const routeEntryByFieldsQuery = (id, language = 'en-GB', fields = [], fieldLinkDepths, versionStatus = 'published') => {
|
|
112
116
|
const query = new contensisDeliveryApi.Query(...[...fieldExpression('sys.id', id), ...fieldExpression('sys.language', language), ...defaultExpressions(versionStatus)]);
|
|
113
117
|
query.fields = fields;
|
|
118
|
+
query.fieldLinkDepths = fieldLinkDepths;
|
|
114
119
|
return query;
|
|
115
120
|
};
|
|
116
121
|
|
|
@@ -132,16 +137,18 @@ function* setRouteSaga(action) {
|
|
|
132
137
|
function* getRouteSaga(action) {
|
|
133
138
|
let entry = null;
|
|
134
139
|
try {
|
|
135
|
-
var _staticRoute$route, _staticRoute$route$pa, _staticRoute$route2, _staticRoute$route2$p, _pathNode2, _pathNode2$entry, _pathNode2$entry$sys, _pathNode3, _pathNode3$entry, _pathNode3$entry$sys;
|
|
140
|
+
var _staticRoute$route, _staticRoute$route$pa, _staticRoute$route2, _staticRoute$route2$p, _staticRoute$route3, _staticRoute$route3$p, _appsays, _appsays2, _appsays3, _pathNode2, _pathNode2$entry, _pathNode2$entry$sys, _pathNode3, _pathNode3$entry, _pathNode3$entry$sys;
|
|
136
141
|
const {
|
|
137
142
|
withEvents,
|
|
138
143
|
routes: {
|
|
139
144
|
ContentTypeMappings = {}
|
|
140
145
|
} = {},
|
|
141
146
|
staticRoute,
|
|
142
|
-
|
|
147
|
+
// get api instance from ssr context that is connected to the specific request in ssr
|
|
148
|
+
ssr: {
|
|
149
|
+
api
|
|
150
|
+
}
|
|
143
151
|
} = action;
|
|
144
|
-
const api = ContensisDeliveryApi.cachedSearchWithCookies(cookies.raw);
|
|
145
152
|
|
|
146
153
|
// Inject redux { key, reducer, saga } provided by staticRoute
|
|
147
154
|
if (staticRoute && staticRoute.route.injectRedux) yield effects.call(reduxInjectorSaga, staticRoute.route.injectRedux);
|
|
@@ -162,23 +169,26 @@ function* getRouteSaga(action) {
|
|
|
162
169
|
}
|
|
163
170
|
const staticRouteLinkDepth = staticRoute === null || staticRoute === void 0 ? void 0 : (_staticRoute$route = staticRoute.route) === null || _staticRoute$route === void 0 ? void 0 : (_staticRoute$route$pa = _staticRoute$route.params) === null || _staticRoute$route$pa === void 0 ? void 0 : _staticRoute$route$pa.linkDepth;
|
|
164
171
|
const staticRouteFields = staticRoute === null || staticRoute === void 0 ? void 0 : (_staticRoute$route2 = staticRoute.route) === null || _staticRoute$route2 === void 0 ? void 0 : (_staticRoute$route2$p = _staticRoute$route2.params) === null || _staticRoute$route2$p === void 0 ? void 0 : _staticRoute$route2$p.fields;
|
|
172
|
+
const staticRouteFieldLinkDepths = staticRoute === null || staticRoute === void 0 ? void 0 : (_staticRoute$route3 = staticRoute.route) === null || _staticRoute$route3 === void 0 ? void 0 : (_staticRoute$route3$p = _staticRoute$route3.params) === null || _staticRoute$route3$p === void 0 ? void 0 : _staticRoute$route3$p.fieldLinkDepths;
|
|
165
173
|
const entryLinkDepth = appsays && appsays.entryLinkDepth !== undefined ? appsays.entryLinkDepth : 2;
|
|
166
|
-
const
|
|
174
|
+
const entryFieldLinkDepths = (_appsays = appsays) === null || _appsays === void 0 ? void 0 : _appsays.entryFieldLinkDepths;
|
|
175
|
+
const setContentTypeLimits = (typeof staticRouteLinkDepth === 'undefined' || !staticRouteFields) && !!ContentTypeMappings.find(ct => ct.fields || ct.linkDepth || ct.nodeOptions || ct.fieldLinkDepths);
|
|
167
176
|
const state = yield effects.select();
|
|
168
177
|
const routeEntry = selectors.selectRouteEntry(state, 'js');
|
|
169
178
|
const routeNode = selectors.selectCurrentNode(state, 'js');
|
|
170
179
|
const currentPath = action.path; //selectCurrentPath(state);
|
|
171
|
-
const deliveryApiStatus = version.selectVersionStatus(state);
|
|
180
|
+
const deliveryApiStatus = version$1.selectVersionStatus(state);
|
|
172
181
|
const project = selectors.selectCurrentProject(state);
|
|
173
182
|
// const isHome = currentPath === '/';
|
|
174
183
|
const isPreview = currentPath && currentPath.startsWith('/preview/');
|
|
175
184
|
const defaultLang = appsays && appsays.defaultLang || 'en-GB';
|
|
176
|
-
if (!isPreview && (appsays &&
|
|
185
|
+
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)) {
|
|
186
|
+
var _staticRoute$route4;
|
|
177
187
|
// To prevent erroneous 404s and wasted network calls, this covers
|
|
178
188
|
// - appsays customRouting and does SET_ENTRY etc. via the consuming app
|
|
179
189
|
// - all staticRoutes (where custom 'route.fetchNode' attribute is falsey)
|
|
180
190
|
// - standard Contensis SiteView Routing where we already have that entry in state
|
|
181
|
-
if (routeEntry && (!staticRoute || staticRoute
|
|
191
|
+
if (routeEntry && (!staticRoute || staticRoute !== null && staticRoute !== void 0 && (_staticRoute$route4 = staticRoute.route) !== null && _staticRoute$route4 !== void 0 && _staticRoute$route4.fetchNode)) {
|
|
182
192
|
pathNode = {
|
|
183
193
|
...routeNode,
|
|
184
194
|
entry: null
|
|
@@ -232,8 +242,9 @@ function* getRouteSaga(action) {
|
|
|
232
242
|
[nodeError, pathNode] = yield to__default["default"](api.getNode({
|
|
233
243
|
depth: 0,
|
|
234
244
|
path: currentPath,
|
|
235
|
-
entryFields: setContentTypeLimits ? ['sys.contentTypeId', 'sys.id'] :
|
|
236
|
-
entryLinkDepth:
|
|
245
|
+
entryFields: staticRouteFields || (setContentTypeLimits ? ['sys.contentTypeId', 'sys.id'] : '*'),
|
|
246
|
+
entryLinkDepth: typeof staticRouteLinkDepth !== 'undefined' ? staticRouteLinkDepth : entryLinkDepth || 0,
|
|
247
|
+
entryFieldLinkDepths: staticRouteFieldLinkDepths || (!setContentTypeLimits ? entryFieldLinkDepths : undefined),
|
|
237
248
|
language: defaultLang,
|
|
238
249
|
versionStatus: deliveryApiStatus
|
|
239
250
|
}, project));
|
|
@@ -270,10 +281,11 @@ function* getRouteSaga(action) {
|
|
|
270
281
|
// and current node's ordinates at a specified depth with specified fields
|
|
271
282
|
contentTypeMapping = ChangePassword_container.findContentTypeMapping(ContentTypeMappings, pathNode.entry.sys.contentTypeId) || {};
|
|
272
283
|
const {
|
|
284
|
+
fieldLinkDepths,
|
|
273
285
|
fields,
|
|
274
286
|
linkDepth
|
|
275
287
|
} = contentTypeMapping;
|
|
276
|
-
const query = routeEntryByFieldsQuery(pathNode.entry.sys.id, pathNode.entry.sys.language, fields, deliveryApiStatus);
|
|
288
|
+
const query = routeEntryByFieldsQuery(pathNode.entry.sys.id, pathNode.entry.sys.language, fields, fieldLinkDepths, deliveryApiStatus);
|
|
277
289
|
const payload = yield api.search(query, typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth || 0, project);
|
|
278
290
|
if ((payload === null || payload === void 0 ? void 0 : (_payload$items = payload.items) === null || _payload$items === void 0 ? void 0 : _payload$items.length) > 0) {
|
|
279
291
|
pathNode.entry = entry = payload.items[0];
|
|
@@ -322,9 +334,9 @@ function* getRouteSaga(action) {
|
|
|
322
334
|
if (typeof window !== 'undefined') window.scrollTo(0, 0);
|
|
323
335
|
}
|
|
324
336
|
if ((_pathNode3 = pathNode) !== null && _pathNode3 !== void 0 && (_pathNode3$entry = _pathNode3.entry) !== null && _pathNode3$entry !== void 0 && (_pathNode3$entry$sys = _pathNode3$entry.sys) !== null && _pathNode3$entry$sys !== void 0 && _pathNode3$entry$sys.id) {
|
|
325
|
-
var _staticRoute$
|
|
337
|
+
var _staticRoute$route5, _staticRoute$route5$f, _appsays4;
|
|
326
338
|
entry = pathNode.entry;
|
|
327
|
-
yield effects.call(setRouteEntry, currentPath, entry, pathNode, ancestors, siblings, (staticRoute === null || staticRoute === void 0 ? void 0 : (_staticRoute$
|
|
339
|
+
yield effects.call(setRouteEntry, currentPath, entry, pathNode, ancestors, siblings, (staticRoute === null || staticRoute === void 0 ? void 0 : (_staticRoute$route5 = staticRoute.route) === null || _staticRoute$route5 === void 0 ? void 0 : (_staticRoute$route5$f = _staticRoute$route5.fetchNode) === null || _staticRoute$route5$f === void 0 ? void 0 : _staticRoute$route5$f.entryMapper) || resolvedContentTypeMapping.entryMapper, false, (_appsays4 = appsays) === null || _appsays4 === void 0 ? void 0 : _appsays4.refetchNode);
|
|
328
340
|
} else {
|
|
329
341
|
if (staticRoute) yield effects.call(setRouteEntry, currentPath, null, pathNode, ancestors, siblings);else yield effects.call(do404);
|
|
330
342
|
}
|
|
@@ -333,16 +345,17 @@ function* getRouteSaga(action) {
|
|
|
333
345
|
yield effects.call(do500, e);
|
|
334
346
|
}
|
|
335
347
|
}
|
|
336
|
-
function* resolveCurrentNodeOrdinates({
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
348
|
+
function* resolveCurrentNodeOrdinates(action) {
|
|
349
|
+
const {
|
|
350
|
+
api,
|
|
351
|
+
appsays,
|
|
352
|
+
contentTypeMapping,
|
|
353
|
+
language,
|
|
354
|
+
path,
|
|
355
|
+
pathNode,
|
|
356
|
+
project,
|
|
357
|
+
versionStatus
|
|
358
|
+
} = action;
|
|
346
359
|
const apiCall = [() => null, () => null, () => null, () => null];
|
|
347
360
|
|
|
348
361
|
// if appsays customNavigation: true, we will set doNavigation to false
|
|
@@ -351,6 +364,7 @@ function* resolveCurrentNodeOrdinates({
|
|
|
351
364
|
const doNavigation = !appsays || ((appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) === true ? false : (appsays === null || appsays === void 0 ? void 0 : appsays.customNavigation) || true);
|
|
352
365
|
const {
|
|
353
366
|
entryLinkDepth = 0,
|
|
367
|
+
fieldLinkDepths,
|
|
354
368
|
fields,
|
|
355
369
|
linkDepth,
|
|
356
370
|
nodeOptions = {}
|
|
@@ -372,12 +386,13 @@ function* resolveCurrentNodeOrdinates({
|
|
|
372
386
|
}
|
|
373
387
|
const childrenDepth = doNavigation === true || doNavigation.children === true ? 1 : doNavigation && doNavigation.children || 0;
|
|
374
388
|
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.children) === 'undefined' && childrenDepth > 0 || nodeOptions.children) {
|
|
375
|
-
const childrenOptions = typeof nodeOptions.children === 'boolean' ? {} : nodeOptions.children;
|
|
389
|
+
const childrenOptions = !nodeOptions.children || typeof nodeOptions.children === 'boolean' ? {} : nodeOptions.children;
|
|
376
390
|
apiCall[1] = function* getChildren() {
|
|
377
391
|
try {
|
|
378
392
|
return yield api.getNode({
|
|
379
393
|
depth: childrenOptions.depth !== undefined ? childrenOptions.depth : childrenDepth,
|
|
380
394
|
path,
|
|
395
|
+
entryFieldLinkDepths: childrenOptions.fieldLinkDepths || fieldLinkDepths,
|
|
381
396
|
entryFields: childrenOptions.fields || fields || undefined,
|
|
382
397
|
entryLinkDepth: typeof childrenOptions.linkDepth !== 'undefined' ? childrenOptions.linkDepth : typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth,
|
|
383
398
|
language,
|
|
@@ -392,11 +407,12 @@ function* resolveCurrentNodeOrdinates({
|
|
|
392
407
|
if (typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.siblings) === 'undefined' && doNavigation.siblings || nodeOptions.siblings) {
|
|
393
408
|
apiCall[2] = function* getSiblings() {
|
|
394
409
|
try {
|
|
395
|
-
var _nodeOptions$siblings, _nodeOptions$siblings2;
|
|
410
|
+
var _nodeOptions$siblings, _nodeOptions$siblings2, _nodeOptions$siblings3;
|
|
396
411
|
return yield api.getSiblings({
|
|
397
412
|
id: pathNode.id,
|
|
398
|
-
|
|
399
|
-
|
|
413
|
+
entryFieldLinkDepths: (nodeOptions === null || nodeOptions === void 0 ? void 0 : (_nodeOptions$siblings = nodeOptions.siblings) === null || _nodeOptions$siblings === void 0 ? void 0 : _nodeOptions$siblings.fieldLinkDepths) || fieldLinkDepths,
|
|
414
|
+
entryFields: (nodeOptions === null || nodeOptions === void 0 ? void 0 : (_nodeOptions$siblings2 = nodeOptions.siblings) === null || _nodeOptions$siblings2 === void 0 ? void 0 : _nodeOptions$siblings2.fields) || fields || undefined,
|
|
415
|
+
entryLinkDepth: typeof (nodeOptions === null || nodeOptions === void 0 ? void 0 : (_nodeOptions$siblings3 = nodeOptions.siblings) === null || _nodeOptions$siblings3 === void 0 ? void 0 : _nodeOptions$siblings3.linkDepth) !== 'undefined' ? nodeOptions.siblings.linkDepth : typeof linkDepth !== 'undefined' ? linkDepth : entryLinkDepth,
|
|
400
416
|
includeInMenu: true,
|
|
401
417
|
language,
|
|
402
418
|
versionStatus
|
|
@@ -408,18 +424,18 @@ function* resolveCurrentNodeOrdinates({
|
|
|
408
424
|
};
|
|
409
425
|
}
|
|
410
426
|
}
|
|
411
|
-
const isTreeLoaded = yield effects.select(version
|
|
427
|
+
const isTreeLoaded = yield effects.select(version.hasNavigationTree);
|
|
412
428
|
if (!isTreeLoaded && (doNavigation === true || doNavigation.tree)) apiCall[3] = function* getNodeTree() {
|
|
413
429
|
const treeDepth = doNavigation === true || !doNavigation.tree || doNavigation.tree === true ? 2 : doNavigation.tree;
|
|
414
430
|
if (typeof window !== 'undefined') {
|
|
415
431
|
return yield effects.put({
|
|
416
|
-
type:
|
|
417
|
-
|
|
432
|
+
type: store.GET_NODE_TREE,
|
|
433
|
+
...action,
|
|
418
434
|
treeDepth
|
|
419
435
|
});
|
|
420
436
|
} else {
|
|
421
437
|
return yield effects.call(ensureNodeTreeSaga, {
|
|
422
|
-
|
|
438
|
+
...action,
|
|
423
439
|
treeDepth
|
|
424
440
|
});
|
|
425
441
|
}
|
|
@@ -507,7 +523,7 @@ function* reduxInjectorSaga(injectorFn) {
|
|
|
507
523
|
reducer,
|
|
508
524
|
saga
|
|
509
525
|
} = yield injectorFn();
|
|
510
|
-
version
|
|
526
|
+
version.injectRedux({
|
|
511
527
|
key,
|
|
512
528
|
reducer,
|
|
513
529
|
saga
|
|
@@ -515,7 +531,7 @@ function* reduxInjectorSaga(injectorFn) {
|
|
|
515
531
|
}
|
|
516
532
|
}
|
|
517
533
|
|
|
518
|
-
const registerSagas = [effects.takeEvery(
|
|
534
|
+
const registerSagas = [effects.takeEvery(selectors.REGISTER_USER, registerSaga), effects.takeEvery(selectors.REGISTER_USER_SUCCESS, redirectSaga)];
|
|
519
535
|
function* registerSaga({
|
|
520
536
|
user,
|
|
521
537
|
mappers
|
|
@@ -547,13 +563,13 @@ function* registerSaga({
|
|
|
547
563
|
}
|
|
548
564
|
// Update user object with mappedResponse or responseBody
|
|
549
565
|
yield effects.put({
|
|
550
|
-
type:
|
|
566
|
+
type: selectors.REGISTER_USER_SUCCESS,
|
|
551
567
|
user: mappedResponse || responseBody
|
|
552
568
|
});
|
|
553
569
|
} else {
|
|
554
570
|
// OK response but unable to parse the response body
|
|
555
571
|
yield effects.put({
|
|
556
|
-
type:
|
|
572
|
+
type: selectors.REGISTER_USER_FAILED,
|
|
557
573
|
error: {
|
|
558
574
|
message: 'Unable to parse the created user from the register service response'
|
|
559
575
|
}
|
|
@@ -571,7 +587,7 @@ function* registerSaga({
|
|
|
571
587
|
error.status = response.status;
|
|
572
588
|
}
|
|
573
589
|
yield effects.put({
|
|
574
|
-
type:
|
|
590
|
+
type: selectors.REGISTER_USER_FAILED,
|
|
575
591
|
error
|
|
576
592
|
});
|
|
577
593
|
}
|
|
@@ -650,11 +666,11 @@ async function api(url, options) {
|
|
|
650
666
|
});
|
|
651
667
|
}
|
|
652
668
|
|
|
653
|
-
const resetPasswordSagas = [effects.takeEvery(
|
|
669
|
+
const resetPasswordSagas = [effects.takeEvery(selectors.REQUEST_USER_PASSWORD_RESET, requestPasswordResetSaga), effects.takeEvery(selectors.RESET_USER_PASSWORD, resetPasswordSaga), effects.takeEvery(selectors.CHANGE_USER_PASSWORD, changePasswordSaga)];
|
|
654
670
|
function* requestPasswordResetSaga(action) {
|
|
655
671
|
const userEmailObject = action.userEmailObject;
|
|
656
672
|
yield effects.put({
|
|
657
|
-
type:
|
|
673
|
+
type: selectors.REQUEST_USER_PASSWORD_RESET_SENDING
|
|
658
674
|
});
|
|
659
675
|
if (userEmailObject && userEmailObject.userEmail) {
|
|
660
676
|
try {
|
|
@@ -662,29 +678,29 @@ function* requestPasswordResetSaga(action) {
|
|
|
662
678
|
if (passwordResetRequestResponse) {
|
|
663
679
|
if (!passwordResetRequestResponse.error) {
|
|
664
680
|
yield effects.put({
|
|
665
|
-
type:
|
|
681
|
+
type: selectors.REQUEST_USER_PASSWORD_RESET_SUCCESS
|
|
666
682
|
});
|
|
667
683
|
} else {
|
|
668
684
|
yield effects.put({
|
|
669
|
-
type:
|
|
685
|
+
type: selectors.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
670
686
|
error: passwordResetRequestResponse.error.message
|
|
671
687
|
});
|
|
672
688
|
}
|
|
673
689
|
} else {
|
|
674
690
|
yield effects.put({
|
|
675
|
-
type:
|
|
691
|
+
type: selectors.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
676
692
|
error: 'No response from server'
|
|
677
693
|
});
|
|
678
694
|
}
|
|
679
695
|
} catch (error) {
|
|
680
696
|
yield effects.put({
|
|
681
|
-
type:
|
|
697
|
+
type: selectors.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
682
698
|
error: error && error.toString()
|
|
683
699
|
});
|
|
684
700
|
}
|
|
685
701
|
} else {
|
|
686
702
|
yield effects.put({
|
|
687
|
-
type:
|
|
703
|
+
type: selectors.REQUEST_USER_PASSWORD_RESET_ERROR,
|
|
688
704
|
error: 'Invalid object'
|
|
689
705
|
});
|
|
690
706
|
}
|
|
@@ -692,7 +708,7 @@ function* requestPasswordResetSaga(action) {
|
|
|
692
708
|
function* resetPasswordSaga(action) {
|
|
693
709
|
const resetPasswordObject = action.resetPasswordObject;
|
|
694
710
|
yield effects.put({
|
|
695
|
-
type:
|
|
711
|
+
type: selectors.RESET_USER_PASSWORD_SENDING
|
|
696
712
|
});
|
|
697
713
|
if (resetPasswordObject.token && resetPasswordObject.password) {
|
|
698
714
|
try {
|
|
@@ -700,30 +716,30 @@ function* resetPasswordSaga(action) {
|
|
|
700
716
|
if (resetPasswordResponse) {
|
|
701
717
|
if (!resetPasswordResponse.error) {
|
|
702
718
|
yield effects.put({
|
|
703
|
-
type:
|
|
719
|
+
type: selectors.RESET_USER_PASSWORD_SUCCESS
|
|
704
720
|
});
|
|
705
721
|
} else {
|
|
706
722
|
const error = resetPasswordResponse.error.data && resetPasswordResponse.error.data.length > 0 && resetPasswordResponse.error.data[0].message || resetPasswordResponse.error.message;
|
|
707
723
|
yield effects.put({
|
|
708
|
-
type:
|
|
724
|
+
type: selectors.RESET_USER_PASSWORD_ERROR,
|
|
709
725
|
error
|
|
710
726
|
});
|
|
711
727
|
}
|
|
712
728
|
} else {
|
|
713
729
|
yield effects.put({
|
|
714
|
-
type:
|
|
730
|
+
type: selectors.RESET_USER_PASSWORD_ERROR,
|
|
715
731
|
error: 'No response from server'
|
|
716
732
|
});
|
|
717
733
|
}
|
|
718
734
|
} catch (error) {
|
|
719
735
|
yield effects.put({
|
|
720
|
-
type:
|
|
736
|
+
type: selectors.RESET_USER_PASSWORD_ERROR,
|
|
721
737
|
error: error && error.toString()
|
|
722
738
|
});
|
|
723
739
|
}
|
|
724
740
|
} else {
|
|
725
741
|
yield effects.put({
|
|
726
|
-
type:
|
|
742
|
+
type: selectors.RESET_USER_PASSWORD_ERROR,
|
|
727
743
|
error: 'Invalid object'
|
|
728
744
|
});
|
|
729
745
|
}
|
|
@@ -735,7 +751,7 @@ function* resetPasswordSaga(action) {
|
|
|
735
751
|
function* changePasswordSaga(action) {
|
|
736
752
|
if (!action || !action.userId || !action.currentPassword || !action.newPassword) {
|
|
737
753
|
yield effects.put({
|
|
738
|
-
type:
|
|
754
|
+
type: selectors.CHANGE_USER_PASSWORD_ERROR,
|
|
739
755
|
error: 'Invalid action object sent to changePassword saga'
|
|
740
756
|
});
|
|
741
757
|
return;
|
|
@@ -747,7 +763,7 @@ function* changePasswordSaga(action) {
|
|
|
747
763
|
new: action.newPassword
|
|
748
764
|
};
|
|
749
765
|
yield effects.put({
|
|
750
|
-
type:
|
|
766
|
+
type: selectors.CHANGE_USER_PASSWORD_SENDING
|
|
751
767
|
});
|
|
752
768
|
const clientCredentials = yield effects.select(ToJs.selectClientCredentials, 'js');
|
|
753
769
|
const client = yield ChangePassword_container.getManagementApiClient({
|
|
@@ -758,7 +774,7 @@ function* changePasswordSaga(action) {
|
|
|
758
774
|
var _err$data, _err$data$data, _err$data2;
|
|
759
775
|
const error = (err === null || err === void 0 ? void 0 : (_err$data = err.data) === null || _err$data === void 0 ? void 0 : (_err$data$data = _err$data.data) === null || _err$data$data === void 0 ? void 0 : _err$data$data.length) > 0 && err.data.data[0].message || (err === null || err === void 0 ? void 0 : (_err$data2 = err.data) === null || _err$data2 === void 0 ? void 0 : _err$data2.message);
|
|
760
776
|
yield effects.put({
|
|
761
|
-
type:
|
|
777
|
+
type: selectors.CHANGE_USER_PASSWORD_ERROR,
|
|
762
778
|
error
|
|
763
779
|
});
|
|
764
780
|
return;
|
|
@@ -769,11 +785,11 @@ function* changePasswordSaga(action) {
|
|
|
769
785
|
// // eslint-disable-next-line no-console
|
|
770
786
|
// console.log(userCredentialsObject);
|
|
771
787
|
yield effects.put({
|
|
772
|
-
type:
|
|
788
|
+
type: selectors.CHANGE_USER_PASSWORD_SUCCESS
|
|
773
789
|
});
|
|
774
790
|
} catch (error) {
|
|
775
791
|
yield effects.put({
|
|
776
|
-
type:
|
|
792
|
+
type: selectors.CHANGE_USER_PASSWORD_ERROR,
|
|
777
793
|
error: error && error.toString()
|
|
778
794
|
});
|
|
779
795
|
}
|
|
@@ -837,4 +853,4 @@ exports.browserHistory = browserHistory;
|
|
|
837
853
|
exports.history = history;
|
|
838
854
|
exports.pickProject = pickProject;
|
|
839
855
|
exports.rootSaga = rootSaga;
|
|
840
|
-
//# sourceMappingURL=App-
|
|
856
|
+
//# sourceMappingURL=App-8a2f85d5.js.map
|