@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.
Files changed (212) hide show
  1. package/README.md +14 -1
  2. package/cjs/{App-vZrUfVgQ.js → App-CNylISW7.js} +546 -104
  3. package/cjs/App-CNylISW7.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-MfcvdfDR.js} +32 -74
  7. package/cjs/ContensisDeliveryApi-MfcvdfDR.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-DJeM8cym.js} +17 -9
  13. package/cjs/RouteLoader-DJeM8cym.js.map +1 -0
  14. package/cjs/SSRContext-tMufQDHY.js +116 -0
  15. package/cjs/SSRContext-tMufQDHY.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 +63 -65
  21. package/cjs/client.js.map +1 -1
  22. package/cjs/contensis-react-base.js +223 -132
  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-BCy9u6zA.js} +523 -370
  33. package/cjs/sagas-BCy9u6zA.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-B7SJs5Hf.js} +64 -5
  43. package/cjs/store-B7SJs5Hf.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-eOjxDjxF.js +148 -0
  49. package/cjs/util-eOjxDjxF.js.map +1 -0
  50. package/cjs/util.js +80 -22
  51. package/cjs/util.js.map +1 -1
  52. package/cjs/{version-CM-bJ62L.js → version-rFG9Y6_B.js} +2 -2
  53. package/cjs/{version-CM-bJ62L.js.map → version-rFG9Y6_B.js.map} +1 -1
  54. package/cjs/{version-B7XFkBhY.js → version-yjHMrfVz.js} +15 -16
  55. package/cjs/version-yjHMrfVz.js.map +1 -0
  56. package/esm/{App-DLZweVSp.js → App-Bvs7Km54.js} +507 -66
  57. package/esm/App-Bvs7Km54.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-LWYXevZ1.js} +30 -67
  61. package/esm/ContensisDeliveryApi-LWYXevZ1.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-CzrlySZf.js} +14 -6
  67. package/esm/RouteLoader-CzrlySZf.js.map +1 -0
  68. package/esm/SSRContext-Bxtg1KGv.js +106 -0
  69. package/esm/SSRContext-Bxtg1KGv.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 +63 -64
  75. package/esm/client.js.map +1 -1
  76. package/esm/contensis-react-base.js +216 -127
  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-Fr9yRduO.js} +511 -357
  87. package/esm/sagas-Fr9yRduO.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-B4IrBYHm.js} +64 -6
  97. package/esm/store-B4IrBYHm.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-Bl2u6LpY.js +136 -0
  103. package/esm/util-Bl2u6LpY.js.map +1 -0
  104. package/esm/util.js +58 -14
  105. package/esm/util.js.map +1 -1
  106. package/esm/{version-wnf-TITV.js → version-BQAL8sQO.js} +2 -2
  107. package/esm/{version-wnf-TITV.js.map → version-BQAL8sQO.js.map} +1 -1
  108. package/esm/{version-BlsI7hX2.js → version-CA9Mdm3A.js} +16 -16
  109. package/esm/version-CA9Mdm3A.js.map +1 -0
  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 +1 -2
  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 +6 -1
  122. package/models/models/EntryMapper.d.ts +2 -1
  123. package/models/models/Locales.d.ts +11 -0
  124. package/models/models/MatchedRoute.d.ts +5 -1
  125. package/models/models/RouteComponent.d.ts +0 -1
  126. package/models/models/RouteNode.d.ts +4 -2
  127. package/models/models/SSRContext.d.ts +4 -4
  128. package/models/models/StaticRoute.d.ts +12 -1
  129. package/models/models/WithEvents.d.ts +8 -0
  130. package/models/models/config/AppConfig.d.ts +2 -0
  131. package/models/models/config/I18n.d.ts +38 -0
  132. package/models/models/config/ServerConfig.d.ts +14 -0
  133. package/models/redux/index.d.ts +2 -1
  134. package/models/redux/sagas/index.d.ts +3 -1
  135. package/models/redux/sagas/injector.d.ts +13 -0
  136. package/models/redux/store/injectors/index.d.ts +26 -0
  137. package/models/redux/store/injectors/inject.d.ts +24 -0
  138. package/models/redux/store/injectors/util.d.ts +2 -0
  139. package/models/redux/store/store.d.ts +13 -4
  140. package/models/redux/util.d.ts +1 -1
  141. package/models/routing/components/RouteLoader.d.ts +3 -3
  142. package/models/routing/httpContext.d.ts +0 -1
  143. package/models/routing/index.d.ts +1 -0
  144. package/models/routing/redux/actions.d.ts +1 -1
  145. package/models/routing/redux/invokeSearch.d.ts +22 -0
  146. package/models/routing/redux/selectors.d.ts +47 -4
  147. package/models/routing/util/expressions.d.ts +1 -1
  148. package/models/routing/util/find-contenttype-mapping.d.ts +3 -1
  149. package/models/search/containers/withListing.d.ts +1 -1
  150. package/models/search/containers/withSearch.d.ts +1 -1
  151. package/models/search/models/Queries.d.ts +3 -5
  152. package/models/search/models/Search.d.ts +43 -13
  153. package/models/search/models/SearchActions.d.ts +61 -18
  154. package/models/search/models/SearchProps.d.ts +11 -10
  155. package/models/search/models/SearchState.d.ts +23 -2
  156. package/models/search/models/SearchUtil.d.ts +3 -3
  157. package/models/search/redux/getIn.d.ts +2 -2
  158. package/models/search/redux/reducers.d.ts +3 -4
  159. package/models/search/redux/sagas.d.ts +13 -14
  160. package/models/search/redux/schema.d.ts +3 -3
  161. package/models/search/redux/selectors.d.ts +64 -42
  162. package/models/search/redux/util.d.ts +10 -1
  163. package/models/search/search/ContensisDeliveryApi.d.ts +6 -26
  164. package/models/search/search/expressions.d.ts +6 -4
  165. package/models/search/search/util.d.ts +9 -7
  166. package/models/search/transformations/state-to-queryparams.mapper.d.ts +1 -1
  167. package/models/server/features/linkdepth-api/search.d.ts +1 -1
  168. package/models/server/features/response-handler/render-stream.d.ts +2 -4
  169. package/models/server/features/static-assets/index.d.ts +4 -3
  170. package/models/server/internalServer.d.ts +1 -2
  171. package/models/server/middleware/subsiteDebug.d.ts +11 -0
  172. package/models/server/root.d.ts +3 -0
  173. package/models/server/util/bundles.d.ts +9 -9
  174. package/models/server/util/jsx.d.ts +2 -14
  175. package/models/user/components.styled/Login.styled.d.ts +1 -1
  176. package/models/user/components.styled/LoginForm.styled.d.ts +1 -1
  177. package/models/user/hocs/withRegistration.d.ts +1 -1
  178. package/models/util/CachedDeliveryApi.d.ts +8 -2
  179. package/models/util/ContensisDeliveryApi.d.ts +2 -4
  180. package/models/util/NoSSR.d.ts +6 -0
  181. package/models/util/SSRContext.d.ts +3 -19
  182. package/models/util/donotuse_useHistory.d.ts +6 -0
  183. package/models/util/errors.d.ts +16 -0
  184. package/models/util/index.d.ts +7 -2
  185. package/models/util/subsite.d.ts +12 -0
  186. package/models/util/urls.d.ts +1 -2
  187. package/models/util/useIsClient.d.ts +6 -0
  188. package/package.json +37 -39
  189. package/cjs/App-vZrUfVgQ.js.map +0 -1
  190. package/cjs/ChangePassword.container-ECjEXixF.js.map +0 -1
  191. package/cjs/CookieHelper.class-C3Eqoze9.js.map +0 -1
  192. package/cjs/RouteLoader-D5Yg7EB5.js.map +0 -1
  193. package/cjs/SSRContext-DVj_QAC1.js.map +0 -1
  194. package/cjs/ToJs-C9jwV7YB.js.map +0 -1
  195. package/cjs/VersionInfo-B_dKCubg.js.map +0 -1
  196. package/cjs/sagas-CbZhaRNd.js.map +0 -1
  197. package/cjs/selectors-wCs5fHD4.js.map +0 -1
  198. package/cjs/store-D07FOXvM.js.map +0 -1
  199. package/cjs/version-B7XFkBhY.js.map +0 -1
  200. package/esm/App-DLZweVSp.js.map +0 -1
  201. package/esm/ChangePassword.container-BgzIy8dA.js.map +0 -1
  202. package/esm/CookieHelper.class-FTURFpz3.js.map +0 -1
  203. package/esm/RouteLoader-xeQBXywk.js.map +0 -1
  204. package/esm/SSRContext-BE8ElZ3X.js.map +0 -1
  205. package/esm/ToJs-CNzfvyxJ.js.map +0 -1
  206. package/esm/VersionInfo-Cno7K0OA.js.map +0 -1
  207. package/esm/sagas-xJU-zOpn.js.map +0 -1
  208. package/esm/selectors-DO2ocdOp.js.map +0 -1
  209. package/esm/store-3u0RzHZ0.js.map +0 -1
  210. package/esm/version-BlsI7hX2.js.map +0 -1
  211. package/models/redux/store/injectors.d.ts +0 -31
  212. package/models/search/search/ToJs.d.ts +0 -4
