@seekora-ai/ui-sdk-react 0.2.8 → 0.2.9
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/components/RichQuerySuggestions.d.ts +4 -0
- package/dist/components/RichQuerySuggestions.d.ts.map +1 -1
- package/dist/components/RichQuerySuggestions.js +3 -1
- package/dist/components/suggestions/SuggestionSearchBar.d.ts +4 -0
- package/dist/components/suggestions/SuggestionSearchBar.d.ts.map +1 -1
- package/dist/components/suggestions/SuggestionSearchBar.js +6 -2
- package/dist/hooks/useQuerySuggestionsEnhanced.d.ts +4 -0
- package/dist/hooks/useQuerySuggestionsEnhanced.d.ts.map +1 -1
- package/dist/hooks/useQuerySuggestionsEnhanced.js +5 -1
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.esm.js +14 -4
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +14 -4
- package/dist/src/index.js.map +1 -1
- package/package.json +3 -3
package/dist/src/index.d.ts
CHANGED
|
@@ -1074,6 +1074,10 @@ interface RichQuerySuggestionsProps extends QuerySuggestionsEventHandlers {
|
|
|
1074
1074
|
debounceMs?: number;
|
|
1075
1075
|
/** Include dropdown recommendations from API */
|
|
1076
1076
|
includeDropdownRecommendations?: boolean;
|
|
1077
|
+
/** When false, omit product hits list from dropdown (default true) */
|
|
1078
|
+
includeDropdownProductList?: boolean;
|
|
1079
|
+
/** When false, omit filtered_tabs from dropdown (default true) */
|
|
1080
|
+
includeFilteredTabs?: boolean;
|
|
1077
1081
|
/** Include categories in suggestions */
|
|
1078
1082
|
includeCategories?: boolean;
|
|
1079
1083
|
/** Max categories per suggestion */
|
|
@@ -1346,6 +1350,10 @@ interface UseQuerySuggestionsEnhancedOptions {
|
|
|
1346
1350
|
minQueryLength?: number;
|
|
1347
1351
|
/** Include dropdown recommendations (trending, products, etc.) */
|
|
1348
1352
|
includeDropdownRecommendations?: boolean;
|
|
1353
|
+
/** When false, omit product hits list from dropdown (default true) */
|
|
1354
|
+
includeDropdownProductList?: boolean;
|
|
1355
|
+
/** When false, omit filtered_tabs from dropdown extensions (default true) */
|
|
1356
|
+
includeFilteredTabs?: boolean;
|
|
1349
1357
|
/** Include categories in suggestions */
|
|
1350
1358
|
includeCategories?: boolean;
|
|
1351
1359
|
/** Include facets in suggestions */
|
|
@@ -2644,6 +2652,10 @@ interface SuggestionSearchBarProps {
|
|
|
2644
2652
|
debounceMs?: number;
|
|
2645
2653
|
/** Include dropdown recommendations (products, tabs, trending) */
|
|
2646
2654
|
includeDropdownRecommendations?: boolean;
|
|
2655
|
+
/** When false, omit product hits list from dropdown (default true) */
|
|
2656
|
+
includeDropdownProductList?: boolean;
|
|
2657
|
+
/** When false, omit filtered_tabs from dropdown (default true) */
|
|
2658
|
+
includeFilteredTabs?: boolean;
|
|
2647
2659
|
/** Include categories per suggestion */
|
|
2648
2660
|
includeCategories?: boolean;
|
|
2649
2661
|
/** Filtered tabs configuration */
|
package/dist/src/index.esm.js
CHANGED
|
@@ -4565,7 +4565,7 @@ function transformFilteredTab(raw) {
|
|
|
4565
4565
|
// Main Hook
|
|
4566
4566
|
// ============================================================================
|
|
4567
4567
|
function useQuerySuggestionsEnhanced(options) {
|
|
4568
|
-
const { client, query, enabled = true, debounceMs = 200, maxSuggestions = 10, minQueryLength = 1, includeDropdownRecommendations = false, includeCategories = true, includeFacets = false, maxCategories = 3, maxFacets = 5, filteredTabs, minPopularity, timeRange, disableTypoTolerance, analyticsTags, enableRecentSearches = true, maxRecentSearches = MAX_RECENT_SEARCHES_DEFAULT, recentSearchesKey = RECENT_SEARCHES_DEFAULT_KEY, onSuggestionsLoaded, onError, } = options;
|
|
4568
|
+
const { client, query, enabled = true, debounceMs = 200, maxSuggestions = 10, minQueryLength = 1, includeDropdownRecommendations = false, includeDropdownProductList = true, includeFilteredTabs = true, includeCategories = true, includeFacets = false, maxCategories = 3, maxFacets = 5, filteredTabs, minPopularity, timeRange, disableTypoTolerance, analyticsTags, enableRecentSearches = true, maxRecentSearches = MAX_RECENT_SEARCHES_DEFAULT, recentSearchesKey = RECENT_SEARCHES_DEFAULT_KEY, onSuggestionsLoaded, onError, } = options;
|
|
4569
4569
|
// State
|
|
4570
4570
|
const [suggestions, setSuggestions] = useState([]);
|
|
4571
4571
|
const [loading, setLoading] = useState(false);
|
|
@@ -4612,6 +4612,8 @@ function useQuerySuggestionsEnhanced(options) {
|
|
|
4612
4612
|
const response = await client.getSuggestions?.(searchQuery, {
|
|
4613
4613
|
hitsPerPage: maxSuggestions,
|
|
4614
4614
|
include_dropdown_recommendations: includeDropdownRecommendations || (filteredTabs && filteredTabs.length > 0),
|
|
4615
|
+
include_dropdown_product_list: includeDropdownProductList,
|
|
4616
|
+
include_filtered_tabs: includeFilteredTabs,
|
|
4615
4617
|
include_categories: includeCategories,
|
|
4616
4618
|
include_facets: includeFacets,
|
|
4617
4619
|
max_categories: maxCategories,
|
|
@@ -4704,6 +4706,8 @@ function useQuerySuggestionsEnhanced(options) {
|
|
|
4704
4706
|
minQueryLength,
|
|
4705
4707
|
maxSuggestions,
|
|
4706
4708
|
includeDropdownRecommendations,
|
|
4709
|
+
includeDropdownProductList,
|
|
4710
|
+
includeFilteredTabs,
|
|
4707
4711
|
includeCategories,
|
|
4708
4712
|
includeFacets,
|
|
4709
4713
|
maxCategories,
|
|
@@ -5473,7 +5477,7 @@ const CloseIcon = () => (React.createElement("svg", { viewBox: "0 0 20 20", fill
|
|
|
5473
5477
|
// Component
|
|
5474
5478
|
// ============================================================================
|
|
5475
5479
|
const RichQuerySuggestions = forwardRef(function RichQuerySuggestions(props, ref) {
|
|
5476
|
-
const { query, isOpen = true, sections = DEFAULT_SECTIONS, maxSuggestionsPerSection = 8, minQueryLength = 0, debounceMs = 200, includeDropdownRecommendations = true, includeCategories = true, maxCategories = 3, showCounts = true, showCategoryCounts = true, showSectionHeaders = true, classNames = {}, style, renderSuggestion, renderCategory, renderTrendingItem, renderRecentItem, header, footer, width = '100%', maxHeight = '480px', zIndex = 1000, ariaLabel = 'Search suggestions', analyticsTags, onSuggestionSelect, onCategoryClick, onRecentSearchClick, onRecentSearchRemove, onViewAllClick, onOpen, onClose, } = props;
|
|
5480
|
+
const { query, isOpen = true, sections = DEFAULT_SECTIONS, maxSuggestionsPerSection = 8, minQueryLength = 0, debounceMs = 200, includeDropdownRecommendations = true, includeDropdownProductList = true, includeFilteredTabs = true, includeCategories = true, maxCategories = 3, showCounts = true, showCategoryCounts = true, showSectionHeaders = true, classNames = {}, style, renderSuggestion, renderCategory, renderTrendingItem, renderRecentItem, header, footer, width = '100%', maxHeight = '480px', zIndex = 1000, ariaLabel = 'Search suggestions', analyticsTags, onSuggestionSelect, onCategoryClick, onRecentSearchClick, onRecentSearchRemove, onViewAllClick, onOpen, onClose, } = props;
|
|
5477
5481
|
const { client } = useSearchContext();
|
|
5478
5482
|
const containerRef = useRef(null);
|
|
5479
5483
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
@@ -5487,6 +5491,8 @@ const RichQuerySuggestions = forwardRef(function RichQuerySuggestions(props, ref
|
|
|
5487
5491
|
maxSuggestions: maxSuggestionsPerSection,
|
|
5488
5492
|
minQueryLength,
|
|
5489
5493
|
includeDropdownRecommendations,
|
|
5494
|
+
includeDropdownProductList,
|
|
5495
|
+
includeFilteredTabs,
|
|
5490
5496
|
includeCategories,
|
|
5491
5497
|
maxCategories,
|
|
5492
5498
|
analyticsTags,
|
|
@@ -11790,7 +11796,7 @@ const createStyles = (isMobile) => ({
|
|
|
11790
11796
|
// Component
|
|
11791
11797
|
// ============================================================================
|
|
11792
11798
|
const SuggestionSearchBar = forwardRef(function SuggestionSearchBar(props, ref) {
|
|
11793
|
-
const { client, variant = 'amazon', autoMobileVariant = true, placeholder = 'Search...', defaultQuery = '', value, minQueryLength = 1, maxSuggestions = 8, debounceMs = 200, includeDropdownRecommendations = true, includeCategories = true, filteredTabs, analyticsTags, enableRecentSearches = true, maxRecentSearches = 10, showProducts = true, showTrendingOnEmpty = true, enableAnalytics = true, analyticsConfig, suggestionFields, productFields, theme, onSearch, onQueryChange, onSuggestionSelect, onProductClick, onCategoryClick, onTabChange, className, style, inputClassName, dropdownWidth, dropdownMaxHeight = '500px', zIndex = 1000, enableCache = true, cacheTtlMs = 30000, cacheMaxSize = 100, } = props;
|
|
11799
|
+
const { client, variant = 'amazon', autoMobileVariant = true, placeholder = 'Search...', defaultQuery = '', value, minQueryLength = 1, maxSuggestions = 8, debounceMs = 200, includeDropdownRecommendations = true, includeDropdownProductList = true, includeFilteredTabs = true, includeCategories = true, filteredTabs, analyticsTags, enableRecentSearches = true, maxRecentSearches = 10, showProducts = true, showTrendingOnEmpty = true, enableAnalytics = true, analyticsConfig, suggestionFields, productFields, theme, onSearch, onQueryChange, onSuggestionSelect, onProductClick, onCategoryClick, onTabChange, className, style, inputClassName, dropdownWidth, dropdownMaxHeight = '500px', zIndex = 1000, enableCache = true, cacheTtlMs = 30000, cacheMaxSize = 100, } = props;
|
|
11794
11800
|
// Theme: prop overrides context (SearchProvider theme)
|
|
11795
11801
|
const searchContext = useSearchContext();
|
|
11796
11802
|
const effectiveTheme = theme ?? searchContext.theme;
|
|
@@ -11873,6 +11879,8 @@ const SuggestionSearchBar = forwardRef(function SuggestionSearchBar(props, ref)
|
|
|
11873
11879
|
const cacheOptions = {
|
|
11874
11880
|
maxSuggestions,
|
|
11875
11881
|
includeDropdownRecommendations,
|
|
11882
|
+
includeDropdownProductList,
|
|
11883
|
+
includeFilteredTabs,
|
|
11876
11884
|
includeCategories,
|
|
11877
11885
|
filteredTabs: filteredTabs?.map(t => t.filter).join(','),
|
|
11878
11886
|
};
|
|
@@ -11893,6 +11901,8 @@ const SuggestionSearchBar = forwardRef(function SuggestionSearchBar(props, ref)
|
|
|
11893
11901
|
const response = await client.getSuggestions?.(searchQuery, {
|
|
11894
11902
|
hitsPerPage: maxSuggestions,
|
|
11895
11903
|
include_dropdown_recommendations: includeDropdownRecommendations,
|
|
11904
|
+
include_dropdown_product_list: includeDropdownProductList,
|
|
11905
|
+
include_filtered_tabs: includeFilteredTabs,
|
|
11896
11906
|
include_categories: includeCategories,
|
|
11897
11907
|
filtered_tabs: filteredTabs,
|
|
11898
11908
|
analytics_tags: analyticsTags,
|
|
@@ -11931,7 +11941,7 @@ const SuggestionSearchBar = forwardRef(function SuggestionSearchBar(props, ref)
|
|
|
11931
11941
|
finally {
|
|
11932
11942
|
setLoading(false);
|
|
11933
11943
|
}
|
|
11934
|
-
}, [client, minQueryLength, maxSuggestions, includeDropdownRecommendations, includeCategories, filteredTabs, analyticsTags, enableAnalytics, analytics, cache]);
|
|
11944
|
+
}, [client, minQueryLength, maxSuggestions, includeDropdownRecommendations, includeDropdownProductList, includeFilteredTabs, includeCategories, filteredTabs, analyticsTags, enableAnalytics, analytics, cache]);
|
|
11935
11945
|
// Parse API response - handles multiple response formats
|
|
11936
11946
|
const parseAndSetData = useCallback((response) => {
|
|
11937
11947
|
// Handle different response structures from the API/SDK
|