@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.js
CHANGED
|
@@ -4567,7 +4567,7 @@ function transformFilteredTab(raw) {
|
|
|
4567
4567
|
// Main Hook
|
|
4568
4568
|
// ============================================================================
|
|
4569
4569
|
function useQuerySuggestionsEnhanced(options) {
|
|
4570
|
-
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;
|
|
4570
|
+
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;
|
|
4571
4571
|
// State
|
|
4572
4572
|
const [suggestions, setSuggestions] = React.useState([]);
|
|
4573
4573
|
const [loading, setLoading] = React.useState(false);
|
|
@@ -4614,6 +4614,8 @@ function useQuerySuggestionsEnhanced(options) {
|
|
|
4614
4614
|
const response = await client.getSuggestions?.(searchQuery, {
|
|
4615
4615
|
hitsPerPage: maxSuggestions,
|
|
4616
4616
|
include_dropdown_recommendations: includeDropdownRecommendations || (filteredTabs && filteredTabs.length > 0),
|
|
4617
|
+
include_dropdown_product_list: includeDropdownProductList,
|
|
4618
|
+
include_filtered_tabs: includeFilteredTabs,
|
|
4617
4619
|
include_categories: includeCategories,
|
|
4618
4620
|
include_facets: includeFacets,
|
|
4619
4621
|
max_categories: maxCategories,
|
|
@@ -4706,6 +4708,8 @@ function useQuerySuggestionsEnhanced(options) {
|
|
|
4706
4708
|
minQueryLength,
|
|
4707
4709
|
maxSuggestions,
|
|
4708
4710
|
includeDropdownRecommendations,
|
|
4711
|
+
includeDropdownProductList,
|
|
4712
|
+
includeFilteredTabs,
|
|
4709
4713
|
includeCategories,
|
|
4710
4714
|
includeFacets,
|
|
4711
4715
|
maxCategories,
|
|
@@ -5475,7 +5479,7 @@ const CloseIcon = () => (React.createElement("svg", { viewBox: "0 0 20 20", fill
|
|
|
5475
5479
|
// Component
|
|
5476
5480
|
// ============================================================================
|
|
5477
5481
|
const RichQuerySuggestions = React.forwardRef(function RichQuerySuggestions(props, ref) {
|
|
5478
|
-
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;
|
|
5482
|
+
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;
|
|
5479
5483
|
const { client } = useSearchContext();
|
|
5480
5484
|
const containerRef = React.useRef(null);
|
|
5481
5485
|
const [activeIndex, setActiveIndex] = React.useState(-1);
|
|
@@ -5489,6 +5493,8 @@ const RichQuerySuggestions = React.forwardRef(function RichQuerySuggestions(prop
|
|
|
5489
5493
|
maxSuggestions: maxSuggestionsPerSection,
|
|
5490
5494
|
minQueryLength,
|
|
5491
5495
|
includeDropdownRecommendations,
|
|
5496
|
+
includeDropdownProductList,
|
|
5497
|
+
includeFilteredTabs,
|
|
5492
5498
|
includeCategories,
|
|
5493
5499
|
maxCategories,
|
|
5494
5500
|
analyticsTags,
|
|
@@ -11792,7 +11798,7 @@ const createStyles = (isMobile) => ({
|
|
|
11792
11798
|
// Component
|
|
11793
11799
|
// ============================================================================
|
|
11794
11800
|
const SuggestionSearchBar = React.forwardRef(function SuggestionSearchBar(props, ref) {
|
|
11795
|
-
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;
|
|
11801
|
+
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;
|
|
11796
11802
|
// Theme: prop overrides context (SearchProvider theme)
|
|
11797
11803
|
const searchContext = useSearchContext();
|
|
11798
11804
|
const effectiveTheme = theme ?? searchContext.theme;
|
|
@@ -11875,6 +11881,8 @@ const SuggestionSearchBar = React.forwardRef(function SuggestionSearchBar(props,
|
|
|
11875
11881
|
const cacheOptions = {
|
|
11876
11882
|
maxSuggestions,
|
|
11877
11883
|
includeDropdownRecommendations,
|
|
11884
|
+
includeDropdownProductList,
|
|
11885
|
+
includeFilteredTabs,
|
|
11878
11886
|
includeCategories,
|
|
11879
11887
|
filteredTabs: filteredTabs?.map(t => t.filter).join(','),
|
|
11880
11888
|
};
|
|
@@ -11895,6 +11903,8 @@ const SuggestionSearchBar = React.forwardRef(function SuggestionSearchBar(props,
|
|
|
11895
11903
|
const response = await client.getSuggestions?.(searchQuery, {
|
|
11896
11904
|
hitsPerPage: maxSuggestions,
|
|
11897
11905
|
include_dropdown_recommendations: includeDropdownRecommendations,
|
|
11906
|
+
include_dropdown_product_list: includeDropdownProductList,
|
|
11907
|
+
include_filtered_tabs: includeFilteredTabs,
|
|
11898
11908
|
include_categories: includeCategories,
|
|
11899
11909
|
filtered_tabs: filteredTabs,
|
|
11900
11910
|
analytics_tags: analyticsTags,
|
|
@@ -11933,7 +11943,7 @@ const SuggestionSearchBar = React.forwardRef(function SuggestionSearchBar(props,
|
|
|
11933
11943
|
finally {
|
|
11934
11944
|
setLoading(false);
|
|
11935
11945
|
}
|
|
11936
|
-
}, [client, minQueryLength, maxSuggestions, includeDropdownRecommendations, includeCategories, filteredTabs, analyticsTags, enableAnalytics, analytics, cache]);
|
|
11946
|
+
}, [client, minQueryLength, maxSuggestions, includeDropdownRecommendations, includeDropdownProductList, includeFilteredTabs, includeCategories, filteredTabs, analyticsTags, enableAnalytics, analytics, cache]);
|
|
11937
11947
|
// Parse API response - handles multiple response formats
|
|
11938
11948
|
const parseAndSetData = React.useCallback((response) => {
|
|
11939
11949
|
// Handle different response structures from the API/SDK
|