@@ -0,0 +1,22 @@
1
+ import { OnRouteLoadedArgs, RouteLoadedOptions } from "../../models";
2
+ import { SearchRouteOptions } from "../../search/models/SearchActions";
3
+ /**
4
+ * Invokes the Search saga if:
5
+ * - `searchOptions` is present on `staticRoute` or `contentTypeRoute`
6
+ * - `searchOptions` is provided by the consumer app
7
+ * - and path starts with one of `onPaths: ['/search']`
8
+ * - or a `facet` or `listingType` is present in provided `searchOptions`
9
+ *
10
+ * A `config` is required if we want to inject the redux reducer here, sagas are injected automatically
11
+ */
12
+ export declare function handleSearchSaga({ location, params, routeSearchOptions, searchOptions, ssr, }: OnRouteLoadedArgs & RouteLoadedOptions & {
13
+ routeSearchOptions: SearchRouteOptions;
14
+ }): Generator<import("redux-saga/effects").CallEffect<void> | Promise<typeof import("../../search")> | import("redux-saga/effects").CallEffect<Generator<Promise<{
15
+ key: string;
16
+ reducer: any;
17
+ saga: any;
18
+ }>, void, {
19
+ key: any;
20
+ reducer: any;
21
+ saga: any;
22
+ }>>, void, typeof import("../../search")>;
@@ -1,13 +1,15 @@
1
- import { AppState, StateType } from "../../models";
1
+ import { AppState, MatchedRoute, StateType, StaticRoute } from "../../models";
2
2
  export declare const selectRouteEntry: (state: AppState, returnType?: StateType) => any;
