@constructor-io/constructorio-ui-autocomplete 1.7.0 → 1.7.1
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 +10 -10
- package/lib/cjs/hooks/useCioAutocomplete.js +20 -45
- package/lib/cjs/hooks/useConsoleErrors.js +16 -0
- package/lib/cjs/hooks/useDebouncedFetchSections.js +18 -12
- package/lib/cjs/hooks/useDownShift.js +1 -8
- package/lib/cjs/hooks/useFetchRecommendationPod.js +6 -1
- package/lib/cjs/hooks/useItems.js +12 -0
- package/lib/cjs/hooks/useSections.js +36 -0
- package/lib/cjs/utils.js +36 -17
- package/lib/mjs/hooks/useCioAutocomplete.js +20 -45
- package/lib/mjs/hooks/useConsoleErrors.js +14 -0
- package/lib/mjs/hooks/useDebouncedFetchSections.js +18 -14
- package/lib/mjs/hooks/useDownShift.js +1 -7
- package/lib/mjs/hooks/useFetchRecommendationPod.js +6 -1
- package/lib/mjs/hooks/useItems.js +10 -0
- package/lib/mjs/hooks/useSections.js +32 -0
- package/lib/mjs/utils.js +34 -15
- package/lib/types/hooks/useCioAutocomplete.d.ts +3 -3
- package/lib/types/hooks/useConsoleErrors.d.ts +2 -0
- package/lib/types/hooks/useDownShift.d.ts +0 -1
- package/lib/types/hooks/useItems.d.ts +3 -0
- package/lib/types/hooks/useSections.d.ts +8 -0
- package/lib/types/types.d.ts +1 -1
- package/lib/types/utils.d.ts +6 -4
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import ConstructorIO from '@constructor-io/constructorio-client-javascript';
|
|
2
|
+
import { Nullable } from '@constructor-io/constructorio-client-javascript/lib/types/types';
|
|
3
|
+
import { AdvancedParameters, UserDefinedSection } from '../types';
|
|
4
|
+
export default function useSections(query: string, cioClient: Nullable<ConstructorIO>, sections: UserDefinedSection[], zeroStateSections: UserDefinedSection[] | undefined, advancedParameters: AdvancedParameters): {
|
|
5
|
+
activeSections: UserDefinedSection[];
|
|
6
|
+
activeSectionsWithData: import("../types").Section[];
|
|
7
|
+
zeroStateActiveSections: false | UserDefinedSection[] | undefined;
|
|
8
|
+
};
|
package/lib/types/types.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type CioAutocompleteProps = CioClientConfig & {
|
|
|
13
13
|
openOnFocus?: boolean;
|
|
14
14
|
onSubmit: OnSubmit;
|
|
15
15
|
onFocus?: () => void;
|
|
16
|
-
onChange?: () => void;
|
|
16
|
+
onChange?: (string: any) => void;
|
|
17
17
|
placeholder?: string;
|
|
18
18
|
children?: ReactNode;
|
|
19
19
|
sections?: UserDefinedSection[];
|
package/lib/types/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ConstructorIOClient from '@constructor-io/constructorio-client-javascript';
|
|
2
|
-
import { OnSubmit, Item } from './types';
|
|
2
|
+
import { OnSubmit, Item, Section, UserDefinedSection, AutocompleteResultSections } from './types';
|
|
3
3
|
export type GetItemPosition = (args: {
|
|
4
4
|
item: Item;
|
|
5
5
|
items: Item[];
|
|
@@ -23,12 +23,14 @@ export declare const getStoryParams: (storyCode: any, templateCode: any, importC
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
export declare const
|
|
27
|
-
|
|
26
|
+
export declare const functionStrings: {
|
|
27
|
+
onSubmit: string;
|
|
28
|
+
};
|
|
28
29
|
export declare const stringifyWithDefaults: (obj: {
|
|
29
30
|
apiKey: string;
|
|
30
31
|
onSubmit: OnSubmit;
|
|
31
|
-
}) =>
|
|
32
|
+
}) => string;
|
|
32
33
|
export declare const disableStoryActions: (story: any) => void;
|
|
33
34
|
export declare const getCioClient: (apiKey?: string) => ConstructorIOClient | null;
|
|
35
|
+
export declare const getActiveSectionsWithData: (activeSections: UserDefinedSection[], sectionResults: AutocompleteResultSections) => Section[];
|
|
34
36
|
export {};
|
package/package.json
CHANGED