@zengenti/contensis-react-base 2.5.1-beta.4 → 3.0.0-beta.3

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 (134) hide show
  1. package/README.md +8 -2
  2. package/cjs/{App-fbd91490.js → App-581b6653.js} +20 -19
  3. package/cjs/App-581b6653.js.map +1 -0
  4. package/cjs/{RouteLoader-f99cd734.js → RouteLoader-282c03ab.js} +5 -5
  5. package/cjs/RouteLoader-282c03ab.js.map +1 -0
  6. package/cjs/ToJs-87edc45d.js +230 -0
  7. package/cjs/ToJs-87edc45d.js.map +1 -0
  8. package/cjs/{actions-e9f69947.js → actions-12871aca.js} +9 -13
  9. package/cjs/actions-12871aca.js.map +1 -0
  10. package/cjs/client.js +47 -64
  11. package/cjs/client.js.map +1 -1
  12. package/cjs/contensis-react-base.js +54 -55
  13. package/cjs/contensis-react-base.js.map +1 -1
  14. package/cjs/forms.js +1 -1
  15. package/cjs/fromJSLeaveImmer-9b550c8e.js +40 -0
  16. package/cjs/fromJSLeaveImmer-9b550c8e.js.map +1 -0
  17. package/cjs/{login-4f274c6a.js → login-81d7f9ef.js} +11 -10
  18. package/cjs/login-81d7f9ef.js.map +1 -0
  19. package/cjs/{reducers-cb531715.js → reducers-fde41d6b.js} +76 -31
  20. package/cjs/reducers-fde41d6b.js.map +1 -0
  21. package/cjs/redux.js +11 -8
  22. package/cjs/redux.js.map +1 -1
  23. package/cjs/routing.js +5 -5
  24. package/cjs/search.js +409 -233
  25. package/cjs/search.js.map +1 -1
  26. package/cjs/selectors-ed26ed97.js +141 -0
  27. package/cjs/selectors-ed26ed97.js.map +1 -0
  28. package/cjs/user.js +14 -14
  29. package/cjs/user.js.map +1 -1
  30. package/cjs/util.js +24 -10
  31. package/cjs/util.js.map +1 -1
  32. package/cjs/version-0c190929.js +20 -0
  33. package/cjs/version-0c190929.js.map +1 -0
  34. package/cjs/{version-3a808c12.js → version-f061e409.js} +154 -76
  35. package/cjs/version-f061e409.js.map +1 -0
  36. package/esm/{App-fbef99b3.js → App-122f28a3.js} +20 -19
  37. package/esm/App-122f28a3.js.map +1 -0
  38. package/esm/{RouteLoader-281d47e1.js → RouteLoader-c2faac87.js} +5 -5
  39. package/esm/RouteLoader-c2faac87.js.map +1 -0
  40. package/esm/ToJs-52fee252.js +199 -0
  41. package/esm/ToJs-52fee252.js.map +1 -0
  42. package/esm/{actions-ddd9c623.js → actions-3cc39599.js} +4 -7
  43. package/esm/actions-3cc39599.js.map +1 -0
  44. package/esm/client.js +48 -65
  45. package/esm/client.js.map +1 -1
  46. package/esm/contensis-react-base.js +53 -53
  47. package/esm/contensis-react-base.js.map +1 -1
  48. package/esm/forms.js +1 -1
  49. package/esm/fromJSLeaveImmer-e44d1a91.js +38 -0
  50. package/esm/fromJSLeaveImmer-e44d1a91.js.map +1 -0
  51. package/esm/{login-1f9ad133.js → login-92db44d1.js} +11 -10
  52. package/esm/login-92db44d1.js.map +1 -0
  53. package/esm/{reducers-feab84fc.js → reducers-d6c0edb1.js} +77 -31
  54. package/esm/reducers-d6c0edb1.js.map +1 -0
  55. package/esm/redux.js +9 -8
  56. package/esm/redux.js.map +1 -1
  57. package/esm/routing.js +5 -5
  58. package/esm/search.js +409 -235
  59. package/esm/search.js.map +1 -1
  60. package/esm/selectors-82e71d8e.js +116 -0
  61. package/esm/selectors-82e71d8e.js.map +1 -0
  62. package/esm/user.js +10 -10
  63. package/esm/user.js.map +1 -1
  64. package/esm/util.js +24 -10
  65. package/esm/util.js.map +1 -1
  66. package/esm/version-59c8f9be.js +15 -0
  67. package/esm/version-59c8f9be.js.map +1 -0
  68. package/esm/{version-64906b26.js → version-cb9cd09d.js} +133 -76
  69. package/esm/version-cb9cd09d.js.map +1 -0
  70. package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +1 -1
  71. package/models/config.d.ts +2 -0
  72. package/models/redux/appstate.d.ts +85 -0
  73. package/models/redux/index.d.ts +1 -0
  74. package/models/redux/reducers/navigation.d.ts +6 -2
  75. package/models/redux/reducers/version.d.ts +5 -2
  76. package/models/redux/store/store.d.ts +4 -1
  77. package/models/redux/util.d.ts +2 -0
  78. package/models/routing/components/RouteLoader.d.ts +20 -2
  79. package/models/routing/redux/reducers.d.ts +21 -3
  80. package/models/routing/redux/selectors.d.ts +29 -25
  81. package/models/routing/routes.d.ts +10 -2
  82. package/models/search/hooks/useMinilist.hook.d.ts +7 -20
  83. package/models/search/models/Search.d.ts +8 -1
  84. package/models/search/models/SearchActions.d.ts +3 -4
  85. package/models/search/models/SearchProps.d.ts +16 -2
  86. package/models/search/models/SearchState.d.ts +25 -9
  87. package/models/search/models/WithSearch.d.ts +61 -0
  88. package/models/search/redux/getIn.d.ts +3 -0
  89. package/models/search/redux/reducers.d.ts +346 -2
  90. package/models/search/redux/sagas.d.ts +2 -2
  91. package/models/search/redux/schema.d.ts +56 -8
  92. package/models/search/redux/selectors.d.ts +75 -66
  93. package/models/search/redux/util.d.ts +1 -1
  94. package/models/search/search/util.d.ts +2 -3
  95. package/models/user/components/Login.d.ts +10 -1
  96. package/models/user/containers/ChangePassword.container.d.ts +4 -1
  97. package/models/user/containers/ForgotPassword.container.d.ts +4 -1
  98. package/models/user/containers/Login.container.d.ts +4 -1
  99. package/models/user/containers/Registration.container.d.ts +4 -1
  100. package/models/user/hocs/withLogin.d.ts +9 -1
  101. package/models/user/hocs/withRegistration.d.ts +9 -1
  102. package/models/user/hooks/useChangePassword.d.ts +5 -5
  103. package/models/user/hooks/useForgotPassword.d.ts +6 -6
  104. package/models/user/hooks/useLogin.d.ts +45 -7
  105. package/models/user/hooks/useRegistration.d.ts +4 -4
  106. package/models/user/redux/reducers.d.ts +54 -3
  107. package/models/user/redux/selectors.d.ts +72 -27
  108. package/models/util/ToJs.d.ts +4 -1
  109. package/package-lock.json +1092 -21401
  110. package/package.json +9 -8
  111. package/cjs/App-fbd91490.js.map +0 -1
  112. package/cjs/RouteLoader-f99cd734.js.map +0 -1
  113. package/cjs/ToJs-d72e5b10.js +0 -167
  114. package/cjs/ToJs-d72e5b10.js.map +0 -1
  115. package/cjs/actions-e9f69947.js.map +0 -1
  116. package/cjs/login-4f274c6a.js.map +0 -1
  117. package/cjs/reducers-cb531715.js.map +0 -1
  118. package/cjs/selectors-1295124a.js +0 -139
  119. package/cjs/selectors-1295124a.js.map +0 -1
  120. package/cjs/version-2193b4a2.js +0 -24
  121. package/cjs/version-2193b4a2.js.map +0 -1
  122. package/cjs/version-3a808c12.js.map +0 -1
  123. package/esm/App-fbef99b3.js.map +0 -1
  124. package/esm/RouteLoader-281d47e1.js.map +0 -1
  125. package/esm/ToJs-6e7b247c.js +0 -136
  126. package/esm/ToJs-6e7b247c.js.map +0 -1
  127. package/esm/actions-ddd9c623.js.map +0 -1
  128. package/esm/login-1f9ad133.js.map +0 -1
  129. package/esm/reducers-feab84fc.js.map +0 -1
  130. package/esm/selectors-68799788.js +0 -117
  131. package/esm/selectors-68799788.js.map +0 -1
  132. package/esm/version-64906b26.js.map +0 -1
  133. package/esm/version-7fdbd2d5.js +0 -19
  134. package/esm/version-7fdbd2d5.js.map +0 -1