3
3
  export declare const selectMappedEntry: (state: AppState, returnType?: StateType) => any;
4
4
  export declare const selectSurrogateKeys: (state: AppState) => any;
5
5
  export declare const selectSsrApiCalls: (state: AppState) => any;
6
6
  export declare const selectCurrentHostname: (state: AppState) => any;
7
+ export declare const selectSsrHostname: (state: AppState) => any;
7
8
  export declare const selectCurrentTreeID: (state: AppState) => any;
8
9
  export declare const selectRouteEntryEntryId: (state: AppState) => any;
9
10
  export declare const selectRouteEntryContentTypeId: (state: AppState) => any;
10
11
  export declare const selectRouteEntryLanguage: (state: AppState) => any;
12
+ export declare const selectRouteEntryAvailableLanguages: (state: AppState) => string[];
11
13
  export declare const selectRouteEntrySlug: (state: AppState) => any;
12
14
  export declare const selectRouteEntryID: (state: AppState) => any;
13
15
  export declare const selectCanonicalPath: (state: AppState) => any;
@@ -15,16 +17,57 @@ export declare const selectCurrentPath: (state: AppState) => any;
15
17
  export declare const selectCurrentLocation: (state: AppState) => any;
16
18
  export declare const selectCurrentSearch: (state: AppState) => any;
17
19
  export declare const selectCurrentHash: (state: AppState) => any;
18
- export declare const selectQueryStringAsObject: (state: AppState) => any;
20
+ export declare const selectQueryStringAsObject: ((state: AppState) => any) & {
21
+ clearCache: () => void;
22
+ resultsCount: () => number;
23
+ resetResultsCount: () => void;
24
+ } & {
25
+ resultFunc: (resultFuncArgs_0: any) => any;
26
+ memoizedResultFunc: ((resultFuncArgs_0: any) => any) & {
27
+ clearCache: () => void;
28
+ resultsCount: () => number;
29
+ resetResultsCount: () => void;
30
+ };
31
+ lastResult: () => any;
32
+ dependencies: [(state: AppState) => any];
33
+ recomputations: () => number;
34
+ resetRecomputations: () => void;
35
+ dependencyRecomputations: () => number;
36
+ resetDependencyRecomputations: () => void;
37
+ } & {
38
+ memoize: typeof import("reselect").weakMapMemoize;
39
+ argsMemoize: typeof import("reselect").weakMapMemoize;
40
+ };
19
41
  export declare const selectCurrentProject: (state: AppState) => any;
20
42
  export declare const selectIsNotFound: (state: AppState) => any;
21
43
  export declare const selectCurrentAncestors: (state: AppState) => any;
22
44
  export declare const selectCurrentSiblings: (state: AppState) => any;
23
45
  export declare const selectCurrentNode: (state: AppState, returnType?: StateType) => any;
46
+ export declare const selectCurrentNodeLanguage: (state: AppState) => any;
24
47
  export declare const selectCurrentChildren: (state: any) => any;
25
- export declare const selectBreadcrumb: (state: AppState) => any[];
48
+ export declare const selectBreadcrumb: ((state: AppState, returnType?: StateType | undefined) => any[]) & {
49
+ clearCache: () => void;
50
+ resultsCount: () => number;
51
+ resetResultsCount: () => void;
52
+ } & {
53
+ resultFunc: (resultFuncArgs_0: any, resultFuncArgs_1: any) => any[];
54
+ memoizedResultFunc: ((resultFuncArgs_0: any, resultFuncArgs_1: any) => any[]) & {
55
+ clearCache: () => void;
56
+ resultsCount: () => number;
57
+ resetResultsCount: () => void;
58
+ };
59
+ lastResult: () => any[];
60
+ dependencies: [(state: AppState) => any, (state: AppState, returnType?: StateType) => any];
61
+ recomputations: () => number;
62
+ resetRecomputations: () => void;
63
+ dependencyRecomputations: () => number;
64
+ resetDependencyRecomputations: () => void;
65
+ } & {
66
+ memoize: typeof import("reselect").weakMapMemoize;
67
+ argsMemoize: typeof import("reselect").weakMapMemoize;
68
+ };
26
69
  export declare const selectRouteErrorMessage: (state: AppState) => any;
27
70
  export declare const selectRouteIsError: (state: AppState) => any;
28
71
  export declare const selectRouteLoading: (state: AppState) => any;
29
72
  export declare const selectRouteStatusCode: (state: AppState) => any;
30
- export declare const selectStaticRoute: (state: AppState) => any;
73
+ export declare const selectStaticRoute: (state: AppState) => MatchedRoute<string, StaticRoute>;
@@ -1,3 +1,3 @@
1
1
  import { IExpression } from 'contensis-core-api';
2
2
  export declare const fieldExpression: (field: string, value: string | string[], operator?: string, weight?: null) => any[];
3
- export declare const defaultExpressions: (versionStatus: 'published' | 'latest') => IExpression[];
3
+ export declare const defaultExpressions: (versionStatus: "published" | "latest") => IExpression[];
@@ -1,2 +1,4 @@
1
- import { ContentTypeMapping } from "../../models";
1
+ import { ContentTypeMapping, MatchedRoute } from "../../models";
2
2
  export declare const findContentTypeMapping: (ContentTypeMappings: ContentTypeMapping[], contentTypeId: string) => ContentTypeMapping | undefined;
