@zengenti/contensis-react-base 4.0.0-beta.6 → 4.0.0-beta.61

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