@@ -1,25 +1,29 @@
1
- export function selectRouteEntry(state: any): any;
2
- export function selectMappedEntry(state: any): any;
3
- export function selectNodeDepends(state: any): any;
4
- export function selectCurrentHostname(state: any): any;
5
- export function selectCurrentTreeID(state: any): any;
6
- export function selectRouteEntryEntryId(state: any): any;
7
- export function selectRouteEntryContentTypeId(state: any): any;
8
- export function selectRouteEntryLanguage(state: any): any;
9
- export function selectRouteEntrySlug(state: any): any;
10
- export function selectRouteEntryID(state: any): any;
11
- export function selectCurrentPath(state: any): any;
12
- export function selectCurrentSearch(state: any): any;
13
- export function selectCurrentHash(state: any): any;
14
- export function selectQueryStringAsObject(state: any): any;
15
- export function selectCurrentProject(state: any): any;
16
- export function selectIsNotFound(state: any): any;
17
- export function selectCurrentAncestors(state: any): any;
18
- export function selectCurrentSiblings(state: any): any;
19
- export function selectCurrentNode(state: any): any;
20
- export function selectCurrentChildren(state: any): any;
21
- export function selectBreadcrumb(state: any): any;
22
- export function selectRouteErrorMessage(state: any): any;
23
- export function selectRouteIsError(state: any): any;
24
- export function selectRouteLoading(state: any): any;
25
- export function selectRouteStatusCode(state: any): any;
1
+ import { StateType } from "../../config";
2
+ import { AppState } from "../../redux/appstate";
3
+ export declare const selectRouteEntry: (state: AppState, returnType?: StateType | undefined) => any;
4
+ export declare const selectMappedEntry: (state: AppState, returnType?: StateType | undefined) => any;
5
+ export declare const selectNodeDepends: (state: AppState) => any;
6
+ export declare const selectCurrentHostname: (state: AppState) => any;
7
+ export declare const selectCurrentTreeID: (state: AppState) => any;
8
+ export declare const selectRouteEntryEntryId: (state: AppState) => any;
9
+ export declare const selectRouteEntryContentTypeId: (state: AppState) => any;
10
+ export declare const selectRouteEntryLanguage: (state: AppState) => any;
11
+ export declare const selectRouteEntrySlug: (state: AppState) => any;
12
+ export declare const selectRouteEntryID: (state: AppState) => any;
13
+ export declare const selectCurrentPath: (state: AppState) => any;
14
+ export declare const selectCurrentLocation: (state: AppState) => any;
15
+ export declare const selectCurrentSearch: (state: AppState) => any;
16
+ export declare const selectCurrentHash: (state: AppState) => any;
17
+ export declare const selectQueryStringAsObject: (state: AppState) => any;
18
+ export declare const selectCurrentProject: (state: AppState) => any;
19
+ export declare const selectIsNotFound: (state: AppState) => any;
20
+ export declare const selectCurrentAncestors: (state: AppState) => any;
21
+ export declare const selectCurrentSiblings: (state: AppState) => any;
22
+ export declare const selectCurrentNode: (state: AppState, returnType?: StateType | undefined) => any;
23
+ export declare const selectCurrentChildren: (state: any) => any;
24
+ export declare const selectBreadcrumb: (state: AppState) => any;
25
+ export declare const selectRouteErrorMessage: (state: AppState) => any;
26
+ export declare const selectRouteIsError: (state: AppState) => any;
27
+ export declare const selectRouteLoading: (state: AppState) => any;
28
+ export declare const selectRouteStatusCode: (state: AppState) => any;
29
+ export declare const selectStaticRoute: (state: AppState) => any;
@@ -14,6 +14,14 @@ export declare type AppRootProps = {
14
14
  routes: AppRoutes;
15
15
  withEvents: WithEvents;
16
16
  };