3
+ /** Find a searchOptions object in any of the current routes */
4
+ export declare const getSearchOptions: (staticRoute: MatchedRoute, contentTypeRoute: ContentTypeMapping) => any;
@@ -2,6 +2,6 @@ import React from 'react';
2
2
  import { Mappers } from '../models/Search';
3
3
  declare const withListing: (mappers: Mappers) => <Props extends Record<string, any>>(ListingComponent: React.FC<Props>) => import("react-redux").ConnectedComponent<any, {
4
4
  context?: React.Context<import("react-redux").ReactReduxContextValue<any, import("../../../node_modules/redux").UnknownAction> | null> | undefined;
5
- store?: import("../../../node_modules/redux").Store<any, import("../../../node_modules/redux").UnknownAction, unknown> | undefined;
5
+ store?: import("../../../node_modules/redux").Store | undefined;
6
6
  }>;
7
7
  export default withListing;
@@ -2,6 +2,6 @@ import React from 'react';
2
2
  import { Mappers } from '../models/Search';
3
3
  declare const withSearch: (mappers: Mappers) => <Props extends Record<string, any>>(SearchComponent: React.ComponentType<Props>) => import("react-redux").ConnectedComponent<any, {
4
4
  context?: React.Context<import("react-redux").ReactReduxContextValue<any, import("../../../node_modules/redux").UnknownAction> | null> | undefined;
5
- store?: import("../../../node_modules/redux").Store<any, import("../../../node_modules/redux").UnknownAction, unknown> | undefined;
5
+ store?: import("../../../node_modules/redux").Store | undefined;
6
6
  }>;
7
7
  export default withSearch;
@@ -1,5 +1,6 @@
1
1
  import { FieldLinkDepths, Operators, Query, QueryAggregations, VersionStatus } from 'contensis-core-api';
2
2
  import { CustomWhereClause, FeaturedResults, WeightedSearchField } from './Search';
3
+ import { SearchParams } from './SearchActions';
3
4
  export type FieldOperators = Exclude<keyof Operators, 'and' | 'or' | 'not'>;
4
5
  export type LogicOperators = 'and' | 'or' | 'not';
