@zengenti/contensis-react-base 3.0.2-beta.4 → 3.0.2-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/cjs/{App-a2783f8b.js → App-7ff737fa.js} +161 -444
- package/cjs/App-7ff737fa.js.map +1 -0
- package/cjs/{login-e711a19e.js → ChangePassword.container-a617190b.js} +304 -191
- package/cjs/ChangePassword.container-a617190b.js.map +1 -0
- package/cjs/ContensisDeliveryApi-9e32960d.js +265 -0
- package/cjs/ContensisDeliveryApi-9e32960d.js.map +1 -0
- package/cjs/CookieConstants-000427db.js +10 -0
- package/cjs/CookieConstants-000427db.js.map +1 -0
- package/cjs/{RouteLoader-3aa6456e.js → RouteLoader-049e81e5.js} +27 -38
- package/cjs/RouteLoader-049e81e5.js.map +1 -0
- package/cjs/{ToJs-a9a8522b.js → ToJs-149fc5e1.js} +50 -4
- package/cjs/ToJs-149fc5e1.js.map +1 -0
- package/cjs/_commonjsHelpers-b3309d7b.js +11 -0
- package/cjs/_commonjsHelpers-b3309d7b.js.map +1 -0
- package/cjs/client.js +25 -30
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +158 -536
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +3555 -326
- package/cjs/forms.js.map +1 -1
- package/cjs/{fromJSLeaveImmer-e74c673c.js → fromJSLeaveImmer-7c363211.js} +1 -4
- package/cjs/{fromJSLeaveImmer-e74c673c.js.map → fromJSLeaveImmer-7c363211.js.map} +1 -1
- package/cjs/{reducers-73a03ef4.js → reducers-9afb5f89.js} +10 -31
- package/{esm/reducers-aa8cef1e.js.map → cjs/reducers-9afb5f89.js.map} +1 -1
- package/cjs/redux.js +17 -18
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +7 -7
- package/cjs/{sagas-8a20e424.js → sagas-e04b94c1.js} +225 -301
- package/cjs/sagas-e04b94c1.js.map +1 -0
- package/cjs/search.js +68 -94
- package/cjs/search.js.map +1 -1
- package/cjs/{selectors-656da4b7.js → selectors-46b689d0.js} +86 -9
- package/cjs/selectors-46b689d0.js.map +1 -0
- package/cjs/urls-6fcaf4c6.js.map +1 -1
- package/cjs/user.js +34 -169
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +47 -53
- package/cjs/util.js.map +1 -1
- package/cjs/{version-bf9ef45e.js → version-79a027cb.js} +55 -179
- package/cjs/version-79a027cb.js.map +1 -0
- package/cjs/version-afd4f77e.js +98 -0
- package/cjs/version-afd4f77e.js.map +1 -0
- package/esm/{App-17d1ac3c.js → App-ff944c78.js} +145 -427
- package/esm/App-ff944c78.js.map +1 -0
- package/esm/{login-551d243a.js → ChangePassword.container-ae0f9ce4.js} +286 -184
- package/esm/ChangePassword.container-ae0f9ce4.js.map +1 -0
- package/esm/ContensisDeliveryApi-c66b0cc3.js +259 -0
- package/esm/ContensisDeliveryApi-c66b0cc3.js.map +1 -0
- package/esm/CookieConstants-3d3b6531.js +6 -0
- package/esm/CookieConstants-3d3b6531.js.map +1 -0
- package/esm/{RouteLoader-5171c63f.js → RouteLoader-02eef6d9.js} +26 -37
- package/esm/RouteLoader-02eef6d9.js.map +1 -0
- package/esm/{ToJs-4e02a04d.js → ToJs-ae860aad.js} +50 -5
- package/esm/ToJs-ae860aad.js.map +1 -0
- package/esm/_commonjsHelpers-1789f0cf.js +8 -0
- package/esm/_commonjsHelpers-1789f0cf.js.map +1 -0
- package/esm/client.js +20 -25
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +151 -530
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +3557 -328
- package/esm/forms.js.map +1 -1
- package/esm/{fromJSLeaveImmer-0114ffcf.js → fromJSLeaveImmer-e2dacd63.js} +1 -4
- package/esm/{fromJSLeaveImmer-0114ffcf.js.map → fromJSLeaveImmer-e2dacd63.js.map} +1 -1
- package/esm/{reducers-aa8cef1e.js → reducers-3d5c37d1.js} +10 -31
- package/{cjs/reducers-73a03ef4.js.map → esm/reducers-3d5c37d1.js.map} +1 -1
- package/esm/redux.js +9 -9
- package/esm/redux.js.map +1 -1
- package/esm/routing.js +4 -4
- package/esm/{sagas-e576b6f6.js → sagas-933a8fc8.js} +177 -254
- package/esm/sagas-933a8fc8.js.map +1 -0
- package/esm/search.js +69 -95
- package/esm/search.js.map +1 -1
- package/esm/{selectors-a5e5835b.js → selectors-01074974.js} +71 -9
- package/esm/selectors-01074974.js.map +1 -0
- package/esm/urls-eac9a747.js.map +1 -1
- package/esm/user.js +22 -161
- package/esm/user.js.map +1 -1
- package/esm/util.js +42 -53
- package/esm/util.js.map +1 -1
- package/esm/version-0fbd1b82.js +87 -0
- package/esm/version-0fbd1b82.js.map +1 -0
- package/esm/{version-72ca17f3.js → version-346a9787.js} +43 -162
- package/esm/version-346a9787.js.map +1 -0
- package/models/client/client.d.ts +1 -1
- package/models/config.d.ts +4 -4
- package/models/redux/appstate.d.ts +2 -1
- package/models/routing/redux/actions.d.ts +10 -6
- package/models/routing/redux/selectors.d.ts +5 -4
- package/models/routing/redux/types.d.ts +0 -1
- package/models/routing/routes.d.ts +20 -17
- package/models/routing/util/queries.d.ts +3 -2
- package/models/search/models/Queries.d.ts +9 -10
- package/models/search/models/Search.d.ts +26 -24
- package/models/search/models/SearchActions.d.ts +36 -36
- 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 +7 -7
- package/models/search/redux/selectors.d.ts +27 -27
- package/models/search/redux/types.d.ts +21 -21
- package/models/search/redux/util.d.ts +2 -2
- package/models/search/search/ContensisDeliveryApi.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 +7 -5
- package/models/server/util/bundles.d.ts +2 -2
- package/models/server/util/handleExceptions.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 +4 -4
- package/models/user/util/CookieConstants.d.ts +8 -0
- package/models/user/util/CookieHelper.class.d.ts +15 -3
- package/models/user/util/LoginHelper.class.d.ts +27 -23
- package/models/util/CachedDeliveryApi.d.ts +25 -0
- package/models/util/ContensisDeliveryApi.d.ts +20 -38
- package/models/util/LruCache.d.ts +12 -0
- package/models/util/ToJs.d.ts +1 -1
- package/models/util/index.d.ts +1 -0
- package/models/util/json-mapper.d.ts +1 -1
- package/package.json +9 -10
- package/cjs/App-a2783f8b.js.map +0 -1
- package/cjs/RouteLoader-3aa6456e.js.map +0 -1
- package/cjs/ToJs-a9a8522b.js.map +0 -1
- package/cjs/actions-8dc9e8de.js +0 -87
- package/cjs/actions-8dc9e8de.js.map +0 -1
- package/cjs/login-e711a19e.js.map +0 -1
- package/cjs/sagas-8a20e424.js.map +0 -1
- package/cjs/selectors-656da4b7.js.map +0 -1
- package/cjs/version-bf9ef45e.js.map +0 -1
- package/cjs/version-eba6d09b.js +0 -20
- package/cjs/version-eba6d09b.js.map +0 -1
- package/esm/App-17d1ac3c.js.map +0 -1
- package/esm/RouteLoader-5171c63f.js.map +0 -1
- package/esm/ToJs-4e02a04d.js.map +0 -1
- package/esm/actions-180948dd.js +0 -72
- package/esm/actions-180948dd.js.map +0 -1
- package/esm/login-551d243a.js.map +0 -1
- package/esm/sagas-e576b6f6.js.map +0 -1
- package/esm/selectors-a5e5835b.js.map +0 -1
- package/esm/version-2485e2fb.js +0 -15
- package/esm/version-2485e2fb.js.map +0 -1
- package/esm/version-72ca17f3.js.map +0 -1
|
@@ -2,20 +2,21 @@ 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
4
|
import { AppState } from "../redux/appstate";
|
|
5
|
-
|
|
6
|
-
|
|
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,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { VersionStatus } from 'contensis-core-api';
|
|
2
|
+
import { Query } from 'contensis-delivery-api';
|
|
3
|
+
export declare const routeEntryByFieldsQuery: (id: string, language?: string, fields?: string[], versionStatus?: VersionStatus) => 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;
|
|
@@ -24,13 +22,14 @@ export declare type SearchQueryOptions = {
|
|
|
24
22
|
languages: string[];
|
|
25
23
|
pageSize: number;
|
|
26
24
|
pageIndex: number;
|
|
25
|
+
omitDefaultSearchFields: string[];
|
|
27
26
|
orderBy: string[];
|
|
28
27
|
searchTerm: string;
|
|
29
28
|
versionStatus: VersionStatus;
|
|
30
29
|
webpageTemplates: string[];
|
|
31
30
|
weightedSearchFields: WeightedSearchField[];
|
|
32
31
|
};
|
|
33
|
-
export
|
|
32
|
+
export type QueryParams = SearchQueryOptions & {
|
|
34
33
|
env: string;
|
|
35
34
|
internalPageIndex: number;
|
|
36
35
|
internalPaging: boolean;
|
|
@@ -43,5 +42,5 @@ export declare type QueryParams = SearchQueryOptions & {
|
|
|
43
42
|
[key: string]: string;
|
|
44
43
|
};
|
|
45
44
|
};
|
|
46
|
-
export
|
|
47
|
-
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 */
|
|
@@ -112,6 +112,8 @@ export declare type SearchQueryParams = {
|
|
|
112
112
|
linkDepth?: number;
|
|
113
113
|
/** Alters the pagination style to retain previously loaded pages of results after loading next pages */
|
|
114
114
|
loadMorePaging?: boolean;
|
|
115
|
+
/** A list of fields to omit from the default search fields that are added to weightedSearchFields */
|
|
116
|
+
omitDefaultSearchFields?: string[];
|
|
115
117
|
/** An array of orderBy expressions to add to the search query */
|
|
116
118
|
orderBy?: string[];
|
|
117
119
|
/** The number of items returned per page in the search */
|
|
@@ -123,7 +125,7 @@ export declare type SearchQueryParams = {
|
|
|
123
125
|
/** An array of WeightedSearchField to include in the search query */
|
|
124
126
|
weightedSearchFields?: WeightedSearchField[];
|
|
125
127
|
};
|
|
126
|
-
export
|
|
128
|
+
export type WhereClause = {
|
|
127
129
|
/** The field we wish to query */
|
|
128
130
|
field: string;
|
|
129
131
|
/** The value we want to evaluate with the chosen operator */
|
|
@@ -132,14 +134,14 @@ export declare type WhereClause = {
|
|
|
132
134
|
/**
|
|
133
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
|
|
134
136
|
*/
|
|
135
|
-
export
|
|
137
|
+
export type CustomWhereClause = (WhereClause | {
|
|
136
138
|
not: WhereClause;
|
|
137
139
|
} | {
|
|
138
140
|
and: WhereClause[];
|
|
139
141
|
} | {
|
|
140
142
|
or: WhereClause[];
|
|
141
143
|
})[];
|
|
142
|
-
export
|
|
144
|
+
export type WeightedSearchField = {
|
|
143
145
|
/** The id of the field to query against */
|
|
144
146
|
fieldId: string;
|
|
145
147
|
/** The weighting applied to the field */
|
|
@@ -150,7 +152,7 @@ export declare type WeightedSearchField = {
|
|
|
150
152
|
*
|
|
151
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.
|
|
152
154
|
*/
|
|
153
|
-
export
|
|
155
|
+
export type SearchConfig = {
|
|
154
156
|
/** An object with a key for each facet that is required for the search */
|
|
155
157
|
facets: {
|
|
156
158
|
[key: string]: SearchFacet;
|
|
@@ -166,7 +168,7 @@ export declare type SearchConfig = {
|
|
|
166
168
|
/** An Array of Tabs */
|
|
167
169
|
tabs: Tab[];
|
|
168
170
|
};
|
|
169
|
-
export
|
|
171
|
+
export type ConfigTypes = {
|
|
170
172
|
[key: string]: SearchFacet;
|
|
171
173
|
} | {
|
|
172
174
|
[key: string]: Listing;
|
|
@@ -174,15 +176,15 @@ export declare type ConfigTypes = {
|
|
|
174
176
|
/**
|
|
175
177
|
* Type your mapper for mapping API responses (entries) into usable props for your components to render
|
|
176
178
|
*/
|
|
177
|
-
export
|
|
179
|
+
export type SearchResultsMapper<Target = any, Source = Entry> = (entries: Source[], facet?: string, context?: Context, state?: AppState) => Target[];
|
|
178
180
|
/**
|
|
179
181
|
* Type your custom filter item mapping function with this to ensure correctly typed FilterItems are returned to work with search functions
|
|
180
182
|
*/
|
|
181
|
-
export
|
|
183
|
+
export type FilterItemsMapper<T = Entry> = (entries: T[]) => FilterItem[];
|
|
182
184
|
/**
|
|
183
185
|
* The uri object type we need to return from the Navigate mapper after any search action has been called
|
|
184
186
|
*/
|
|
185
|
-
export
|
|
187
|
+
export type NavigateUri = {
|
|
186
188
|
path: string;
|
|
187
189
|
search: string;
|
|
188
190
|
hash: string;
|
|
@@ -190,11 +192,11 @@ export declare type NavigateUri = {
|
|
|
190
192
|
/**
|
|
191
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
|
|
192
194
|
*/
|
|
193
|
-
export
|
|
195
|
+
export type SearchUriMapping = MappingTemplate<SearchStateParams>;
|
|
194
196
|
/**
|
|
195
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
|
|
196
198
|
*/
|
|
197
|
-
export
|
|
199
|
+
export type SearchStateParams = {
|
|
198
200
|
state: AppState;
|
|
199
201
|
facet?: string;
|
|
200
202
|
orderBy?: string;
|
|
@@ -203,15 +205,15 @@ export declare type SearchStateParams = {
|
|
|
203
205
|
term?: string;
|
|
204
206
|
};
|
|
205
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 */
|
|
206
|
-
export
|
|
208
|
+
export type NavigateMapper = ({ state, facet, orderBy, pageIndex, pageSize, term, }: SearchStateParams) => NavigateUri;
|
|
207
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 */
|
|
208
|
-
export
|
|
210
|
+
export type ResultsInfoMapper<T = any> = (state: AppState) => T;
|
|
209
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 */
|
|
210
|
-
export
|
|
212
|
+
export type CustomApiParamsMapper = (queryParams: SearchQueryParams) => {
|
|
211
213
|
[key: string]: string;
|
|
212
214
|
};
|
|
213
215
|
/** Type your Mappers object with this type to provide a accurate, type-safe "mapper" argument to your search implementation */
|
|
214
|
-
export
|
|
216
|
+
export type Mappers = {
|
|
215
217
|
customApi?: CustomApiParamsMapper;
|
|
216
218
|
results: SearchResultsMapper;
|
|
217
219
|
filterItems?: FilterItemsMapper;
|
|
@@ -219,4 +221,4 @@ export declare type Mappers = {
|
|
|
219
221
|
resultsInfo?: ResultsInfoMapper;
|
|
220
222
|
};
|
|
221
223
|
/** SearchTransformations is just an alias for Mappers object / argument */
|
|
222
|
-
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
|
};
|
|
@@ -11,15 +11,15 @@ export declare const navigate: (path: string, state?: any) => {
|
|
|
11
11
|
state: any;
|
|
12
12
|
};
|
|
13
13
|
export declare const clearFilters: ClearFiltersActionCreator;
|
|
14
|
-
export declare const updatePageIndex: (pageIndex: number,
|
|
14
|
+
export declare const updatePageIndex: (pageIndex: number, scrollToElement?: string) => {
|
|
15
15
|
type: string;
|
|
16
16
|
pageIndex: number;
|
|
17
|
-
|
|
17
|
+
scrollToElement: string | undefined;
|
|
18
18
|
};
|
|
19
|
-
export declare const updatePageSize: (pageSize: number,
|
|
19
|
+
export declare const updatePageSize: (pageSize: number, scrollToElement?: string) => {
|
|
20
20
|
type: string;
|
|
21
21
|
pageSize: number;
|
|
22
|
-
|
|
22
|
+
scrollToElement: string | undefined;
|
|
23
23
|
};
|
|
24
24
|
export declare const updateCurrentFacet: (facet: string) => {
|
|
25
25
|
type: string;
|
|
@@ -33,14 +33,14 @@ export declare const updateSearchTerm: (term: string) => {
|
|
|
33
33
|
type: string;
|
|
34
34
|
term: string;
|
|
35
35
|
};
|
|
36
|
-
export declare const updateSelectedFilters: (filter: string, key: string, isUnknownItem?: boolean,
|
|
36
|
+
export declare const updateSelectedFilters: (filter: string, key: string, isUnknownItem?: boolean, scrollToElement?: string) => {
|
|
37
37
|
type: string;
|
|
38
38
|
filter: string;
|
|
39
39
|
key: string;
|
|
40
40
|
isUnknownItem: boolean;
|
|
41
|
-
|
|
41
|
+
scrollToElement: string | undefined;
|
|
42
42
|
};
|
|
43
|
-
export declare const updateSortOrder: (orderBy: string, facet?: string
|
|
43
|
+
export declare const updateSortOrder: (orderBy: string, facet?: string) => {
|
|
44
44
|
type: string;
|
|
45
45
|
orderBy: string;
|
|
46
46
|
facet: string | undefined;
|