@constructor-io/constructorio-ui-autocomplete 1.25.4 → 1.26.0
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 +9 -9
- package/lib/cjs/constants.js +4 -2
- package/lib/cjs/hooks/useCioAutocomplete.js +24 -5
- package/lib/cjs/hooks/useCioClient.js +3 -2
- package/lib/cjs/hooks/useNormalizedProps.js +3 -3
- package/lib/cjs/utils/helpers.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/mjs/constants.js +3 -1
- package/lib/mjs/hooks/useCioAutocomplete.js +22 -2
- package/lib/mjs/hooks/useCioClient.js +3 -2
- package/lib/mjs/hooks/useNormalizedProps.js +3 -3
- package/lib/mjs/utils/helpers.js +2 -2
- package/lib/mjs/version.js +1 -1
- package/lib/types/constants.d.ts +1 -1
- package/lib/types/hooks/useNormalizedProps.d.ts +1 -1
- package/lib/types/types.d.ts +5 -1
- package/lib/types/utils/helpers.d.ts +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.displayShowAllResultsButtonDescription = exports.customRenderItemDescription = exports.translationsDescription = exports.fetchZeroStateOnFocusDescription = exports.debounceDescription = exports.termsWithImagesAndCountsDescription = exports.filteredSuggestionsDescription = exports.termsWithGroupSuggestionsDescription = exports.advancedParametersDefaultDescription = exports.advancedParametersDescription = exports.customStylesDescription = exports.multipleSectionsDescription = exports.openOnFocusDescription = exports.zeroStateSectionsDescription = exports.onSubmitDefault = exports.onSubmitDescription = exports.onIsOpenChangeDescription = exports.onChangeDescription = exports.onFocusDescription = exports.customSectionDescription = exports.displayNoResultsMessageDescription = exports.displaySearchTermHighlightsDescription = exports.recommendationsDescription = exports.sectionOrderDescription = exports.numResultsDescription = exports.contentDescription = exports.productsDescription = exports.searchSuggestionsDescription = exports.placeholderDescription = exports.
|
|
3
|
+
exports.displayShowAllResultsButtonDescription = exports.customRenderItemDescription = exports.translationsDescription = exports.fetchZeroStateOnFocusDescription = exports.debounceDescription = exports.termsWithImagesAndCountsDescription = exports.filteredSuggestionsDescription = exports.termsWithGroupSuggestionsDescription = exports.advancedParametersDefaultDescription = exports.advancedParametersDescription = exports.customStylesDescription = exports.multipleSectionsDescription = exports.openOnFocusDescription = exports.zeroStateSectionsDescription = exports.onSubmitDefault = exports.onSubmitDescription = exports.onIsOpenChangeDescription = exports.onChangeDescription = exports.onFocusDescription = exports.customSectionDescription = exports.displayNoResultsMessageDescription = exports.displaySearchTermHighlightsDescription = exports.recommendationsDescription = exports.sectionOrderDescription = exports.numResultsDescription = exports.contentDescription = exports.productsDescription = exports.searchSuggestionsDescription = exports.placeholderDescription = exports.cioClientOptionsDescription = exports.cioJsClientDescription = exports.apiKeyDescription = exports.fullFeaturedAndStyledExampleDescription = exports.zeroStateDescription = exports.userEventsDescription = exports.sectionsDescription = exports.hookDescription = exports.componentDescription = exports.apiKey = void 0;
|
|
4
4
|
// Autocomplete key index
|
|
5
5
|
exports.apiKey = 'key_M57QS8SMPdLdLx4x';
|
|
6
6
|
/// //////////////////////////////
|
|
@@ -119,7 +119,9 @@ exports.apiKeyDescription = `Pass an \`apiKey\` to request results from construc
|
|
|
119
119
|
exports.cioJsClientDescription = `If you are already using an instance of the \`ConstructorIOClient\`, you can pass a \`cioJsClient\` instead of an \`apiKey\` to request results from constructor's servers
|
|
120
120
|
|
|
121
121
|
> Note: when we say \`cioJsClient\`, we are referring to an instance of the [constructorio-client-javascript](https://www.npmjs.com/package/@constructor-io/constructorio-client-javascript)`;
|
|
122
|
-
exports.
|
|
122
|
+
exports.cioClientOptionsDescription = `If you don't want to create an instance of the \`ConstructorIOClient\` but still want to customize some of the options, you can pass a \`cioClientOptions\` object. You can learn more about the possible values [here under the parameters section](https://constructor-io.github.io/constructorio-client-javascript/ConstructorIO.html).
|
|
123
|
+
|
|
124
|
+
> Note: The legacy \`cioJsClientOptions\` prop is still supported for backwards compatibility, but \`cioClientOptions\` is now the preferred name.`;
|
|
123
125
|
exports.placeholderDescription = `Pass a \`placeholder\` to override the default input field placeholder text shown to users before they start typing their query`;
|
|
124
126
|
exports.searchSuggestionsDescription = `Override default \`sections\` to only suggest search terms`;
|
|
125
127
|
exports.productsDescription = `Override default \`sections\` to only suggested products`;
|
|
@@ -28,11 +28,16 @@ exports.defaultSections = [
|
|
|
28
28
|
},
|
|
29
29
|
];
|
|
30
30
|
const useCioAutocomplete = (options) => {
|
|
31
|
-
const { sections, zeroStateSections,
|
|
31
|
+
const { sections, zeroStateSections, cioClientOptions, advancedParameters } = (0, useNormalizedProps_1.default)(options);
|
|
32
32
|
const { onSubmit, onChange, openOnFocus, apiKey, cioJsClient, placeholder = 'What can we help you find today?', autocompleteClassName = 'cio-autocomplete', defaultInput, getSearchResultsUrl } = options, rest = tslib_1.__rest(options, ["onSubmit", "onChange", "openOnFocus", "apiKey", "cioJsClient", "placeholder", "autocompleteClassName", "defaultInput", "getSearchResultsUrl"]);
|
|
33
33
|
const [query, setQuery] = (0, react_1.useState)(defaultInput || '');
|
|
34
34
|
const previousQuery = (0, usePrevious_1.default)(query);
|
|
35
|
-
const cioClient = (0, useCioClient_1.default)({
|
|
35
|
+
const cioClient = (0, useCioClient_1.default)({
|
|
36
|
+
apiKey,
|
|
37
|
+
cioJsClient,
|
|
38
|
+
cioClientOptions,
|
|
39
|
+
cioJsClientOptions: options.cioJsClientOptions,
|
|
40
|
+
});
|
|
36
41
|
// Get autocomplete sections (autocomplete + recommendations + custom)
|
|
37
42
|
const { fetchRecommendationResults, activeSections, activeSectionsWithData, zeroStateActiveSections, request, totalNumResultsPerSection, } = (0, useSections_1.default)(query, cioClient, sections, zeroStateSections, advancedParameters);
|
|
38
43
|
const features = (0, react_1.useMemo)(() => (0, features_1.getFeatures)(request), [request]);
|
|
@@ -60,12 +65,26 @@ const useCioAutocomplete = (options) => {
|
|
|
60
65
|
openMenu,
|
|
61
66
|
closeMenu,
|
|
62
67
|
getItemProps: (item) => {
|
|
63
|
-
var _a;
|
|
68
|
+
var _a, _b;
|
|
64
69
|
const { index, sectionId } = (0, helpers_1.getItemPosition)({ item, items });
|
|
65
70
|
const sectionItemTestId = `cio-item-${sectionId === null || sectionId === void 0 ? void 0 : sectionId.replace(' ', '')}`;
|
|
66
|
-
|
|
71
|
+
// Products always have links, Search Suggestions with getSearchResultsUrl have links
|
|
72
|
+
const hasLink = ((_a = item.data) === null || _a === void 0 ? void 0 : _a.url) || (item.section === 'Search Suggestions' && getSearchResultsUrl) || false;
|
|
73
|
+
const nonInteractiveItemsProps = {
|
|
74
|
+
tabIndex: 0,
|
|
75
|
+
onKeyDown: (event) => {
|
|
76
|
+
const { code, key } = event;
|
|
77
|
+
const isEnter = code === 'Enter' || key === 'Enter';
|
|
78
|
+
if (isEnter) {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
// Trigger default click behavior
|
|
81
|
+
getItemPropsDownShift({ item, index }).onClick(event);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
return Object.assign(Object.assign(Object.assign({}, getItemPropsDownShift({ item, index })), {
|
|
67
86
|
// @deprecated `sectionItemTestId` will be removed as a className in the next major version
|
|
68
|
-
className: `cio-item ${sectionItemTestId}`, 'data-testid': sectionItemTestId, 'data-cnstrc-item-section': item.section, 'data-cnstrc-item-group': item.groupId, 'data-cnstrc-item-name': item.value, 'data-cnstrc-item-id': (
|
|
87
|
+
className: `cio-item ${sectionItemTestId}`, 'data-testid': sectionItemTestId, 'data-cnstrc-item-section': item.section, 'data-cnstrc-item-group': item.groupId, 'data-cnstrc-item-name': item.value, 'data-cnstrc-item-id': (_b = item.data) === null || _b === void 0 ? void 0 : _b.id }), (hasLink ? {} : nonInteractiveItemsProps));
|
|
69
88
|
},
|
|
70
89
|
getInputProps: () => (Object.assign(Object.assign({}, getInputProps({
|
|
71
90
|
onChange: (e) => {
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_1 = require("react");
|
|
4
4
|
const helpers_1 = require("../utils/helpers");
|
|
5
|
-
const useCioClient = ({ apiKey, cioJsClient, cioJsClientOptions }) => {
|
|
5
|
+
const useCioClient = ({ apiKey, cioJsClient, cioClientOptions, cioJsClientOptions, }) => {
|
|
6
6
|
if (!apiKey && !cioJsClient) {
|
|
7
7
|
// eslint-disable-next-line no-console
|
|
8
8
|
console.error('Either apiKey or cioJsClient is required');
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
const mergedClientOptions = cioClientOptions !== null && cioClientOptions !== void 0 ? cioClientOptions : cioJsClientOptions;
|
|
11
|
+
return (0, react_1.useMemo)(() => cioJsClient || (0, helpers_1.getCioClient)(apiKey, mergedClientOptions), [apiKey, cioJsClient, mergedClientOptions]);
|
|
11
12
|
};
|
|
12
13
|
exports.default = useCioClient;
|
|
@@ -38,15 +38,15 @@ const normalizeSections = (sections) => {
|
|
|
38
38
|
};
|
|
39
39
|
// Normalize and Memoize Objects to prevent infinite rerenders if users pass object literals to useCioAutocomplete
|
|
40
40
|
const useNormalizedProps = (options) => {
|
|
41
|
-
const { sections = exports.defaultSections, zeroStateSections, cioJsClientOptions, advancedParameters, } = options;
|
|
41
|
+
const { sections = exports.defaultSections, zeroStateSections, cioClientOptions, cioJsClientOptions, advancedParameters, } = options;
|
|
42
42
|
const sectionsMemoized = (0, react_1.useMemo)(() => normalizeSections(sections), [JSON.stringify(sections)]);
|
|
43
43
|
const zeroStateSectionsMemoized = (0, react_1.useMemo)(() => normalizeSections(zeroStateSections), [JSON.stringify(zeroStateSections)]);
|
|
44
|
-
const
|
|
44
|
+
const cioClientOptionsMemoized = (0, react_1.useMemo)(() => cioClientOptions !== null && cioClientOptions !== void 0 ? cioClientOptions : cioJsClientOptions, [JSON.stringify(cioClientOptions), JSON.stringify(cioJsClientOptions)]);
|
|
45
45
|
const advancedParametersMemoized = (0, react_1.useMemo)(() => advancedParameters, [JSON.stringify(advancedParameters)]);
|
|
46
46
|
return {
|
|
47
47
|
sections: sectionsMemoized,
|
|
48
48
|
zeroStateSections: zeroStateSectionsMemoized,
|
|
49
|
-
|
|
49
|
+
cioClientOptions: cioClientOptionsMemoized,
|
|
50
50
|
advancedParameters: advancedParametersMemoized,
|
|
51
51
|
};
|
|
52
52
|
};
|
package/lib/cjs/utils/helpers.js
CHANGED
|
@@ -61,9 +61,9 @@ const disableStoryActions = (story) => {
|
|
|
61
61
|
story.parameters.actions = { argTypesRegex: null };
|
|
62
62
|
};
|
|
63
63
|
exports.disableStoryActions = disableStoryActions;
|
|
64
|
-
const getCioClient = (apiKey,
|
|
64
|
+
const getCioClient = (apiKey, cioClientOptions) => {
|
|
65
65
|
if (apiKey && typeof window !== 'undefined') {
|
|
66
|
-
const cioClient = new constructorio_client_javascript_1.default(Object.assign(Object.assign({ apiKey, sendTrackingEvents: true, version: `cio-ui-autocomplete-${version_1.default}` },
|
|
66
|
+
const cioClient = new constructorio_client_javascript_1.default(Object.assign(Object.assign({ apiKey, sendTrackingEvents: true, version: `cio-ui-autocomplete-${version_1.default}` }, cioClientOptions), { eventDispatcher: { waitForBeacon: false } }));
|
|
67
67
|
// eslint-disable-next-line no-console
|
|
68
68
|
cioClient.tracker.on('error', (error) => console.error(error));
|
|
69
69
|
return cioClient;
|
package/lib/cjs/version.js
CHANGED
package/lib/mjs/constants.js
CHANGED
|
@@ -116,7 +116,9 @@ export const apiKeyDescription = `Pass an \`apiKey\` to request results from con
|
|
|
116
116
|
export const cioJsClientDescription = `If you are already using an instance of the \`ConstructorIOClient\`, you can pass a \`cioJsClient\` instead of an \`apiKey\` to request results from constructor's servers
|
|
117
117
|
|
|
118
118
|
> Note: when we say \`cioJsClient\`, we are referring to an instance of the [constructorio-client-javascript](https://www.npmjs.com/package/@constructor-io/constructorio-client-javascript)`;
|
|
119
|
-
export const
|
|
119
|
+
export const cioClientOptionsDescription = `If you don't want to create an instance of the \`ConstructorIOClient\` but still want to customize some of the options, you can pass a \`cioClientOptions\` object. You can learn more about the possible values [here under the parameters section](https://constructor-io.github.io/constructorio-client-javascript/ConstructorIO.html).
|
|
120
|
+
|
|
121
|
+
> Note: The legacy \`cioJsClientOptions\` prop is still supported for backwards compatibility, but \`cioClientOptions\` is now the preferred name.`;
|
|
120
122
|
export const placeholderDescription = `Pass a \`placeholder\` to override the default input field placeholder text shown to users before they start typing their query`;
|
|
121
123
|
export const searchSuggestionsDescription = `Override default \`sections\` to only suggest search terms`;
|
|
122
124
|
export const productsDescription = `Override default \`sections\` to only suggested products`;
|
|
@@ -24,11 +24,16 @@ export const defaultSections = [
|
|
|
24
24
|
},
|
|
25
25
|
];
|
|
26
26
|
const useCioAutocomplete = (options) => {
|
|
27
|
-
const { sections, zeroStateSections,
|
|
27
|
+
const { sections, zeroStateSections, cioClientOptions, advancedParameters } = useNormalizedProps(options);
|
|
28
28
|
const { onSubmit, onChange, openOnFocus, apiKey, cioJsClient, placeholder = 'What can we help you find today?', autocompleteClassName = 'cio-autocomplete', defaultInput, getSearchResultsUrl, ...rest } = options;
|
|
29
29
|
const [query, setQuery] = useState(defaultInput || '');
|
|
30
30
|
const previousQuery = usePrevious(query);
|
|
31
|
-
const cioClient = useCioClient({
|
|
31
|
+
const cioClient = useCioClient({
|
|
32
|
+
apiKey,
|
|
33
|
+
cioJsClient,
|
|
34
|
+
cioClientOptions,
|
|
35
|
+
cioJsClientOptions: options.cioJsClientOptions,
|
|
36
|
+
});
|
|
32
37
|
// Get autocomplete sections (autocomplete + recommendations + custom)
|
|
33
38
|
const { fetchRecommendationResults, activeSections, activeSectionsWithData, zeroStateActiveSections, request, totalNumResultsPerSection, } = useSections(query, cioClient, sections, zeroStateSections, advancedParameters);
|
|
34
39
|
const features = useMemo(() => getFeatures(request), [request]);
|
|
@@ -66,6 +71,20 @@ const useCioAutocomplete = (options) => {
|
|
|
66
71
|
getItemProps: (item) => {
|
|
67
72
|
const { index, sectionId } = getItemPosition({ item, items });
|
|
68
73
|
const sectionItemTestId = `cio-item-${sectionId?.replace(' ', '')}`;
|
|
74
|
+
// Products always have links, Search Suggestions with getSearchResultsUrl have links
|
|
75
|
+
const hasLink = item.data?.url || (item.section === 'Search Suggestions' && getSearchResultsUrl) || false;
|
|
76
|
+
const nonInteractiveItemsProps = {
|
|
77
|
+
tabIndex: 0,
|
|
78
|
+
onKeyDown: (event) => {
|
|
79
|
+
const { code, key } = event;
|
|
80
|
+
const isEnter = code === 'Enter' || key === 'Enter';
|
|
81
|
+
if (isEnter) {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
// Trigger default click behavior
|
|
84
|
+
getItemPropsDownShift({ item, index }).onClick(event);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
};
|
|
69
88
|
return {
|
|
70
89
|
...getItemPropsDownShift({ item, index }),
|
|
71
90
|
// @deprecated `sectionItemTestId` will be removed as a className in the next major version
|
|
@@ -75,6 +94,7 @@ const useCioAutocomplete = (options) => {
|
|
|
75
94
|
'data-cnstrc-item-group': item.groupId,
|
|
76
95
|
'data-cnstrc-item-name': item.value,
|
|
77
96
|
'data-cnstrc-item-id': item.data?.id,
|
|
97
|
+
...(hasLink ? {} : nonInteractiveItemsProps),
|
|
78
98
|
};
|
|
79
99
|
},
|
|
80
100
|
getInputProps: () => ({
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { getCioClient } from '../utils/helpers';
|
|
3
|
-
const useCioClient = ({ apiKey, cioJsClient, cioJsClientOptions }) => {
|
|
3
|
+
const useCioClient = ({ apiKey, cioJsClient, cioClientOptions, cioJsClientOptions, }) => {
|
|
4
4
|
if (!apiKey && !cioJsClient) {
|
|
5
5
|
// eslint-disable-next-line no-console
|
|
6
6
|
console.error('Either apiKey or cioJsClient is required');
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
const mergedClientOptions = cioClientOptions ?? cioJsClientOptions;
|
|
9
|
+
return useMemo(() => cioJsClient || getCioClient(apiKey, mergedClientOptions), [apiKey, cioJsClient, mergedClientOptions]);
|
|
9
10
|
};
|
|
10
11
|
export default useCioClient;
|
|
@@ -35,15 +35,15 @@ const normalizeSections = (sections) => {
|
|
|
35
35
|
};
|
|
36
36
|
// Normalize and Memoize Objects to prevent infinite rerenders if users pass object literals to useCioAutocomplete
|
|
37
37
|
const useNormalizedProps = (options) => {
|
|
38
|
-
const { sections = defaultSections, zeroStateSections, cioJsClientOptions, advancedParameters, } = options;
|
|
38
|
+
const { sections = defaultSections, zeroStateSections, cioClientOptions, cioJsClientOptions, advancedParameters, } = options;
|
|
39
39
|
const sectionsMemoized = useMemo(() => normalizeSections(sections), [JSON.stringify(sections)]);
|
|
40
40
|
const zeroStateSectionsMemoized = useMemo(() => normalizeSections(zeroStateSections), [JSON.stringify(zeroStateSections)]);
|
|
41
|
-
const
|
|
41
|
+
const cioClientOptionsMemoized = useMemo(() => cioClientOptions ?? cioJsClientOptions, [JSON.stringify(cioClientOptions), JSON.stringify(cioJsClientOptions)]);
|
|
42
42
|
const advancedParametersMemoized = useMemo(() => advancedParameters, [JSON.stringify(advancedParameters)]);
|
|
43
43
|
return {
|
|
44
44
|
sections: sectionsMemoized,
|
|
45
45
|
zeroStateSections: zeroStateSectionsMemoized,
|
|
46
|
-
|
|
46
|
+
cioClientOptions: cioClientOptionsMemoized,
|
|
47
47
|
advancedParameters: advancedParametersMemoized,
|
|
48
48
|
};
|
|
49
49
|
};
|
package/lib/mjs/utils/helpers.js
CHANGED
|
@@ -50,13 +50,13 @@ export const disableStoryActions = (story) => {
|
|
|
50
50
|
// eslint-disable-next-line
|
|
51
51
|
story.parameters.actions = { argTypesRegex: null };
|
|
52
52
|
};
|
|
53
|
-
export const getCioClient = (apiKey,
|
|
53
|
+
export const getCioClient = (apiKey, cioClientOptions) => {
|
|
54
54
|
if (apiKey && typeof window !== 'undefined') {
|
|
55
55
|
const cioClient = new ConstructorIOClient({
|
|
56
56
|
apiKey,
|
|
57
57
|
sendTrackingEvents: true,
|
|
58
58
|
version: `cio-ui-autocomplete-${version}`,
|
|
59
|
-
...
|
|
59
|
+
...cioClientOptions,
|
|
60
60
|
eventDispatcher: { waitForBeacon: false },
|
|
61
61
|
});
|
|
62
62
|
// eslint-disable-next-line no-console
|
package/lib/mjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.
|
|
1
|
+
export default '1.26.0';
|
package/lib/types/constants.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const zeroStateDescription = "- when the text input field has no
|
|
|
8
8
|
export declare const fullFeaturedAndStyledExampleDescription = "Using the default options, the library displays clean and minimal visual elements, with the intent of making it easy for consumers to easily extend and customize the styles to suit unique needs. The example below shows a full featured and styled example to demonstrate what is possible using Constructor.io's advanced Autocomplete UI library.";
|
|
9
9
|
export declare const apiKeyDescription = "Pass an `apiKey` to request results from constructor's servers";
|
|
10
10
|
export declare const cioJsClientDescription = "If you are already using an instance of the `ConstructorIOClient`, you can pass a `cioJsClient` instead of an `apiKey` to request results from constructor's servers\n\n> Note: when we say `cioJsClient`, we are referring to an instance of the [constructorio-client-javascript](https://www.npmjs.com/package/@constructor-io/constructorio-client-javascript)";
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const cioClientOptionsDescription = "If you don't want to create an instance of the `ConstructorIOClient` but still want to customize some of the options, you can pass a `cioClientOptions` object. You can learn more about the possible values [here under the parameters section](https://constructor-io.github.io/constructorio-client-javascript/ConstructorIO.html).\n\n> Note: The legacy `cioJsClientOptions` prop is still supported for backwards compatibility, but `cioClientOptions` is now the preferred name.";
|
|
12
12
|
export declare const placeholderDescription = "Pass a `placeholder` to override the default input field placeholder text shown to users before they start typing their query";
|
|
13
13
|
export declare const searchSuggestionsDescription = "Override default `sections` to only suggest search terms";
|
|
14
14
|
export declare const productsDescription = "Override default `sections` to only suggested products";
|
|
@@ -3,7 +3,7 @@ export declare const defaultSections: UserDefinedSection[];
|
|
|
3
3
|
declare const useNormalizedProps: (options: UseCioAutocompleteOptions) => {
|
|
4
4
|
sections: UserDefinedSection[];
|
|
5
5
|
zeroStateSections: UserDefinedSection[] | undefined;
|
|
6
|
-
|
|
6
|
+
cioClientOptions: import("@constructor-io/constructorio-client-javascript").ConstructorClientOptions | undefined;
|
|
7
7
|
advancedParameters: import("../types").AdvancedParameters | undefined;
|
|
8
8
|
};
|
|
9
9
|
export default useNormalizedProps;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -13,7 +13,11 @@ export type CioClientConfig = {
|
|
|
13
13
|
*/
|
|
14
14
|
cioJsClient?: ConstructorIOClient;
|
|
15
15
|
/**
|
|
16
|
-
* Pass a `
|
|
16
|
+
* Pass a `cioClientOptions` object to customize the client's configurations w/o creating a new instance of `ConstructorIOClient`. You can learn more about the possible values [Here](https://constructor-io.github.io/constructorio-client-javascript/ConstructorIO.html)
|
|
17
|
+
*/
|
|
18
|
+
cioClientOptions?: ConstructorClientOptions;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `cioClientOptions` instead.
|
|
17
21
|
*/
|
|
18
22
|
cioJsClientOptions?: ConstructorClientOptions;
|
|
19
23
|
};
|
|
@@ -26,7 +26,7 @@ export declare const functionStrings: {
|
|
|
26
26
|
renderItem: string;
|
|
27
27
|
};
|
|
28
28
|
export declare const disableStoryActions: (story: any) => void;
|
|
29
|
-
export declare const getCioClient: (apiKey?: string,
|
|
29
|
+
export declare const getCioClient: (apiKey?: string, cioClientOptions?: ConstructorClientOptions) => ConstructorIOClient | null;
|
|
30
30
|
export declare const getActiveSectionsWithData: (activeSections: UserDefinedSection[], sectionsResults: SectionsData, sectionsRefs: React.MutableRefObject<React.RefObject<HTMLLIElement>[]>, podsData: Record<string, PodData>) => Section[];
|
|
31
31
|
export declare const escapeRegExp: (string: string) => string;
|
|
32
32
|
export declare const getItemsForActiveSections: (activeSectionsWithData: Section[]) => Item[];
|
package/lib/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.
|
|
1
|
+
declare const _default: "1.26.0";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED