@seekora-ai/ui-sdk-react 0.2.8 → 0.2.10
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/components/suggestions-primitives/SuggestionItem.d.ts +15 -2
- package/dist/components/suggestions-primitives/SuggestionItem.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionItem.js +11 -3
- package/dist/components/suggestions-primitives/SuggestionList.d.ts +13 -2
- package/dist/components/suggestions-primitives/SuggestionList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionList.js +5 -3
- package/dist/components/suggestions-primitives/highlightMarkup.d.ts +19 -0
- package/dist/components/suggestions-primitives/highlightMarkup.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/highlightMarkup.js +32 -0
- package/dist/components/suggestions-primitives/index.d.ts +2 -0
- package/dist/components/suggestions-primitives/index.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/index.js +1 -0
- 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.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +56 -5
- package/dist/src/index.esm.js +62 -11
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +62 -10
- package/dist/src/index.js.map +1 -1
- package/package.json +5 -5
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 */
|
|
@@ -1554,19 +1562,49 @@ interface DropdownPanelProps {
|
|
|
1554
1562
|
}
|
|
1555
1563
|
declare function DropdownPanel({ children, position, top, left, right, width, maxHeight, zIndex, className, style, closeOnClickOutside, closeOnEscape, }: DropdownPanelProps): React__default.JSX.Element | null;
|
|
1556
1564
|
|
|
1565
|
+
/**
|
|
1566
|
+
* Parses suggestion text containing <mark>...</mark> and returns React nodes
|
|
1567
|
+
* with the marked segments rendered as <mark> elements. Safe: inner content
|
|
1568
|
+
* is rendered as text, not HTML.
|
|
1569
|
+
*/
|
|
1570
|
+
|
|
1571
|
+
interface HighlightMarkupOptions {
|
|
1572
|
+
/** Class name for the <mark> element. */
|
|
1573
|
+
markClassName?: string;
|
|
1574
|
+
/** Inline style for the <mark> element. */
|
|
1575
|
+
markStyle?: React__default.CSSProperties;
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* Converts a string like "lined <mark>blue</mark>" into React nodes with
|
|
1579
|
+
* the marked part rendered as a <mark> element. When no <mark> tags are
|
|
1580
|
+
* present, returns the string as-is.
|
|
1581
|
+
*/
|
|
1582
|
+
declare function parseHighlightMarkup(text: string, options?: HighlightMarkupOptions): React__default.ReactNode;
|
|
1583
|
+
|
|
1557
1584
|
interface SuggestionListProps {
|
|
1558
1585
|
maxItems?: number;
|
|
1559
1586
|
className?: string;
|
|
1560
1587
|
style?: React__default.CSSProperties;
|
|
1561
1588
|
listClassName?: string;
|
|
1589
|
+
/**
|
|
1590
|
+
* When true (default), suggestion text with <mark>...</mark> is rendered
|
|
1591
|
+
* with those segments highlighted. When false, plain text is shown.
|
|
1592
|
+
* Only applies when not using custom renderItem.
|
|
1593
|
+
*/
|
|
1594
|
+
enableHighlightMarkup?: boolean;
|
|
1595
|
+
/** Options for default highlight <mark> styling. Only applies when not using custom renderItem. */
|
|
1596
|
+
highlightMarkupOptions?: HighlightMarkupOptions;
|
|
1562
1597
|
renderItem?: (suggestion: _seekora_ai_ui_sdk_types.SuggestionItem, index: number, isActive: boolean, onSelect: () => void) => React__default.ReactNode;
|
|
1563
1598
|
}
|
|
1564
|
-
declare function SuggestionList({ maxItems, className, style, listClassName, renderItem, }: SuggestionListProps): React__default.JSX.Element | null;
|
|
1599
|
+
declare function SuggestionList({ maxItems, className, style, listClassName, enableHighlightMarkup, highlightMarkupOptions, renderItem, }: SuggestionListProps): React__default.JSX.Element | null;
|
|
1565
1600
|
|
|
1566
1601
|
/**
|
|
1567
1602
|
* SuggestionItem – single text suggestion row (primitive)
|
|
1568
1603
|
*
|
|
1569
|
-
* Highlights when isActive; onClick calls context selectSuggestion.
|
|
1604
|
+
* Highlights when isActive; onClick calls context selectSuggestion.
|
|
1605
|
+
* When enableHighlightMarkup is true (default), parses <mark>...</mark> in
|
|
1606
|
+
* suggestion text and renders as highlighted <mark> elements. Overridable via
|
|
1607
|
+
* renderHighlight, className/style.
|
|
1570
1608
|
*/
|
|
1571
1609
|
|
|
1572
1610
|
interface SuggestionItemProps {
|
|
@@ -1576,9 +1614,18 @@ interface SuggestionItemProps {
|
|
|
1576
1614
|
onSelect: () => void;
|
|
1577
1615
|
className?: string;
|
|
1578
1616
|
style?: React__default.CSSProperties;
|
|
1617
|
+
/**
|
|
1618
|
+
* When true (default), text containing <mark>...</mark> is rendered with
|
|
1619
|
+
* those segments as highlighted <mark> elements. When false, plain query
|
|
1620
|
+
* text is shown with no markup parsing.
|
|
1621
|
+
*/
|
|
1622
|
+
enableHighlightMarkup?: boolean;
|
|
1623
|
+
/** Options for the default highlight <mark> styling when enableHighlightMarkup is true. */
|
|
1624
|
+
highlightMarkupOptions?: HighlightMarkupOptions;
|
|
1625
|
+
/** Custom renderer for suggestion text; overrides default highlight parsing when provided. */
|
|
1579
1626
|
renderHighlight?: (text: string) => React__default.ReactNode;
|
|
1580
1627
|
}
|
|
1581
|
-
declare function SuggestionItem$1({ suggestion, index, isActive, onSelect, className, style, renderHighlight, }: SuggestionItemProps): React__default.JSX.Element;
|
|
1628
|
+
declare function SuggestionItem$1({ suggestion, index, isActive, onSelect, className, style, enableHighlightMarkup, highlightMarkupOptions, renderHighlight, }: SuggestionItemProps): React__default.JSX.Element;
|
|
1582
1629
|
|
|
1583
1630
|
/**
|
|
1584
1631
|
* ItemCard – generic item tile (primitive)
|
|
@@ -2644,6 +2691,10 @@ interface SuggestionSearchBarProps {
|
|
|
2644
2691
|
debounceMs?: number;
|
|
2645
2692
|
/** Include dropdown recommendations (products, tabs, trending) */
|
|
2646
2693
|
includeDropdownRecommendations?: boolean;
|
|
2694
|
+
/** When false, omit product hits list from dropdown (default true) */
|
|
2695
|
+
includeDropdownProductList?: boolean;
|
|
2696
|
+
/** When false, omit filtered_tabs from dropdown (default true) */
|
|
2697
|
+
includeFilteredTabs?: boolean;
|
|
2647
2698
|
/** Include categories per suggestion */
|
|
2648
2699
|
includeCategories?: boolean;
|
|
2649
2700
|
/** Filtered tabs configuration */
|
|
@@ -3609,5 +3660,5 @@ declare function updateSuggestionsStyles(theme: SuggestionsThemeVariables): void
|
|
|
3609
3660
|
|
|
3610
3661
|
declare const createTheme: (config: ThemeConfig) => _seekora_ai_ui_sdk_types.Theme;
|
|
3611
3662
|
|
|
3612
|
-
export { AmazonDropdown, Breadcrumb, CategoriesTabs, ClearRefinements, CurrentRefinements, DocSearch, DocSearchButton, DropdownPanel, Facets, FederatedDropdown, FrequentlyBoughtTogether, GoogleDropdown, HierarchicalMenu, Highlight, HitsPerPage, ImageDisplay, InfiniteHits, ItemCard, ItemGrid, MinimalDropdown, MobileFilters, MobileFiltersButton, MobileSheetDropdown, Pagination, PinterestDropdown, ProductCard, ProductGallery, ProductGrid, ProductInfo, ProductRecommendations, QuerySuggestions, QuerySuggestionsDropdown, RangeInput, RangeSlider, RecentSearchesList, RecentlyViewed, RelatedProducts, RichQuerySuggestions, SearchBar, SearchBarWithSuggestions, SearchInput, SearchLayout, SearchProvider, SearchResults, SectionError, SectionItemGrid, SectionLoading, SectionSearchProvider, ShopifyDropdown, Snippet, SortBy, SpotlightDropdown, Stats, SuggestionDropdownVariants, SuggestionItem$1 as SuggestionItem, SuggestionList, SuggestionSearchBar, SuggestionsCache, SuggestionsDropdownComposition, SuggestionsError, SuggestionsLoading, SuggestionsProvider, TrendingItems, TrendingList, addRecentSearch, addToRecentlyViewed, brandPresets, breakpoints, clearRecentSearches, clearSuggestionsCache, createSuggestionsCache, createSuggestionsTheme, createTheme, darkTheme, darkThemeVariables, defaultTheme, extractBrand, extractCategory, extractProduct, extractSuggestion, formatParsedFilters, formatPrice as formatSuggestionPrice, generateSuggestionsStylesheet, getRecentSearches, getShortcutText, getSuggestionsCache, highlightText, injectGlobalResponsiveStyles, injectSuggestionsStyles, lightThemeVariables, mediaQueries, minimalTheme, minimalThemeVariables, removeRecentSearch, touchTargets, updateSuggestionsStyles, useAnalytics, useDocSearch, useSeekoraSearch$1 as useDocSearchSeekoraSearch, useInjectResponsiveStyles, useKeyboard, useNaturalLanguageFilters, useQuerySuggestions, useQuerySuggestionsEnhanced, useResponsive, useSearchContext, useSearchState, useSectionSearchContext, useSeekoraSearch, useSmartSuggestions, useSuggestionsAnalytics, useSuggestionsContext };
|
|
3613
|
-
export type { AnalyticsConfig, AnalyticsEventPayload, BaseDropdownProps, BrandFieldMapping, BreadcrumbItem, BreadcrumbProps, BreadcrumbTheme, CategoriesTabsProps, CategoryFieldMapping, ClearRefinementsProps, ClearRefinementsTheme, DocSearchAction, DocSearchButtonProps, DocSearchHit, DocSearchProps, DocSearchResponse, DocSearchState, DocSearchSuggestion, DocSearchSuggestionsResponse, DocSearchTranslations, DropdownClassNames, DropdownEventHandlers, DropdownPanelProps, DropdownRef, DropdownThemeConfig, FederatedDropdownProps, FederatedDropdownRef, FrequentlyBoughtTogetherProps, GenericItem, HierarchicalMenuItem, HierarchicalMenuProps, HierarchicalMenuTheme, HighlightProps, HighlightTheme, HitsPerPageItem, HitsPerPageProps, HitsPerPageTheme, ImageDisplayProps, ImageDisplayVariant, InfiniteHitsProps, InfiniteHitsTheme, ImageDisplayVariant$1 as ItemCardImageVariant, ItemCardProps, ItemGridProps, MobileFiltersButtonProps, MobileFiltersProps, MobileFiltersTheme, NaturalLanguageFiltersOptions, NaturalLanguageResult, NavigableItem, ParsedFilter, ProductCardImageVariant, ProductCardProps, ProductClickEventData, ProductDisplayConfig, ProductFieldMapping, ProductGalleryProps, ProductGridProps, ProductInfoProps, ProductRecommendationsProps, QuerySuggestionsDropdownProps, QuerySuggestionsDropdownRef, QuerySuggestionsProps, QuerySuggestionsTheme, RangeSliderProps, RangeSliderTheme, RecentSearchesListProps, RecentlyViewedProps, RecommendationItem, RecommendationTheme, RefinementInput, RelatedProductsProps, ResponsiveState, RichQuerySuggestionsProps, RichQuerySuggestionsRef, SearchBarProps, SearchBarTheme, SearchBarWithSuggestionsProps, SearchBarWithSuggestionsRef, SearchInputProps, SearchProviderProps, SearchResultsProps, SearchResultsTheme, SearchSource, SectionConfig, SectionErrorProps, SectionItemGridProps, SectionLoadingProps, SectionSearchContextValue, SectionSearchProviderProps, SmartSuggestion, SmartSuggestionsOptions, SnippetProps, SnippetTheme, SuggestionClickEventData, SuggestionDisplayConfig, SuggestionDropdownVariant, SuggestionFieldMapping, SuggestionImpressionEventData, SuggestionItemProps, SuggestionListProps, SuggestionSearchBarProps, SuggestionSearchBarRef, SuggestionsContextValue, SuggestionsDropdownCompositionProps, SuggestionsErrorProps, SuggestionsLoadingProps, SuggestionsProviderProps, SuggestionsThemeVariables, TrendingItemsProps, TrendingListProps, UseAnalyticsOptions, UseAnalyticsReturn, UseSeekoraSearchOptions$1 as UseDocSearchSeekoraSearchOptions, UseSeekoraSearchResult as UseDocSearchSeekoraSearchResult, UseQuerySuggestionsEnhancedOptions, UseQuerySuggestionsEnhancedReturn, UseSmartSuggestionsReturn, UseSuggestionsAnalyticsOptions, UseSuggestionsAnalyticsReturn };
|
|
3663
|
+
export { AmazonDropdown, Breadcrumb, CategoriesTabs, ClearRefinements, CurrentRefinements, DocSearch, DocSearchButton, DropdownPanel, Facets, FederatedDropdown, FrequentlyBoughtTogether, GoogleDropdown, HierarchicalMenu, Highlight, HitsPerPage, ImageDisplay, InfiniteHits, ItemCard, ItemGrid, MinimalDropdown, MobileFilters, MobileFiltersButton, MobileSheetDropdown, Pagination, PinterestDropdown, ProductCard, ProductGallery, ProductGrid, ProductInfo, ProductRecommendations, QuerySuggestions, QuerySuggestionsDropdown, RangeInput, RangeSlider, RecentSearchesList, RecentlyViewed, RelatedProducts, RichQuerySuggestions, SearchBar, SearchBarWithSuggestions, SearchInput, SearchLayout, SearchProvider, SearchResults, SectionError, SectionItemGrid, SectionLoading, SectionSearchProvider, ShopifyDropdown, Snippet, SortBy, SpotlightDropdown, Stats, SuggestionDropdownVariants, SuggestionItem$1 as SuggestionItem, SuggestionList, SuggestionSearchBar, SuggestionsCache, SuggestionsDropdownComposition, SuggestionsError, SuggestionsLoading, SuggestionsProvider, TrendingItems, TrendingList, addRecentSearch, addToRecentlyViewed, brandPresets, breakpoints, clearRecentSearches, clearSuggestionsCache, createSuggestionsCache, createSuggestionsTheme, createTheme, darkTheme, darkThemeVariables, defaultTheme, extractBrand, extractCategory, extractProduct, extractSuggestion, formatParsedFilters, formatPrice as formatSuggestionPrice, generateSuggestionsStylesheet, getRecentSearches, getShortcutText, getSuggestionsCache, highlightText, injectGlobalResponsiveStyles, injectSuggestionsStyles, lightThemeVariables, mediaQueries, minimalTheme, minimalThemeVariables, parseHighlightMarkup, removeRecentSearch, touchTargets, updateSuggestionsStyles, useAnalytics, useDocSearch, useSeekoraSearch$1 as useDocSearchSeekoraSearch, useInjectResponsiveStyles, useKeyboard, useNaturalLanguageFilters, useQuerySuggestions, useQuerySuggestionsEnhanced, useResponsive, useSearchContext, useSearchState, useSectionSearchContext, useSeekoraSearch, useSmartSuggestions, useSuggestionsAnalytics, useSuggestionsContext };
|
|
3664
|
+
export type { AnalyticsConfig, AnalyticsEventPayload, BaseDropdownProps, BrandFieldMapping, BreadcrumbItem, BreadcrumbProps, BreadcrumbTheme, CategoriesTabsProps, CategoryFieldMapping, ClearRefinementsProps, ClearRefinementsTheme, DocSearchAction, DocSearchButtonProps, DocSearchHit, DocSearchProps, DocSearchResponse, DocSearchState, DocSearchSuggestion, DocSearchSuggestionsResponse, DocSearchTranslations, DropdownClassNames, DropdownEventHandlers, DropdownPanelProps, DropdownRef, DropdownThemeConfig, FederatedDropdownProps, FederatedDropdownRef, FrequentlyBoughtTogetherProps, GenericItem, HierarchicalMenuItem, HierarchicalMenuProps, HierarchicalMenuTheme, HighlightMarkupOptions, HighlightProps, HighlightTheme, HitsPerPageItem, HitsPerPageProps, HitsPerPageTheme, ImageDisplayProps, ImageDisplayVariant, InfiniteHitsProps, InfiniteHitsTheme, ImageDisplayVariant$1 as ItemCardImageVariant, ItemCardProps, ItemGridProps, MobileFiltersButtonProps, MobileFiltersProps, MobileFiltersTheme, NaturalLanguageFiltersOptions, NaturalLanguageResult, NavigableItem, ParsedFilter, ProductCardImageVariant, ProductCardProps, ProductClickEventData, ProductDisplayConfig, ProductFieldMapping, ProductGalleryProps, ProductGridProps, ProductInfoProps, ProductRecommendationsProps, QuerySuggestionsDropdownProps, QuerySuggestionsDropdownRef, QuerySuggestionsProps, QuerySuggestionsTheme, RangeSliderProps, RangeSliderTheme, RecentSearchesListProps, RecentlyViewedProps, RecommendationItem, RecommendationTheme, RefinementInput, RelatedProductsProps, ResponsiveState, RichQuerySuggestionsProps, RichQuerySuggestionsRef, SearchBarProps, SearchBarTheme, SearchBarWithSuggestionsProps, SearchBarWithSuggestionsRef, SearchInputProps, SearchProviderProps, SearchResultsProps, SearchResultsTheme, SearchSource, SectionConfig, SectionErrorProps, SectionItemGridProps, SectionLoadingProps, SectionSearchContextValue, SectionSearchProviderProps, SmartSuggestion, SmartSuggestionsOptions, SnippetProps, SnippetTheme, SuggestionClickEventData, SuggestionDisplayConfig, SuggestionDropdownVariant, SuggestionFieldMapping, SuggestionImpressionEventData, SuggestionItemProps, SuggestionListProps, SuggestionSearchBarProps, SuggestionSearchBarRef, SuggestionsContextValue, SuggestionsDropdownCompositionProps, SuggestionsErrorProps, SuggestionsLoadingProps, SuggestionsProviderProps, SuggestionsThemeVariables, TrendingItemsProps, TrendingListProps, UseAnalyticsOptions, UseAnalyticsReturn, UseSeekoraSearchOptions$1 as UseDocSearchSeekoraSearchOptions, UseSeekoraSearchResult as UseDocSearchSeekoraSearchResult, UseQuerySuggestionsEnhancedOptions, UseQuerySuggestionsEnhancedReturn, UseSmartSuggestionsReturn, UseSuggestionsAnalyticsOptions, UseSuggestionsAnalyticsReturn };
|
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,
|
|
@@ -7105,10 +7111,45 @@ function DropdownPanel({ children, position = 'absolute', top = '100%', left = 0
|
|
|
7105
7111
|
return (React.createElement("div", { ref: panelRef, role: "listbox", className: clsx('seekora-suggestions-dropdown-panel', className), style: { ...panelStyle, ...style } }, children));
|
|
7106
7112
|
}
|
|
7107
7113
|
|
|
7114
|
+
/**
|
|
7115
|
+
* Parses suggestion text containing <mark>...</mark> and returns React nodes
|
|
7116
|
+
* with the marked segments rendered as <mark> elements. Safe: inner content
|
|
7117
|
+
* is rendered as text, not HTML.
|
|
7118
|
+
*/
|
|
7119
|
+
const defaultMarkStyle = {
|
|
7120
|
+
backgroundColor: 'var(--seekora-highlight-bg, rgba(251, 191, 36, 0.4))',
|
|
7121
|
+
fontWeight: 500,
|
|
7122
|
+
borderRadius: '2px',
|
|
7123
|
+
padding: '0 2px',
|
|
7124
|
+
};
|
|
7125
|
+
/**
|
|
7126
|
+
* Converts a string like "lined <mark>blue</mark>" into React nodes with
|
|
7127
|
+
* the marked part rendered as a <mark> element. When no <mark> tags are
|
|
7128
|
+
* present, returns the string as-is.
|
|
7129
|
+
*/
|
|
7130
|
+
function parseHighlightMarkup(text, options = {}) {
|
|
7131
|
+
if (text == null || typeof text !== 'string')
|
|
7132
|
+
return text;
|
|
7133
|
+
const parts = text.split(/(<mark>[\s\S]*?<\/mark>)/g);
|
|
7134
|
+
if (parts.length <= 1)
|
|
7135
|
+
return text;
|
|
7136
|
+
const { markClassName, markStyle } = options;
|
|
7137
|
+
return (React.createElement(React.Fragment, null, parts.map((part, i) => {
|
|
7138
|
+
const m = part.match(/^<mark>([\s\S]*)<\/mark>$/);
|
|
7139
|
+
if (m) {
|
|
7140
|
+
return (React.createElement("mark", { key: i, className: markClassName, style: { ...defaultMarkStyle, ...markStyle } }, m[1]));
|
|
7141
|
+
}
|
|
7142
|
+
return part;
|
|
7143
|
+
})));
|
|
7144
|
+
}
|
|
7145
|
+
|
|
7108
7146
|
/**
|
|
7109
7147
|
* SuggestionItem – single text suggestion row (primitive)
|
|
7110
7148
|
*
|
|
7111
|
-
* Highlights when isActive; onClick calls context selectSuggestion.
|
|
7149
|
+
* Highlights when isActive; onClick calls context selectSuggestion.
|
|
7150
|
+
* When enableHighlightMarkup is true (default), parses <mark>...</mark> in
|
|
7151
|
+
* suggestion text and renders as highlighted <mark> elements. Overridable via
|
|
7152
|
+
* renderHighlight, className/style.
|
|
7112
7153
|
*/
|
|
7113
7154
|
const defaultItemStyle = {
|
|
7114
7155
|
padding: '10px 12px',
|
|
@@ -7123,9 +7164,13 @@ const defaultItemStyle = {
|
|
|
7123
7164
|
color: 'var(--seekora-text-primary, #111827)',
|
|
7124
7165
|
transition: 'background-color 120ms ease',
|
|
7125
7166
|
};
|
|
7126
|
-
function SuggestionItem({ suggestion, index, isActive, onSelect, className, style, renderHighlight, }) {
|
|
7167
|
+
function SuggestionItem({ suggestion, index, isActive, onSelect, className, style, enableHighlightMarkup = true, highlightMarkupOptions, renderHighlight, }) {
|
|
7127
7168
|
const displayText = suggestion.highlightedQuery ?? suggestion.query;
|
|
7128
|
-
const content = renderHighlight
|
|
7169
|
+
const content = renderHighlight != null
|
|
7170
|
+
? renderHighlight(displayText)
|
|
7171
|
+
: enableHighlightMarkup
|
|
7172
|
+
? parseHighlightMarkup(displayText ?? '', highlightMarkupOptions)
|
|
7173
|
+
: (suggestion.query ?? displayText ?? '');
|
|
7129
7174
|
return (React.createElement("li", { role: "option", "aria-selected": isActive, id: `seekora-suggestion-${index}`, className: clsx('seekora-suggestions-item', isActive && 'seekora-suggestions-item--active', className), style: {
|
|
7130
7175
|
...defaultItemStyle,
|
|
7131
7176
|
...(isActive ? { backgroundColor: 'var(--seekora-bg-hover, #f3f4f6)' } : {}),
|
|
@@ -7156,13 +7201,15 @@ function SuggestionsLoading({ className, style, text = 'Loading...' }) {
|
|
|
7156
7201
|
/**
|
|
7157
7202
|
* SuggestionList – container for text suggestions (primitive)
|
|
7158
7203
|
*
|
|
7159
|
-
* Renders list of SuggestionItem from context; uses activeIndex for highlight.
|
|
7204
|
+
* Renders list of SuggestionItem from context; uses activeIndex for highlight.
|
|
7205
|
+
* Optional renderItem. When not using renderItem, enableHighlightMarkup and
|
|
7206
|
+
* highlightMarkupOptions control parsing of <mark>...</mark> in suggestion text.
|
|
7160
7207
|
*/
|
|
7161
7208
|
const listStyle = {
|
|
7162
7209
|
margin: 0,
|
|
7163
7210
|
padding: '4px 0',
|
|
7164
7211
|
};
|
|
7165
|
-
function SuggestionList({ maxItems = 10, className, style, listClassName, renderItem, }) {
|
|
7212
|
+
function SuggestionList({ maxItems = 10, className, style, listClassName, enableHighlightMarkup = true, highlightMarkupOptions, renderItem, }) {
|
|
7166
7213
|
const { suggestions, activeIndex, loading, selectSuggestion, getAllNavigableItems, } = useSuggestionsContext();
|
|
7167
7214
|
const items = suggestions.slice(0, maxItems);
|
|
7168
7215
|
const navigableItems = getAllNavigableItems();
|
|
@@ -7181,7 +7228,7 @@ function SuggestionList({ maxItems = 10, className, style, listClassName, render
|
|
|
7181
7228
|
if (renderItem) {
|
|
7182
7229
|
return (React.createElement("li", { key: suggestion.objectID ?? suggestion.query ?? i, role: "option" }, renderItem(suggestion, globalIndex, isActive, onSelect)));
|
|
7183
7230
|
}
|
|
7184
|
-
return (React.createElement(SuggestionItem, { key: suggestion.objectID ?? suggestion.query ?? i, suggestion: suggestion, index: globalIndex, isActive: isActive, onSelect: onSelect }));
|
|
7231
|
+
return (React.createElement(SuggestionItem, { key: suggestion.objectID ?? suggestion.query ?? i, suggestion: suggestion, index: globalIndex, isActive: isActive, onSelect: onSelect, enableHighlightMarkup: enableHighlightMarkup, highlightMarkupOptions: highlightMarkupOptions }));
|
|
7185
7232
|
}))));
|
|
7186
7233
|
}
|
|
7187
7234
|
|
|
@@ -11790,7 +11837,7 @@ const createStyles = (isMobile) => ({
|
|
|
11790
11837
|
// Component
|
|
11791
11838
|
// ============================================================================
|
|
11792
11839
|
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;
|
|
11840
|
+
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
11841
|
// Theme: prop overrides context (SearchProvider theme)
|
|
11795
11842
|
const searchContext = useSearchContext();
|
|
11796
11843
|
const effectiveTheme = theme ?? searchContext.theme;
|
|
@@ -11873,6 +11920,8 @@ const SuggestionSearchBar = forwardRef(function SuggestionSearchBar(props, ref)
|
|
|
11873
11920
|
const cacheOptions = {
|
|
11874
11921
|
maxSuggestions,
|
|
11875
11922
|
includeDropdownRecommendations,
|
|
11923
|
+
includeDropdownProductList,
|
|
11924
|
+
includeFilteredTabs,
|
|
11876
11925
|
includeCategories,
|
|
11877
11926
|
filteredTabs: filteredTabs?.map(t => t.filter).join(','),
|
|
11878
11927
|
};
|
|
@@ -11893,6 +11942,8 @@ const SuggestionSearchBar = forwardRef(function SuggestionSearchBar(props, ref)
|
|
|
11893
11942
|
const response = await client.getSuggestions?.(searchQuery, {
|
|
11894
11943
|
hitsPerPage: maxSuggestions,
|
|
11895
11944
|
include_dropdown_recommendations: includeDropdownRecommendations,
|
|
11945
|
+
include_dropdown_product_list: includeDropdownProductList,
|
|
11946
|
+
include_filtered_tabs: includeFilteredTabs,
|
|
11896
11947
|
include_categories: includeCategories,
|
|
11897
11948
|
filtered_tabs: filteredTabs,
|
|
11898
11949
|
analytics_tags: analyticsTags,
|
|
@@ -11931,7 +11982,7 @@ const SuggestionSearchBar = forwardRef(function SuggestionSearchBar(props, ref)
|
|
|
11931
11982
|
finally {
|
|
11932
11983
|
setLoading(false);
|
|
11933
11984
|
}
|
|
11934
|
-
}, [client, minQueryLength, maxSuggestions, includeDropdownRecommendations, includeCategories, filteredTabs, analyticsTags, enableAnalytics, analytics, cache]);
|
|
11985
|
+
}, [client, minQueryLength, maxSuggestions, includeDropdownRecommendations, includeDropdownProductList, includeFilteredTabs, includeCategories, filteredTabs, analyticsTags, enableAnalytics, analytics, cache]);
|
|
11935
11986
|
// Parse API response - handles multiple response formats
|
|
11936
11987
|
const parseAndSetData = useCallback((response) => {
|
|
11937
11988
|
// Handle different response structures from the API/SDK
|
|
@@ -14363,5 +14414,5 @@ function updateSuggestionsStyles(theme) {
|
|
|
14363
14414
|
injectSuggestionsStyles(theme, true);
|
|
14364
14415
|
}
|
|
14365
14416
|
|
|
14366
|
-
export { AmazonDropdown, Breadcrumb, CategoriesTabs, ClearRefinements, CurrentRefinements, DocSearch, DocSearchButton, DropdownPanel, Facets, FederatedDropdown, Fingerprint, FrequentlyBoughtTogether, GoogleDropdown, HierarchicalMenu, Highlight$1 as Highlight, HitsPerPage, ImageDisplay, InfiniteHits, ItemCard, ItemGrid, MinimalDropdown, MobileFilters, MobileFiltersButton, MobileSheetDropdown, Pagination, PinterestDropdown, ProductCard, ProductGallery, ProductGrid, ProductInfo, ProductRecommendations, QuerySuggestions, QuerySuggestionsDropdown, RangeInput, RangeSlider, RecentSearchesList, RecentlyViewed, RelatedProducts, RichQuerySuggestions, SearchBar, SearchBarWithSuggestions, SearchInput, SearchLayout, SearchProvider, SearchResults, SectionError, SectionItemGrid, SectionLoading, SectionSearchProvider, ShopifyDropdown, Snippet, SortBy, SpotlightDropdown, Stats, SuggestionDropdownVariants, SuggestionItem, SuggestionList, SuggestionSearchBar, SuggestionsDropdownComposition, SuggestionsError, SuggestionsLoading, SuggestionsProvider, TrendingItems, TrendingList, addRecentSearch, addToRecentlyViewed, brandPresets, breakpoints, clearRecentSearches, clearSuggestionsCache, createSuggestionsCache, createSuggestionsTheme, createTheme, darkTheme, darkThemeVariables, defaultTheme, extractBrand, extractCategory, extractProduct, extractSuggestion, formatParsedFilters, formatPrice as formatSuggestionPrice, generateSuggestionsStylesheet, getFingerprint, getRecentSearches, getShortcutText, getSuggestionsCache, highlightText, injectGlobalResponsiveStyles, injectSuggestionsStyles, lightThemeVariables, mediaQueries, mergeThemes, minimalTheme, minimalThemeVariables, removeRecentSearch, touchTargets, updateSuggestionsStyles, useAnalytics, useDocSearch, useSeekoraSearch$1 as useDocSearchSeekoraSearch, useInjectResponsiveStyles, useKeyboard, useNaturalLanguageFilters, useQuerySuggestions, useQuerySuggestionsEnhanced, useResponsive, useSearchContext, useSearchState, useSectionSearchContext, useSeekoraSearch, useSmartSuggestions, useSuggestionsAnalytics, useSuggestionsContext };
|
|
14417
|
+
export { AmazonDropdown, Breadcrumb, CategoriesTabs, ClearRefinements, CurrentRefinements, DocSearch, DocSearchButton, DropdownPanel, Facets, FederatedDropdown, Fingerprint, FrequentlyBoughtTogether, GoogleDropdown, HierarchicalMenu, Highlight$1 as Highlight, HitsPerPage, ImageDisplay, InfiniteHits, ItemCard, ItemGrid, MinimalDropdown, MobileFilters, MobileFiltersButton, MobileSheetDropdown, Pagination, PinterestDropdown, ProductCard, ProductGallery, ProductGrid, ProductInfo, ProductRecommendations, QuerySuggestions, QuerySuggestionsDropdown, RangeInput, RangeSlider, RecentSearchesList, RecentlyViewed, RelatedProducts, RichQuerySuggestions, SearchBar, SearchBarWithSuggestions, SearchInput, SearchLayout, SearchProvider, SearchResults, SectionError, SectionItemGrid, SectionLoading, SectionSearchProvider, ShopifyDropdown, Snippet, SortBy, SpotlightDropdown, Stats, SuggestionDropdownVariants, SuggestionItem, SuggestionList, SuggestionSearchBar, SuggestionsDropdownComposition, SuggestionsError, SuggestionsLoading, SuggestionsProvider, TrendingItems, TrendingList, addRecentSearch, addToRecentlyViewed, brandPresets, breakpoints, clearRecentSearches, clearSuggestionsCache, createSuggestionsCache, createSuggestionsTheme, createTheme, darkTheme, darkThemeVariables, defaultTheme, extractBrand, extractCategory, extractProduct, extractSuggestion, formatParsedFilters, formatPrice as formatSuggestionPrice, generateSuggestionsStylesheet, getFingerprint, getRecentSearches, getShortcutText, getSuggestionsCache, highlightText, injectGlobalResponsiveStyles, injectSuggestionsStyles, lightThemeVariables, mediaQueries, mergeThemes, minimalTheme, minimalThemeVariables, parseHighlightMarkup, removeRecentSearch, touchTargets, updateSuggestionsStyles, useAnalytics, useDocSearch, useSeekoraSearch$1 as useDocSearchSeekoraSearch, useInjectResponsiveStyles, useKeyboard, useNaturalLanguageFilters, useQuerySuggestions, useQuerySuggestionsEnhanced, useResponsive, useSearchContext, useSearchState, useSectionSearchContext, useSeekoraSearch, useSmartSuggestions, useSuggestionsAnalytics, useSuggestionsContext };
|
|
14367
14418
|
//# sourceMappingURL=index.esm.js.map
|