5
6
  export type FilterExpression = {
@@ -32,7 +33,6 @@ export type SearchQueryOptions = {
32
33
  weightedSearchFields: WeightedSearchField[];
33
34
  };
34
35
  export type QueryParams = SearchQueryOptions & {
35
- env: string;
36
36
  internalPageIndex: number;
37
37
  internalPaging: boolean;
38
38
  linkDepth: number;
@@ -40,9 +40,7 @@ export type QueryParams = SearchQueryOptions & {
40
40
  pagesLoaded: number[];
41
41
  prevPageIndex: number;
42
42
  projectId: string;
43
- selectedFilters: {
44
- [key: string]: string;
45
- };
43
+ selectedFilters: SearchParams;
46
44
  };
47
45
  export type SearchQuery = ({ aggregations, contentTypeIds, customWhere, dynamicOrderBy, excludeIds, featuredResults, fields, filters, fuzzySearch, languages, pageSize, pageIndex, omitDefaultSearchFields, orderBy, searchTerm, versionStatus, webpageTemplates, weightedSearchFields, }: SearchQueryOptions, isFeatured?: boolean) => Query;
48
- export type FilterQuery = (contentTypeIds: string[], versionStatus: VersionStatus, customWhere?: CustomWhereClause) => Query;
46
+ export type FilterQuery = (contentTypeIds: string[], languages: string[], versionStatus: VersionStatus, customWhere?: CustomWhereClause, pageSize?: number) => Query;
@@ -4,6 +4,19 @@ import { MappingTemplate } from 'jsonpath-mapper';
4
4
  import { Context } from './Enums';
5
5
  import { FieldOperators, LogicOperators } from './Queries';
6
6
  import { AppState } from './SearchState';
7
+ export type FacetComposition = {
8
+ /** Display title */
9
+ title?: string;
10
+ /** An array of facet keys to include in this composition */
11
+ facets?: string[];
12
+ };
13
+ export type ListingComposition = {
14
+ /** Display title */
15
+ title?: string;
16
+ /** An array of listing keys to include in this composition */
17
+ listings?: string[];
18
+ };
19
+ export type Composition = FacetComposition | ListingComposition;
7
20
  export type Tab = {
8
21
  /** The facet to render as default */
9
22
  defaultFacet?: string;
@@ -19,13 +32,6 @@ export type CustomApi = {
19
32
  uri: string;
20
33
  };
21
34
  export type Listing = {
22
- /** Display title */
23
- title?: string;
24
- /** Experimental: use a custom API to retrieve search results */
25
- customApi?: CustomApi;
26
- } | {
27
- /** Experimental: override the rootUrl of the Delivery API client */
28
- env?: string;
29
35
  /** An object with a key for each filter that is required in this facet */
30
36
  filters?: SearchFilters;
31
37
  /** Use this to target the search to a project other than the default configured */
@@ -34,6 +40,12 @@ export type Listing = {
34
40
  queryParams: SearchQueryParams;
35
41
  /** Display title */
36
42
  title?: string;
43
+ /** Experimental: use a custom API to retrieve search results */
44
+ customApi?: CustomApi;
45
+ /** Internationalisation config */
46
+ i18n?: {
47
+ [language: string]: string;
48
+ };
37
49
  };
38
50
  export type SearchFacet = {
39
51
  /** The first facet to be shown if no facet is supplied via a route parameter [default false] */
@@ -47,13 +59,17 @@ export type SearchFilters = {
47
59
  [key: string]: SearchFilter;
48
60
  };
49
61
  export type SearchFilter = {
62
+ /** Populate items using aggregations, `true` will enable or supply name(s) of other field aggregations to populate the items with */
63
+ aggregations?: boolean | string | string[];
50
64
  /** The content type id we will dynamically load entries from and load into state under the items[] */
51
65
  contentTypeId?: string | string[];
52
66
  /** An array of CustomWhereClause to include in the search query when dynamically loading entries via the contentTypeId key */
53
67
  customWhere?: CustomWhereClause;
68
+ /** Max number of items returned when providing `contentTypeId`, default is 100 */
69
+ pageSize?: number;
54
70
  /** Use this to set a specific value to render for the initial / unselected option in this filter */
55
71
  defaultValue?: string;
56
- /** The content type field we will apply the filter key to, to filter the list of returned results. */
72
+ /** The content type field id(s) we will apply selected filter keys to, so we can filter the list of returned results. */
57
73
  fieldId: string | string[];
58
74
  /** The Delivery API search operator we will use to filter the list of returned results. */
59
75
  fieldOperator?: FieldOperators;
@@ -67,10 +83,18 @@ export type SearchFilter = {
67
83
  isSingleSelect?: boolean;
68
84
  /** Supply an empty array or a hardcoded list of FilterItem depending on the type of filter we require */
69
85
  items: FilterItem[];
70
- /** Set to false to not include this filter in filters prop */
86
+ /** Setting `false` will change the filter behaviour:
87
+ *
88
+ * a) to be excluded from the `filters` prop
89
+ *
90
+ * b) to not include selected items in the querystring on next navigate */
71
91
  renderable?: boolean;
72
92
  /** The title to render next to the filter */
73
93
  title: string;
94
+ /** Internationalisation config */
95
+ i18n?: {
96
+ [language: string]: string;
97
+ };
74
98
  };
75
99
  export type FilterItem = {
76
100
  /** Whether the filter is in a selected state */
@@ -113,6 +137,8 @@ export type SearchQueryParams = {
113
137
  includeInSearch?: string[];
114
138
  /** Whether or not to load all results with the first page and handle all pagination yourself */
115
139
  internalPaging?: boolean;
140
+ /** Search within specific languages */
141
+ languages?: string[];
116
142
  /** The linkDepth to apply to the facet search (defaults to 0) */
117
143
  linkDepth?: number;
118
144
  /** Alters the pagination style to retain previously loaded pages of results after loading next pages */
@@ -161,7 +187,7 @@ export type WeightedSearchField = {
161
187
  */
162
188
  export type SearchConfig = {
163
189
  /** An object with a key for each facet that is required for the search */
164
- facets: {
190
+ facets?: {
165
191
  [key: string]: SearchFacet;
166
192
  };
167
193
  /** An object with a key for each independent listing that is required for the site */
@@ -172,8 +198,12 @@ export type SearchConfig = {
172
198
  minilist?: {
173
199
  [key: string]: Listing;
174
200
  };
175
- /** An Array of Tabs */
176
- tabs: Tab[];
201
+ /** An Array of Tabs to partition search facets */
202
+ tabs?: Tab[];
203
+ /** An object with a key for each composition that is required for the site */
204
+ compositions?: {
205
+ [key: string]: Composition;
206
+ };
177
207
  };
178
208
  export type ConfigTypes = {
179
209
  [key: string]: SearchFacet;
@@ -183,7 +213,7 @@ export type ConfigTypes = {
183
213
  /**
184
214
  * Type your mapper for mapping API responses (entries) into usable props for your components to render
185
215
  */
186
- export type SearchResultsMapper<Target = any, Source = Entry> = (entries: Source[], facet?: string, context?: Context, state?: AppState) => Target[];
216
+ export type SearchResultsMapper<Target = any, Source = Entry> = (entries: Source[], facet?: string, context?: keyof typeof Context, state?: AppState) => Target[];
187
217
  /**
188
218
  * Type your custom filter item mapping function with this to ensure correctly typed FilterItems are returned to work with search functions
189
219
  */
@@ -1,10 +1,20 @@
1
1
  import { PagedList } from 'contensis-core-api';
2
2
  import { Entry, TaxonomyNode } from 'contensis-delivery-api/lib/models';
3
3
  import { Context } from '../models/Enums';
4
- import { SearchFacet, Listing, Mappers } from '../models/Search';
5
- import { AppState, Facet } from './SearchState';
4
+ import { SearchFacet, Listing, Mappers, SearchConfig } from '../models/Search';
5
+ import { AppState, Facet, Filter } from './SearchState';
6
6
  import { QueryParams } from './Queries';
7
7
  import { TimedSearchResponse } from './SearchUtil';
8
+ import { SSRContext } from "../../models";
9
+ /**
10
+ * Parameters for the current search
11
+ * usually provided by route, path or query parameters or
12
+ * can be overridden manually to manipulate the search to
13
+ * drive certain conditions when required
14
+ */
15
+ export type SearchParams = {
16
+ [key: string]: string;
17
+ };
8
18
  type Action = {
9
19
  type: string;
10
20
  };
@@ -24,33 +34,49 @@ export type TriggerSearchParams = {
24
34
  facet: string;
25
35
  mapper?: Mappers['results'];
26
36
  mappers?: Mappers;
27
- params?: {
28
- [key: string]: string;
29
- };
37
+ params?: SearchParams;
38
+ ssr?: SSRContext;
30
39
  };
31
40
  export type TriggerSearchAction = Action & TriggerSearchParams;
32
41
  export type TriggerSearchActionCreator = (p: TriggerSearchParams) => TriggerSearchAction;
33
42
  type InitListingParams = {
34
- context: Context;
43
+ context: keyof typeof Context;
35
44
  debug?: DebugFlags;
36
45
  defaultLang?: string;
46
+ languages?: string[];
47
+ /**
48
+ * Triggers the loading of the search config facet
49
+ */
37
50
  facet: string;
51
+ /**
52
+ * Triggers the loading of the search config listing
53
+ */
38
54
  listingType?: string;
55
+ /**
56
+ * Triggers the loading of the search config composition
57
+ */
58
+ composition?: string;
39
59
  mapper?: Mappers['results'];
40
60
  mappers?: Mappers;
41
- params: {
42
- [key: string]: string;
43
- };
61
+ params: SearchParams;
44
62
  preload?: boolean;
63
+ ssr?: SSRContext;
45
64
  };
46
65
  export type InitListingAction = Action & InitListingParams & {
47
- ssr?: boolean;
48
- };
49
- export type SetRouteFiltersOptions = Partial<InitListingAction>;
66
+ isSSR?: boolean;
67
+ };
68
+ export type SetRouteFiltersOptions = Omit<Partial<InitListingAction>, 'type'>;
69
+ export type SearchRouteOptions = Omit<SetRouteFiltersOptions & {
70
+ /**
71
+ * The search configuration to use for the search
72
+ */
73
+ config?: SearchConfig;
74
+ }, 'ssr' | 'isSSR'>;
50
75
  export type InitListingActionCreator = (p: InitListingParams) => InitListingAction;
51
76
  export type LoadFiltersSearchResults = Action & {
52
77
  error: any;
53
78
  facetKey: string;
79
+ filter: Filter;
54
80
  filterKey: string;
55
81
  payload: TaxonomyNode | PagedList<Entry>;
56
82
  selectedKeys: string[];
@@ -66,6 +92,17 @@ export type SearchResults = {
66
92
  result: TimedSearchResponse;
67
93
  state: AppState;
68
94
  };
95
+ export type LoadFilterAction = {
96
+ context: Context;
97
+ facetKey: string;
98
+ filter: Filter;
99
+ filterKey: string;
100
+ languages: string[];
101
+ mapper: Mappers['filterItems'];
102
+ projectId: string;
103
+ selectedKeys: string[];
104
+ ssr?: SSRContext;
105
+ };
69
106
  export type LoadFiltersCompleteAction = Action & {
70
107
  error: any;
71
108
  facetKey: string;
@@ -85,16 +122,14 @@ export type ExecuteSearchAction = EnsureSearchAction & {
85
122
  export type SetSearchEntriesParams = {
86
123
  type: string;
87
124
  context: Context;
88
- defaultLang: string;
125
+ languages: string[];
89
126
  facet: string;
90
127
  mappers: Mappers;
91
128
  nextFacet: Facet;
92
129
  preload: boolean;
93
130
  ogState: AppState;
94
131
  debug: DebugFlags;
95
- params: {
96
- [key: string]: string;
97
- };
132
+ params: SearchParams;
98
133
  };
99
134
  export type SetSearchEntriesAction = Action & SetSearchEntriesParams;
100
135
  export type ApplySearchFilterAction = Action & {
@@ -104,8 +139,16 @@ export type ApplySearchFilterAction = Action & {
104
139
  scrollToElement?: string;
105
140
  };
106
141
  export type ApplySearchFilterActionCreator = (filter: string, key: string) => ApplySearchFilterAction;
107
- export type ClearFiltersAction = Action;
108
- export type ClearFiltersActionCreator = (filterKey?: string) => ClearFiltersAction;
142
+ export type ClearFiltersAction = Action & {
143
+ clear?: {
144
+ term?: boolean;
145
+ keys?: boolean | string[];
146
+ };
147
+ };
148
+ export type ClearFiltersActionCreator = (clear?: string | {
149
+ term?: boolean;
150
+ keys?: boolean | string[];
151
+ }) => ClearFiltersAction;
109
152
  export type UpdateCurrentFacetAction = Action & {
110
153
  facet: string;
111
154
  };
@@ -1,7 +1,8 @@
1
1
  import { clearFilters, updateCurrentFacet, updateCurrentTab, updatePageIndex, updatePageSize, updateSearchTerm, updateSelectedFilters, updateSortOrder } from '../redux/actions';
2
2
  import { SearchFacet, Mappers } from '../models/Search';
3
- import { DebugFlags } from '../models/SearchActions';
3
+ import { DebugFlags, SearchParams } from '../models/SearchActions';
4
4
  import { Facet as StateFacet, Facets, Filters, Paging, SelectedFilters, TabAndFacets } from '../models/SearchState';
5
+ import { getComposition } from '../redux/selectors';
5
6
  export interface MinilistProps<SearchResults = any> {
6
7
  filters: Filters;
7
8
  isLoading: boolean;
@@ -18,12 +19,15 @@ export interface MinilistProps<SearchResults = any> {
18
19
  }
19
20
  export interface ListingProps<SearchResults = any> {
20
21
  clearFilters: typeof clearFilters;
22
+ composition?: Omit<ReturnType<typeof getComposition>, 'facets'>;
23
+ currentComposition?: string;
21
24
  currentListing: string;
22
25
  currentPageIndex: number;
23
26
  featured: SearchResults[];
24
27
  filters: Filters;
25
28
  isLoading: boolean;
26
29
  listing: StateFacet;
30
+ localisedCurrent: string;
27
31
  pageIsLoading: boolean;
28
32
  paging: Paging;
29
33
  results: SearchResults[];
@@ -41,6 +45,8 @@ export interface ListingProps<SearchResults = any> {
41
45
  }
42
46
  export interface SearchProps<SearchResults = any> {
43
47
  clearFilters: typeof clearFilters;
48
+ composition?: Omit<ReturnType<typeof getComposition>, 'listings'>;
49
+ currentComposition?: string;
44
50
  currentFacet: string;
45
51
  currentPageIndex: number;
46
52
  currentTabIndex: number;
@@ -55,6 +61,7 @@ export interface SearchProps<SearchResults = any> {
55
61
  featured: SearchResults[];
56
62
  filters: Filters;
57
63
  isLoading: boolean;
64
+ localisedCurrent: string;
58
65
  pageIsLoading: boolean;
59
66
  paging: Paging;
60
67
  results: SearchResults[];
@@ -79,9 +86,7 @@ export interface UseFacetsProps {
79
86
  mappers?: Mappers;
80
87
  /** Reserved for future use */
81
88
  id?: string;
82
- params?: {
83
- [key: string]: string;
84
- };
89
+ params?: SearchParams;
85
90
  }
86
91
  export interface UseListingProps {
87
92
  debug?: DebugFlags;
@@ -89,9 +94,7 @@ export interface UseListingProps {
89
94
  mappers?: Mappers;
90
95
  /** Reserved for future use */
91
96
  id?: string;
92
- params?: {
93
- [key: string]: string;
94
- };
97
+ params?: SearchParams;
95
98
  }
96
99
  export interface UseMinilistProps {
97
100
  id: string;
@@ -101,7 +104,5 @@ export interface UseMinilistProps {
101
104
  excludeIds?: string[];
102
105
  mapper?: Mappers['results'];
103
106
  mappers?: Mappers;
104
- params?: {
105
- [key: string]: string;
106
- };
107
+ params?: SearchParams;
107
108
  }
@@ -1,16 +1,22 @@
1
1
  import { PagedSearchList } from 'contensis-core-api';
2
2
  import { Context } from './Enums';
3
3
  import { CustomWhereClause } from './Search';
4
- export type AppState = Record<'search', SearchState> & Record<string, any>;
4
+ import { AppState as ReduxState } from "../../models";
5
+ export type AppSearchState = Record<'search', SearchState>;
6
+ export type AppState = AppSearchState & ReduxState;
5
7
  export type SearchState = {
6
8
  context: keyof typeof Context;
7
9
  currentFacet: string;
8
10
  currentListing: string;
11
+ currentComposition: string;
9
12
  term: string;
10
13
  facets: Facets;
11
14
  listings: Facets;
12
15
  minilist: Facets;
13
16
  tabs: Tab[];
17
+ compositions: {
18
+ [key: string]: Composition;
19
+ };
14
20
  config: Record<string, boolean>;
15
21
  };
16
22
  export type Aggregations = Required<PagedSearchList<unknown>>['aggregations'];
@@ -31,6 +37,9 @@ export type Facet = {
31
37
  };
32
38
  featuredResults: any[];
33
39
  filters: Filters;
40
+ i18n?: {
41
+ [language: string]: string;
42
+ };
34
43
  pagingInfo: {
35
44
  isLoading: boolean;
36
45
  pageCount: number;
@@ -46,13 +55,15 @@ export type Facet = {
46
55
  queryParams: {
47
56
  contentTypeIds: string[];
48
57
  dynamicOrderBy: string[];
49
- pageSize: number;
50
58
  excludeIds: string[];
51
59
  internalPaging: boolean;
60
+ languages: string[];
52
61
  loadMorePaging: boolean;
62
+ pageSize: number;
53
63
  useSearchTerm: boolean;
54
64
  };
55
65
  results: any[];
66
+ resultsInfo?: any;
56
67
  tabId: number;
57
68
  title: string;
58
69
  };
@@ -60,15 +71,20 @@ export type Filters = {
60
71
  [key: string]: Filter;
61
72
  };
62
73
  export type Filter = {
74
+ aggregations?: boolean | string | string[];
63
75
  contentTypeId?: string;
64
76
  customWhere?: CustomWhereClause;
65
77
  defaultValue?: string;
66
78
  fieldId?: string | string[];
79
+ i18n?: {
80
+ [language: string]: string;
81
+ };
67
82
  isGrouped?: boolean;
68
83
  isSingleSelect?: boolean;
69
84
  isLoading: boolean;
70
85
  isError: boolean;
71
86
  items?: FilterItem[];
87
+ pageSize?: number;
72
88
  path?: string;
73
89
  renderable?: boolean;
74
90
  title?: string;
@@ -106,3 +122,8 @@ export type TabAndFacets = Tab & {
106
122
  [key: string]: Facet;
107
123
  };
108
124
  };
125
+ export type Composition = {
126
+ title?: string;
127
+ listings?: string[];
128
+ facets?: string[];
129
+ };
@@ -1,6 +1,6 @@
1
- import { Entry } from 'contensis-delivery-api/lib/models';
2
- import { PagedList } from 'contensis-core-api';
1
+ import { Entry } from 'contensis-delivery-api';
2
+ import { PagedSearchList } from 'contensis-core-api';
3
3
  export type TimedSearchResponse = {
4
4
  duration: number;
5
- payload: PagedList<Entry> | any[];
5
+ payload: PagedSearchList<Entry> | any[];
6
6
  };
@@ -1,3 +1,3 @@
1
- export declare const makeFromJS: (returnType?: 'immutable' | 'js') => any;
2
- declare const getImmutableOrJS: <S extends Record<string, unknown>, T extends unknown>(state: S, stateKey: T | T[], fallbackValue?: any, returnType?: 'immutable' | 'js') => any;
1
+ export declare const makeFromJS: (returnType?: "immutable" | "js") => any;
2
+ declare const getImmutableOrJS: <S extends Record<string, unknown>, T extends keyof S | any>(state: S, stateKey: T | T[], fallbackValue?: any, returnType?: "immutable" | "js") => any;
3
3
  export default getImmutableOrJS;
@@ -1,12 +1,11 @@
1
- import { SearchConfig } from '../models/Search';
2
1
  import { Context } from '../models/Enums';
2
+ import { SearchConfig } from '../models/Search';
3
+ import { SearchParams } from '../models/SearchActions';
3
4
  import { SearchState } from '../models/SearchState';
4
5
  declare const _default: (config: SearchConfig) => (state?: SearchState | undefined, action: {
5
6
  [key: string]: any;
6
7
  context: keyof typeof Context;
7
8
  facet: string;
8
- params: {
9
- [key: string]: string;
10
- };
9
+ params: SearchParams;
11
10
  }) => SearchState;
12
11
  export default _default;
@@ -1,22 +1,21 @@
1
- import { Entry } from 'contensis-delivery-api/lib/models';
2
- import { InitListingAction, SetRouteFiltersOptions, TriggerSearchAction, TriggerSearchParams } from '../models/SearchActions';
1
+ import { InitListingAction, SearchParams, SetRouteFiltersOptions, TriggerSearchAction, TriggerSearchParams } from '../models/SearchActions';
3
2
  import { Mappers } from '../models/Search';
3
+ import { Context } from '../models/Enums';
4
4
  export declare const searchSagas: import("redux-saga/effects").ForkEffect<never>[];
5
5
  export declare function setRouteFilters(action: InitListingAction | SetRouteFiltersOptions): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").PutEffect<InitListingAction> | import("redux-saga/effects").CallEffect<void>, void, any>;
6
- export declare function doSearch(action: TriggerSearchAction): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").PutEffect<{
6
+ export declare function doSearch(action: TriggerSearchAction): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").PutEffect<InitListingAction> | import("redux-saga/effects").CallEffect<void> | import("redux-saga/effects").PutEffect<{
7
7
  type: string;
8
- config?: import("../models/Search").Listing | import("../models/Search").SearchFacet | undefined;
9
- context: string;
10
- debug?: import("../models/SearchActions").DebugFlags | undefined;
11
- defaultLang?: string | undefined;
12
- excludeIds?: string[] | undefined;
8
+ config?: import("../models/Search").SearchFacet | import("../models/Search").Listing;
9
+ context: Context | string;
10
+ debug?: import("../models/SearchActions").DebugFlags;
11
+ defaultLang?: string;
12
+ excludeIds?: string[];
13
13
  facet: string;
14
- mapper?: import("../models/Search").SearchResultsMapper<any, Entry> | undefined;
15
- mappers?: Mappers | undefined;
16
- params?: {
17
- [key: string]: string;
18
- } | undefined;
19
- }> | import("redux-saga/effects").PutEffect<InitListingAction> | import("redux-saga/effects").CallEffect<void>, void, any>;
14
+ mapper?: Mappers["results"];
15
+ mappers?: Mappers;
16
+ params?: SearchParams;
17
+ ssr?: import("../..").SSRContext;
18
+ }>, void, any>;
20
19
  export declare function triggerMinilistSsr(options: TriggerSearchParams): Generator<import("redux-saga/effects").CallEffect<void>, void, unknown>;
21
20
  export declare function triggerListingSsr(options: SetRouteFiltersOptions & {
22
21
  listingType: string;
@@ -49,9 +49,9 @@ export declare const searchTab: {
49
49
  label: undefined;
50
50
  totalCount: string;
51
51
  };
52
- export declare const filtering: Omit<Filter, "items" | "customWhere"> & {
53
- customWhere?: CustomWhereClause[] | undefined;
54
- items?: FilterItem[] | undefined;
52
+ export declare const filtering: Omit<Filter, "customWhere" | "items"> & {
53
+ customWhere?: CustomWhereClause[];
54
+ items?: FilterItem[];
55
55
  };
56
56
  export declare const filterItem: FilterItem;
57
57
  export declare const initialState: SearchState;