@zengenti/contensis-react-base 3.0.2-beta.22 → 3.0.2-beta.24
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/cjs/{App-21a7d836.js → App-a9f4effe.js} +48 -21
- package/cjs/App-a9f4effe.js.map +1 -0
- package/cjs/{ContensisDeliveryApi-c079b03a.js → ContensisDeliveryApi-76de5ca9.js} +55 -34
- package/cjs/ContensisDeliveryApi-76de5ca9.js.map +1 -0
- package/cjs/CookieConstants-000427db.js +10 -0
- package/cjs/CookieConstants-000427db.js.map +1 -0
- package/cjs/CookieHelper.class-daeb09dd.js +52 -0
- package/cjs/CookieHelper.class-daeb09dd.js.map +1 -0
- package/cjs/{RouteLoader-7f0d107a.js → RouteLoader-005d7f4e.js} +9 -5
- package/cjs/RouteLoader-005d7f4e.js.map +1 -0
- package/cjs/{ToJs-6e9cfa69.js → ToJs-5169fe56.js} +2 -2
- package/cjs/ToJs-5169fe56.js.map +1 -0
- package/cjs/client.js +15 -11
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +18 -343
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/{login-2a6b5be0.js → login-c94a3369.js} +86 -80
- package/cjs/login-c94a3369.js.map +1 -0
- package/cjs/redux.js +3 -3
- package/cjs/routing.js +5 -3
- package/cjs/routing.js.map +1 -1
- package/cjs/{selectors-bcca60f4.js → selectors-bb991331.js} +4 -9
- package/cjs/selectors-bb991331.js.map +1 -0
- package/cjs/user.js +30 -15
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +5 -3
- package/cjs/util.js.map +1 -1
- package/cjs/{version-4077e706.js → version-153ec9ef.js} +2 -2
- package/cjs/{version-4077e706.js.map → version-153ec9ef.js.map} +1 -1
- package/cjs/{version-fe28099e.js → version-963a7634.js} +3 -3
- package/cjs/{version-fe28099e.js.map → version-963a7634.js.map} +1 -1
- package/esm/{App-2af18a99.js → App-cdcedf62.js} +47 -21
- package/esm/App-cdcedf62.js.map +1 -0
- package/esm/{ContensisDeliveryApi-5660ee0e.js → ContensisDeliveryApi-91398551.js} +55 -35
- package/esm/ContensisDeliveryApi-91398551.js.map +1 -0
- package/esm/CookieConstants-3d3b6531.js +6 -0
- package/esm/CookieConstants-3d3b6531.js.map +1 -0
- package/esm/CookieHelper.class-4d6ee27b.js +49 -0
- package/esm/CookieHelper.class-4d6ee27b.js.map +1 -0
- package/esm/{RouteLoader-6eac364e.js → RouteLoader-d36840dd.js} +9 -5
- package/esm/RouteLoader-d36840dd.js.map +1 -0
- package/esm/{ToJs-9b30636a.js → ToJs-e1af7030.js} +2 -2
- package/esm/ToJs-e1af7030.js.map +1 -0
- package/esm/client.js +16 -12
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +18 -344
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/{login-71ff3fcb.js → login-950e0b92.js} +79 -72
- package/esm/login-950e0b92.js.map +1 -0
- package/esm/redux.js +6 -6
- package/esm/routing.js +5 -3
- package/esm/routing.js.map +1 -1
- package/esm/{selectors-74de49a3.js → selectors-1a3c1725.js} +4 -9
- package/esm/selectors-1a3c1725.js.map +1 -0
- package/esm/user.js +27 -16
- package/esm/user.js.map +1 -1
- package/esm/util.js +5 -3
- package/esm/util.js.map +1 -1
- package/esm/{version-ef107106.js → version-6cc0418c.js} +2 -2
- package/esm/{version-ef107106.js.map → version-6cc0418c.js.map} +1 -1
- package/esm/{version-b15807c5.js → version-ec722079.js} +3 -3
- package/esm/{version-b15807c5.js.map → version-ec722079.js.map} +1 -1
- package/models/client/client.d.ts +2 -2
- package/models/client/index.d.ts +1 -1
- package/models/config.d.ts +3 -3
- package/models/index.d.ts +5 -5
- package/models/redux/actions/index.d.ts +1 -1
- package/models/redux/appstate.d.ts +2 -2
- package/models/redux/selectors/index.d.ts +1 -1
- package/models/redux/store/store.d.ts +1 -1
- package/models/redux/types/index.d.ts +1 -1
- package/models/routing/redux/actions.d.ts +10 -6
- package/models/routing/redux/selectors.d.ts +5 -5
- package/models/routing/redux/types.d.ts +0 -1
- package/models/routing/routes.d.ts +21 -18
- package/models/routing/util/queries.d.ts +1 -1
- package/models/search/models/Queries.d.ts +8 -10
- package/models/search/models/Search.d.ts +24 -24
- package/models/search/models/SearchActions.d.ts +33 -33
- package/models/search/models/SearchState.d.ts +11 -11
- package/models/search/models/SearchUtil.d.ts +1 -1
- package/models/search/models/WithSearch.d.ts +1 -1
- package/models/search/redux/actions.d.ts +4 -4
- package/models/search/redux/selectors.d.ts +27 -27
- package/models/search/redux/util.d.ts +1 -1
- package/models/search/search/expressions.d.ts +4 -4
- package/models/search/search/util.d.ts +2 -2
- package/models/search/transformations/state-to-queryparams.mapper.d.ts +1 -1
- package/models/server/features/linkdepth-api/LinkDepthSearchService.d.ts +1 -1
- package/models/server/features/linkdepth-api/search.d.ts +3 -3
- package/models/server/internalServer.d.ts +8 -6
- package/models/server/util/bundles.d.ts +3 -3
- package/models/server/util/headers.d.ts +1 -1
- package/models/server/webApp.d.ts +1 -1
- package/models/testImmer/redux/reducer.d.ts +1 -1
- package/models/user/components/Login.d.ts +2 -3
- package/models/user/containers/ChangePassword.container.d.ts +2 -2
- package/models/user/containers/ForgotPassword.container.d.ts +2 -2
- package/models/user/containers/Login.container.d.ts +2 -2
- package/models/user/containers/Registration.container.d.ts +2 -2
- package/models/user/hocs/withLogin.d.ts +5 -11
- package/models/user/hocs/withRegistration.d.ts +2 -8
- package/models/user/redux/actions.d.ts +2 -2
- package/models/user/redux/sagas/login.d.ts +9 -8
- package/models/user/redux/selectors.d.ts +6 -6
- package/models/user/util/CookieConstants.d.ts +7 -0
- package/models/user/util/CookieHelper.class.d.ts +15 -3
- package/models/user/util/LoginHelper.class.d.ts +26 -23
- package/models/user/util/matchGroups.d.ts +1 -1
- package/models/util/ContensisDeliveryApi.d.ts +21 -14
- package/models/util/ToJs.d.ts +1 -1
- package/models/util/index.d.ts +2 -2
- package/models/util/json-mapper.d.ts +3 -3
- package/package.json +8 -8
- package/cjs/App-21a7d836.js.map +0 -1
- package/cjs/ContensisDeliveryApi-c079b03a.js.map +0 -1
- package/cjs/RouteLoader-7f0d107a.js.map +0 -1
- package/cjs/ToJs-6e9cfa69.js.map +0 -1
- package/cjs/login-2a6b5be0.js.map +0 -1
- package/cjs/selectors-bcca60f4.js.map +0 -1
- package/esm/App-2af18a99.js.map +0 -1
- package/esm/ContensisDeliveryApi-5660ee0e.js.map +0 -1
- package/esm/RouteLoader-6eac364e.js.map +0 -1
- package/esm/ToJs-9b30636a.js.map +0 -1
- package/esm/login-71ff3fcb.js.map +0 -1
- package/esm/selectors-74de49a3.js.map +0 -1
|
@@ -2,8 +2,8 @@ import { VersionStatus } from 'contensis-core-api';
|
|
|
2
2
|
import { Entry, Node } from 'contensis-delivery-api/lib/models';
|
|
3
3
|
import { Group, User } from 'contensis-management-api/lib/models';
|
|
4
4
|
import { MatchedRoute } from 'react-router-config';
|
|
5
|
-
import { StaticRoute } from
|
|
6
|
-
export
|
|
5
|
+
import { StaticRoute } from '~/routing/routes';
|
|
6
|
+
export type AppState = {
|
|
7
7
|
navigation: {
|
|
8
8
|
root: Node | null;
|
|
9
9
|
isError: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AppState } from '../appstate';
|
|
2
2
|
import { History, MemoryHistory } from 'history';
|
|
3
|
-
import { StateType } from
|
|
3
|
+
import { StateType } from '~/config';
|
|
4
4
|
export declare let reduxStore: any;
|
|
5
5
|
declare const _default: (featureReducers: any, initialState: AppState, history: History | MemoryHistory, stateType: StateType) => Promise<any>;
|
|
6
6
|
export default _default;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const
|
|
1
|
+
import { useLocation } from 'react-router-dom';
|
|
2
|
+
import { Entry } from 'contensis-delivery-api/lib/models';
|
|
3
|
+
import { MatchedRoute, RouteConfig } from 'react-router-config';
|
|
4
|
+
import { AppRoutes, WithEvents } from '../routes';
|
|
5
|
+
import { CookieHelper } from '~/user/util/CookieHelper.class';
|
|
6
|
+
export declare const setNavigationPath: (path: string, location: ReturnType<typeof useLocation>, staticRoute: MatchedRoute<any, RouteConfig> | undefined, withEvents: WithEvents, statePath: string, routes: AppRoutes, cookies: CookieHelper) => any;
|
|
7
|
+
export declare const setCurrentProject: (project: string, allowedGroups: any, hostname: string) => any;
|
|
8
|
+
export declare const setRoute: (path: string, state?: any) => any;
|
|
9
|
+
export declare const setRouteEntry: (entry: Entry) => any;
|
|
10
|
+
export declare const setSurrogateKeys: (keys: string, url: string) => any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { StateType } from
|
|
2
|
-
import { AppState } from
|
|
3
|
-
export declare const selectRouteEntry: (state: AppState, returnType?: StateType
|
|
4
|
-
export declare const selectMappedEntry: (state: AppState, returnType?: StateType
|
|
1
|
+
import { StateType } from '~/config';
|
|
2
|
+
import { AppState } from '~/redux/appstate';
|
|
3
|
+
export declare const selectRouteEntry: (state: AppState, returnType?: StateType) => any;
|
|
4
|
+
export declare const selectMappedEntry: (state: AppState, returnType?: StateType) => any;
|
|
5
5
|
export declare const selectSurrogateKeys: (state: AppState) => any;
|
|
6
6
|
export declare const selectCurrentHostname: (state: AppState) => any;
|
|
7
7
|
export declare const selectCurrentTreeID: (state: AppState) => any;
|
|
@@ -20,7 +20,7 @@ export declare const selectCurrentProject: (state: AppState) => any;
|
|
|
20
20
|
export declare const selectIsNotFound: (state: AppState) => any;
|
|
21
21
|
export declare const selectCurrentAncestors: (state: AppState) => any;
|
|
22
22
|
export declare const selectCurrentSiblings: (state: AppState) => any;
|
|
23
|
-
export declare const selectCurrentNode: (state: AppState, returnType?: StateType
|
|
23
|
+
export declare const selectCurrentNode: (state: AppState, returnType?: StateType) => any;
|
|
24
24
|
export declare const selectCurrentChildren: (state: any) => any;
|
|
25
25
|
export declare const selectBreadcrumb: (state: AppState) => any[];
|
|
26
26
|
export declare const selectRouteErrorMessage: (state: AppState) => any;
|
|
@@ -5,7 +5,6 @@ export declare const SET_ANCESTORS: string;
|
|
|
5
5
|
export declare const SET_SIBLINGS: string;
|
|
6
6
|
export declare const SET_ENTRY_ID: string;
|
|
7
7
|
export declare const SET_SURROGATE_KEYS: string;
|
|
8
|
-
export declare const SET_NAVIGATION_NOT_FOUND: string;
|
|
9
8
|
export declare const SET_NAVIGATION_PATH: string;
|
|
10
9
|
export declare const SET_TARGET_PROJECT: string;
|
|
11
10
|
export declare const SET_ROUTE: string;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { MatchedRoute, RouteConfig } from 'react-router-config';
|
|
2
2
|
import { Entry, Node } from 'contensis-delivery-api/lib/models';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { AppState } from
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { AppState } from '~/redux/appstate';
|
|
5
|
+
import { CookieHelper } from '~/user/util/CookieHelper.class';
|
|
6
|
+
type RouteComponent<Props> = React.ComponentType<Props>;
|
|
7
|
+
export type RouteNode = Node & {
|
|
7
8
|
ancestors: Node[];
|
|
8
9
|
children: Node[];
|
|
9
10
|
};
|
|
10
|
-
export
|
|
11
|
+
export type AppRoutes = {
|
|
11
12
|
ContentTypeMappings: ContentTypeMapping[];
|
|
12
13
|
StaticRoutes: StaticRoute[];
|
|
13
14
|
};
|
|
14
|
-
export
|
|
15
|
+
export type AppRootProps = {
|
|
15
16
|
routes: AppRoutes;
|
|
16
17
|
withEvents: WithEvents;
|
|
17
18
|
};
|
|
18
|
-
export
|
|
19
|
+
export type RouteComponentProps<P = any> = {
|
|
19
20
|
[key: string]: any;
|
|
20
21
|
projectId?: string;
|
|
21
22
|
contentTypeId?: string;
|
|
@@ -23,23 +24,23 @@ export declare type RouteComponentProps<P = any> = {
|
|
|
23
24
|
mappedEntry?: P;
|
|
24
25
|
isLoggedIn?: boolean;
|
|
25
26
|
};
|
|
26
|
-
export
|
|
27
|
+
export type RouteLoaderProps = {
|
|
27
28
|
loadingComponent?: React.ComponentType;
|
|
28
29
|
notFoundComponent?: React.ComponentType;
|
|
29
30
|
trailingSlashRedirectCode?: 301 | 302;
|
|
30
31
|
};
|
|
31
|
-
export
|
|
32
|
-
export
|
|
32
|
+
export type EntryMapper = (<MappedProps>(node: RouteNode, state?: AppState) => MappedProps | unknown) | (<MappedProps>(node: RouteNode, state?: AppState) => Promise<MappedProps | unknown>);
|
|
33
|
+
export type ReduxInjector = () => Promise<{
|
|
33
34
|
key: string;
|
|
34
35
|
reducer: any;
|
|
35
36
|
saga: any;
|
|
36
37
|
}>;
|
|
37
|
-
|
|
38
|
+
type UserGroupRequisite = {
|
|
38
39
|
id?: string;
|
|
39
40
|
name?: string;
|
|
40
41
|
};
|
|
41
|
-
export
|
|
42
|
-
export
|
|
42
|
+
export type RequireLogin = boolean | UserGroupRequisite[];
|
|
43
|
+
export type ContentTypeMapping = {
|
|
43
44
|
contentTypeID: string;
|
|
44
45
|
component: RouteComponent<RouteComponentProps>;
|
|
45
46
|
entryMapper?: EntryMapper;
|
|
@@ -59,7 +60,7 @@ export declare type ContentTypeMapping = {
|
|
|
59
60
|
};
|
|
60
61
|
requireLogin?: RequireLogin;
|
|
61
62
|
};
|
|
62
|
-
export
|
|
63
|
+
export type StaticRoute = Omit<RouteConfig, 'component'> & {
|
|
63
64
|
component: RouteComponent<RouteComponentProps>;
|
|
64
65
|
fetchNode?: boolean | {
|
|
65
66
|
/**
|
|
@@ -79,7 +80,8 @@ export declare type StaticRoute = Omit<RouteConfig, 'component'> & {
|
|
|
79
80
|
ssr?: boolean;
|
|
80
81
|
ssrOnly?: boolean;
|
|
81
82
|
};
|
|
82
|
-
export
|
|
83
|
+
export type OnRouteLoadArgs = {
|
|
84
|
+
cookies: CookieHelper;
|
|
83
85
|
location: {
|
|
84
86
|
pathname: string;
|
|
85
87
|
search: string;
|
|
@@ -90,7 +92,8 @@ export declare type OnRouteLoadArgs = {
|
|
|
90
92
|
staticRoute: MatchedRoute<any, StaticRoute>;
|
|
91
93
|
statePath: string;
|
|
92
94
|
};
|
|
93
|
-
export
|
|
95
|
+
export type OnRouteLoadedArgs = {
|
|
96
|
+
cookies: CookieHelper;
|
|
94
97
|
entry: Entry | any;
|
|
95
98
|
location: {
|
|
96
99
|
pathname: string;
|
|
@@ -101,7 +104,7 @@ export declare type OnRouteLoadedArgs = {
|
|
|
101
104
|
path: string;
|
|
102
105
|
staticRoute: MatchedRoute<any, StaticRoute>;
|
|
103
106
|
};
|
|
104
|
-
export
|
|
107
|
+
export type RouteLoadOptions = {
|
|
105
108
|
customNavigation?: boolean | {
|
|
106
109
|
ancestors: boolean | number;
|
|
107
110
|
children: boolean | number;
|
|
@@ -114,10 +117,10 @@ export declare type RouteLoadOptions = {
|
|
|
114
117
|
preventScrollTop?: boolean;
|
|
115
118
|
refetchNode?: true;
|
|
116
119
|
};
|
|
117
|
-
export
|
|
120
|
+
export type RouteLoadedOptions = {
|
|
118
121
|
requireLogin?: RequireLogin;
|
|
119
122
|
};
|
|
120
|
-
export
|
|
123
|
+
export type WithEvents = {
|
|
121
124
|
onRouteLoad: (args: OnRouteLoadArgs) => Generator<void | RouteLoadOptions>;
|
|
122
125
|
onRouteLoaded: (args: OnRouteLoadedArgs) => Generator<void | RouteLoadedOptions>;
|
|
123
126
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Query } from
|
|
1
|
+
import { Query } from '~/util/ContensisDeliveryApi';
|
|
2
2
|
export declare const routeEntryByFieldsQuery: (id: string, language?: string, fields?: string[], versionStatus?: 'published' | 'latest') => Query;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { Query } from 'contensis-core-api';
|
|
2
|
-
import { VersionStatus } from 'contensis-core-api/lib/models';
|
|
3
|
-
import { Operators } from 'contensis-delivery-api/lib/entries/query';
|
|
1
|
+
import { Operators, Query, VersionStatus } from 'contensis-core-api';
|
|
4
2
|
import { CustomWhereClause, FeaturedResults, WeightedSearchField } from './Search';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
3
|
+
export type FieldOperators = Exclude<keyof Operators, 'and' | 'or' | 'not'>;
|
|
4
|
+
export type LogicOperators = 'and' | 'or' | 'not';
|
|
5
|
+
export type FilterExpression = {
|
|
8
6
|
key: string;
|
|
9
7
|
values: string[];
|
|
10
8
|
fieldOperator: FieldOperators;
|
|
11
9
|
logicOperator: LogicOperators;
|
|
12
10
|
};
|
|
13
|
-
export
|
|
11
|
+
export type SearchQueryOptions = {
|
|
14
12
|
assetTypes: string[];
|
|
15
13
|
contentTypeIds: string[];
|
|
16
14
|
customWhere: any;
|
|
@@ -31,7 +29,7 @@ export declare type SearchQueryOptions = {
|
|
|
31
29
|
webpageTemplates: string[];
|
|
32
30
|
weightedSearchFields: WeightedSearchField[];
|
|
33
31
|
};
|
|
34
|
-
export
|
|
32
|
+
export type QueryParams = SearchQueryOptions & {
|
|
35
33
|
env: string;
|
|
36
34
|
internalPageIndex: number;
|
|
37
35
|
internalPaging: boolean;
|
|
@@ -44,5 +42,5 @@ export declare type QueryParams = SearchQueryOptions & {
|
|
|
44
42
|
[key: string]: string;
|
|
45
43
|
};
|
|
46
44
|
};
|
|
47
|
-
export
|
|
48
|
-
export
|
|
45
|
+
export type SearchQuery = ({ contentTypeIds, customWhere, dynamicOrderBy, excludeIds, featuredResults, fields, filters, fuzzySearch, languages, pageSize, pageIndex, omitDefaultSearchFields, orderBy, searchTerm, versionStatus, webpageTemplates, weightedSearchFields, }: SearchQueryOptions, isFeatured?: boolean) => Query;
|
|
46
|
+
export type FilterQuery = (contentTypeIds: string[], versionStatus: VersionStatus, customWhere?: CustomWhereClause) => Query;
|
|
@@ -3,7 +3,7 @@ import MappingTemplate from 'jsonpath-mapper/dist/models/Template';
|
|
|
3
3
|
import { Context } from './Enums';
|
|
4
4
|
import { FieldOperators, LogicOperators } from './Queries';
|
|
5
5
|
import { AppState } from './SearchState';
|
|
6
|
-
export
|
|
6
|
+
export type Tab = {
|
|
7
7
|
/** The facet to render as default */
|
|
8
8
|
defaultFacet?: string;
|
|
9
9
|
/** The zero-based incrementing id assigned to the tab */
|
|
@@ -13,11 +13,11 @@ export declare type Tab = {
|
|
|
13
13
|
/** The facet to render the total results count as default */
|
|
14
14
|
totalCount?: string;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type CustomApi = {
|
|
17
17
|
/** The uri of the REST API implementing a simple GET request */
|
|
18
18
|
uri: string;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type Listing = {
|
|
21
21
|
/** Display title */
|
|
22
22
|
title?: string;
|
|
23
23
|
/** Experimental: use a custom API to retrieve search results */
|
|
@@ -34,7 +34,7 @@ export declare type Listing = {
|
|
|
34
34
|
/** Display title */
|
|
35
35
|
title?: string;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type SearchFacet = {
|
|
38
38
|
/** The first facet to be shown if no facet is supplied via a route parameter [default false] */
|
|
39
39
|
isDefault?: boolean;
|
|
40
40
|
/** Set to true to temporarily disable the facet [default false] */
|
|
@@ -42,10 +42,10 @@ export declare type SearchFacet = {
|
|
|
42
42
|
/** The id of the tab the facet applies to. Use 0 for default or the id assigned to the tab */
|
|
43
43
|
tabId?: number;
|
|
44
44
|
} & Listing;
|
|
45
|
-
export
|
|
45
|
+
export type SearchFilters = {
|
|
46
46
|
[key: string]: SearchFilter;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type SearchFilter = {
|
|
49
49
|
/** The content type id we will dynamically load entries from and load into state under the items[] */
|
|
50
50
|
contentTypeId?: string | string[];
|
|
51
51
|
/** An array of CustomWhereClause to include in the search query when dynamically loading entries via the contentTypeId key */
|
|
@@ -71,7 +71,7 @@ export declare type SearchFilter = {
|
|
|
71
71
|
/** The title to render next to the filter */
|
|
72
72
|
title: string;
|
|
73
73
|
};
|
|
74
|
-
export
|
|
74
|
+
export type FilterItem = {
|
|
75
75
|
/** Whether the filter is in a selected state */
|
|
76
76
|
isSelected?: boolean;
|
|
77
77
|
/** This will usually be the entry id or the taxonomy key */
|
|
@@ -81,7 +81,7 @@ export declare type FilterItem = {
|
|
|
81
81
|
/** The title to render next to the filter item */
|
|
82
82
|
title: string;
|
|
83
83
|
};
|
|
84
|
-
export
|
|
84
|
+
export type FeaturedResults = {
|
|
85
85
|
/** If the featured results are flagged with a certain field value, specify the fieldId containing the flagged value */
|
|
86
86
|
fieldId?: string | string[];
|
|
87
87
|
/** If the featured results are flagged with a certain field value, specify the value in the flagged fieldId */
|
|
@@ -91,7 +91,7 @@ export declare type FeaturedResults = {
|
|
|
91
91
|
/** The number of featured results to retrieve */
|
|
92
92
|
count?: number;
|
|
93
93
|
};
|
|
94
|
-
export
|
|
94
|
+
export type SearchQueryParams = {
|
|
95
95
|
/** An array of assetTypes to search over (sys.dataFormat == 'asset'); Prefix an entry with a "!" to exclude that asset type from the search */
|
|
96
96
|
assetTypes?: string[];
|
|
97
97
|
/** An array of contentTypeIds to search over (sys.dataFormat == 'entry'); Prefix an entry with a "!" to exclude that content type from the search */
|
|
@@ -125,7 +125,7 @@ export declare type SearchQueryParams = {
|
|
|
125
125
|
/** An array of WeightedSearchField to include in the search query */
|
|
126
126
|
weightedSearchFields?: WeightedSearchField[];
|
|
127
127
|
};
|
|
128
|
-
export
|
|
128
|
+
export type WhereClause = {
|
|
129
129
|
/** The field we wish to query */
|
|
130
130
|
field: string;
|
|
131
131
|
/** The value we want to evaluate with the chosen operator */
|
|
@@ -134,14 +134,14 @@ export declare type WhereClause = {
|
|
|
134
134
|
/**
|
|
135
135
|
* N.B. This shares syntax with adding where operators to a search query when using the Delivery API via HTTP, and should be used sparingly for exceptional cases where the standard query falls short
|
|
136
136
|
*/
|
|
137
|
-
export
|
|
137
|
+
export type CustomWhereClause = (WhereClause | {
|
|
138
138
|
not: WhereClause;
|
|
139
139
|
} | {
|
|
140
140
|
and: WhereClause[];
|
|
141
141
|
} | {
|
|
142
142
|
or: WhereClause[];
|
|
143
143
|
})[];
|
|
144
|
-
export
|
|
144
|
+
export type WeightedSearchField = {
|
|
145
145
|
/** The id of the field to query against */
|
|
146
146
|
fieldId: string;
|
|
147
147
|
/** The weighting applied to the field */
|
|
@@ -152,7 +152,7 @@ export declare type WeightedSearchField = {
|
|
|
152
152
|
*
|
|
153
153
|
* You need to provide a search configuration to the reducer so the initialState for your search can be set, this tells the package what you need your search to do, and where to get its data from.
|
|
154
154
|
*/
|
|
155
|
-
export
|
|
155
|
+
export type SearchConfig = {
|
|
156
156
|
/** An object with a key for each facet that is required for the search */
|
|
157
157
|
facets: {
|
|
158
158
|
[key: string]: SearchFacet;
|
|
@@ -168,7 +168,7 @@ export declare type SearchConfig = {
|
|
|
168
168
|
/** An Array of Tabs */
|
|
169
169
|
tabs: Tab[];
|
|
170
170
|
};
|
|
171
|
-
export
|
|
171
|
+
export type ConfigTypes = {
|
|
172
172
|
[key: string]: SearchFacet;
|
|
173
173
|
} | {
|
|
174
174
|
[key: string]: Listing;
|
|
@@ -176,15 +176,15 @@ export declare type ConfigTypes = {
|
|
|
176
176
|
/**
|
|
177
177
|
* Type your mapper for mapping API responses (entries) into usable props for your components to render
|
|
178
178
|
*/
|
|
179
|
-
export
|
|
179
|
+
export type SearchResultsMapper<Target = any, Source = Entry> = (entries: Source[], facet?: string, context?: Context, state?: AppState) => Target[];
|
|
180
180
|
/**
|
|
181
181
|
* Type your custom filter item mapping function with this to ensure correctly typed FilterItems are returned to work with search functions
|
|
182
182
|
*/
|
|
183
|
-
export
|
|
183
|
+
export type FilterItemsMapper<T = Entry> = (entries: T[]) => FilterItem[];
|
|
184
184
|
/**
|
|
185
185
|
* The uri object type we need to return from the Navigate mapper after any search action has been called
|
|
186
186
|
*/
|
|
187
|
-
export
|
|
187
|
+
export type NavigateUri = {
|
|
188
188
|
path: string;
|
|
189
189
|
search: string;
|
|
190
190
|
hash: string;
|
|
@@ -192,11 +192,11 @@ export declare type NavigateUri = {
|
|
|
192
192
|
/**
|
|
193
193
|
* Type your jsonpath-mapper mapping template with this to map your next search uri to your custom uri structure after calling any search action
|
|
194
194
|
*/
|
|
195
|
-
export
|
|
195
|
+
export type SearchUriMapping = MappingTemplate<SearchStateParams>;
|
|
196
196
|
/**
|
|
197
197
|
* Type the argument passed to the Navigate mapper, this provides the relevant keys and data available to manipulate and return the next uri after any search action has been called
|
|
198
198
|
*/
|
|
199
|
-
export
|
|
199
|
+
export type SearchStateParams = {
|
|
200
200
|
state: AppState;
|
|
201
201
|
facet?: string;
|
|
202
202
|
orderBy?: string;
|
|
@@ -205,15 +205,15 @@ export declare type SearchStateParams = {
|
|
|
205
205
|
term?: string;
|
|
206
206
|
};
|
|
207
207
|
/** Type your Navigate mapper with this, the Navigate mapper is called after any search action has been called and is required to return the next uri to be parsed by your project's route configuration and provide the right uri parameters to drive the next search query and resulting state */
|
|
208
|
-
export
|
|
208
|
+
export type NavigateMapper = ({ state, facet, orderBy, pageIndex, pageSize, term, }: SearchStateParams) => NavigateUri;
|
|
209
209
|
/** Type your Results Info mapper with this, remember "resultsInfo" prop is a custom object you define yourself - you can provide any keys you wish, conveying detailed messaging or UX tweaks to cover all kinds of scenarios based on data in the search state at that time */
|
|
210
|
-
export
|
|
210
|
+
export type ResultsInfoMapper<T = any> = (state: AppState) => T;
|
|
211
211
|
/** Experimental**: If you are trying to use the custom API feature you can add specific keys to the resultant querystring that for the custom API GET request */
|
|
212
|
-
export
|
|
212
|
+
export type CustomApiParamsMapper = (queryParams: SearchQueryParams) => {
|
|
213
213
|
[key: string]: string;
|
|
214
214
|
};
|
|
215
215
|
/** Type your Mappers object with this type to provide a accurate, type-safe "mapper" argument to your search implementation */
|
|
216
|
-
export
|
|
216
|
+
export type Mappers = {
|
|
217
217
|
customApi?: CustomApiParamsMapper;
|
|
218
218
|
results: SearchResultsMapper;
|
|
219
219
|
filterItems?: FilterItemsMapper;
|
|
@@ -221,4 +221,4 @@ export declare type Mappers = {
|
|
|
221
221
|
resultsInfo?: ResultsInfoMapper;
|
|
222
222
|
};
|
|
223
223
|
/** SearchTransformations is just an alias for Mappers object / argument */
|
|
224
|
-
export
|
|
224
|
+
export type SearchTransformations = Mappers;
|
|
@@ -5,17 +5,17 @@ import { SearchFacet, Listing, Mappers } from '../models/Search';
|
|
|
5
5
|
import { AppState } from './SearchState';
|
|
6
6
|
import { QueryParams } from './Queries';
|
|
7
7
|
import { TimedSearchResponse } from './SearchUtil';
|
|
8
|
-
|
|
8
|
+
type Action = {
|
|
9
9
|
type: string;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type WithMappers<T> = T & {
|
|
12
12
|
mappers: Mappers;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type DebugFlags = boolean | {
|
|
15
15
|
executeSearch?: boolean;
|
|
16
16
|
preloadOtherFacets?: boolean;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type TriggerSearchParams = {
|
|
19
19
|
config?: SearchFacet | Listing;
|
|
20
20
|
context: Context | string;
|
|
21
21
|
debug?: DebugFlags;
|
|
@@ -28,9 +28,9 @@ export declare type TriggerSearchParams = {
|
|
|
28
28
|
[key: string]: string;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
|
|
31
|
+
export type TriggerSearchAction = Action & TriggerSearchParams;
|
|
32
|
+
export type TriggerSearchActionCreator = (p: TriggerSearchParams) => TriggerSearchAction;
|
|
33
|
+
type InitListingParams = {
|
|
34
34
|
context: Context;
|
|
35
35
|
debug?: DebugFlags;
|
|
36
36
|
defaultLang?: string;
|
|
@@ -43,12 +43,12 @@ declare type InitListingParams = {
|
|
|
43
43
|
};
|
|
44
44
|
preload?: boolean;
|
|
45
45
|
};
|
|
46
|
-
export
|
|
46
|
+
export type InitListingAction = Action & InitListingParams & {
|
|
47
47
|
ssr?: boolean;
|
|
48
48
|
};
|
|
49
|
-
export
|
|
50
|
-
export
|
|
51
|
-
export
|
|
49
|
+
export type SetRouteFiltersOptions = Partial<InitListingAction>;
|
|
50
|
+
export type InitListingActionCreator = (p: InitListingParams) => InitListingAction;
|
|
51
|
+
export type LoadFiltersSearchResults = Action & {
|
|
52
52
|
error: any;
|
|
53
53
|
facetKey: string;
|
|
54
54
|
filterKey: string;
|
|
@@ -57,7 +57,7 @@ export declare type LoadFiltersSearchResults = Action & {
|
|
|
57
57
|
context: Context;
|
|
58
58
|
mapper: Mappers['filterItems'];
|
|
59
59
|
};
|
|
60
|
-
export
|
|
60
|
+
export type SearchResults = {
|
|
61
61
|
action: ExecuteSearchAction;
|
|
62
62
|
featuredResult?: TimedSearchResponse;
|
|
63
63
|
pageIndex: number;
|
|
@@ -65,7 +65,7 @@ export declare type SearchResults = {
|
|
|
65
65
|
result: TimedSearchResponse;
|
|
66
66
|
state: AppState;
|
|
67
67
|
};
|
|
68
|
-
export
|
|
68
|
+
export type LoadFiltersCompleteAction = Action & {
|
|
69
69
|
error: any;
|
|
70
70
|
facetKey: string;
|
|
71
71
|
filterKey: string;
|
|
@@ -74,14 +74,14 @@ export declare type LoadFiltersCompleteAction = Action & {
|
|
|
74
74
|
context: Context;
|
|
75
75
|
mapper: Mappers['filterItems'];
|
|
76
76
|
};
|
|
77
|
-
export
|
|
77
|
+
export type EnsureSearchAction = InitListingAction & {
|
|
78
78
|
ogState: AppState;
|
|
79
79
|
};
|
|
80
|
-
export
|
|
80
|
+
export type ExecuteSearchAction = EnsureSearchAction & {
|
|
81
81
|
preload: boolean;
|
|
82
82
|
queryParams: QueryParams;
|
|
83
83
|
};
|
|
84
|
-
export
|
|
84
|
+
export type SetSearchEntriesParams = {
|
|
85
85
|
type: string;
|
|
86
86
|
context: Context;
|
|
87
87
|
defaultLang: string;
|
|
@@ -95,41 +95,41 @@ export declare type SetSearchEntriesParams = {
|
|
|
95
95
|
[key: string]: string;
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
|
-
export
|
|
99
|
-
export
|
|
98
|
+
export type SetSearchEntriesAction = Action & SetSearchEntriesParams;
|
|
99
|
+
export type ApplySearchFilterAction = Action & {
|
|
100
100
|
filter: string;
|
|
101
101
|
key: string;
|
|
102
102
|
isUnknownItem: boolean;
|
|
103
103
|
scrollToElement?: string;
|
|
104
104
|
};
|
|
105
|
-
export
|
|
106
|
-
export
|
|
107
|
-
export
|
|
108
|
-
export
|
|
105
|
+
export type ApplySearchFilterActionCreator = (filter: string, key: string) => ApplySearchFilterAction;
|
|
106
|
+
export type ClearFiltersAction = Action;
|
|
107
|
+
export type ClearFiltersActionCreator = (filterKey?: string) => ClearFiltersAction;
|
|
108
|
+
export type UpdateCurrentFacetAction = Action & {
|
|
109
109
|
facet: string;
|
|
110
110
|
};
|
|
111
|
-
export
|
|
112
|
-
export
|
|
111
|
+
export type UpdateCurrentFacetActionCreator = (facet: string) => UpdateCurrentFacetAction;
|
|
112
|
+
export type UpdateCurrentTabAction = Action & {
|
|
113
113
|
id: number;
|
|
114
114
|
};
|
|
115
|
-
export
|
|
116
|
-
export
|
|
115
|
+
export type UpdateCurrentTabActionCreator = (id: number) => UpdateCurrentFacetAction;
|
|
116
|
+
export type UpdateSearchTermAction = Action & {
|
|
117
117
|
term: string;
|
|
118
118
|
};
|
|
119
|
-
export
|
|
120
|
-
export
|
|
119
|
+
export type UpdateSearchTermActionCreator = (term: string) => UpdateSearchTermAction;
|
|
120
|
+
export type UpdateSortOrderAction = Action & {
|
|
121
121
|
orderBy: string;
|
|
122
122
|
facet: string;
|
|
123
123
|
};
|
|
124
|
-
export
|
|
125
|
-
export
|
|
124
|
+
export type UpdateSortOrderActionCreator = (orderBy: string, facet: string) => UpdateSortOrderAction;
|
|
125
|
+
export type UpdatePageIndexAction = Action & {
|
|
126
126
|
pageIndex: number;
|
|
127
127
|
scrollToElement?: string;
|
|
128
128
|
};
|
|
129
|
-
export
|
|
130
|
-
export
|
|
129
|
+
export type UpdatePageIndexActionCreator = (pageIndex: number) => UpdatePageIndexAction;
|
|
130
|
+
export type UpdatePageSizeAction = Action & {
|
|
131
131
|
pageSize: number;
|
|
132
132
|
scrollToElement?: string;
|
|
133
133
|
};
|
|
134
|
-
export
|
|
134
|
+
export type UpdatePageSizeActionCreator = (pageSize: number) => UpdatePageSizeAction;
|
|
135
135
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context } from './Enums';
|
|
2
2
|
import { CustomWhereClause } from './Search';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type AppState = Record<'search', SearchState> & Record<string, any>;
|
|
4
|
+
export type SearchState = {
|
|
5
5
|
context: keyof typeof Context;
|
|
6
6
|
currentFacet: string;
|
|
7
7
|
currentListing: string;
|
|
@@ -12,10 +12,10 @@ export declare type SearchState = {
|
|
|
12
12
|
tabs: Tab[];
|
|
13
13
|
config: Record<string, boolean>;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type Facets = {
|
|
16
16
|
[key: string]: Facet;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type Facet = {
|
|
19
19
|
entries: {
|
|
20
20
|
isLoading: boolean;
|
|
21
21
|
isError: boolean;
|
|
@@ -53,10 +53,10 @@ export declare type Facet = {
|
|
|
53
53
|
tabId: number;
|
|
54
54
|
title: string;
|
|
55
55
|
};
|
|
56
|
-
export
|
|
56
|
+
export type Filters = {
|
|
57
57
|
[key: string]: Filter;
|
|
58
58
|
};
|
|
59
|
-
export
|
|
59
|
+
export type Filter = {
|
|
60
60
|
contentTypeId?: string;
|
|
61
61
|
customWhere?: CustomWhereClause;
|
|
62
62
|
defaultValue?: string;
|
|
@@ -70,7 +70,7 @@ export declare type Filter = {
|
|
|
70
70
|
renderable?: boolean;
|
|
71
71
|
title?: string;
|
|
72
72
|
};
|
|
73
|
-
export
|
|
73
|
+
export type FilterItem = {
|
|
74
74
|
contentTypeId?: string;
|
|
75
75
|
title?: string;
|
|
76
76
|
type?: string;
|
|
@@ -78,10 +78,10 @@ export declare type FilterItem = {
|
|
|
78
78
|
path?: string;
|
|
79
79
|
isSelected: boolean;
|
|
80
80
|
};
|
|
81
|
-
export
|
|
81
|
+
export type SelectedFilters = {
|
|
82
82
|
[k: string]: string[];
|
|
83
83
|
};
|
|
84
|
-
export
|
|
84
|
+
export type Paging = {
|
|
85
85
|
isLoading: boolean;
|
|
86
86
|
pageCount: number;
|
|
87
87
|
pageIndex: number;
|
|
@@ -90,14 +90,14 @@ export declare type Paging = {
|
|
|
90
90
|
prevPageIndex: number;
|
|
91
91
|
totalCount: number;
|
|
92
92
|
};
|
|
93
|
-
export
|
|
93
|
+
export type Tab = {
|
|
94
94
|
currentFacet: string;
|
|
95
95
|
defaultFacet: string;
|
|
96
96
|
id: number;
|
|
97
97
|
label: string;
|
|
98
98
|
totalCount: number;
|
|
99
99
|
};
|
|
100
|
-
export
|
|
100
|
+
export type TabAndFacets = Tab & {
|
|
101
101
|
facets: {
|
|
102
102
|
[key: string]: Facet;
|
|
103
103
|
};
|