instantsearch.js 4.49.0 → 4.49.2
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/README.md +3 -3
- package/cjs/components/Answers/Answers.js +6 -16
- package/cjs/components/Breadcrumb/Breadcrumb.js +5 -12
- package/cjs/components/ClearRefinements/ClearRefinements.js +4 -11
- package/cjs/components/CurrentRefinements/CurrentRefinements.js +5 -12
- package/cjs/components/GeoSearchControls/GeoSearchButton.js +4 -6
- package/cjs/components/GeoSearchControls/GeoSearchControls.js +11 -20
- package/cjs/components/GeoSearchControls/GeoSearchToggle.js +4 -6
- package/cjs/components/Highlight/Highlight.js +3 -11
- package/cjs/components/Hits/Hits.js +8 -20
- package/cjs/components/InfiniteHits/InfiniteHits.js +13 -25
- package/cjs/components/InternalHighlight/InternalHighlight.js +0 -3
- package/cjs/components/MenuSelect/MenuSelect.js +9 -19
- package/cjs/components/Pagination/Pagination.js +10 -17
- package/cjs/components/Panel/Panel.js +7 -26
- package/cjs/components/PoweredBy/PoweredBy.js +4 -5
- package/cjs/components/QueryRuleCustomData/QueryRuleCustomData.js +2 -6
- package/cjs/components/RangeInput/RangeInput.js +16 -48
- package/cjs/components/RefinementList/RefinementList.js +19 -73
- package/cjs/components/RefinementList/RefinementListItem.js +8 -14
- package/cjs/components/RelevantSort/RelevantSort.js +4 -8
- package/cjs/components/ReverseHighlight/ReverseHighlight.js +3 -11
- package/cjs/components/ReverseSnippet/ReverseSnippet.js +3 -11
- package/cjs/components/SearchBox/SearchBox.js +25 -69
- package/cjs/components/Selector/Selector.js +3 -6
- package/cjs/components/Slider/Pit.js +3 -10
- package/cjs/components/Slider/Rheostat.js +63 -131
- package/cjs/components/Slider/Slider.js +28 -65
- package/cjs/components/Snippet/Snippet.js +3 -11
- package/cjs/components/Stats/Stats.js +7 -20
- package/cjs/components/Template/Template.js +8 -37
- package/cjs/components/ToggleRefinement/ToggleRefinement.js +4 -10
- package/cjs/components/VoiceSearch/VoiceSearch.js +8 -15
- package/cjs/connectors/answers/connectAnswers.js +21 -36
- package/cjs/connectors/autocomplete/connectAutocomplete.js +8 -25
- package/cjs/connectors/breadcrumb/connectBreadcrumb.js +17 -48
- package/cjs/connectors/clear-refinements/connectClearRefinements.js +27 -45
- package/cjs/connectors/configure/connectConfigure.js +6 -20
- package/cjs/connectors/configure-related-items/connectConfigureRelatedItems.js +11 -36
- package/cjs/connectors/current-refinements/connectCurrentRefinements.js +18 -57
- package/cjs/connectors/dynamic-widgets/connectDynamicWidgets.js +17 -37
- package/cjs/connectors/geo-search/connectGeoSearch.js +17 -47
- package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +38 -74
- package/cjs/connectors/hits/connectHits.js +10 -26
- package/cjs/connectors/hits/connectHitsWithInsights.js +0 -4
- package/cjs/connectors/hits-per-page/connectHitsPerPage.js +15 -38
- package/cjs/connectors/index.js +62 -96
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +26 -62
- package/cjs/connectors/infinite-hits/connectInfiniteHitsWithInsights.js +0 -4
- package/cjs/connectors/menu/connectMenu.js +28 -66
- package/cjs/connectors/numeric-menu/connectNumericMenu.js +24 -78
- package/cjs/connectors/pagination/Paginator.js +3 -20
- package/cjs/connectors/pagination/connectPagination.js +8 -25
- package/cjs/connectors/powered-by/connectPoweredBy.js +4 -13
- package/cjs/connectors/query-rules/connectQueryRules.js +32 -56
- package/cjs/connectors/range/connectRange.js +41 -101
- package/cjs/connectors/rating-menu/connectRatingMenu.js +23 -79
- package/cjs/connectors/refinement-list/connectRefinementList.js +37 -70
- package/cjs/connectors/relevant-sort/connectRelevantSort.js +4 -14
- package/cjs/connectors/search-box/connectSearchBox.js +7 -23
- package/cjs/connectors/sort-by/connectSortBy.js +11 -21
- package/cjs/connectors/stats/connectStats.js +4 -11
- package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +29 -63
- package/cjs/connectors/voice-search/connectVoiceSearch.js +13 -35
- package/cjs/helpers/components/Highlight.js +4 -12
- package/cjs/helpers/components/ReverseHighlight.js +7 -19
- package/cjs/helpers/components/ReverseSnippet.js +7 -19
- package/cjs/helpers/components/Snippet.js +4 -12
- package/cjs/helpers/components/index.js +0 -8
- package/cjs/helpers/get-insights-anonymous-user-token.js +7 -12
- package/cjs/helpers/highlight.js +10 -16
- package/cjs/helpers/index.js +17 -31
- package/cjs/helpers/insights.js +5 -17
- package/cjs/helpers/reverseHighlight.js +10 -16
- package/cjs/helpers/reverseSnippet.js +10 -16
- package/cjs/helpers/snippet.js +10 -16
- package/cjs/index.js +3 -18
- package/cjs/lib/InstantSearch.js +79 -180
- package/cjs/lib/createHelpers.js +4 -11
- package/cjs/lib/formatNumber.js +0 -1
- package/cjs/lib/infiniteHitsCache/index.js +0 -2
- package/cjs/lib/infiniteHitsCache/sessionStorage.js +9 -18
- package/cjs/lib/insights/client.js +8 -34
- package/cjs/lib/insights/index.js +7 -13
- package/cjs/lib/insights/listener.js +4 -20
- package/cjs/lib/routers/history.js +63 -102
- package/cjs/lib/routers/index.js +0 -2
- package/cjs/lib/stateMappings/index.js +0 -3
- package/cjs/lib/stateMappings/simple.js +6 -13
- package/cjs/lib/stateMappings/singleIndex.js +1 -7
- package/cjs/lib/suit.js +2 -5
- package/cjs/lib/templating/index.js +0 -4
- package/cjs/lib/templating/prepareTemplateProps.js +8 -19
- package/cjs/lib/templating/renderTemplate.js +9 -24
- package/cjs/lib/utils/capitalize.js +0 -1
- package/cjs/lib/utils/checkIndexUiState.js +15 -43
- package/cjs/lib/utils/checkRendering.js +0 -2
- package/cjs/lib/utils/clearRefinements.js +2 -9
- package/cjs/lib/utils/concatHighlightedParts.js +1 -3
- package/cjs/lib/utils/createConcurrentSafePromise.js +0 -3
- package/cjs/lib/utils/createSendEventForFacet.js +7 -14
- package/cjs/lib/utils/createSendEventForHits.js +9 -33
- package/cjs/lib/utils/debounce.js +0 -3
- package/cjs/lib/utils/defer.js +0 -11
- package/cjs/lib/utils/detect-insights-client.js +0 -2
- package/cjs/lib/utils/documentation.js +2 -5
- package/cjs/lib/utils/escape-highlight.js +5 -22
- package/cjs/lib/utils/escape-html.js +9 -7
- package/cjs/lib/utils/escapeFacetValue.js +1 -5
- package/cjs/lib/utils/find.js +2 -5
- package/cjs/lib/utils/findIndex.js +0 -3
- package/cjs/lib/utils/geo-search.js +14 -34
- package/cjs/lib/utils/getAppIdAndApiKey.js +2 -3
- package/cjs/lib/utils/getContainerNode.js +0 -6
- package/cjs/lib/utils/getHighlightFromSiblings.js +0 -6
- package/cjs/lib/utils/getHighlightedParts.js +1 -4
- package/cjs/lib/utils/getObjectType.js +0 -1
- package/cjs/lib/utils/getPropertyByPath.js +0 -1
- package/cjs/lib/utils/getRefinements.js +13 -26
- package/cjs/lib/utils/getWidgetAttribute.js +0 -6
- package/cjs/lib/utils/hits-absolute-position.js +2 -6
- package/cjs/lib/utils/hits-query-id.js +2 -7
- package/cjs/lib/utils/index.js +0 -92
- package/cjs/lib/utils/isDomElement.js +0 -1
- package/cjs/lib/utils/isEqual.js +0 -8
- package/cjs/lib/utils/isFacetRefined.js +0 -1
- package/cjs/lib/utils/isFiniteNumber.js +0 -1
- package/cjs/lib/utils/isIndexWidget.js +0 -1
- package/cjs/lib/utils/isPlainObject.js +3 -11
- package/cjs/lib/utils/isSpecialClick.js +0 -1
- package/cjs/lib/utils/logger.js +3 -13
- package/cjs/lib/utils/mergeSearchParameters.js +16 -40
- package/cjs/lib/utils/noop.js +0 -1
- package/cjs/lib/utils/range.js +8 -14
- package/cjs/lib/utils/render-args.js +0 -2
- package/cjs/lib/utils/resolveSearchParameters.js +0 -3
- package/cjs/lib/utils/reverseHighlightedParts.js +2 -8
- package/cjs/lib/utils/safelyRunOnBrowser.js +7 -9
- package/cjs/lib/utils/serializer.js +1 -3
- package/cjs/lib/utils/setIndexHelperState.js +0 -5
- package/cjs/lib/utils/toArray.js +0 -1
- package/cjs/lib/utils/typedObject.js +0 -1
- package/cjs/lib/utils/uniq.js +0 -1
- package/cjs/lib/version.js +1 -1
- package/cjs/lib/voiceSearchHelper/index.js +8 -36
- package/cjs/middlewares/createInsightsMiddleware.js +15 -44
- package/cjs/middlewares/createMetadataMiddleware.js +4 -12
- package/cjs/middlewares/createRouterMiddleware.js +8 -19
- package/cjs/middlewares/index.js +0 -6
- package/cjs/types/algoliasearch.js +0 -2
- package/cjs/types/index.js +0 -28
- package/cjs/widgets/analytics/analytics.js +12 -47
- package/cjs/widgets/answers/answers.js +19 -39
- package/cjs/widgets/breadcrumb/breadcrumb.js +18 -38
- package/cjs/widgets/clear-refinements/clear-refinements.js +15 -35
- package/cjs/widgets/configure/configure.js +2 -10
- package/cjs/widgets/configure-related-items/configure-related-items.js +2 -10
- package/cjs/widgets/current-refinements/current-refinements.js +12 -30
- package/cjs/widgets/dynamic-widgets/dynamic-widgets.js +6 -25
- package/cjs/widgets/geo-search/GeoSearchRenderer.js +41 -68
- package/cjs/widgets/geo-search/createHTMLMarker.js +30 -60
- package/cjs/widgets/geo-search/defaultTemplates.js +0 -3
- package/cjs/widgets/geo-search/geo-search.js +27 -59
- package/cjs/widgets/hierarchical-menu/defaultTemplates.js +4 -7
- package/cjs/widgets/hierarchical-menu/hierarchical-menu.js +28 -47
- package/cjs/widgets/hits/hits.js +16 -37
- package/cjs/widgets/hits-per-page/hits-per-page.js +13 -31
- package/cjs/widgets/index/index.js +49 -95
- package/cjs/widgets/index.js +12 -50
- package/cjs/widgets/infinite-hits/infinite-hits.js +23 -44
- package/cjs/widgets/menu/defaultTemplates.js +3 -6
- package/cjs/widgets/menu/menu.js +23 -43
- package/cjs/widgets/menu-select/defaultTemplates.js +1 -3
- package/cjs/widgets/menu-select/menu-select.js +18 -38
- package/cjs/widgets/numeric-menu/defaultTemplates.js +3 -4
- package/cjs/widgets/numeric-menu/numeric-menu.js +17 -37
- package/cjs/widgets/pagination/pagination.js +32 -53
- package/cjs/widgets/panel/panel.js +20 -48
- package/cjs/widgets/places/places.js +16 -33
- package/cjs/widgets/powered-by/powered-by.js +10 -27
- package/cjs/widgets/query-rule-context/query-rule-context.js +2 -13
- package/cjs/widgets/query-rule-custom-data/query-rule-custom-data.js +14 -32
- package/cjs/widgets/range-input/range-input.js +23 -50
- package/cjs/widgets/range-slider/range-slider.js +28 -53
- package/cjs/widgets/rating-menu/defaultTemplates.js +8 -14
- package/cjs/widgets/rating-menu/rating-menu.js +17 -38
- package/cjs/widgets/refinement-list/defaultTemplates.js +5 -8
- package/cjs/widgets/refinement-list/refinement-list.js +39 -60
- package/cjs/widgets/relevant-sort/relevant-sort.js +10 -29
- package/cjs/widgets/search-box/defaultTemplates.js +0 -5
- package/cjs/widgets/search-box/search-box.js +31 -49
- package/cjs/widgets/sort-by/sort-by.js +11 -29
- package/cjs/widgets/stats/defaultTemplates.js +0 -1
- package/cjs/widgets/stats/stats.js +27 -57
- package/cjs/widgets/toggle-refinement/toggle-refinement.js +16 -36
- package/cjs/widgets/voice-search/defaultTemplates.js +4 -14
- package/cjs/widgets/voice-search/voice-search.js +17 -36
- package/dist/instantsearch.development.d.ts +8 -6
- package/dist/instantsearch.development.js +1725 -3087
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +8 -6
- package/dist/instantsearch.production.min.d.ts +8 -6
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Answers/Answers.js +6 -11
- package/es/components/Breadcrumb/Breadcrumb.js +5 -7
- package/es/components/ClearRefinements/ClearRefinements.js +4 -6
- package/es/components/CurrentRefinements/CurrentRefinements.js +7 -10
- package/es/components/GeoSearchControls/GeoSearchButton.js +6 -6
- package/es/components/GeoSearchControls/GeoSearchControls.js +11 -13
- package/es/components/GeoSearchControls/GeoSearchToggle.js +6 -6
- package/es/components/Highlight/Highlight.js +3 -7
- package/es/components/Hits/Hits.js +8 -15
- package/es/components/InfiniteHits/InfiniteHits.js +13 -20
- package/es/components/MenuSelect/MenuSelect.js +9 -13
- package/es/components/Pagination/Pagination.js +12 -15
- package/es/components/Panel/Panel.js +7 -20
- package/es/components/PoweredBy/PoweredBy.js +6 -5
- package/es/components/QueryRuleCustomData/QueryRuleCustomData.js +4 -4
- package/es/components/RangeInput/RangeInput.js +16 -43
- package/es/components/RefinementList/RefinementList.js +19 -64
- package/es/components/RefinementList/RefinementListItem.js +8 -10
- package/es/components/RelevantSort/RelevantSort.js +6 -6
- package/es/components/ReverseHighlight/ReverseHighlight.js +3 -7
- package/es/components/ReverseSnippet/ReverseSnippet.js +3 -7
- package/es/components/SearchBox/SearchBox.js +25 -63
- package/es/components/Selector/Selector.js +5 -5
- package/es/components/Slider/Pit.js +3 -7
- package/es/components/Slider/Rheostat.js +64 -129
- package/es/components/Slider/Slider.js +28 -58
- package/es/components/Snippet/Snippet.js +3 -7
- package/es/components/Stats/Stats.js +7 -15
- package/es/components/Template/Template.js +8 -32
- package/es/components/ToggleRefinement/ToggleRefinement.js +4 -6
- package/es/components/VoiceSearch/VoiceSearch.js +10 -13
- package/es/connectors/answers/connectAnswers.js +21 -35
- package/es/connectors/autocomplete/connectAutocomplete.js +8 -23
- package/es/connectors/breadcrumb/connectBreadcrumb.js +17 -46
- package/es/connectors/clear-refinements/connectClearRefinements.js +27 -43
- package/es/connectors/configure/connectConfigure.js +7 -16
- package/es/connectors/configure-related-items/connectConfigureRelatedItems.js +11 -31
- package/es/connectors/current-refinements/connectCurrentRefinements.js +18 -55
- package/es/connectors/dynamic-widgets/connectDynamicWidgets.js +17 -35
- package/es/connectors/geo-search/connectGeoSearch.js +17 -45
- package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +38 -72
- package/es/connectors/hits/connectHits.js +10 -24
- package/es/connectors/hits-per-page/connectHitsPerPage.js +15 -36
- package/es/connectors/index.d.ts +2 -1
- package/es/connectors/index.js +6 -3
- package/es/connectors/infinite-hits/connectInfiniteHits.js +26 -60
- package/es/connectors/menu/connectMenu.js +28 -64
- package/es/connectors/numeric-menu/connectNumericMenu.js +24 -76
- package/es/connectors/pagination/Paginator.js +3 -19
- package/es/connectors/pagination/connectPagination.js +8 -21
- package/es/connectors/powered-by/connectPoweredBy.js +4 -11
- package/es/connectors/query-rules/connectQueryRules.js +32 -54
- package/es/connectors/range/connectRange.js +41 -99
- package/es/connectors/rating-menu/connectRatingMenu.js +23 -77
- package/es/connectors/refinement-list/connectRefinementList.js +37 -68
- package/es/connectors/relevant-sort/connectRelevantSort.js +4 -13
- package/es/connectors/search-box/connectSearchBox.js +7 -21
- package/es/connectors/sort-by/connectSortBy.js +11 -19
- package/es/connectors/stats/connectStats.js +4 -9
- package/es/connectors/toggle-refinement/connectToggleRefinement.js +29 -61
- package/es/connectors/voice-search/connectVoiceSearch.js +13 -31
- package/es/helpers/components/Highlight.js +4 -8
- package/es/helpers/components/ReverseHighlight.js +7 -15
- package/es/helpers/components/ReverseSnippet.js +7 -15
- package/es/helpers/components/Snippet.js +4 -8
- package/es/helpers/get-insights-anonymous-user-token.js +5 -7
- package/es/helpers/highlight.js +9 -11
- package/es/helpers/insights.js +3 -10
- package/es/helpers/reverseHighlight.js +9 -11
- package/es/helpers/reverseSnippet.js +9 -11
- package/es/helpers/snippet.js +9 -11
- package/es/index.js +0 -2
- package/es/lib/InstantSearch.js +79 -170
- package/es/lib/createHelpers.js +4 -8
- package/es/lib/infiniteHitsCache/sessionStorage.js +9 -16
- package/es/lib/insights/client.js +8 -32
- package/es/lib/insights/listener.js +6 -18
- package/es/lib/routers/history.js +63 -99
- package/es/lib/stateMappings/simple.js +6 -12
- package/es/lib/stateMappings/singleIndex.js +1 -6
- package/es/lib/suit.js +2 -3
- package/es/lib/templating/prepareTemplateProps.js +8 -18
- package/es/lib/templating/renderTemplate.js +9 -20
- package/es/lib/utils/checkIndexUiState.js +18 -40
- package/es/lib/utils/clearRefinements.js +2 -8
- package/es/lib/utils/concatHighlightedParts.js +1 -1
- package/es/lib/utils/createConcurrentSafePromise.js +0 -2
- package/es/lib/utils/createSendEventForFacet.js +7 -12
- package/es/lib/utils/createSendEventForHits.js +8 -30
- package/es/lib/utils/debounce.js +0 -2
- package/es/lib/utils/defer.js +0 -10
- package/es/lib/utils/documentation.js +2 -3
- package/es/lib/utils/escape-highlight.js +3 -16
- package/es/lib/utils/escape-html.js +9 -5
- package/es/lib/utils/escapeFacetValue.js +0 -2
- package/es/lib/utils/find.js +2 -4
- package/es/lib/utils/findIndex.js +0 -2
- package/es/lib/utils/geo-search.js +14 -32
- package/es/lib/utils/getAppIdAndApiKey.js +2 -2
- package/es/lib/utils/getContainerNode.js +1 -5
- package/es/lib/utils/getHighlightFromSiblings.js +0 -3
- package/es/lib/utils/getHighlightedParts.js +1 -2
- package/es/lib/utils/getRefinements.js +13 -24
- package/es/lib/utils/getWidgetAttribute.js +0 -5
- package/es/lib/utils/hits-absolute-position.js +2 -5
- package/es/lib/utils/hits-query-id.js +2 -6
- package/es/lib/utils/isEqual.js +0 -7
- package/es/lib/utils/isPlainObject.js +3 -10
- package/es/lib/utils/logger.js +2 -12
- package/es/lib/utils/mergeSearchParameters.js +16 -37
- package/es/lib/utils/range.js +8 -13
- package/es/lib/utils/resolveSearchParameters.js +0 -2
- package/es/lib/utils/reverseHighlightedParts.js +2 -6
- package/es/lib/utils/safelyRunOnBrowser.js +7 -8
- package/es/lib/utils/setIndexHelperState.js +0 -2
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/lib/voiceSearchHelper/index.js +8 -35
- package/es/middlewares/createInsightsMiddleware.js +15 -41
- package/es/middlewares/createMetadataMiddleware.js +3 -9
- package/es/middlewares/createRouterMiddleware.js +8 -13
- package/es/types/index.js +9 -5
- package/es/widgets/analytics/analytics.js +12 -45
- package/es/widgets/answers/answers.js +19 -28
- package/es/widgets/breadcrumb/breadcrumb.js +18 -27
- package/es/widgets/clear-refinements/clear-refinements.js +15 -24
- package/es/widgets/configure/configure.js +3 -6
- package/es/widgets/configure-related-items/configure-related-items.js +2 -7
- package/es/widgets/current-refinements/current-refinements.js +12 -21
- package/es/widgets/dynamic-widgets/dynamic-widgets.js +6 -20
- package/es/widgets/geo-search/GeoSearchRenderer.js +41 -63
- package/es/widgets/geo-search/createHTMLMarker.js +30 -59
- package/es/widgets/geo-search/defaultTemplates.js +2 -2
- package/es/widgets/geo-search/geo-search.js +27 -49
- package/es/widgets/hierarchical-menu/defaultTemplates.js +5 -4
- package/es/widgets/hierarchical-menu/hierarchical-menu.js +28 -36
- package/es/widgets/hits/hits.js +16 -25
- package/es/widgets/hits-per-page/hits-per-page.js +13 -22
- package/es/widgets/index/index.js +49 -91
- package/es/widgets/index.d.ts +2 -1
- package/es/widgets/index.js +4 -3
- package/es/widgets/infinite-hits/infinite-hits.js +23 -32
- package/es/widgets/menu/defaultTemplates.js +4 -3
- package/es/widgets/menu/menu.js +23 -32
- package/es/widgets/menu-select/defaultTemplates.js +1 -1
- package/es/widgets/menu-select/menu-select.js +18 -27
- package/es/widgets/numeric-menu/defaultTemplates.js +4 -3
- package/es/widgets/numeric-menu/numeric-menu.js +17 -26
- package/es/widgets/pagination/pagination.js +32 -44
- package/es/widgets/panel/panel.js +20 -40
- package/es/widgets/places/places.js +16 -32
- package/es/widgets/powered-by/powered-by.js +10 -18
- package/es/widgets/query-rule-context/query-rule-context.js +2 -9
- package/es/widgets/query-rule-custom-data/query-rule-custom-data.js +13 -22
- package/es/widgets/range-input/range-input.js +23 -40
- package/es/widgets/range-slider/range-slider.js +28 -44
- package/es/widgets/rating-menu/defaultTemplates.js +9 -12
- package/es/widgets/rating-menu/rating-menu.js +17 -27
- package/es/widgets/refinement-list/defaultTemplates.js +6 -5
- package/es/widgets/refinement-list/refinement-list.js +39 -48
- package/es/widgets/relevant-sort/relevant-sort.js +10 -19
- package/es/widgets/search-box/defaultTemplates.js +1 -4
- package/es/widgets/search-box/search-box.js +31 -39
- package/es/widgets/sort-by/sort-by.js +11 -20
- package/es/widgets/stats/stats.js +26 -45
- package/es/widgets/toggle-refinement/toggle-refinement.js +16 -25
- package/es/widgets/voice-search/defaultTemplates.js +5 -13
- package/es/widgets/voice-search/voice-search.js +17 -26
- package/package.json +20 -119
- package/scripts/transforms/__testfixtures__/addWidget-to-addWidgets/imported.input.js +0 -1
- package/scripts/transforms/__testfixtures__/addWidget-to-addWidgets/imported.output.js +0 -1
- package/CHANGELOG.md +0 -3684
|
@@ -4,86 +4,53 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _preact = require("preact");
|
|
9
|
-
|
|
10
8
|
var _Rheostat = _interopRequireDefault(require("./Rheostat.js"));
|
|
11
|
-
|
|
12
9
|
var _uiComponentsShared = require("@algolia/ui-components-shared");
|
|
13
|
-
|
|
14
10
|
var _index = require("../../lib/utils/index.js");
|
|
15
|
-
|
|
16
11
|
var _Pit = _interopRequireDefault(require("./Pit.js"));
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
|
-
|
|
22
14
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
23
|
-
|
|
24
15
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
25
|
-
|
|
26
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
27
|
-
|
|
16
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
28
17
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
29
|
-
|
|
30
18
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
35
|
-
|
|
19
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
20
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
36
21
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
37
|
-
|
|
38
22
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
43
|
-
|
|
44
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
|
-
|
|
23
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
24
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
46
26
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
47
|
-
|
|
48
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
49
|
-
|
|
27
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
50
28
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
51
|
-
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
55
|
-
|
|
29
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
30
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
56
31
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
57
|
-
|
|
58
32
|
var Slider = /*#__PURE__*/function (_Component) {
|
|
59
33
|
_inherits(Slider, _Component);
|
|
60
|
-
|
|
61
34
|
var _super = _createSuper(Slider);
|
|
62
|
-
|
|
63
35
|
function Slider() {
|
|
64
36
|
var _this;
|
|
65
|
-
|
|
66
37
|
_classCallCheck(this, Slider);
|
|
67
|
-
|
|
68
38
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
69
39
|
args[_key] = arguments[_key];
|
|
70
40
|
}
|
|
71
|
-
|
|
72
41
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
73
|
-
|
|
74
42
|
_defineProperty(_assertThisInitialized(_this), "handleChange", function (_ref) {
|
|
75
43
|
var values = _ref.values;
|
|
76
|
-
|
|
77
44
|
if (!_this.isDisabled) {
|
|
78
45
|
_this.props.refine(values);
|
|
79
46
|
}
|
|
80
47
|
});
|
|
81
|
-
|
|
82
48
|
_defineProperty(_assertThisInitialized(_this), "createHandleComponent", function (tooltips) {
|
|
83
49
|
return function (props) {
|
|
84
50
|
// display only two decimals after comma,
|
|
85
51
|
// and apply `tooltips.format()` if any
|
|
86
|
-
var roundedValue = Math.round(
|
|
52
|
+
var roundedValue = Math.round(
|
|
53
|
+
// have to cast as a string, as the value given to the prop is a number, but becomes a string when read
|
|
87
54
|
parseFloat(props['aria-valuenow']) * 100) / 100;
|
|
88
55
|
var value = _typeof(tooltips) === 'object' && tooltips.format ? tooltips.format(roundedValue) : roundedValue;
|
|
89
56
|
var className = (0, _uiComponentsShared.cx)(props.className, props['data-handle-key'] === 0 && 'rheostat-handle-lower', props['data-handle-key'] === 1 && 'rheostat-handle-upper');
|
|
@@ -94,10 +61,8 @@ var Slider = /*#__PURE__*/function (_Component) {
|
|
|
94
61
|
}, value));
|
|
95
62
|
};
|
|
96
63
|
});
|
|
97
|
-
|
|
98
64
|
return _this;
|
|
99
65
|
}
|
|
100
|
-
|
|
101
66
|
_createClass(Slider, [{
|
|
102
67
|
key: "isDisabled",
|
|
103
68
|
get: function get() {
|
|
@@ -105,10 +70,11 @@ var Slider = /*#__PURE__*/function (_Component) {
|
|
|
105
70
|
}
|
|
106
71
|
}, {
|
|
107
72
|
key: "computeDefaultPitPoints",
|
|
108
|
-
value:
|
|
73
|
+
value:
|
|
74
|
+
// creates an array number where to display a pit point on the slider
|
|
109
75
|
function computeDefaultPitPoints(_ref2) {
|
|
110
76
|
var min = _ref2.min,
|
|
111
|
-
|
|
77
|
+
max = _ref2.max;
|
|
112
78
|
var totalLength = max - min;
|
|
113
79
|
var steps = 34;
|
|
114
80
|
var stepsLength = totalLength / steps;
|
|
@@ -118,14 +84,15 @@ var Slider = /*#__PURE__*/function (_Component) {
|
|
|
118
84
|
return min + stepsLength * (step + 1);
|
|
119
85
|
})), [max]);
|
|
120
86
|
return pitPoints;
|
|
121
|
-
}
|
|
87
|
+
}
|
|
122
88
|
|
|
89
|
+
// creates an array of values where the slider should snap to
|
|
123
90
|
}, {
|
|
124
91
|
key: "computeSnapPoints",
|
|
125
92
|
value: function computeSnapPoints(_ref3) {
|
|
126
93
|
var min = _ref3.min,
|
|
127
|
-
|
|
128
|
-
|
|
94
|
+
max = _ref3.max,
|
|
95
|
+
step = _ref3.step;
|
|
129
96
|
if (!step) return undefined;
|
|
130
97
|
return [].concat(_toConsumableArray((0, _index.range)({
|
|
131
98
|
start: min,
|
|
@@ -137,19 +104,17 @@ var Slider = /*#__PURE__*/function (_Component) {
|
|
|
137
104
|
key: "render",
|
|
138
105
|
value: function render() {
|
|
139
106
|
var _this$props = this.props,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
107
|
+
tooltips = _this$props.tooltips,
|
|
108
|
+
step = _this$props.step,
|
|
109
|
+
pips = _this$props.pips,
|
|
110
|
+
values = _this$props.values,
|
|
111
|
+
cssClasses = _this$props.cssClasses; // @TODO: figure out why this.props needs to be non-null asserted
|
|
146
112
|
var _ref4 = this.isDisabled ? {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
113
|
+
min: this.props.min,
|
|
114
|
+
max: this.props.max + 0.001
|
|
115
|
+
} : this.props,
|
|
116
|
+
min = _ref4.min,
|
|
117
|
+
max = _ref4.max;
|
|
153
118
|
var snapPoints = this.computeSnapPoints({
|
|
154
119
|
min: min,
|
|
155
120
|
max: max,
|
|
@@ -175,9 +140,7 @@ var Slider = /*#__PURE__*/function (_Component) {
|
|
|
175
140
|
}));
|
|
176
141
|
}
|
|
177
142
|
}]);
|
|
178
|
-
|
|
179
143
|
return Slider;
|
|
180
144
|
}(_preact.Component);
|
|
181
|
-
|
|
182
145
|
var _default = Slider;
|
|
183
146
|
exports.default = _default;
|
|
@@ -4,24 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Snippet = Snippet;
|
|
7
|
-
|
|
8
7
|
var _uiComponentsShared = require("@algolia/ui-components-shared");
|
|
9
|
-
|
|
10
8
|
var _preact = require("preact");
|
|
11
|
-
|
|
12
9
|
var _InternalHighlight = require("../InternalHighlight/InternalHighlight.js");
|
|
13
|
-
|
|
14
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
-
|
|
10
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
11
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
-
|
|
18
12
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
|
-
|
|
20
13
|
function Snippet(_ref) {
|
|
21
14
|
var _ref$classNames = _ref.classNames,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
16
|
+
props = _objectWithoutProperties(_ref, ["classNames"]);
|
|
25
17
|
return (0, _preact.h)(_InternalHighlight.InternalHighlight, _extends({
|
|
26
18
|
classNames: {
|
|
27
19
|
root: (0, _uiComponentsShared.cx)('ais-Snippet', classNames.root),
|
|
@@ -4,34 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _preact = require("preact");
|
|
9
|
-
|
|
10
8
|
var _uiComponentsShared = require("@algolia/ui-components-shared");
|
|
11
|
-
|
|
12
9
|
var _Template = _interopRequireDefault(require("../Template/Template.js"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
21
|
-
|
|
11
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
|
|
24
15
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
25
|
-
|
|
26
16
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
27
|
-
|
|
28
17
|
var Stats = function Stats(_ref) {
|
|
29
18
|
var nbHits = _ref.nbHits,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
nbSortedHits = _ref.nbSortedHits,
|
|
20
|
+
cssClasses = _ref.cssClasses,
|
|
21
|
+
templateProps = _ref.templateProps,
|
|
22
|
+
rest = _objectWithoutProperties(_ref, ["nbHits", "nbSortedHits", "cssClasses", "templateProps"]);
|
|
35
23
|
return (0, _preact.h)("div", {
|
|
36
24
|
className: (0, _uiComponentsShared.cx)(cssClasses.root)
|
|
37
25
|
}, (0, _preact.h)(_Template.default, _extends({}, templateProps, {
|
|
@@ -53,6 +41,5 @@ var Stats = function Stats(_ref) {
|
|
|
53
41
|
}, rest)
|
|
54
42
|
})));
|
|
55
43
|
};
|
|
56
|
-
|
|
57
44
|
var _default = Stats;
|
|
58
45
|
exports.default = _default;
|
|
@@ -4,39 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _preact = require("preact");
|
|
9
|
-
|
|
10
8
|
var _index = require("../../lib/utils/index.js");
|
|
11
|
-
|
|
12
9
|
var _index2 = require("../../lib/templating/index.js");
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
17
|
-
|
|
10
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
18
12
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
-
|
|
20
13
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
|
-
|
|
26
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
27
|
-
|
|
14
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
15
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
28
17
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
29
|
-
|
|
30
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
31
|
-
|
|
18
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
32
19
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
37
|
-
|
|
20
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
38
22
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
|
-
|
|
40
23
|
var defaultProps = {
|
|
41
24
|
data: {},
|
|
42
25
|
rootTagName: 'div',
|
|
@@ -44,19 +27,14 @@ var defaultProps = {
|
|
|
44
27
|
templates: {},
|
|
45
28
|
templatesConfig: {}
|
|
46
29
|
};
|
|
47
|
-
|
|
48
30
|
// @TODO: Template should be a generic and receive TData to pass to Templates (to avoid TTemplateData to be set as `any`)
|
|
49
31
|
var Template = /*#__PURE__*/function (_Component) {
|
|
50
32
|
_inherits(Template, _Component);
|
|
51
|
-
|
|
52
33
|
var _super = _createSuper(Template);
|
|
53
|
-
|
|
54
34
|
function Template() {
|
|
55
35
|
_classCallCheck(this, Template);
|
|
56
|
-
|
|
57
36
|
return _super.apply(this, arguments);
|
|
58
37
|
}
|
|
59
|
-
|
|
60
38
|
_createClass(Template, [{
|
|
61
39
|
key: "shouldComponentUpdate",
|
|
62
40
|
value: function shouldComponentUpdate(nextProps) {
|
|
@@ -66,7 +44,6 @@ var Template = /*#__PURE__*/function (_Component) {
|
|
|
66
44
|
key: "render",
|
|
67
45
|
value: function render() {
|
|
68
46
|
var _this = this;
|
|
69
|
-
|
|
70
47
|
process.env.NODE_ENV === 'development' ? (0, _index.warning)(Object.keys(this.props.templates).every(function (key) {
|
|
71
48
|
return typeof _this.props.templates[key] === 'function';
|
|
72
49
|
}), "Hogan.js and string-based templates are deprecated and will not be supported in InstantSearch.js 5.x.\n\nYou can replace them with function-form templates and use either the provided `html` function or JSX templates.\n\nSee: https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/#upgrade-templates") : void 0;
|
|
@@ -82,17 +59,14 @@ var Template = /*#__PURE__*/function (_Component) {
|
|
|
82
59
|
bindEvent: this.props.bindEvent,
|
|
83
60
|
sendEvent: this.props.sendEvent
|
|
84
61
|
});
|
|
85
|
-
|
|
86
62
|
if (content === null) {
|
|
87
63
|
// Adds a noscript to the DOM but virtual DOM is null
|
|
88
64
|
// See http://facebook.github.io/react/docs/component-specs.html#render
|
|
89
65
|
return null;
|
|
90
66
|
}
|
|
91
|
-
|
|
92
67
|
if (_typeof(content) === 'object') {
|
|
93
68
|
return (0, _preact.h)(RootTagName, this.props.rootProps, content);
|
|
94
69
|
}
|
|
95
|
-
|
|
96
70
|
return (0, _preact.h)(RootTagName, _extends({}, this.props.rootProps, {
|
|
97
71
|
dangerouslySetInnerHTML: {
|
|
98
72
|
__html: content
|
|
@@ -100,11 +74,8 @@ var Template = /*#__PURE__*/function (_Component) {
|
|
|
100
74
|
}));
|
|
101
75
|
}
|
|
102
76
|
}]);
|
|
103
|
-
|
|
104
77
|
return Template;
|
|
105
78
|
}(_preact.Component);
|
|
106
|
-
|
|
107
79
|
_defineProperty(Template, "defaultProps", defaultProps);
|
|
108
|
-
|
|
109
80
|
var _default = Template;
|
|
110
81
|
exports.default = _default;
|
|
@@ -4,20 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _preact = require("preact");
|
|
9
|
-
|
|
10
8
|
var _Template = _interopRequireDefault(require("../Template/Template.js"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
-
|
|
10
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
11
|
var ToggleRefinement = function ToggleRefinement(_ref) {
|
|
17
12
|
var currentRefinement = _ref.currentRefinement,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
refine = _ref.refine,
|
|
14
|
+
cssClasses = _ref.cssClasses,
|
|
15
|
+
templateProps = _ref.templateProps;
|
|
21
16
|
return (0, _preact.h)("div", {
|
|
22
17
|
className: cssClasses.root
|
|
23
18
|
}, (0, _preact.h)("label", {
|
|
@@ -40,6 +35,5 @@ var ToggleRefinement = function ToggleRefinement(_ref) {
|
|
|
40
35
|
data: currentRefinement
|
|
41
36
|
}))));
|
|
42
37
|
};
|
|
43
|
-
|
|
44
38
|
var _default = ToggleRefinement;
|
|
45
39
|
exports.default = _default;
|
|
@@ -4,33 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _preact = require("preact");
|
|
9
|
-
|
|
10
8
|
var _Template = _interopRequireDefault(require("../Template/Template.js"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
10
|
|
|
14
11
|
var VoiceSearch = function VoiceSearch(_ref) {
|
|
15
12
|
var cssClasses = _ref.cssClasses,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
isBrowserSupported = _ref.isBrowserSupported,
|
|
14
|
+
isListening = _ref.isListening,
|
|
15
|
+
toggleListening = _ref.toggleListening,
|
|
16
|
+
voiceListeningState = _ref.voiceListeningState,
|
|
17
|
+
templates = _ref.templates;
|
|
22
18
|
var handleClick = function handleClick(event) {
|
|
23
19
|
if (event.currentTarget instanceof HTMLElement) {
|
|
24
20
|
event.currentTarget.blur();
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
toggleListening();
|
|
28
23
|
};
|
|
29
|
-
|
|
30
24
|
var status = voiceListeningState.status,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
transcript = voiceListeningState.transcript,
|
|
26
|
+
isSpeechFinal = voiceListeningState.isSpeechFinal,
|
|
27
|
+
errorCode = voiceListeningState.errorCode;
|
|
34
28
|
return (0, _preact.h)("div", {
|
|
35
29
|
className: cssClasses.root
|
|
36
30
|
}, (0, _preact.h)(_Template.default, {
|
|
@@ -68,6 +62,5 @@ var VoiceSearch = function VoiceSearch(_ref) {
|
|
|
68
62
|
templates: templates
|
|
69
63
|
}));
|
|
70
64
|
};
|
|
71
|
-
|
|
72
65
|
var _default = VoiceSearch;
|
|
73
66
|
exports.default = _default;
|
|
@@ -4,64 +4,53 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _index = require("../../lib/utils/index.js");
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
13
|
-
|
|
8
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
10
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
-
|
|
16
11
|
function hasFindAnswersMethod(answersIndex) {
|
|
17
12
|
return typeof answersIndex.findAnswers === 'function';
|
|
18
13
|
}
|
|
19
|
-
|
|
20
14
|
var withUsage = (0, _index.createDocumentationMessageGenerator)({
|
|
21
15
|
name: 'answers',
|
|
22
16
|
connector: true
|
|
23
17
|
});
|
|
24
|
-
|
|
25
18
|
var connectAnswers = function connectAnswers(renderFn) {
|
|
26
19
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _index.noop;
|
|
27
20
|
(0, _index.checkRendering)(renderFn, withUsage());
|
|
28
21
|
return function (widgetParams) {
|
|
29
22
|
var _ref = widgetParams || {},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
queryLanguages = _ref.queryLanguages,
|
|
24
|
+
attributesForPrediction = _ref.attributesForPrediction,
|
|
25
|
+
_ref$nbHits = _ref.nbHits,
|
|
26
|
+
nbHits = _ref$nbHits === void 0 ? 1 : _ref$nbHits,
|
|
27
|
+
_ref$renderDebounceTi = _ref.renderDebounceTime,
|
|
28
|
+
renderDebounceTime = _ref$renderDebounceTi === void 0 ? 100 : _ref$renderDebounceTi,
|
|
29
|
+
_ref$searchDebounceTi = _ref.searchDebounceTime,
|
|
30
|
+
searchDebounceTime = _ref$searchDebounceTi === void 0 ? 100 : _ref$searchDebounceTi,
|
|
31
|
+
_ref$escapeHTML = _ref.escapeHTML,
|
|
32
|
+
escapeHTML = _ref$escapeHTML === void 0 ? true : _ref$escapeHTML,
|
|
33
|
+
_ref$extraParameters = _ref.extraParameters,
|
|
34
|
+
extraParameters = _ref$extraParameters === void 0 ? {} : _ref$extraParameters; // @ts-expect-error checking for the wrong value
|
|
44
35
|
if (!queryLanguages || queryLanguages.length === 0) {
|
|
45
36
|
throw new Error(withUsage('The `queryLanguages` expects an array of strings.'));
|
|
46
37
|
}
|
|
47
|
-
|
|
48
38
|
var runConcurrentSafePromise = (0, _index.createConcurrentSafePromise)();
|
|
49
39
|
var lastHits = [];
|
|
50
40
|
var isLoading = false;
|
|
51
|
-
var debouncedRender = (0, _index.debounce)(renderFn, renderDebounceTime);
|
|
41
|
+
var debouncedRender = (0, _index.debounce)(renderFn, renderDebounceTime);
|
|
52
42
|
|
|
43
|
+
// this does not directly use DebouncedFunction<findAnswers>, since then the generic will disappear
|
|
53
44
|
var debouncedRefine;
|
|
54
45
|
return {
|
|
55
46
|
$$type: 'ais.answers',
|
|
56
47
|
init: function init(initOptions) {
|
|
57
48
|
var state = initOptions.state,
|
|
58
|
-
|
|
49
|
+
instantSearchInstance = initOptions.instantSearchInstance;
|
|
59
50
|
var answersIndex = instantSearchInstance.client.initIndex(state.index);
|
|
60
|
-
|
|
61
51
|
if (!hasFindAnswersMethod(answersIndex)) {
|
|
62
52
|
throw new Error(withUsage('`algoliasearch` >= 4.8.0 required.'));
|
|
63
53
|
}
|
|
64
|
-
|
|
65
54
|
debouncedRefine = (0, _index.debounce)(answersIndex.findAnswers, searchDebounceTime);
|
|
66
55
|
renderFn(_objectSpread(_objectSpread({}, this.getWidgetRenderState(initOptions)), {}, {
|
|
67
56
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
@@ -69,9 +58,7 @@ var connectAnswers = function connectAnswers(renderFn) {
|
|
|
69
58
|
},
|
|
70
59
|
render: function render(renderOptions) {
|
|
71
60
|
var _this = this;
|
|
72
|
-
|
|
73
61
|
var query = renderOptions.state.query;
|
|
74
|
-
|
|
75
62
|
if (!query) {
|
|
76
63
|
// renders nothing with empty query
|
|
77
64
|
lastHits = [];
|
|
@@ -80,15 +67,16 @@ var connectAnswers = function connectAnswers(renderFn) {
|
|
|
80
67
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
81
68
|
}), false);
|
|
82
69
|
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
70
|
+
}
|
|
85
71
|
|
|
72
|
+
// render the loader
|
|
86
73
|
lastHits = [];
|
|
87
74
|
isLoading = true;
|
|
88
75
|
renderFn(_objectSpread(_objectSpread({}, this.getWidgetRenderState(renderOptions)), {}, {
|
|
89
76
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
90
|
-
}), false);
|
|
77
|
+
}), false);
|
|
91
78
|
|
|
79
|
+
// call /answers API
|
|
92
80
|
runConcurrentSafePromise(debouncedRefine(query, queryLanguages, _objectSpread(_objectSpread({}, extraParameters), {}, {
|
|
93
81
|
nbHits: nbHits,
|
|
94
82
|
attributesForPrediction: attributesForPrediction
|
|
@@ -97,11 +85,9 @@ var connectAnswers = function connectAnswers(renderFn) {
|
|
|
97
85
|
// It's undefined when it's debounced.
|
|
98
86
|
return;
|
|
99
87
|
}
|
|
100
|
-
|
|
101
88
|
if (escapeHTML && result.hits.length > 0) {
|
|
102
89
|
result.hits = (0, _index.escapeHits)(result.hits);
|
|
103
90
|
}
|
|
104
|
-
|
|
105
91
|
var hitsWithAbsolutePosition = (0, _index.addAbsolutePosition)(result.hits, 0, nbHits);
|
|
106
92
|
var hitsWithAbsolutePositionAndQueryID = (0, _index.addQueryID)(hitsWithAbsolutePosition, result.queryID);
|
|
107
93
|
lastHits = hitsWithAbsolutePositionAndQueryID;
|
|
@@ -134,6 +120,5 @@ var connectAnswers = function connectAnswers(renderFn) {
|
|
|
134
120
|
};
|
|
135
121
|
};
|
|
136
122
|
};
|
|
137
|
-
|
|
138
123
|
var _default = connectAnswers;
|
|
139
124
|
exports.default = _default;
|