17
+ export declare type RouteComponentProps<P = any> = {
18
+ [key: string]: any;
19
+ projectId?: string;
20
+ contentTypeId?: string;
21
+ entry?: Entry | null;
22
+ mappedEntry?: P;
23
+ isLoggedIn?: boolean;
24
+ };
17
25
  export declare type RouteLoaderProps = {
18
26
  loadingComponent?: React.ComponentType;
19
27
  notFoundComponent?: React.ComponentType;
@@ -31,7 +39,7 @@ declare type UserGroupRequisite = {
31
39
  export declare type RequireLogin = boolean | UserGroupRequisite[];
32
40
  export declare type ContentTypeMapping = {
33
41
  contentTypeID: string;
34
- component: RouteComponent<any>;
42
+ component: RouteComponent<RouteComponentProps>;
35
43
  entryMapper?: EntryMapper;
36
44
  fields?: string[];
37
45
  injectRedux?: ReduxInjector;
@@ -45,7 +53,7 @@ export declare type ContentTypeMapping = {
45
53
  requireLogin?: RequireLogin;
46
54
  };
47
55
  export declare type StaticRoute = Omit<RouteConfig, 'component'> & {
48
- component: RouteComponent<any>;
56
+ component: RouteComponent<RouteComponentProps>;
49
57
  fetchNode?: boolean;
50
58
  fetchNodeLevel?: number;
51
59
  injectRedux?: ReduxInjector;
@@ -1,23 +1,10 @@
1
- import { Facet, Mappers } from '../models/Search';
2
- import { DebugFlags } from '../models/SearchActions';
3
- declare type UseMiniListProps = {
4
- id: string;
5
- config?: Facet;
6
- debug?: DebugFlags;
7
- defaultLang?: string;
8
- excludeIds?: string[];
9
- mapper?: Mappers['results'];
10
- mappers?: Mappers;
11
- params?: {
12
- [key: string]: string;
13
- };
14
- };
15
- declare const useMinilist: ({ id, config, excludeIds, mapper, mappers, params, defaultLang, debug, }?: UseMiniListProps) => {
16
- filters: Object;
17
- isLoading: any;
18
- pagingInfo: any;
1
+ import { UseMinilistProps } from '../models/SearchProps';
2
+ declare const useMinilist: ({ id, config, excludeIds, mapper, mappers, params, defaultLang, debug, }?: UseMinilistProps) => {
3
+ filters: import("../models/SearchState").Filters;
4
+ isLoading: boolean;
5
+ pagingInfo: import("../models/SearchState").Paging;
19
6
  results: any[];
20
- searchTerm: any;
21
- title: any;
7
+ searchTerm: string;
8
+ title: string;
22
9
  };
23
10
  export default useMinilist;
@@ -29,13 +29,18 @@ export declare type Listing = {
29
29
  title: string;
30
30
  };
31
31
  export declare type Facet = {
32
+ /** Display title */
33
+ title: string;
34
+ /** Experimental: use a custom API to retrieve search results */
35
+ customApi?: CustomApi;
36
+ } | ({
32
37
  /** The first facet to be shown if no facet is supplied via a route parameter [default false] */
33
38
  isDefault?: boolean;
34
39
  /** Set to true to temporarily disable the facet [default false] */
35
40
  isDisabled?: boolean;
36
41
  /** The id of the tab the facet applies to. Use 0 for default or the id assigned to the tab */
37
42
  tabId?: number;
38
- } & Listing;
43
+ } & Listing);
39
44
  export declare type SearchFilters = {
40
45
  [key: string]: SearchFilter;
41
46
  };
@@ -56,6 +61,8 @@ export declare type SearchFilter = {
56
61
  isSingleSelect?: boolean;
57
62
  /** Supply an empty array or a hardcoded list of FilterItem depending on the type of filter we require */
58
63
  items: FilterItem[];
64
+ /** Set to false to not include this filter in filters prop */
65
+ renderable?: boolean;
59
66
  /** The title to render next to the filter */
60
67
  title: string;
61
68
  };
@@ -1,4 +1,3 @@
1
- import { List } from 'immutable';
2
1
  import { PagedList } from 'contensis-core-api';
3
2
  import { Entry, TaxonomyNode } from 'contensis-delivery-api/lib/models';
4
3
  import { Context } from '../models/Enums';
@@ -53,7 +52,7 @@ export declare type LoadFiltersSearchResults = Action & {
53
52
  facetKey: string;
54
53
  filterKey: string;
55
54
  payload: TaxonomyNode | PagedList<Entry>;
56
- selectedKeys: List<string>;
55
+ selectedKeys: string[];
57
56
  context: Context;
58
57
  mapper: Mappers['filterItems'];
59
58
  };
@@ -61,7 +60,7 @@ export declare type SearchResults = {
61
60
  action: ExecuteSearchAction;
62
61
  featuredResult?: TimedSearchResponse;
63
62
  pageIndex: number;
64
- prevResults: List<any>;
63
+ prevResults: any[];
65
64
  result: TimedSearchResponse;
66
65
  state: AppState;
67
66
  };
@@ -70,7 +69,7 @@ export declare type LoadFiltersCompleteAction = Action & {
70
69
  facetKey: string;
71
70
  filterKey: string;
72
71
  payload: TaxonomyNode | PagedList<Entry>;
73
- selectedKeys: List<string>;
72
+ selectedKeys: string[];
74
73
  context: Context;
75
74
  mapper: Mappers['filterItems'];
76
75
  };
@@ -1,5 +1,7 @@
1
1
  import { clearFilters, updateCurrentFacet, updateCurrentTab, updatePageIndex, updateSearchTerm, updateSelectedFilters, updateSortOrder } from '../redux/actions';
2
- import { Facet, Facets, Filters, Paging } from '../models/SearchState';
2
+ import { Facet, Mappers } from '../models/Search';
3
+ import { DebugFlags } from '../models/SearchActions';
4
+ import { Facet as StateFacet, Facets, Filters, Paging } from '../models/SearchState';
3
5
  export interface ListingProps<SearchResults = any> {
4
6
  clearFilters: typeof clearFilters;
5
7
  currentListing: string;
@@ -24,7 +26,7 @@ export interface SearchProps<SearchResults = any> {
24
26
  currentFacet: string;
25
27
  currentPageIndex: number;
26
28
  currentTabIndex: number;
27
- facet: Facet;
29
+ facet: StateFacet;
28
30
  facets: Facets;
29
31
  featuredResults: SearchResults[];
30
32
  filters: Filters;
@@ -43,3 +45,15 @@ export interface SearchProps<SearchResults = any> {
43
45
  updateSelectedFilters: typeof updateSelectedFilters;
44
46
  updateSortOrder: typeof updateSortOrder;
45
47
  }
48
+ export interface UseMinilistProps {
49
+ id: string;
50
+ config?: Facet;
51
+ debug?: DebugFlags;
52
+ defaultLang?: string;
53
+ excludeIds?: string[];
54
+ mapper?: Mappers['results'];
55
+ mappers?: Mappers;
56
+ params?: {
57
+ [key: string]: string;
58
+ };
59
+ }
@@ -1,13 +1,16 @@
1
- import { List, Map, OrderedMap } from 'immutable';
2
- import { initialState, searchFacet } from '../redux/schema';
1
+ import { Context } from './Enums';
3
2
  import { CustomWhereClause } from './Search';
4
- export declare type AppState = Map<'search', typeof initialState>;
3
+ export declare type AppState = Record<'search', SearchState>;
5
4
  export declare type SearchState = {
5
+ context: keyof typeof Context;
6
6
  currentFacet: string;
7
+ currentListing: string;
7
8
  term: string;
8
- facets: OrderedMap<string, OrderedMap<string, typeof searchFacet>>;
9
- tabs: List<Tab>;
10
- config: Map<string, boolean>;
9
+ facets: Facets;
10
+ listings: Facets;
11
+ minilist: Facets;
12
+ tabs: Tab[];
13
+ config: Record<string, boolean>;
11
14
  };
12
15
  export declare type Facets = {
13
16
  [key: string]: Facet;
@@ -16,10 +19,12 @@ export declare type Facet = {
16
19
  entries: {
17
20
  isLoading: boolean;
18
21
  isError: boolean;
22
+ error?: any;
19
23
  };
20
24
  featuredEntries: {
21
25
  isLoading: boolean;
22
26
  isError: boolean;
27
+ error?: any;
23
28
  };
24
29
  featuredResults: any[];
25
30
  filters: Filters;
@@ -28,13 +33,20 @@ export declare type Facet = {
28
33
  pageCount: number;
29
34
  pageSize: number;
30
35
  pageIndex: number;
36
+ pagesLoaded: number[];
37
+ prevPageIndex: number;
31
38
  totalCount: number;
32
39
  };
33
40
  preloaded: boolean;
41
+ projectId: string;
34
42
  queryDuration: number;
35
43
  queryParams: {
36
44
  contentTypeIds: string[];
37
45
  dynamicOrderBy: string[];
46
+ excludeIds: string[];
47
+ internalPaging: boolean;
48
+ loadMorePaging: boolean;
49
+ useSearchTerm: boolean;
38
50
  };
39
51
  results: any[];
40
52
  tabId: number;
@@ -53,6 +65,7 @@ export declare type Filter = {
53
65
  isError: boolean;
54
66
  items?: FilterItem[];
55
67
  path?: string;
68
+ renderable?: boolean;
56
69
  title?: string;
57
70
  };
58
71
  export declare type FilterItem = {
@@ -74,10 +87,13 @@ export declare type Paging = {
74
87
  };
75
88
  export declare type Tab = {
76
89
  currentFacet: string;
77
- facets: {
78
- [key: string]: Facet;
79
- };
90
+ defaultFacet: string;
80
91
  id: number;
81
92
  label: string;
82
93
  totalCount: number;
83
94
  };
95
+ export declare type TabAndFacets = Tab & {
96
+ facets: {
97
+ [key: string]: Facet;
98
+ };
99
+ };
@@ -0,0 +1,61 @@
1
+ import { Facet, Filter, Paging, Tab } from './SearchState';
2
+ export declare type WithSearch<T> = {
3
+ className: string;
4
+ /** Dispatch action to clear all selected filters */
5
+ clearFilters: Function;
6
+ /** The key of the current facet */
7
+ currentFacet: string;
8
+ /** The index of the current page */
9
+ currentPageIndex: number;
10
+ /** The index of the current tab */
11
+ currentTabIndex: number;
12
+ /** The entire facet object from the state */
13
+ facet: Facet;
14
+ /** All facets from state */
15
+ facets: {
16
+ [key: string]: Facet;
17
+ };
18
+ /** Featured results entry array */
19
+ featuredResults: T[];
20
+ /** ? */
21
+ filters: {
22
+ [key: string]: Filter;
23
+ };
24
+ /** Search loading status */
25
+ isLoading: boolean;
26
+ /** Array of entries for current page of results */
27
+ results: T[];
28
+ /**
29
+ * Results info object
30
+ *
31
+ * This is defined in the SearchTranformation.resultsInfo that is passed to the withSearch HOC
32
+ */
33
+ resultsInfo: any;
34
+ /** The paging information of the current search */
35
+ paging: Paging;
36
+ /** Page loading status (best used with loadMorePaging) */
37
+ pageIsLoading: boolean;
38
+ /** The currently applied keyword / search term */
39
+ searchTerm: string;
40
+ /** The current sort order of the results */
41
+ sortOrder: string[];
42
+ /** An array of each tab on the state */
43
+ tabsAndFacets: Tab[];
44
+ /** param {string} facet : The key of the facet to set */
45
+ updateCurrentFacet: Function;
46
+ /** param {number} id : The tabId to set */
47
+ updateCurrentTab: Function;
48
+ /** param {number} pageIndex : The page index to set */
49
+ updatePageIndex: Function;
50
+ /** param {string} term : The keyword term to set */
51
+ updateSearchTerm: Function;
52
+ /**
53
+ * param filter
54
+ * param key
55
+ */
56
+ updateSelectedFilters: Function;
57
+ /**
58
+ * param orderBy
59
+ */
60
+ updateSortOrder: Function;
61
+ };
@@ -0,0 +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;
3
+ export default getImmutableOrJS;