@constructor-io/constructorio-ui-autocomplete 1.23.4 → 1.23.6
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/dist/constructorio-ui-autocomplete-bundled.js +11 -11
- package/lib/cjs/hooks/useCioAutocomplete.js +4 -2
- package/lib/cjs/hooks/useSections.js +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/mjs/hooks/useCioAutocomplete.js +4 -2
- package/lib/mjs/hooks/useSections.js +1 -1
- package/lib/mjs/version.js +1 -1
- package/lib/types/types.d.ts +3 -5
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -39,8 +39,10 @@ const convertLegacyParametersAndAddDefaults = (sections) => sections.map((config
|
|
|
39
39
|
return config;
|
|
40
40
|
});
|
|
41
41
|
const useCioAutocomplete = (options) => {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
const memoizedOptions = (0, react_1.useMemo)(() => options, [JSON.stringify(options)]);
|
|
44
|
+
const { onSubmit, onChange, openOnFocus, apiKey, cioJsClient, cioJsClientOptions, placeholder = 'What can we help you find today?', autocompleteClassName = 'cio-autocomplete', advancedParameters, defaultInput, } = memoizedOptions;
|
|
45
|
+
let { sections = exports.defaultSections, zeroStateSections } = memoizedOptions;
|
|
44
46
|
sections = (0, react_1.useMemo)(() => {
|
|
45
47
|
if (sections) {
|
|
46
48
|
return convertLegacyParametersAndAddDefaults(sections);
|
|
@@ -50,7 +50,7 @@ function useSections(query, cioClient, sections, zeroStateSections, advancedPara
|
|
|
50
50
|
(0, react_1.useEffect)(() => {
|
|
51
51
|
const sectionsResults = Object.assign(Object.assign({}, autocompleteResults), recommendationsResults);
|
|
52
52
|
setActiveSectionsWithData((0, utils_1.getActiveSectionsWithData)(activeSectionConfigs, sectionsResults, sectionsRefs));
|
|
53
|
-
}, [autocompleteResults, recommendationsResults, activeSectionConfigs
|
|
53
|
+
}, [autocompleteResults, recommendationsResults, activeSectionConfigs]);
|
|
54
54
|
return {
|
|
55
55
|
fetchRecommendationResults,
|
|
56
56
|
activeSections,
|
package/lib/cjs/version.js
CHANGED
|
@@ -35,8 +35,10 @@ const convertLegacyParametersAndAddDefaults = (sections) => sections.map((config
|
|
|
35
35
|
return config;
|
|
36
36
|
});
|
|
37
37
|
const useCioAutocomplete = (options) => {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
|
+
const memoizedOptions = useMemo(() => options, [JSON.stringify(options)]);
|
|
40
|
+
const { onSubmit, onChange, openOnFocus, apiKey, cioJsClient, cioJsClientOptions, placeholder = 'What can we help you find today?', autocompleteClassName = 'cio-autocomplete', advancedParameters, defaultInput, } = memoizedOptions;
|
|
41
|
+
let { sections = defaultSections, zeroStateSections } = memoizedOptions;
|
|
40
42
|
sections = useMemo(() => {
|
|
41
43
|
if (sections) {
|
|
42
44
|
return convertLegacyParametersAndAddDefaults(sections);
|
|
@@ -46,7 +46,7 @@ export default function useSections(query, cioClient, sections, zeroStateSection
|
|
|
46
46
|
useEffect(() => {
|
|
47
47
|
const sectionsResults = { ...autocompleteResults, ...recommendationsResults };
|
|
48
48
|
setActiveSectionsWithData(getActiveSectionsWithData(activeSectionConfigs, sectionsResults, sectionsRefs));
|
|
49
|
-
}, [autocompleteResults, recommendationsResults, activeSectionConfigs
|
|
49
|
+
}, [autocompleteResults, recommendationsResults, activeSectionConfigs]);
|
|
50
50
|
return {
|
|
51
51
|
fetchRecommendationResults,
|
|
52
52
|
activeSections,
|
package/lib/mjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.23.
|
|
1
|
+
export default '1.23.6';
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GetItemPropsOptions } from 'downshift';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import ConstructorIOClient from '@constructor-io/constructorio-client-javascript';
|
|
4
|
-
import { IAutocompleteParameters, SearchSuggestion as SearchSuggestionFromClient, Product as ProductFromClient, Item as ItemBase, AutocompleteRequestType, ConstructorClientOptions } from '@constructor-io/constructorio-client-javascript/lib/types';
|
|
4
|
+
import { IAutocompleteParameters, SearchSuggestion as SearchSuggestionFromClient, Product as ProductFromClient, Item as ItemBase, AutocompleteRequestType, ConstructorClientOptions, RecommendationsParameters } from '@constructor-io/constructorio-client-javascript/lib/types';
|
|
5
5
|
export type { IAutocompleteParameters } from '@constructor-io/constructorio-client-javascript/lib/types';
|
|
6
6
|
export type CioClientConfig = {
|
|
7
7
|
apiKey?: string;
|
|
@@ -96,15 +96,13 @@ export interface AutocompleteSectionConfiguration extends SectionConfiguration {
|
|
|
96
96
|
/** @deprecated use indexSectionName field instead */
|
|
97
97
|
identifier?: string;
|
|
98
98
|
}
|
|
99
|
-
export
|
|
99
|
+
export type RecommendationsSectionConfiguration = SectionConfiguration & {
|
|
100
100
|
type: 'recommendations';
|
|
101
101
|
indexSectionName?: string;
|
|
102
102
|
podId: string;
|
|
103
|
-
itemIds?: string[];
|
|
104
|
-
term?: string;
|
|
105
103
|
/** @deprecated use podId field instead */
|
|
106
104
|
identifier?: string;
|
|
107
|
-
}
|
|
105
|
+
} & Omit<RecommendationsParameters, 'section' | 'numResults'>;
|
|
108
106
|
export interface CustomSectionConfiguration extends SectionConfiguration {
|
|
109
107
|
type: 'custom';
|
|
110
108
|
displayName: string;
|
package/lib/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.23.
|
|
1
|
+
declare const _default: "1.23.6";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED