@envive-ai/react-widgets 0.1.2-arthur-3 → 0.1.3
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/SearchResults/SearchResults.cjs +86 -0
- package/dist/SearchResults/SearchResults.js +84 -0
- package/dist/SearchResults/SearchResultsWidget.cjs +34 -0
- package/dist/SearchResults/SearchResultsWidget.js +33 -0
- package/dist/SearchResults/index.cjs +2 -122
- package/dist/SearchResults/index.d.cts +2 -0
- package/dist/SearchResults/index.d.ts +2 -0
- package/dist/SearchResults/index.js +1 -119
- package/dist/SearchResults/withSearchResults.cjs +18 -0
- package/dist/SearchResults/withSearchResults.js +17 -0
- package/dist/SearchZeroState/SearchIcon.cjs +48 -0
- package/dist/SearchZeroState/SearchIcon.js +45 -0
- package/dist/SearchZeroState/SearchOverlay.cjs +42 -0
- package/dist/SearchZeroState/SearchOverlay.js +39 -0
- package/dist/SearchZeroState/SearchZeroState.cjs +173 -0
- package/dist/SearchZeroState/SearchZeroState.d.cts +7 -0
- package/dist/SearchZeroState/SearchZeroState.d.ts +7 -0
- package/dist/SearchZeroState/SearchZeroState.js +171 -0
- package/dist/SearchZeroState/SearchZeroStateWidget.cjs +23 -0
- package/dist/SearchZeroState/SearchZeroStateWidget.d.cts +15 -0
- package/dist/SearchZeroState/SearchZeroStateWidget.d.ts +15 -0
- package/dist/SearchZeroState/SearchZeroStateWidget.js +22 -0
- package/dist/SearchZeroState/components/RecommendedProducts.cjs +74 -0
- package/dist/SearchZeroState/components/RecommendedProducts.js +72 -0
- package/dist/SearchZeroState/index.cjs +4 -2996
- package/dist/SearchZeroState/index.d.cts +4 -0
- package/dist/SearchZeroState/index.d.ts +4 -0
- package/dist/SearchZeroState/index.js +2 -2991
- package/dist/SearchZeroState/overlay/overlayHostLocator.cjs +21 -0
- package/dist/SearchZeroState/overlay/overlayHostLocator.js +20 -0
- package/dist/SearchZeroState/types.d.cts +10 -0
- package/dist/SearchZeroState/types.d.ts +10 -0
- package/dist/SearchZeroState/zeroStateSearchVariants.cjs +21 -0
- package/dist/SearchZeroState/zeroStateSearchVariants.js +20 -0
- package/dist/SuggestionBar/SuggestionBar.cjs +74 -0
- package/dist/SuggestionBar/{index-DZU9kbWS.d.cts → SuggestionBar.d.cts} +4 -9
- package/dist/SuggestionBar/{index-DyXd4-b7.d.ts → SuggestionBar.d.ts} +6 -11
- package/dist/SuggestionBar/SuggestionBar.js +72 -0
- package/dist/SuggestionBar/index.cjs +3 -3
- package/dist/SuggestionBar/index.d.cts +3 -0
- package/dist/SuggestionBar/index.d.ts +3 -0
- package/dist/SuggestionBar/index.js +2 -2
- package/dist/SuggestionBar/types.cjs +10 -0
- package/dist/SuggestionBar/types.d.cts +7 -0
- package/dist/SuggestionBar/types.d.ts +7 -0
- package/dist/SuggestionBar/types.js +9 -0
- package/dist/SuggestionButtonContainer/SuggestionButtonContainer.cjs +76 -0
- package/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.cts +6 -0
- package/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +6 -0
- package/dist/SuggestionButtonContainer/SuggestionButtonContainer.js +75 -0
- package/dist/SuggestionButtonContainer/index.cjs +1 -1
- package/dist/SuggestionButtonContainer/index.d.cts +3 -0
- package/dist/SuggestionButtonContainer/index.d.ts +3 -0
- package/dist/SuggestionButtonContainer/index.js +1 -1
- package/dist/SuggestionButtonContainer/{index-B_X537jw.d.cts → types.d.cts} +1 -4
- package/dist/SuggestionButtonContainer/{index-vwelzDzM.d.ts → types.d.ts} +1 -4
- package/dist/_virtual/rolldown_runtime.cjs +33 -0
- package/dist/node_modules/react-icons/lib/iconBase.cjs +121 -0
- package/dist/node_modules/react-icons/lib/iconBase.js +119 -0
- package/dist/node_modules/react-icons/lib/iconContext.cjs +17 -0
- package/dist/node_modules/react-icons/lib/iconContext.js +14 -0
- package/dist/node_modules/react-icons/md/index.cjs +35 -0
- package/dist/node_modules/react-icons/md/index.js +35 -0
- package/dist/{SuggestionBar-BOThXJvJ.cjs → node_modules/react-indiana-drag-scroll/dist/index.cjs} +6 -139
- package/dist/node_modules/uuid/dist/native.js +6 -0
- package/dist/node_modules/uuid/dist/rng.js +13 -0
- package/dist/node_modules/uuid/dist/stringify.js +9 -0
- package/dist/node_modules/uuid/dist/v4.js +27 -0
- package/dist/node_modules/uuid/dist-node/native.cjs +8 -0
- package/dist/node_modules/uuid/dist-node/rng.cjs +16 -0
- package/dist/node_modules/uuid/dist-node/stringify.cjs +10 -0
- package/dist/node_modules/uuid/dist-node/v4.cjs +27 -0
- package/dist/packages/components/dist/components/Accordion/Accordion.cjs +80 -0
- package/dist/packages/components/dist/components/Accordion/Accordion.js +78 -0
- package/dist/packages/components/dist/components/Accordion/index.cjs +1 -0
- package/dist/packages/components/dist/components/Accordion/index.js +1 -0
- package/dist/packages/components/dist/components/AnimatedChevron/AnimatedChevron.cjs +30 -0
- package/dist/packages/components/dist/components/AnimatedChevron/AnimatedChevron.js +29 -0
- package/dist/packages/components/dist/components/ButtonBase/ButtonBase.cjs +56 -0
- package/dist/packages/components/dist/components/ButtonBase/ButtonBase.js +54 -0
- package/dist/packages/components/dist/components/ButtonBase/index.cjs +2 -0
- package/dist/packages/components/dist/components/ButtonBase/index.js +2 -0
- package/dist/packages/components/dist/components/ButtonBase/types.cjs +11 -0
- package/dist/packages/components/dist/components/ButtonBase/types.js +10 -0
- package/dist/packages/components/dist/components/FilterScrollbar/AppliedFiltersScrollbar.cjs +45 -0
- package/dist/packages/components/dist/components/FilterScrollbar/AppliedFiltersScrollbar.js +42 -0
- package/dist/packages/components/dist/components/FilterScrollbar/DynamicFiltersScrollbar.cjs +33 -0
- package/dist/packages/components/dist/components/FilterScrollbar/DynamicFiltersScrollbar.js +30 -0
- package/dist/packages/components/dist/components/ImageWithFallback/ImageWithFallback.cjs +45 -0
- package/dist/packages/components/dist/components/ImageWithFallback/ImageWithFallback.js +42 -0
- package/dist/packages/components/dist/components/ImageWithFallback/index.cjs +1 -0
- package/dist/packages/components/dist/components/ImageWithFallback/index.js +1 -0
- package/dist/packages/components/dist/components/ModalSheet/ModalSheet.cjs +30 -0
- package/dist/packages/components/dist/components/ModalSheet/ModalSheet.js +29 -0
- package/dist/packages/components/dist/components/ModalSheet/desktop/desktopHeader.cjs +26 -0
- package/dist/packages/components/dist/components/ModalSheet/desktop/desktopHeader.js +24 -0
- package/dist/packages/components/dist/components/ModalSheet/desktop/index.cjs +122 -0
- package/dist/packages/components/dist/components/ModalSheet/desktop/index.js +120 -0
- package/dist/packages/components/dist/components/ModalSheet/index.cjs +1 -0
- package/dist/packages/components/dist/components/ModalSheet/index.js +1 -0
- package/dist/packages/components/dist/components/ModalSheet/mobile/index.cjs +116 -0
- package/dist/packages/components/dist/components/ModalSheet/mobile/index.js +114 -0
- package/dist/packages/components/dist/components/ModalSheet/mobile/mobileHeader.cjs +38 -0
- package/dist/packages/components/dist/components/ModalSheet/mobile/mobileHeader.js +36 -0
- package/dist/packages/components/dist/components/ProductCard/ProductCard.cjs +153 -0
- package/dist/packages/components/dist/components/ProductCard/ProductCard.js +149 -0
- package/dist/packages/components/dist/components/ProductCard/ProductCardSkeleton.cjs +33 -0
- package/dist/packages/components/dist/components/ProductCard/ProductCardSkeleton.js +31 -0
- package/dist/packages/components/dist/components/ProductCard/index.cjs +4 -0
- package/dist/packages/components/dist/components/ProductCard/index.js +4 -0
- package/dist/packages/components/dist/components/ProductCard/productCardVariants.cjs +49 -0
- package/dist/packages/components/dist/components/ProductCard/productCardVariants.js +45 -0
- package/dist/packages/components/dist/components/ProductCard/types.cjs +10 -0
- package/dist/packages/components/dist/components/ProductCard/types.js +9 -0
- package/dist/packages/components/dist/components/ProductGrid/ProductGrid.cjs +43 -0
- package/dist/packages/components/dist/components/ProductGrid/ProductGrid.js +41 -0
- package/dist/packages/components/dist/components/ProductGrid/index.cjs +2 -0
- package/dist/packages/components/dist/components/ProductGrid/index.js +2 -0
- package/dist/packages/components/dist/components/ProductGrid/productGridVariants.cjs +21 -0
- package/dist/packages/components/dist/components/ProductGrid/productGridVariants.js +20 -0
- package/dist/packages/components/dist/components/RadioButton/RadioButton.cjs +74 -0
- package/dist/packages/components/dist/components/RadioButton/RadioButton.js +72 -0
- package/dist/packages/components/dist/components/RadioButton/index.cjs +1 -0
- package/dist/packages/components/dist/components/RadioButton/index.js +1 -0
- package/dist/packages/components/dist/components/RadioButtonGroup/RadioButtonGroup.cjs +42 -0
- package/dist/packages/components/dist/components/RadioButtonGroup/RadioButtonGroup.js +39 -0
- package/dist/packages/components/dist/components/RadioButtonGroup/index.cjs +1 -0
- package/dist/packages/components/dist/components/RadioButtonGroup/index.js +1 -0
- package/dist/packages/components/dist/components/RecommendedProducts/RecommendedProducts.cjs +53 -0
- package/dist/packages/components/dist/components/RecommendedProducts/RecommendedProducts.js +51 -0
- package/dist/packages/components/dist/components/RecommendedProducts/index.cjs +3 -0
- package/dist/packages/components/dist/components/RecommendedProducts/index.js +3 -0
- package/dist/packages/components/dist/components/SearchAutocomplete/SearchAutocomplete.cjs +72 -0
- package/dist/packages/components/dist/components/SearchAutocomplete/SearchAutocomplete.js +69 -0
- package/dist/packages/components/dist/components/SearchAutocomplete/index.cjs +1 -0
- package/dist/packages/components/dist/components/SearchAutocomplete/index.js +1 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilter.cjs +134 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilter.js +132 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterFooter.cjs +48 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterFooter.js +46 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterHeader.cjs +42 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterHeader.js +40 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterItem.cjs +6 -0
- package/dist/packages/components/dist/components/SearchFilter/SearchFilterItem.js +4 -0
- package/dist/packages/components/dist/components/SearchFilter/index.cjs +5 -0
- package/dist/packages/components/dist/components/SearchFilter/index.js +5 -0
- package/dist/packages/components/dist/components/SearchFilter/useHasFilterStateChanged.cjs +27 -0
- package/dist/packages/components/dist/components/SearchFilter/useHasFilterStateChanged.js +26 -0
- package/dist/packages/components/dist/components/SearchFilter/utils.cjs +11 -0
- package/dist/packages/components/dist/components/SearchFilter/utils.js +9 -0
- package/dist/packages/components/dist/components/SearchInput/SearchInput.cjs +81 -0
- package/dist/packages/components/dist/components/SearchInput/SearchInput.js +78 -0
- package/dist/packages/components/dist/components/SearchInput/index.cjs +2 -0
- package/dist/packages/components/dist/components/SearchInput/index.js +2 -0
- package/dist/packages/components/dist/components/SearchInput/searchInputVariants.cjs +15 -0
- package/dist/packages/components/dist/components/SearchInput/searchInputVariants.js +15 -0
- package/dist/packages/components/dist/components/SearchInputForm/SearchInputForm.cjs +57 -0
- package/dist/packages/components/dist/components/SearchInputForm/SearchInputForm.js +55 -0
- package/dist/packages/components/dist/components/SearchInputForm/index.cjs +1 -0
- package/dist/packages/components/dist/components/SearchInputForm/index.js +1 -0
- package/dist/packages/components/dist/components/SearchResultsContent/SearchResultsContent.cjs +52 -0
- package/dist/packages/components/dist/components/SearchResultsContent/SearchResultsContent.js +50 -0
- package/dist/packages/components/dist/components/SearchResultsContent/index.cjs +1 -0
- package/dist/packages/components/dist/components/SearchResultsContent/index.js +1 -0
- package/dist/packages/components/dist/components/SearchResultsFilterButton/SearchResultsFilterButton.cjs +24 -0
- package/dist/packages/components/dist/components/SearchResultsFilterButton/SearchResultsFilterButton.js +23 -0
- package/dist/packages/components/dist/components/SearchResultsFilterButton/index.cjs +3 -0
- package/dist/packages/components/dist/components/SearchResultsFilterButton/index.js +3 -0
- package/dist/packages/components/dist/components/SearchResultsFilterModal/SearchResultsFilterModal.cjs +36 -0
- package/dist/packages/components/dist/components/SearchResultsFilterModal/SearchResultsFilterModal.js +35 -0
- package/dist/packages/components/dist/components/SearchResultsFilterModal/index.cjs +3 -0
- package/dist/packages/components/dist/components/SearchResultsFilterModal/index.js +3 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/SearchResultsFilter.cjs +9 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/SearchResultsFilter.js +9 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/index.cjs +2 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/index.js +2 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/searchFilterSidebarVariants.cjs +34 -0
- package/dist/packages/components/dist/components/SearchResultsFilterSidebar/searchFilterSidebarVariants.js +34 -0
- package/dist/packages/components/dist/components/SearchResultsStates/NoSearchResultsFound.cjs +56 -0
- package/dist/packages/components/dist/components/SearchResultsStates/NoSearchResultsFound.js +54 -0
- package/dist/packages/components/dist/components/SearchResultsStates/SearchResultsGrid.cjs +53 -0
- package/dist/packages/components/dist/components/SearchResultsStates/SearchResultsGrid.js +51 -0
- package/dist/packages/components/dist/components/SearchResultsStates/SearchResultsLoadingGrid.cjs +52 -0
- package/dist/packages/components/dist/components/SearchResultsStates/SearchResultsLoadingGrid.js +51 -0
- package/dist/packages/components/dist/components/SearchResultsStates/index.cjs +3 -0
- package/dist/packages/components/dist/components/SearchResultsStates/index.js +3 -0
- package/dist/packages/components/dist/components/SearchResultsToolbar/SearchResultsToolbar.cjs +60 -0
- package/dist/packages/components/dist/components/SearchResultsToolbar/SearchResultsToolbar.js +57 -0
- package/dist/packages/components/dist/components/SearchResultsToolbar/index.cjs +3 -0
- package/dist/packages/components/dist/components/SearchResultsToolbar/index.js +3 -0
- package/dist/packages/components/dist/components/SparkleAnimation/SparkleAnimation.cjs +77 -0
- package/dist/packages/components/dist/components/SparkleAnimation/SparkleAnimation.js +75 -0
- package/dist/packages/components/dist/components/SparkleAnimation/index.cjs +2 -0
- package/dist/packages/components/dist/components/SparkleAnimation/index.js +2 -0
- package/dist/packages/components/dist/components/SparkleAnimation/types.cjs +12 -0
- package/dist/packages/components/dist/components/SparkleAnimation/types.js +11 -0
- package/dist/packages/components/dist/components/Spinner/Spinner.cjs +40 -0
- package/dist/packages/components/dist/components/Spinner/Spinner.js +38 -0
- package/dist/packages/components/dist/components/Spinner/index.cjs +1 -0
- package/dist/packages/components/dist/components/Spinner/index.js +1 -0
- package/dist/packages/components/dist/components/SuggestionButton/SuggestionButton.cjs +193 -0
- package/dist/packages/components/dist/components/SuggestionButton/SuggestionButton.js +188 -0
- package/dist/packages/components/dist/components/SuggestionButton/index.cjs +1 -0
- package/dist/packages/components/dist/components/SuggestionButton/index.js +1 -0
- package/dist/packages/components/dist/components/TextInput/TextInput.cjs +34 -0
- package/dist/packages/components/dist/components/TextInput/TextInput.js +31 -0
- package/dist/packages/components/dist/components/TextInput/index.cjs +1 -0
- package/dist/packages/components/dist/components/TextInput/index.js +1 -0
- package/dist/packages/components/dist/components/ToggleButton/ToggleButton.cjs +63 -0
- package/dist/packages/components/dist/components/ToggleButton/ToggleButton.js +61 -0
- package/dist/packages/components/dist/components/ToggleButton/index.cjs +1 -0
- package/dist/packages/components/dist/components/ToggleButton/index.js +1 -0
- package/dist/packages/components/dist/components/Typography/Typography.cjs +53 -0
- package/dist/packages/components/dist/components/Typography/Typography.js +50 -0
- package/dist/packages/components/dist/components/Typography/index.cjs +2 -0
- package/dist/packages/components/dist/components/Typography/index.js +2 -0
- package/dist/packages/components/dist/components/Typography/typographyVariantClasses.cjs +99 -0
- package/dist/packages/components/dist/components/Typography/typographyVariantClasses.js +96 -0
- package/dist/packages/components/dist/components/Typography/util.cjs +10 -0
- package/dist/packages/components/dist/components/Typography/util.js +10 -0
- package/dist/packages/components/dist/logging/logger.cjs +20 -0
- package/dist/packages/components/dist/logging/logger.js +19 -0
- package/dist/packages/components/dist/models/colorsConfig.cjs +28 -0
- package/dist/packages/components/dist/models/colorsConfig.js +26 -0
- package/dist/packages/components/dist/util/formatPrice.cjs +14 -0
- package/dist/packages/components/dist/util/formatPrice.js +13 -0
- package/dist/packages/components/dist/util/index.cjs +3 -0
- package/dist/packages/components/dist/util/index.js +3 -0
- package/dist/packages/components/dist/util/useScrollDirection.cjs +39 -0
- package/dist/packages/components/dist/util/useScrollDirection.js +38 -0
- package/dist/packages/components/dist/util/useStickyVisibility.cjs +38 -0
- package/dist/packages/components/dist/util/useStickyVisibility.js +37 -0
- package/dist/packages/icons/dist/AiSearchBold.cjs +38 -0
- package/dist/packages/icons/dist/AiSearchBold.js +38 -0
- package/dist/packages/icons/dist/AiSearchThin.cjs +35 -0
- package/dist/packages/icons/dist/AiSearchThin.js +35 -0
- package/dist/packages/icons/dist/ChevronDown.cjs +23 -0
- package/dist/packages/icons/dist/ChevronDown.js +23 -0
- package/dist/packages/icons/dist/FourPointStar.cjs +22 -0
- package/dist/packages/icons/dist/FourPointStar.js +22 -0
- package/dist/packages/icons/dist/IconClose.cjs +26 -0
- package/dist/packages/icons/dist/IconClose.js +26 -0
- package/dist/packages/icons/dist/IconCloseVariant.cjs +22 -0
- package/dist/packages/icons/dist/IconCloseVariant.js +22 -0
- package/dist/packages/icons/dist/MagnifyingGlassStarVariant.cjs +39 -0
- package/dist/packages/icons/dist/MagnifyingGlassStarVariant.js +39 -0
- package/dist/packages/icons/dist/OutlinedStar.cjs +22 -0
- package/dist/packages/icons/dist/OutlinedStar.js +22 -0
- package/dist/packages/icons/dist/SettingsVariant.cjs +72 -0
- package/dist/packages/icons/dist/SettingsVariant.js +72 -0
- package/dist/packages/icons/dist/Sparkles.cjs +43 -0
- package/dist/packages/icons/dist/Sparkles.js +43 -0
- package/dist/{chunk-DWy1uDak.cjs → packages/icons/dist/_virtual/rolldown_runtime.cjs} +4 -14
- package/dist/packages/icons/dist/_virtual/rolldown_runtime.js +27 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +696 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.js +696 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs +43 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +43 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.development.cjs +1528 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.development.js +1528 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.cjs +329 -0
- package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.js +329 -0
- package/dist/packages/icons/dist/node_modules/react/index.cjs +13 -0
- package/dist/packages/icons/dist/node_modules/react/index.js +13 -0
- package/dist/packages/icons/dist/node_modules/react/jsx-runtime.cjs +13 -0
- package/dist/packages/icons/dist/node_modules/react/jsx-runtime.js +13 -0
- package/dist/util/useHorizontalScrollAnimation.cjs +88 -0
- package/dist/util/useHorizontalScrollAnimation.js +87 -0
- package/dist/util/useReducedMotionWithOverride.cjs +15 -0
- package/dist/util/useReducedMotionWithOverride.js +14 -0
- package/package.json +14 -8
- package/src/SearchResults/SearchResults.tsx +2 -4
- package/src/SearchResults/SearchResultsWidget.tsx +1 -1
- package/src/SearchResults/types.ts +0 -3
- package/src/SearchZeroState/SearchIcon.tsx +16 -9
- package/src/SearchZeroState/SearchOverlay.tsx +3 -2
- package/src/SearchZeroState/SearchZeroState.tsx +15 -18
- package/src/SearchZeroState/SearchZeroStateWidget.tsx +17 -8
- package/src/SearchZeroState/components/RecommendedProducts.tsx +8 -3
- package/src/SearchZeroState/overlay/overlayHostLocator.ts +2 -4
- package/src/SearchZeroState/types.ts +4 -1
- package/src/SearchZeroState/zeroStateSearchVariants.ts +14 -5
- package/src/SuggestionBar/SuggestionBar.tsx +12 -20
- package/src/SuggestionBar/types.ts +3 -3
- package/src/SuggestionButtonContainer/SuggestionButtonContainer.tsx +8 -17
- package/src/SuggestionButtonContainer/types.ts +3 -4
- package/src/stories/SearchResults.stories.tsx +1 -1
- package/src/stories/SearchZeroState.stories.tsx +10 -2
- package/src/stories/SuggestionBar.stories.tsx +1 -2
- package/src/util/useHorizontalScrollAnimation.ts +1 -1
- package/dist/SearchZeroState/index-19CiYvee.d.cts +0 -27
- package/dist/SearchZeroState/index-6EaGWYP4.d.ts +0 -27
- package/dist/SuggestionBar-DeMmAK4M.js +0 -131
- package/dist/SuggestionButtonContainer-BeWPpeQk.cjs +0 -173
- package/dist/SuggestionButtonContainer-CZhOkZaJ.js +0 -167
- /package/dist/SearchResults/{index-D8nrHueo.d.ts → SearchResultsWidget.d.cts} +0 -0
- /package/dist/SearchResults/{index-D52sX_I2.d.cts → SearchResultsWidget.d.ts} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_overlayHostLocator = require('./overlay/overlayHostLocator.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
5
|
+
let classnames = require("classnames");
|
|
6
|
+
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let framer_motion = require("framer-motion");
|
|
9
|
+
let react_dom = require("react-dom");
|
|
10
|
+
|
|
11
|
+
//#region src/SearchZeroState/SearchOverlay.tsx
|
|
12
|
+
const SearchOverlay = react.default.forwardRef(({ children, className, dataTestId, role, ariaModal, ariaLabelledby, id, usingPortal }, ref) => {
|
|
13
|
+
const overlayClasses = (0, classnames.default)("spiffy-search-overlay", "spiffy-tw-fixed", "spiffy-tw-top-[0]", "spiffy-tw-left-[0]", "spiffy-tw-h-[100vh]", "spiffy-tw-w-full", "spiffy-h-[calc(100%-1rem)]", "spiffy-tw-px-[24px] spiffy-tw-pt-[16px] sm:spiffy-tw-px-[41px] sm:spiffy-tw-pt-[40px]", "spiffy-tw-z-[2147483647]", "spiffy-tw-overflow-y-auto", "spiffy-tw-overflow-x-hidden", className);
|
|
14
|
+
const overlayContentClasses = (0, classnames.default)("spiffy-search-overlay-content", "spiffy-tw-flex spiffy-tw-flex-col", "spiffy-tw-min-h-full", className);
|
|
15
|
+
const node = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
16
|
+
ref,
|
|
17
|
+
className: overlayClasses,
|
|
18
|
+
initial: { opacity: 0 },
|
|
19
|
+
animate: { opacity: 1 },
|
|
20
|
+
exit: { opacity: 0 },
|
|
21
|
+
transition: { duration: .2 },
|
|
22
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
23
|
+
className: overlayContentClasses,
|
|
24
|
+
"data-testid": dataTestId,
|
|
25
|
+
role,
|
|
26
|
+
"aria-modal": ariaModal,
|
|
27
|
+
"aria-labelledby": ariaLabelledby,
|
|
28
|
+
id,
|
|
29
|
+
children
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
if (!usingPortal) return node;
|
|
33
|
+
try {
|
|
34
|
+
return (0, react_dom.createPortal)(node, require_overlayHostLocator.getOverlayPortalTarget());
|
|
35
|
+
} catch (err) {
|
|
36
|
+
return node;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
SearchOverlay.displayName = "SearchOverlay";
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
exports.SearchOverlay = SearchOverlay;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getOverlayPortalTarget } from "./overlay/overlayHostLocator.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { motion } from "framer-motion";
|
|
6
|
+
import { createPortal } from "react-dom";
|
|
7
|
+
|
|
8
|
+
//#region src/SearchZeroState/SearchOverlay.tsx
|
|
9
|
+
const SearchOverlay = React.forwardRef(({ children, className, dataTestId, role, ariaModal, ariaLabelledby, id, usingPortal }, ref) => {
|
|
10
|
+
const overlayClasses = classNames("spiffy-search-overlay", "spiffy-tw-fixed", "spiffy-tw-top-[0]", "spiffy-tw-left-[0]", "spiffy-tw-h-[100vh]", "spiffy-tw-w-full", "spiffy-h-[calc(100%-1rem)]", "spiffy-tw-px-[24px] spiffy-tw-pt-[16px] sm:spiffy-tw-px-[41px] sm:spiffy-tw-pt-[40px]", "spiffy-tw-z-[2147483647]", "spiffy-tw-overflow-y-auto", "spiffy-tw-overflow-x-hidden", className);
|
|
11
|
+
const overlayContentClasses = classNames("spiffy-search-overlay-content", "spiffy-tw-flex spiffy-tw-flex-col", "spiffy-tw-min-h-full", className);
|
|
12
|
+
const node = /* @__PURE__ */ jsx(motion.div, {
|
|
13
|
+
ref,
|
|
14
|
+
className: overlayClasses,
|
|
15
|
+
initial: { opacity: 0 },
|
|
16
|
+
animate: { opacity: 1 },
|
|
17
|
+
exit: { opacity: 0 },
|
|
18
|
+
transition: { duration: .2 },
|
|
19
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
20
|
+
className: overlayContentClasses,
|
|
21
|
+
"data-testid": dataTestId,
|
|
22
|
+
role,
|
|
23
|
+
"aria-modal": ariaModal,
|
|
24
|
+
"aria-labelledby": ariaLabelledby,
|
|
25
|
+
id,
|
|
26
|
+
children
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
if (!usingPortal) return node;
|
|
30
|
+
try {
|
|
31
|
+
return createPortal(node, getOverlayPortalTarget());
|
|
32
|
+
} catch (err) {
|
|
33
|
+
return node;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
SearchOverlay.displayName = "SearchOverlay";
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { SearchOverlay };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_Typography = require('../packages/components/dist/components/Typography/Typography.cjs');
|
|
3
|
+
require('../packages/components/dist/components/Typography/index.cjs');
|
|
4
|
+
const require_SuggestionBar = require('../SuggestionBar/SuggestionBar.cjs');
|
|
5
|
+
require('../SuggestionBar/index.cjs');
|
|
6
|
+
const require_Sparkles = require('../packages/icons/dist/Sparkles.cjs');
|
|
7
|
+
const require_searchInputVariants = require('../packages/components/dist/components/SearchInput/searchInputVariants.cjs');
|
|
8
|
+
const require_SearchInput = require('../packages/components/dist/components/SearchInput/SearchInput.cjs');
|
|
9
|
+
const require_SearchInputForm = require('../packages/components/dist/components/SearchInputForm/SearchInputForm.cjs');
|
|
10
|
+
require('../packages/components/dist/components/SearchInputForm/index.cjs');
|
|
11
|
+
require('../packages/components/dist/components/SearchInput/index.cjs');
|
|
12
|
+
const require_IconCloseVariant = require('../packages/icons/dist/IconCloseVariant.cjs');
|
|
13
|
+
const require_SearchOverlay = require('./SearchOverlay.cjs');
|
|
14
|
+
const require_zeroStateSearchVariants = require('./zeroStateSearchVariants.cjs');
|
|
15
|
+
const require_SearchIcon = require('./SearchIcon.cjs');
|
|
16
|
+
const require_RecommendedProducts = require('./components/RecommendedProducts.cjs');
|
|
17
|
+
let react = require("react");
|
|
18
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
19
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
20
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
21
|
+
let framer_motion = require("framer-motion");
|
|
22
|
+
let __envive_ai_react_hooks_hooks_Search = require("@envive-ai/react-hooks/hooks/Search");
|
|
23
|
+
let __envive_ai_react_hooks_hooks_AmplitudeOperations = require("@envive-ai/react-hooks/hooks/AmplitudeOperations");
|
|
24
|
+
let __envive_ai_react_hooks_types = require("@envive-ai/react-hooks/types");
|
|
25
|
+
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
26
|
+
|
|
27
|
+
//#region src/SearchZeroState/SearchZeroState.tsx
|
|
28
|
+
const SEARCH_ENTRYPOINT_INPUT_TESTID = "spiffy-search-entrypoint-input";
|
|
29
|
+
const SearchZeroState = ({ widgetConfig, initialIsOpen, entryPointRef }) => {
|
|
30
|
+
console.log("SearchZeroState: widgetConfig", widgetConfig);
|
|
31
|
+
const { searchZeroStateVariant, searchInputVariant, searchIconVariant, searchIconSize = 24, searchBoxPlaceholder, layout, compactLabel, initialSuggestions = [], animationSpeed = "standard", suggestionButtonConfig, includeSubtitle, usingPortal = false } = widgetConfig;
|
|
32
|
+
const { variant: suggestionButtonVariant, hoverVariant: suggestionButtonHoverVariant, borderRadius: suggestionButtonBorderRadius } = suggestionButtonConfig;
|
|
33
|
+
const [isOpen, setIsOpen] = (0, react.useState)(!!initialIsOpen);
|
|
34
|
+
const searchInputRef = (0, react.useRef)(null);
|
|
35
|
+
const searchInput = (0, __envive_ai_react_hooks_hooks_Search.useSearch)({ allowRedirect: true });
|
|
36
|
+
const { track } = (0, __envive_ai_react_hooks_hooks_AmplitudeOperations.useAmplitudeTracking)();
|
|
37
|
+
const { recommendedProductsHeading, searchOverlayHeading, productCardConfig, merchantShortName, recommendedProducts, searchText, autocompleteResults, focusedIndex, focusedOptionId, shouldShowAutocomplete, onSearchInputChange, onSearchInputFocus, onSearchInputBlur, onKeyDown, onAutocompleteSelect, onSubmitSearch, resetSearch } = searchInput;
|
|
38
|
+
const { overlayBackgroundClasses, sparklesIconColor } = require_zeroStateSearchVariants.searchZeroStateVariantClasses[searchZeroStateVariant && require_zeroStateSearchVariants.searchZeroStateVariantClasses[searchZeroStateVariant] ? searchZeroStateVariant : "backgroundTertiary"];
|
|
39
|
+
const { searchInputIconColor } = require_searchInputVariants.searchInputVariantClasses[searchInputVariant];
|
|
40
|
+
const handleOpen = () => setIsOpen(true);
|
|
41
|
+
const handleClose = () => setIsOpen(false);
|
|
42
|
+
(0, react.useEffect)(() => {
|
|
43
|
+
if (isOpen) track(__envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.SearchComponentVisible, { eventProps: { search_component: __envive_ai_react_hooks_application_models.SpiffyWidgets.SearchZeroState } });
|
|
44
|
+
}, [isOpen, track]);
|
|
45
|
+
(0, react.useEffect)(() => {
|
|
46
|
+
if (isOpen) {
|
|
47
|
+
resetSearch();
|
|
48
|
+
searchInputRef.current?.focus();
|
|
49
|
+
}
|
|
50
|
+
}, [isOpen, resetSearch]);
|
|
51
|
+
const submitSearchString = (0, react.useCallback)((query) => {
|
|
52
|
+
onSearchInputChange(query);
|
|
53
|
+
if (onSubmitSearch && query.trim()) {
|
|
54
|
+
onSubmitSearch();
|
|
55
|
+
setIsOpen(false);
|
|
56
|
+
}
|
|
57
|
+
}, [onSubmitSearch, onSearchInputChange]);
|
|
58
|
+
const searchChange = (value) => {
|
|
59
|
+
onSearchInputChange(value);
|
|
60
|
+
};
|
|
61
|
+
if (!isOpen) {
|
|
62
|
+
if (layout === "icon") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SearchIcon.SearchIcon, {
|
|
63
|
+
entryPointRef,
|
|
64
|
+
size: searchIconSize,
|
|
65
|
+
variant: searchIconVariant,
|
|
66
|
+
label: compactLabel,
|
|
67
|
+
onClick: handleOpen,
|
|
68
|
+
color: searchInputIconColor
|
|
69
|
+
});
|
|
70
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SearchInput.SearchInput, {
|
|
71
|
+
value: "",
|
|
72
|
+
onChange: () => {},
|
|
73
|
+
placeholder: searchBoxPlaceholder,
|
|
74
|
+
suggestions: [],
|
|
75
|
+
onFocus: handleOpen,
|
|
76
|
+
searchInputVariant,
|
|
77
|
+
dataTestId: SEARCH_ENTRYPOINT_INPUT_TESTID
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.AnimatePresence, { children: isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_SearchOverlay.SearchOverlay, {
|
|
81
|
+
role: "dialog",
|
|
82
|
+
ariaModal: true,
|
|
83
|
+
ariaLabelledby: "global-search-title",
|
|
84
|
+
className: overlayBackgroundClasses,
|
|
85
|
+
usingPortal,
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
88
|
+
className: "spiffy-tw-relative spiffy-tw-mb-4",
|
|
89
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
90
|
+
className: "spiffy-tw-flex spiffy-tw-items-center",
|
|
91
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
92
|
+
id: "global-search-title",
|
|
93
|
+
variant: "t3",
|
|
94
|
+
children: searchOverlayHeading
|
|
95
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Sparkles.Sparkles_default, {
|
|
96
|
+
className: "spiffy-tw-ml-2 spiffy-tw-h-[36px] spiffy-tw-w-[24px] sm:spiffy-tw-h-[45px] sm:spiffy-tw-w-[36px]",
|
|
97
|
+
color: sparklesIconColor,
|
|
98
|
+
stroke: "2px"
|
|
99
|
+
})]
|
|
100
|
+
}), includeSubtitle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
101
|
+
variant: "body2",
|
|
102
|
+
children: "Go ahead, get as specific as you like..."
|
|
103
|
+
})]
|
|
104
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
105
|
+
onClick: handleClose,
|
|
106
|
+
className: "spiffy-tw-absolute spiffy-tw-right-4 spiffy-tw-top-4 sm:spiffy-tw-right-8 sm:spiffy-tw-top-8",
|
|
107
|
+
"aria-label": "Close search",
|
|
108
|
+
type: "button",
|
|
109
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_IconCloseVariant.IconCloseVariant_default, {
|
|
110
|
+
className: "spiffy-tw-h-[20px] spiffy-tw-w-[20px] sm:spiffy-tw-h-[28px] sm:spiffy-tw-w-[28px]",
|
|
111
|
+
strokeWidth: "2px"
|
|
112
|
+
})
|
|
113
|
+
})] }),
|
|
114
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SearchInputForm.SearchInputForm, {
|
|
115
|
+
searchInputRef,
|
|
116
|
+
searchInputVariant,
|
|
117
|
+
searchText,
|
|
118
|
+
autocompleteResults,
|
|
119
|
+
searchBoxPlaceholder,
|
|
120
|
+
focusedOptionId,
|
|
121
|
+
shouldShowAutocomplete,
|
|
122
|
+
focusedIndex,
|
|
123
|
+
onKeyDown,
|
|
124
|
+
onAutocompleteSelect,
|
|
125
|
+
onSearchInputChange: searchChange,
|
|
126
|
+
onSearchSubmit: () => submitSearchString,
|
|
127
|
+
onSearchInputFocus,
|
|
128
|
+
onSearchInputBlur
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.AnimatePresence, { children: [initialSuggestions && initialSuggestions.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
131
|
+
className: "spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden",
|
|
132
|
+
initial: { opacity: 0 },
|
|
133
|
+
animate: { opacity: 1 },
|
|
134
|
+
exit: { opacity: 0 },
|
|
135
|
+
transition: { duration: .2 },
|
|
136
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
137
|
+
className: "spiffy-tw-mt-6",
|
|
138
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SuggestionBar.SuggestionBar, {
|
|
139
|
+
id: "global-search-suggestions",
|
|
140
|
+
locationForMetrics: __envive_ai_react_hooks_types.SuggestionBarLocationForMetrics.SUGGESTION_BAR_TOP,
|
|
141
|
+
buttonTexts: initialSuggestions,
|
|
142
|
+
buttonBorderRadius: suggestionButtonBorderRadius,
|
|
143
|
+
buttonVariation: suggestionButtonVariant ?? "primary",
|
|
144
|
+
hoverButtonVariation: suggestionButtonHoverVariant ?? "primary",
|
|
145
|
+
animationSpeed,
|
|
146
|
+
handleReply: (message) => {
|
|
147
|
+
if (message.type === __envive_ai_react_hooks_application_models.MessageType.QueryTyped && message.metadata?.content) {
|
|
148
|
+
track(__envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.SearchZeroStateSuggestionClicked, { eventProps: {
|
|
149
|
+
queryText: message.metadata.content,
|
|
150
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
151
|
+
} });
|
|
152
|
+
submitSearchString(message.metadata.content);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
twoRowsOnMobile: true
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
}), recommendedProducts.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
159
|
+
className: "spiffy-tw-mt-[40px]",
|
|
160
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_RecommendedProducts.RecommendedProducts, {
|
|
161
|
+
retrievedProducts: recommendedProducts,
|
|
162
|
+
merchantShortName,
|
|
163
|
+
productCardConfig,
|
|
164
|
+
productGridVariant: "standard",
|
|
165
|
+
heading: recommendedProductsHeading
|
|
166
|
+
})
|
|
167
|
+
})] })
|
|
168
|
+
]
|
|
169
|
+
}) });
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
//#endregion
|
|
173
|
+
exports.SearchZeroState = SearchZeroState;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Typography } from "../packages/components/dist/components/Typography/Typography.js";
|
|
2
|
+
import "../packages/components/dist/components/Typography/index.js";
|
|
3
|
+
import { SuggestionBar } from "../SuggestionBar/SuggestionBar.js";
|
|
4
|
+
import "../SuggestionBar/index.js";
|
|
5
|
+
import { Sparkles_default } from "../packages/icons/dist/Sparkles.js";
|
|
6
|
+
import { searchInputVariantClasses } from "../packages/components/dist/components/SearchInput/searchInputVariants.js";
|
|
7
|
+
import { SearchInput } from "../packages/components/dist/components/SearchInput/SearchInput.js";
|
|
8
|
+
import { SearchInputForm } from "../packages/components/dist/components/SearchInputForm/SearchInputForm.js";
|
|
9
|
+
import "../packages/components/dist/components/SearchInputForm/index.js";
|
|
10
|
+
import "../packages/components/dist/components/SearchInput/index.js";
|
|
11
|
+
import { IconCloseVariant_default } from "../packages/icons/dist/IconCloseVariant.js";
|
|
12
|
+
import { SearchOverlay } from "./SearchOverlay.js";
|
|
13
|
+
import { searchZeroStateVariantClasses } from "./zeroStateSearchVariants.js";
|
|
14
|
+
import { SearchIcon } from "./SearchIcon.js";
|
|
15
|
+
import { RecommendedProducts } from "./components/RecommendedProducts.js";
|
|
16
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
17
|
+
import { MessageType, SpiffyWidgets } from "@envive-ai/react-hooks/application/models";
|
|
18
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
20
|
+
import { useSearch } from "@envive-ai/react-hooks/hooks/Search";
|
|
21
|
+
import { useAmplitudeTracking } from "@envive-ai/react-hooks/hooks/AmplitudeOperations";
|
|
22
|
+
import { SuggestionBarLocationForMetrics } from "@envive-ai/react-hooks/types";
|
|
23
|
+
import { SpiffyMetricsEventName } from "@envive-ai/react-hooks/contexts/amplitudeContext";
|
|
24
|
+
|
|
25
|
+
//#region src/SearchZeroState/SearchZeroState.tsx
|
|
26
|
+
const SEARCH_ENTRYPOINT_INPUT_TESTID = "spiffy-search-entrypoint-input";
|
|
27
|
+
const SearchZeroState = ({ widgetConfig, initialIsOpen, entryPointRef }) => {
|
|
28
|
+
console.log("SearchZeroState: widgetConfig", widgetConfig);
|
|
29
|
+
const { searchZeroStateVariant, searchInputVariant, searchIconVariant, searchIconSize = 24, searchBoxPlaceholder, layout, compactLabel, initialSuggestions = [], animationSpeed = "standard", suggestionButtonConfig, includeSubtitle, usingPortal = false } = widgetConfig;
|
|
30
|
+
const { variant: suggestionButtonVariant, hoverVariant: suggestionButtonHoverVariant, borderRadius: suggestionButtonBorderRadius } = suggestionButtonConfig;
|
|
31
|
+
const [isOpen, setIsOpen] = useState(!!initialIsOpen);
|
|
32
|
+
const searchInputRef = useRef(null);
|
|
33
|
+
const searchInput = useSearch({ allowRedirect: true });
|
|
34
|
+
const { track } = useAmplitudeTracking();
|
|
35
|
+
const { recommendedProductsHeading, searchOverlayHeading, productCardConfig, merchantShortName, recommendedProducts, searchText, autocompleteResults, focusedIndex, focusedOptionId, shouldShowAutocomplete, onSearchInputChange, onSearchInputFocus, onSearchInputBlur, onKeyDown, onAutocompleteSelect, onSubmitSearch, resetSearch } = searchInput;
|
|
36
|
+
const { overlayBackgroundClasses, sparklesIconColor } = searchZeroStateVariantClasses[searchZeroStateVariant && searchZeroStateVariantClasses[searchZeroStateVariant] ? searchZeroStateVariant : "backgroundTertiary"];
|
|
37
|
+
const { searchInputIconColor } = searchInputVariantClasses[searchInputVariant];
|
|
38
|
+
const handleOpen = () => setIsOpen(true);
|
|
39
|
+
const handleClose = () => setIsOpen(false);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (isOpen) track(SpiffyMetricsEventName.SearchComponentVisible, { eventProps: { search_component: SpiffyWidgets.SearchZeroState } });
|
|
42
|
+
}, [isOpen, track]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (isOpen) {
|
|
45
|
+
resetSearch();
|
|
46
|
+
searchInputRef.current?.focus();
|
|
47
|
+
}
|
|
48
|
+
}, [isOpen, resetSearch]);
|
|
49
|
+
const submitSearchString = useCallback((query) => {
|
|
50
|
+
onSearchInputChange(query);
|
|
51
|
+
if (onSubmitSearch && query.trim()) {
|
|
52
|
+
onSubmitSearch();
|
|
53
|
+
setIsOpen(false);
|
|
54
|
+
}
|
|
55
|
+
}, [onSubmitSearch, onSearchInputChange]);
|
|
56
|
+
const searchChange = (value) => {
|
|
57
|
+
onSearchInputChange(value);
|
|
58
|
+
};
|
|
59
|
+
if (!isOpen) {
|
|
60
|
+
if (layout === "icon") return /* @__PURE__ */ jsx(SearchIcon, {
|
|
61
|
+
entryPointRef,
|
|
62
|
+
size: searchIconSize,
|
|
63
|
+
variant: searchIconVariant,
|
|
64
|
+
label: compactLabel,
|
|
65
|
+
onClick: handleOpen,
|
|
66
|
+
color: searchInputIconColor
|
|
67
|
+
});
|
|
68
|
+
return /* @__PURE__ */ jsx(SearchInput, {
|
|
69
|
+
value: "",
|
|
70
|
+
onChange: () => {},
|
|
71
|
+
placeholder: searchBoxPlaceholder,
|
|
72
|
+
suggestions: [],
|
|
73
|
+
onFocus: handleOpen,
|
|
74
|
+
searchInputVariant,
|
|
75
|
+
dataTestId: SEARCH_ENTRYPOINT_INPUT_TESTID
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsxs(SearchOverlay, {
|
|
79
|
+
role: "dialog",
|
|
80
|
+
ariaModal: true,
|
|
81
|
+
ariaLabelledby: "global-search-title",
|
|
82
|
+
className: overlayBackgroundClasses,
|
|
83
|
+
usingPortal,
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
86
|
+
className: "spiffy-tw-relative spiffy-tw-mb-4",
|
|
87
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
88
|
+
className: "spiffy-tw-flex spiffy-tw-items-center",
|
|
89
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
90
|
+
id: "global-search-title",
|
|
91
|
+
variant: "t3",
|
|
92
|
+
children: searchOverlayHeading
|
|
93
|
+
}), /* @__PURE__ */ jsx(Sparkles_default, {
|
|
94
|
+
className: "spiffy-tw-ml-2 spiffy-tw-h-[36px] spiffy-tw-w-[24px] sm:spiffy-tw-h-[45px] sm:spiffy-tw-w-[36px]",
|
|
95
|
+
color: sparklesIconColor,
|
|
96
|
+
stroke: "2px"
|
|
97
|
+
})]
|
|
98
|
+
}), includeSubtitle && /* @__PURE__ */ jsx(Typography, {
|
|
99
|
+
variant: "body2",
|
|
100
|
+
children: "Go ahead, get as specific as you like..."
|
|
101
|
+
})]
|
|
102
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
103
|
+
onClick: handleClose,
|
|
104
|
+
className: "spiffy-tw-absolute spiffy-tw-right-4 spiffy-tw-top-4 sm:spiffy-tw-right-8 sm:spiffy-tw-top-8",
|
|
105
|
+
"aria-label": "Close search",
|
|
106
|
+
type: "button",
|
|
107
|
+
children: /* @__PURE__ */ jsx(IconCloseVariant_default, {
|
|
108
|
+
className: "spiffy-tw-h-[20px] spiffy-tw-w-[20px] sm:spiffy-tw-h-[28px] sm:spiffy-tw-w-[28px]",
|
|
109
|
+
strokeWidth: "2px"
|
|
110
|
+
})
|
|
111
|
+
})] }),
|
|
112
|
+
/* @__PURE__ */ jsx(SearchInputForm, {
|
|
113
|
+
searchInputRef,
|
|
114
|
+
searchInputVariant,
|
|
115
|
+
searchText,
|
|
116
|
+
autocompleteResults,
|
|
117
|
+
searchBoxPlaceholder,
|
|
118
|
+
focusedOptionId,
|
|
119
|
+
shouldShowAutocomplete,
|
|
120
|
+
focusedIndex,
|
|
121
|
+
onKeyDown,
|
|
122
|
+
onAutocompleteSelect,
|
|
123
|
+
onSearchInputChange: searchChange,
|
|
124
|
+
onSearchSubmit: () => submitSearchString,
|
|
125
|
+
onSearchInputFocus,
|
|
126
|
+
onSearchInputBlur
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ jsxs(AnimatePresence, { children: [initialSuggestions && initialSuggestions.length > 0 && /* @__PURE__ */ jsx(motion.div, {
|
|
129
|
+
className: "spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden",
|
|
130
|
+
initial: { opacity: 0 },
|
|
131
|
+
animate: { opacity: 1 },
|
|
132
|
+
exit: { opacity: 0 },
|
|
133
|
+
transition: { duration: .2 },
|
|
134
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
135
|
+
className: "spiffy-tw-mt-6",
|
|
136
|
+
children: /* @__PURE__ */ jsx(SuggestionBar, {
|
|
137
|
+
id: "global-search-suggestions",
|
|
138
|
+
locationForMetrics: SuggestionBarLocationForMetrics.SUGGESTION_BAR_TOP,
|
|
139
|
+
buttonTexts: initialSuggestions,
|
|
140
|
+
buttonBorderRadius: suggestionButtonBorderRadius,
|
|
141
|
+
buttonVariation: suggestionButtonVariant ?? "primary",
|
|
142
|
+
hoverButtonVariation: suggestionButtonHoverVariant ?? "primary",
|
|
143
|
+
animationSpeed,
|
|
144
|
+
handleReply: (message) => {
|
|
145
|
+
if (message.type === MessageType.QueryTyped && message.metadata?.content) {
|
|
146
|
+
track(SpiffyMetricsEventName.SearchZeroStateSuggestionClicked, { eventProps: {
|
|
147
|
+
queryText: message.metadata.content,
|
|
148
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
149
|
+
} });
|
|
150
|
+
submitSearchString(message.metadata.content);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
twoRowsOnMobile: true
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
}), recommendedProducts.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
157
|
+
className: "spiffy-tw-mt-[40px]",
|
|
158
|
+
children: /* @__PURE__ */ jsx(RecommendedProducts, {
|
|
159
|
+
retrievedProducts: recommendedProducts,
|
|
160
|
+
merchantShortName,
|
|
161
|
+
productCardConfig,
|
|
162
|
+
productGridVariant: "standard",
|
|
163
|
+
heading: recommendedProductsHeading
|
|
164
|
+
})
|
|
165
|
+
})] })
|
|
166
|
+
]
|
|
167
|
+
}) });
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
export { SearchZeroState };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_SearchZeroState = require('./SearchZeroState.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let __envive_ai_react_hooks_hooks_NewOrgConfig = require("@envive-ai/react-hooks/hooks/NewOrgConfig");
|
|
6
|
+
|
|
7
|
+
//#region src/SearchZeroState/SearchZeroStateWidget.tsx
|
|
8
|
+
const SearchZeroStateWidget = ({ initialIsOpen, widgetConfigId = "searchEntryPointIcon", entryPointRef }) => {
|
|
9
|
+
const newConfig = (0, __envive_ai_react_hooks_hooks_NewOrgConfig.useNewOrgConfig)();
|
|
10
|
+
const widgetConfig = (0, react.useMemo)(() => {
|
|
11
|
+
if (newConfig && newConfig.frontendConfig?.widgetConfigs) return { ...(newConfig.frontendConfig?.widgetConfigs).find((widget) => widget.key === widgetConfigId).config };
|
|
12
|
+
return null;
|
|
13
|
+
}, [newConfig, widgetConfigId]);
|
|
14
|
+
if (!widgetConfig) return null;
|
|
15
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SearchZeroState.SearchZeroState, {
|
|
16
|
+
widgetConfig,
|
|
17
|
+
initialIsOpen,
|
|
18
|
+
entryPointRef
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.SearchZeroStateWidget = SearchZeroStateWidget;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
4
|
+
type SearchZeroStateWidgetProps = {
|
|
5
|
+
initialIsOpen: boolean;
|
|
6
|
+
widgetConfigId?: string;
|
|
7
|
+
entryPointRef: React.Ref<HTMLButtonElement>;
|
|
8
|
+
};
|
|
9
|
+
declare const SearchZeroStateWidget: ({
|
|
10
|
+
initialIsOpen,
|
|
11
|
+
widgetConfigId,
|
|
12
|
+
entryPointRef
|
|
13
|
+
}: SearchZeroStateWidgetProps) => react_jsx_runtime0.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SearchZeroStateWidget };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/SearchZeroState/SearchZeroStateWidget.d.ts
|
|
4
|
+
type SearchZeroStateWidgetProps = {
|
|
5
|
+
initialIsOpen: boolean;
|
|
6
|
+
widgetConfigId?: string;
|
|
7
|
+
entryPointRef: React.Ref<HTMLButtonElement>;
|
|
8
|
+
};
|
|
9
|
+
declare const SearchZeroStateWidget: ({
|
|
10
|
+
initialIsOpen,
|
|
11
|
+
widgetConfigId,
|
|
12
|
+
entryPointRef
|
|
13
|
+
}: SearchZeroStateWidgetProps) => react_jsx_runtime0.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SearchZeroStateWidget };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SearchZeroState } from "./SearchZeroState.js";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useNewOrgConfig } from "@envive-ai/react-hooks/hooks/NewOrgConfig";
|
|
5
|
+
|
|
6
|
+
//#region src/SearchZeroState/SearchZeroStateWidget.tsx
|
|
7
|
+
const SearchZeroStateWidget = ({ initialIsOpen, widgetConfigId = "searchEntryPointIcon", entryPointRef }) => {
|
|
8
|
+
const newConfig = useNewOrgConfig();
|
|
9
|
+
const widgetConfig = useMemo(() => {
|
|
10
|
+
if (newConfig && newConfig.frontendConfig?.widgetConfigs) return { ...(newConfig.frontendConfig?.widgetConfigs).find((widget) => widget.key === widgetConfigId).config };
|
|
11
|
+
return null;
|
|
12
|
+
}, [newConfig, widgetConfigId]);
|
|
13
|
+
if (!widgetConfig) return null;
|
|
14
|
+
return /* @__PURE__ */ jsx(SearchZeroState, {
|
|
15
|
+
widgetConfig,
|
|
16
|
+
initialIsOpen,
|
|
17
|
+
entryPointRef
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { SearchZeroStateWidget };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_Typography = require('../../packages/components/dist/components/Typography/Typography.cjs');
|
|
3
|
+
require('../../packages/components/dist/components/Typography/index.cjs');
|
|
4
|
+
const require_ProductGrid = require('../../packages/components/dist/components/ProductGrid/ProductGrid.cjs');
|
|
5
|
+
require('../../packages/components/dist/components/ProductGrid/index.cjs');
|
|
6
|
+
let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
|
|
7
|
+
let classnames = require("classnames");
|
|
8
|
+
classnames = require_rolldown_runtime.__toESM(classnames);
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
let framer_motion = require("framer-motion");
|
|
11
|
+
let __envive_ai_react_hooks_hooks_AmplitudeOperations = require("@envive-ai/react-hooks/hooks/AmplitudeOperations");
|
|
12
|
+
let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
|
|
13
|
+
|
|
14
|
+
//#region src/SearchZeroState/components/RecommendedProducts.tsx
|
|
15
|
+
const RecommendedProducts = ({ retrievedProducts, merchantShortName, productCardConfig = {
|
|
16
|
+
variant: "minimal",
|
|
17
|
+
hoverVariant: "none",
|
|
18
|
+
layoutVariant: "square"
|
|
19
|
+
}, productGridVariant = "square", heading }) => {
|
|
20
|
+
const { track } = (0, __envive_ai_react_hooks_hooks_AmplitudeOperations.useAmplitudeTracking)();
|
|
21
|
+
const containerClasses = (0, classnames.default)("spiffy-tw-justify-center", "spiffy-tw-overflow-hidden", "spiffy-tw-bg-white", "spiffy-tw-relative", "spiffy-tw-px-[24px]", "spiffy-tw-py-[16px]", "sm:spiffy-tw-px-[41px]", "sm:spiffy-tw-py-[40px]");
|
|
22
|
+
const titleContainerClasses = (0, classnames.default)("spiffy-tw-w-full", "spiffy-tw-border-b", "spiffy-tw-border-solid", "spiffy-tw-border-b-[--spiffy-colors-text-accent]", "spiffy-tw-pb-[8px]", "spiffy-tw-mb-[16px]");
|
|
23
|
+
const productGridClasses = (0, classnames.default)("spiffy-tw-grid", "spiffy-tw-justify-items-stretch", "spiffy-tw-grid-cols-2", "md:spiffy-tw-grid-cols-3", "lg:spiffy-tw-grid-cols-4", "spiffy-tw-gap-x-[4px]", "spiffy-tw-gap-y-[24px]", "spiffy-tw-h-full", "spiffy-tw-w-full", "spiffy-tw-items-stretch");
|
|
24
|
+
if (retrievedProducts == null || retrievedProducts.length === 0) return null;
|
|
25
|
+
const handleProductClick = (product, index) => {
|
|
26
|
+
track(__envive_ai_react_hooks_contexts_amplitudeContext.SpiffyMetricsEventName.ProductCardClicked, {
|
|
27
|
+
eventProps: {
|
|
28
|
+
url: product.url,
|
|
29
|
+
search_response_id: void 0,
|
|
30
|
+
product_response_id: product.response_id,
|
|
31
|
+
trigger_location: __envive_ai_react_hooks_application_models.ChatElementDisplayLocation.SEARCH_ZERO_STATE_SUGGESTED_PRODUCTS,
|
|
32
|
+
click_position: index != null ? index + 1 : null,
|
|
33
|
+
title: product.title,
|
|
34
|
+
original_price: product.original_price,
|
|
35
|
+
sale_price: product.sale_price,
|
|
36
|
+
average_rating: product.average_rating,
|
|
37
|
+
number_reviews: product.number_reviews
|
|
38
|
+
},
|
|
39
|
+
alsoSendToGoogleAnalytics: true
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.div, {
|
|
43
|
+
className: containerClasses,
|
|
44
|
+
initial: { opacity: 0 },
|
|
45
|
+
animate: { opacity: 1 },
|
|
46
|
+
exit: { opacity: 0 },
|
|
47
|
+
transition: { duration: .2 },
|
|
48
|
+
style: {
|
|
49
|
+
left: "50%",
|
|
50
|
+
right: "50%",
|
|
51
|
+
marginLeft: "-50vw",
|
|
52
|
+
marginRight: "-50vw",
|
|
53
|
+
width: "100vw"
|
|
54
|
+
},
|
|
55
|
+
children: [heading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
56
|
+
className: titleContainerClasses,
|
|
57
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.Typography, {
|
|
58
|
+
variant: "h1",
|
|
59
|
+
className: "spiffy-tw-text-[--spiffy-colors-text-accent]",
|
|
60
|
+
children: heading
|
|
61
|
+
})
|
|
62
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ProductGrid.ProductGrid, {
|
|
63
|
+
productList: retrievedProducts,
|
|
64
|
+
productGridVariant,
|
|
65
|
+
productGridClasses,
|
|
66
|
+
productCardConfig,
|
|
67
|
+
merchantShortName,
|
|
68
|
+
onProductClick: handleProductClick
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
exports.RecommendedProducts = RecommendedProducts;
|