instantsearch.js 4.49.1 → 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 +4 -15
- 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 +1722 -3088
- 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 +2 -10
- 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 -3693
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
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; }
|
|
6
|
-
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
7
4
|
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; }
|
|
8
|
-
|
|
9
5
|
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; }
|
|
10
|
-
|
|
11
6
|
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; }
|
|
12
|
-
|
|
13
7
|
import { h } from 'preact';
|
|
14
8
|
import { ReverseSnippet as ReverseSnippetUiComponent } from "../../components/ReverseSnippet/ReverseSnippet.js";
|
|
15
9
|
import { getPropertyByPath, unescape, toArray, warning, getHighlightedParts } from "../../lib/utils/index.js";
|
|
16
10
|
export function ReverseSnippet(_ref) {
|
|
17
11
|
var hit = _ref.hit,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
attribute = _ref.attribute,
|
|
13
|
+
cssClasses = _ref.cssClasses,
|
|
14
|
+
props = _objectWithoutProperties(_ref, ["hit", "attribute", "cssClasses"]);
|
|
22
15
|
var property = getPropertyByPath(hit._snippetResult, attribute) || [];
|
|
23
16
|
var properties = toArray(property);
|
|
24
17
|
process.env.NODE_ENV === 'development' ? warning(Boolean(properties.length), "Could not enable snippet for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
|
|
@@ -26,8 +19,7 @@ export function ReverseSnippet(_ref) {
|
|
|
26
19
|
var value = _ref2.value;
|
|
27
20
|
return getHighlightedParts(unescape(value || '')).map(function (_ref3) {
|
|
28
21
|
var isHighlighted = _ref3.isHighlighted,
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
rest = _objectWithoutProperties(_ref3, ["isHighlighted"]);
|
|
31
23
|
return _objectSpread(_objectSpread({}, rest), {}, {
|
|
32
24
|
isHighlighted: !isHighlighted
|
|
33
25
|
});
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
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); }
|
|
3
2
|
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; }
|
|
4
|
-
|
|
5
3
|
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; }
|
|
6
|
-
|
|
7
4
|
import { h } from 'preact';
|
|
8
5
|
import { Snippet as SnippetUiComponent } from "../../components/Snippet/Snippet.js";
|
|
9
6
|
import { getPropertyByPath, unescape, toArray, warning, getHighlightedParts } from "../../lib/utils/index.js";
|
|
10
7
|
export function Snippet(_ref) {
|
|
11
8
|
var hit = _ref.hit,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
attribute = _ref.attribute,
|
|
10
|
+
cssClasses = _ref.cssClasses,
|
|
11
|
+
props = _objectWithoutProperties(_ref, ["hit", "attribute", "cssClasses"]);
|
|
16
12
|
var property = getPropertyByPath(hit._snippetResult, attribute) || [];
|
|
17
13
|
var properties = toArray(property);
|
|
18
14
|
process.env.NODE_ENV === 'development' ? warning(Boolean(properties.length), "Could not enable snippet for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
|
|
@@ -1,38 +1,30 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
2
|
-
|
|
1
|
+
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); }
|
|
3
2
|
import { warning } from "../lib/utils/index.js";
|
|
4
3
|
export var ANONYMOUS_TOKEN_COOKIE_KEY = '_ALGOLIA';
|
|
5
|
-
|
|
6
4
|
function getCookie(name) {
|
|
7
5
|
if ((typeof document === "undefined" ? "undefined" : _typeof(document)) !== 'object' || typeof document.cookie !== 'string') {
|
|
8
6
|
return undefined;
|
|
9
7
|
}
|
|
10
|
-
|
|
11
8
|
var prefix = "".concat(name, "=");
|
|
12
9
|
var cookies = document.cookie.split(';');
|
|
13
|
-
|
|
14
10
|
for (var i = 0; i < cookies.length; i++) {
|
|
15
11
|
var cookie = cookies[i];
|
|
16
|
-
|
|
17
12
|
while (cookie.charAt(0) === ' ') {
|
|
18
13
|
cookie = cookie.substring(1);
|
|
19
14
|
}
|
|
20
|
-
|
|
21
15
|
if (cookie.indexOf(prefix) === 0) {
|
|
22
16
|
return cookie.substring(prefix.length, cookie.length);
|
|
23
17
|
}
|
|
24
18
|
}
|
|
25
|
-
|
|
26
19
|
return undefined;
|
|
27
20
|
}
|
|
28
|
-
|
|
29
21
|
export function getInsightsAnonymousUserTokenInternal() {
|
|
30
22
|
return getCookie(ANONYMOUS_TOKEN_COOKIE_KEY);
|
|
31
23
|
}
|
|
24
|
+
|
|
32
25
|
/**
|
|
33
26
|
* @deprecated This function will be still supported in 4.x releases, but not further. It is replaced by the `insights` middleware. For more information, visit https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/how-to/send-click-and-conversion-events-with-instantsearch/js/
|
|
34
27
|
*/
|
|
35
|
-
|
|
36
28
|
export default function getInsightsAnonymousUserToken() {
|
|
37
29
|
process.env.NODE_ENV === 'development' ? warning(false, "`getInsightsAnonymousUserToken` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `insights` middleware.\n\nFor more information, visit https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/how-to/send-click-and-conversion-events-with-instantsearch/js/") : void 0;
|
|
38
30
|
return getInsightsAnonymousUserTokenInternal();
|
package/es/helpers/highlight.js
CHANGED
|
@@ -3,20 +3,18 @@ import { getPropertyByPath, TAG_REPLACEMENT, warning } from "../lib/utils/index.
|
|
|
3
3
|
var suit = component('Highlight');
|
|
4
4
|
export default function highlight(_ref) {
|
|
5
5
|
var attribute = _ref.attribute,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute);
|
|
6
|
+
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
7
|
+
highlightedTagName = _ref$highlightedTagNa === void 0 ? 'mark' : _ref$highlightedTagNa,
|
|
8
|
+
hit = _ref.hit,
|
|
9
|
+
_ref$cssClasses = _ref.cssClasses,
|
|
10
|
+
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
11
|
+
var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute);
|
|
12
12
|
|
|
13
|
+
// @MAJOR fallback to attribute value if highlight is not found
|
|
13
14
|
process.env.NODE_ENV === 'development' ? warning(highlightAttributeResult, "Could not enable highlight for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
|
|
14
|
-
|
|
15
15
|
var _ref2 = highlightAttributeResult || {},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
_ref2$value = _ref2.value,
|
|
17
|
+
attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
|
|
20
18
|
var className = suit({
|
|
21
19
|
descendantName: 'highlighted'
|
|
22
20
|
}) + (cssClasses.highlighted ? " ".concat(cssClasses.highlighted) : '');
|
package/es/helpers/insights.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
2
|
-
|
|
1
|
+
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); }
|
|
3
2
|
import { warning, serializePayload, deserializePayload } from "../lib/utils/index.js";
|
|
4
3
|
export function readDataAttributes(domElement) {
|
|
5
4
|
var method = domElement.getAttribute('data-insights-method');
|
|
6
5
|
var serializedPayload = domElement.getAttribute('data-insights-payload');
|
|
7
|
-
|
|
8
6
|
if (typeof serializedPayload !== 'string') {
|
|
9
7
|
throw new Error('The insights helper expects `data-insights-payload` to be a base64-encoded JSON string.');
|
|
10
8
|
}
|
|
11
|
-
|
|
12
9
|
try {
|
|
13
10
|
var payload = deserializePayload(serializedPayload);
|
|
14
11
|
return {
|
|
@@ -24,26 +21,22 @@ export function hasDataAttributes(domElement) {
|
|
|
24
21
|
}
|
|
25
22
|
export function writeDataAttributes(_ref) {
|
|
26
23
|
var method = _ref.method,
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
payload = _ref.payload;
|
|
29
25
|
if (_typeof(payload) !== 'object') {
|
|
30
26
|
throw new Error("The insights helper expects the payload to be an object.");
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
var serializedPayload;
|
|
34
|
-
|
|
35
29
|
try {
|
|
36
30
|
serializedPayload = serializePayload(payload);
|
|
37
31
|
} catch (error) {
|
|
38
32
|
throw new Error("Could not JSON serialize the payload object.");
|
|
39
33
|
}
|
|
40
|
-
|
|
41
34
|
return "data-insights-method=\"".concat(method, "\" data-insights-payload=\"").concat(serializedPayload, "\"");
|
|
42
35
|
}
|
|
36
|
+
|
|
43
37
|
/**
|
|
44
38
|
* @deprecated This function will be still supported in 4.x releases, but not further. It is replaced by the `insights` middleware. For more information, visit https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/how-to/send-click-and-conversion-events-with-instantsearch/js/
|
|
45
39
|
*/
|
|
46
|
-
|
|
47
40
|
export default function insights(method, payload) {
|
|
48
41
|
process.env.NODE_ENV === 'development' ? warning(false, "`insights` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `insights` middleware.\n\nFor more information, visit https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/how-to/send-click-and-conversion-events-with-instantsearch/js/") : void 0;
|
|
49
42
|
return writeDataAttributes({
|
|
@@ -3,20 +3,18 @@ import { component } from "../lib/suit.js";
|
|
|
3
3
|
var suit = component('ReverseHighlight');
|
|
4
4
|
export default function reverseHighlight(_ref) {
|
|
5
5
|
var attribute = _ref.attribute,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute);
|
|
6
|
+
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
7
|
+
highlightedTagName = _ref$highlightedTagNa === void 0 ? 'mark' : _ref$highlightedTagNa,
|
|
8
|
+
hit = _ref.hit,
|
|
9
|
+
_ref$cssClasses = _ref.cssClasses,
|
|
10
|
+
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
11
|
+
var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute);
|
|
12
12
|
|
|
13
|
+
// @MAJOR fallback to attribute value if highlight is not found
|
|
13
14
|
process.env.NODE_ENV === 'development' ? warning(highlightAttributeResult, "Could not enable reverse highlight for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
|
|
14
|
-
|
|
15
15
|
var _ref2 = highlightAttributeResult || {},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
_ref2$value = _ref2.value,
|
|
17
|
+
attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
|
|
20
18
|
var className = suit({
|
|
21
19
|
descendantName: 'highlighted'
|
|
22
20
|
}) + (cssClasses.highlighted ? " ".concat(cssClasses.highlighted) : '');
|
|
@@ -3,20 +3,18 @@ import { component } from "../lib/suit.js";
|
|
|
3
3
|
var suit = component('ReverseSnippet');
|
|
4
4
|
export default function reverseSnippet(_ref) {
|
|
5
5
|
var attribute = _ref.attribute,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute);
|
|
6
|
+
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
7
|
+
highlightedTagName = _ref$highlightedTagNa === void 0 ? 'mark' : _ref$highlightedTagNa,
|
|
8
|
+
hit = _ref.hit,
|
|
9
|
+
_ref$cssClasses = _ref.cssClasses,
|
|
10
|
+
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
11
|
+
var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute);
|
|
12
12
|
|
|
13
|
+
// @MAJOR fallback to attribute value if snippet is not found
|
|
13
14
|
process.env.NODE_ENV === 'development' ? warning(snippetAttributeResult, "Could not enable reverse snippet for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
|
|
14
|
-
|
|
15
15
|
var _ref2 = snippetAttributeResult || {},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
_ref2$value = _ref2.value,
|
|
17
|
+
attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
|
|
20
18
|
var className = suit({
|
|
21
19
|
descendantName: 'highlighted'
|
|
22
20
|
}) + (cssClasses.highlighted ? " ".concat(cssClasses.highlighted) : '');
|
package/es/helpers/snippet.js
CHANGED
|
@@ -3,20 +3,18 @@ import { TAG_REPLACEMENT, getPropertyByPath, warning } from "../lib/utils/index.
|
|
|
3
3
|
var suit = component('Snippet');
|
|
4
4
|
export default function snippet(_ref) {
|
|
5
5
|
var attribute = _ref.attribute,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute);
|
|
6
|
+
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
7
|
+
highlightedTagName = _ref$highlightedTagNa === void 0 ? 'mark' : _ref$highlightedTagNa,
|
|
8
|
+
hit = _ref.hit,
|
|
9
|
+
_ref$cssClasses = _ref.cssClasses,
|
|
10
|
+
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
11
|
+
var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute);
|
|
12
12
|
|
|
13
|
+
// @MAJOR fallback to attribute value if snippet is not found
|
|
13
14
|
process.env.NODE_ENV === 'development' ? warning(snippetAttributeResult, "Could not enable snippet for \"".concat(attribute, "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
|
|
14
|
-
|
|
15
15
|
var _ref2 = snippetAttributeResult || {},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
_ref2$value = _ref2.value,
|
|
17
|
+
attributeValue = _ref2$value === void 0 ? '' : _ref2$value; // cx is not used, since it would be bundled as a dependency for Vue & Angular
|
|
20
18
|
var className = suit({
|
|
21
19
|
descendantName: 'highlighted'
|
|
22
20
|
}) + (cssClasses.highlighted ? " ".concat(cssClasses.highlighted) : '');
|
package/es/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import version from "./lib/version.js";
|
|
|
3
3
|
import { snippet, reverseSnippet, highlight, reverseHighlight, insights, getInsightsAnonymousUserToken } from "./helpers/index.js";
|
|
4
4
|
import { createInfiniteHitsSessionStorageCache } from "./lib/infiniteHitsCache/index.js";
|
|
5
5
|
import { deprecate } from "./lib/utils/index.js";
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* InstantSearch is the main component of InstantSearch.js. This object
|
|
9
8
|
* manages the widget and lets you add new ones.
|
|
@@ -22,7 +21,6 @@ import { deprecate } from "./lib/utils/index.js";
|
|
|
22
21
|
var instantsearch = function instantsearch(options) {
|
|
23
22
|
return new InstantSearch(options);
|
|
24
23
|
};
|
|
25
|
-
|
|
26
24
|
instantsearch.version = version;
|
|
27
25
|
instantsearch.createInfiniteHitsSessionStorageCache = deprecate(createInfiniteHitsSessionStorageCache, "import { createInfiniteHitsSessionStorageCache } from 'instantsearch.js/es/lib/infiniteHitsCache'");
|
|
28
26
|
instantsearch.highlight = deprecate(highlight, "import { highlight } from 'instantsearch.js/es/helpers'");
|