instantsearch.js 4.49.2 → 4.49.4
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 +12 -6
- package/cjs/components/Answers/Answers.js +5 -2
- package/cjs/components/Breadcrumb/Breadcrumb.js +1 -1
- package/cjs/components/ClearRefinements/ClearRefinements.js +1 -1
- package/cjs/components/CurrentRefinements/CurrentRefinements.js +3 -4
- package/cjs/components/GeoSearchControls/GeoSearchButton.js +0 -1
- package/cjs/components/GeoSearchControls/GeoSearchControls.js +3 -3
- package/cjs/components/GeoSearchControls/GeoSearchToggle.js +0 -1
- package/cjs/components/Highlight/Highlight.js +3 -2
- package/cjs/components/Hits/Hits.js +5 -2
- package/cjs/components/InfiniteHits/InfiniteHits.js +5 -2
- package/cjs/components/MenuSelect/MenuSelect.js +3 -3
- package/cjs/components/Pagination/Pagination.js +2 -3
- package/cjs/components/Panel/Panel.js +3 -3
- package/cjs/components/PoweredBy/PoweredBy.js +0 -1
- package/cjs/components/QueryRuleCustomData/QueryRuleCustomData.js +1 -2
- package/cjs/components/RangeInput/RangeInput.js +6 -4
- package/cjs/components/RefinementList/RefinementList.js +13 -10
- package/cjs/components/RefinementList/RefinementListItem.js +1 -1
- package/cjs/components/RelevantSort/RelevantSort.js +1 -2
- package/cjs/components/ReverseHighlight/ReverseHighlight.js +3 -2
- package/cjs/components/ReverseSnippet/ReverseSnippet.js +3 -2
- package/cjs/components/SearchBox/SearchBox.js +11 -9
- package/cjs/components/Selector/Selector.js +0 -1
- package/cjs/components/Slider/Pit.js +4 -1
- package/cjs/components/Slider/Rheostat.js +7 -3
- package/cjs/components/Slider/Slider.js +13 -9
- package/cjs/components/Snippet/Snippet.js +3 -2
- package/cjs/components/Stats/Stats.js +7 -3
- package/cjs/components/Template/Template.js +9 -7
- package/cjs/components/ToggleRefinement/ToggleRefinement.js +1 -1
- package/cjs/components/VoiceSearch/VoiceSearch.js +1 -2
- package/cjs/connectors/answers/connectAnswers.js +17 -12
- package/cjs/connectors/autocomplete/connectAutocomplete.js +13 -10
- package/cjs/connectors/breadcrumb/connectBreadcrumb.js +11 -8
- package/cjs/connectors/clear-refinements/connectClearRefinements.js +14 -11
- package/cjs/connectors/configure/connectConfigure.js +12 -9
- package/cjs/connectors/configure-related-items/connectConfigureRelatedItems.js +10 -7
- package/cjs/connectors/current-refinements/connectCurrentRefinements.js +11 -8
- package/cjs/connectors/dynamic-widgets/connectDynamicWidgets.js +10 -8
- package/cjs/connectors/geo-search/connectGeoSearch.js +15 -12
- package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +14 -10
- package/cjs/connectors/hits/connectHits.js +15 -12
- package/cjs/connectors/hits/connectHitsWithInsights.js +3 -3
- package/cjs/connectors/hits-per-page/connectHitsPerPage.js +11 -8
- package/cjs/connectors/index.js +32 -32
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +19 -15
- package/cjs/connectors/infinite-hits/connectInfiniteHitsWithInsights.js +3 -3
- package/cjs/connectors/menu/connectMenu.js +13 -9
- package/cjs/connectors/numeric-menu/connectNumericMenu.js +14 -9
- package/cjs/connectors/pagination/Paginator.js +8 -5
- package/cjs/connectors/pagination/connectPagination.js +9 -6
- package/cjs/connectors/powered-by/connectPoweredBy.js +9 -6
- package/cjs/connectors/query-rules/connectQueryRules.js +12 -9
- package/cjs/connectors/range/connectRange.js +32 -29
- package/cjs/connectors/rating-menu/connectRatingMenu.js +12 -9
- package/cjs/connectors/refinement-list/connectRefinementList.js +16 -11
- package/cjs/connectors/relevant-sort/connectRelevantSort.js +7 -4
- package/cjs/connectors/search-box/connectSearchBox.js +8 -5
- package/cjs/connectors/sort-by/connectSortBy.js +10 -7
- package/cjs/connectors/stats/connectStats.js +8 -5
- package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +15 -12
- package/cjs/connectors/voice-search/connectVoiceSearch.js +10 -7
- package/cjs/helpers/components/Highlight.js +8 -7
- package/cjs/helpers/components/ReverseHighlight.js +14 -9
- package/cjs/helpers/components/ReverseSnippet.js +14 -9
- package/cjs/helpers/components/Snippet.js +8 -7
- package/cjs/helpers/components/index.js +4 -4
- package/cjs/helpers/get-insights-anonymous-user-token.js +2 -2
- package/cjs/helpers/highlight.js +8 -6
- package/cjs/helpers/index.js +6 -6
- package/cjs/helpers/insights.js +4 -4
- package/cjs/helpers/reverseHighlight.js +9 -7
- package/cjs/helpers/reverseSnippet.js +9 -7
- package/cjs/helpers/snippet.js +8 -6
- package/cjs/index.js +9 -9
- package/cjs/lib/InstantSearch.js +31 -29
- package/cjs/lib/createHelpers.js +11 -8
- package/cjs/lib/infiniteHitsCache/index.js +1 -1
- package/cjs/lib/infiniteHitsCache/sessionStorage.js +6 -5
- package/cjs/lib/insights/client.js +9 -6
- package/cjs/lib/insights/index.js +2 -2
- package/cjs/lib/insights/listener.js +3 -4
- package/cjs/lib/routers/history.js +16 -19
- package/cjs/lib/routers/index.js +1 -1
- package/cjs/lib/stateMappings/index.js +2 -2
- package/cjs/lib/stateMappings/simple.js +6 -2
- package/cjs/lib/stateMappings/singleIndex.js +6 -2
- package/cjs/lib/templating/index.js +2 -2
- package/cjs/lib/templating/prepareTemplateProps.js +6 -3
- package/cjs/lib/templating/renderTemplate.js +8 -6
- package/cjs/lib/utils/checkIndexUiState.js +5 -5
- package/cjs/lib/utils/checkRendering.js +1 -1
- package/cjs/lib/utils/concatHighlightedParts.js +1 -1
- package/cjs/lib/utils/createSendEventForFacet.js +1 -1
- package/cjs/lib/utils/createSendEventForHits.js +1 -1
- package/cjs/lib/utils/detect-insights-client.js +1 -1
- package/cjs/lib/utils/escape-highlight.js +8 -4
- package/cjs/lib/utils/geo-search.js +14 -10
- package/cjs/lib/utils/getContainerNode.js +1 -1
- package/cjs/lib/utils/getHighlightFromSiblings.js +1 -1
- package/cjs/lib/utils/getHighlightedParts.js +1 -1
- package/cjs/lib/utils/getRefinements.js +17 -19
- package/cjs/lib/utils/hits-absolute-position.js +4 -1
- package/cjs/lib/utils/hits-query-id.js +4 -1
- package/cjs/lib/utils/index.js +46 -46
- package/cjs/lib/utils/isEqual.js +3 -0
- package/cjs/lib/utils/logger.js +3 -3
- package/cjs/lib/utils/mergeSearchParameters.js +8 -4
- package/cjs/lib/utils/range.js +1 -1
- package/cjs/lib/utils/reverseHighlightedParts.js +5 -2
- package/cjs/lib/utils/setIndexHelperState.js +2 -2
- package/cjs/lib/version.js +1 -1
- package/cjs/lib/voiceSearchHelper/index.js +4 -1
- package/cjs/middlewares/createInsightsMiddleware.js +18 -13
- package/cjs/middlewares/createMetadataMiddleware.js +3 -3
- package/cjs/middlewares/createRouterMiddleware.js +8 -5
- package/cjs/middlewares/index.js +3 -3
- package/cjs/types/index.js +14 -14
- package/cjs/widgets/analytics/analytics.js +13 -4
- package/cjs/widgets/answers/answers.js +13 -10
- package/cjs/widgets/breadcrumb/breadcrumb.js +13 -10
- package/cjs/widgets/clear-refinements/clear-refinements.js +13 -10
- package/cjs/widgets/configure/configure.js +7 -4
- package/cjs/widgets/configure-related-items/configure-related-items.js +7 -4
- package/cjs/widgets/current-refinements/current-refinements.js +10 -7
- package/cjs/widgets/dynamic-widgets/dynamic-widgets.js +12 -8
- package/cjs/widgets/geo-search/GeoSearchRenderer.js +12 -7
- package/cjs/widgets/geo-search/createHTMLMarker.js +4 -2
- package/cjs/widgets/geo-search/geo-search.js +20 -14
- package/cjs/widgets/hierarchical-menu/defaultTemplates.js +1 -2
- package/cjs/widgets/hierarchical-menu/hierarchical-menu.js +13 -10
- package/cjs/widgets/hits/hits.js +16 -13
- package/cjs/widgets/hits-per-page/hits-per-page.js +11 -8
- package/cjs/widgets/index/index.js +24 -20
- package/cjs/widgets/index.js +37 -37
- package/cjs/widgets/infinite-hits/infinite-hits.js +16 -13
- package/cjs/widgets/menu/defaultTemplates.js +1 -2
- package/cjs/widgets/menu/menu.js +13 -10
- package/cjs/widgets/menu-select/defaultTemplates.js +1 -1
- package/cjs/widgets/menu-select/menu-select.js +13 -10
- package/cjs/widgets/numeric-menu/defaultTemplates.js +0 -1
- package/cjs/widgets/numeric-menu/numeric-menu.js +13 -10
- package/cjs/widgets/pagination/pagination.js +11 -8
- package/cjs/widgets/panel/panel.js +11 -8
- package/cjs/widgets/places/places.js +8 -3
- package/cjs/widgets/powered-by/powered-by.js +10 -7
- package/cjs/widgets/query-rule-context/query-rule-context.js +8 -5
- package/cjs/widgets/query-rule-custom-data/query-rule-custom-data.js +10 -7
- package/cjs/widgets/range-input/range-input.js +14 -11
- package/cjs/widgets/range-slider/range-slider.js +12 -9
- package/cjs/widgets/rating-menu/defaultTemplates.js +1 -2
- package/cjs/widgets/rating-menu/rating-menu.js +13 -10
- package/cjs/widgets/refinement-list/defaultTemplates.js +1 -2
- package/cjs/widgets/refinement-list/refinement-list.js +15 -12
- package/cjs/widgets/relevant-sort/relevant-sort.js +11 -8
- package/cjs/widgets/search-box/search-box.js +11 -8
- package/cjs/widgets/sort-by/sort-by.js +10 -7
- package/cjs/widgets/stats/defaultTemplates.js +1 -1
- package/cjs/widgets/stats/stats.js +13 -10
- package/cjs/widgets/toggle-refinement/toggle-refinement.js +13 -10
- package/cjs/widgets/voice-search/voice-search.js +11 -8
- package/dist/instantsearch.development.d.ts +1 -0
- package/dist/instantsearch.development.js +189 -122
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +1 -0
- package/dist/instantsearch.production.min.d.ts +1 -0
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Answers/Answers.js +4 -2
- package/es/components/Breadcrumb/Breadcrumb.js +0 -1
- package/es/components/ClearRefinements/ClearRefinements.js +0 -1
- package/es/components/CurrentRefinements/CurrentRefinements.js +0 -2
- package/es/components/GeoSearchControls/GeoSearchButton.js +0 -2
- package/es/components/GeoSearchControls/GeoSearchControls.js +0 -1
- package/es/components/GeoSearchControls/GeoSearchToggle.js +0 -2
- package/es/components/Highlight/Highlight.js +2 -1
- package/es/components/Hits/Hits.js +4 -2
- package/es/components/InfiniteHits/InfiniteHits.js +4 -2
- package/es/components/MenuSelect/MenuSelect.js +0 -1
- package/es/components/Pagination/Pagination.js +0 -2
- package/es/components/Panel/Panel.js +2 -3
- package/es/components/PoweredBy/PoweredBy.js +0 -2
- package/es/components/QueryRuleCustomData/QueryRuleCustomData.js +0 -2
- package/es/components/RangeInput/RangeInput.js +4 -3
- package/es/components/RefinementList/RefinementList.js +6 -4
- package/es/components/RefinementList/RefinementListItem.js +0 -1
- package/es/components/RelevantSort/RelevantSort.js +0 -2
- package/es/components/ReverseHighlight/ReverseHighlight.js +2 -1
- package/es/components/ReverseSnippet/ReverseSnippet.js +2 -1
- package/es/components/SearchBox/SearchBox.js +4 -3
- package/es/components/Selector/Selector.js +0 -2
- package/es/components/Slider/Pit.js +4 -2
- package/es/components/Slider/Rheostat.js +8 -6
- package/es/components/Slider/Slider.js +8 -5
- package/es/components/Snippet/Snippet.js +2 -1
- package/es/components/Stats/Stats.js +6 -3
- package/es/components/Template/Template.js +4 -3
- package/es/components/ToggleRefinement/ToggleRefinement.js +0 -1
- package/es/components/VoiceSearch/VoiceSearch.js +0 -2
- package/es/connectors/answers/connectAnswers.js +7 -2
- package/es/connectors/autocomplete/connectAutocomplete.js +4 -1
- package/es/connectors/breadcrumb/connectBreadcrumb.js +6 -3
- package/es/connectors/clear-refinements/connectClearRefinements.js +5 -2
- package/es/connectors/configure/connectConfigure.js +4 -1
- package/es/connectors/configure-related-items/connectConfigureRelatedItems.js +5 -2
- package/es/connectors/current-refinements/connectCurrentRefinements.js +5 -2
- package/es/connectors/dynamic-widgets/connectDynamicWidgets.js +3 -1
- package/es/connectors/geo-search/connectGeoSearch.js +4 -1
- package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +8 -4
- package/es/connectors/hits/connectHits.js +4 -1
- package/es/connectors/hits-per-page/connectHitsPerPage.js +5 -2
- package/es/connectors/infinite-hits/connectInfiniteHits.js +7 -3
- package/es/connectors/menu/connectMenu.js +8 -4
- package/es/connectors/numeric-menu/connectNumericMenu.js +8 -3
- package/es/connectors/pagination/Paginator.js +5 -2
- package/es/connectors/pagination/connectPagination.js +4 -1
- package/es/connectors/powered-by/connectPoweredBy.js +4 -1
- package/es/connectors/query-rules/connectQueryRules.js +5 -2
- package/es/connectors/range/connectRange.js +6 -3
- package/es/connectors/rating-menu/connectRatingMenu.js +6 -3
- package/es/connectors/refinement-list/connectRefinementList.js +8 -3
- package/es/connectors/relevant-sort/connectRelevantSort.js +4 -1
- package/es/connectors/search-box/connectSearchBox.js +4 -1
- package/es/connectors/sort-by/connectSortBy.js +4 -1
- package/es/connectors/stats/connectStats.js +4 -1
- package/es/connectors/toggle-refinement/connectToggleRefinement.js +4 -1
- package/es/connectors/toggle-refinement/types.js +1 -0
- package/es/connectors/voice-search/connectVoiceSearch.js +4 -1
- package/es/helpers/components/Highlight.js +2 -1
- package/es/helpers/components/ReverseHighlight.js +8 -3
- package/es/helpers/components/ReverseSnippet.js +8 -3
- package/es/helpers/components/Snippet.js +2 -1
- package/es/helpers/highlight.js +3 -1
- package/es/helpers/reverseHighlight.js +3 -1
- package/es/helpers/reverseSnippet.js +3 -1
- package/es/helpers/snippet.js +3 -1
- package/es/lib/InstantSearch.js +4 -2
- package/es/lib/createHelpers.js +4 -1
- package/es/lib/infiniteHitsCache/sessionStorage.js +2 -1
- package/es/lib/insights/client.js +4 -1
- package/es/lib/insights/listener.js +0 -2
- package/es/lib/routers/history.js +9 -12
- package/es/lib/stateMappings/simple.js +6 -2
- package/es/lib/stateMappings/singleIndex.js +6 -2
- package/es/lib/templating/prepareTemplateProps.js +5 -2
- package/es/lib/templating/renderTemplate.js +3 -1
- package/es/lib/utils/checkIndexUiState.js +2 -2
- package/es/lib/utils/escape-highlight.js +6 -2
- package/es/lib/utils/geo-search.js +14 -10
- package/es/lib/utils/getRefinements.js +15 -17
- package/es/lib/utils/hits-absolute-position.js +4 -1
- package/es/lib/utils/hits-query-id.js +4 -1
- package/es/lib/utils/isEqual.js +3 -0
- package/es/lib/utils/logger.js +2 -2
- package/es/lib/utils/mergeSearchParameters.js +6 -2
- package/es/lib/utils/range.js +1 -1
- package/es/lib/utils/reverseHighlightedParts.js +4 -1
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/lib/voiceSearchHelper/index.js +4 -1
- package/es/lib/voiceSearchHelper/types.js +1 -0
- package/es/middlewares/createInsightsMiddleware.js +9 -4
- package/es/middlewares/createRouterMiddleware.js +4 -1
- package/es/types/algoliasearch.js +1 -0
- package/es/types/component.js +1 -0
- package/es/types/connector.js +1 -0
- package/es/types/insights.js +1 -0
- package/es/types/instantsearch.js +1 -0
- package/es/types/middleware.js +1 -0
- package/es/types/render-state.js +1 -0
- package/es/types/results.js +1 -0
- package/es/types/router.js +1 -0
- package/es/types/templates.js +1 -0
- package/es/types/ui-state.js +1 -0
- package/es/types/utils.js +1 -0
- package/es/types/widget-factory.js +1 -0
- package/es/types/widget.js +1 -0
- package/es/widgets/analytics/analytics.js +10 -1
- package/es/widgets/answers/answers.js +4 -2
- package/es/widgets/breadcrumb/breadcrumb.js +4 -2
- package/es/widgets/clear-refinements/clear-refinements.js +4 -2
- package/es/widgets/configure/configure.js +4 -1
- package/es/widgets/configure-related-items/configure-related-items.js +4 -1
- package/es/widgets/current-refinements/current-refinements.js +4 -2
- package/es/widgets/dynamic-widgets/dynamic-widgets.js +6 -2
- package/es/widgets/geo-search/GeoSearchRenderer.d.js +1 -0
- package/es/widgets/geo-search/GeoSearchRenderer.js +9 -5
- package/es/widgets/geo-search/createHTMLMarker.d.ts +1 -0
- package/es/widgets/geo-search/createHTMLMarker.js +4 -2
- package/es/widgets/geo-search/defaultTemplates.js +0 -2
- package/es/widgets/geo-search/geo-search.d.ts +1 -0
- package/es/widgets/geo-search/geo-search.js +10 -4
- package/es/widgets/hierarchical-menu/defaultTemplates.js +0 -1
- package/es/widgets/hierarchical-menu/hierarchical-menu.js +4 -2
- package/es/widgets/hits/hits.js +4 -2
- package/es/widgets/hits-per-page/hits-per-page.js +4 -2
- package/es/widgets/index/index.js +7 -3
- package/es/widgets/infinite-hits/infinite-hits.js +4 -2
- package/es/widgets/menu/defaultTemplates.js +0 -1
- package/es/widgets/menu/menu.js +4 -2
- package/es/widgets/menu-select/menu-select.js +4 -2
- package/es/widgets/numeric-menu/defaultTemplates.js +0 -1
- package/es/widgets/numeric-menu/numeric-menu.js +4 -2
- package/es/widgets/pagination/pagination.js +4 -2
- package/es/widgets/panel/panel.js +4 -2
- package/es/widgets/places/places.js +8 -3
- package/es/widgets/powered-by/powered-by.js +4 -2
- package/es/widgets/query-rule-context/query-rule-context.js +4 -1
- package/es/widgets/query-rule-custom-data/query-rule-custom-data.js +4 -2
- package/es/widgets/range-input/range-input.js +6 -4
- package/es/widgets/range-slider/range-slider.js +6 -4
- package/es/widgets/rating-menu/defaultTemplates.js +0 -1
- package/es/widgets/rating-menu/rating-menu.js +4 -2
- package/es/widgets/refinement-list/defaultTemplates.js +0 -1
- package/es/widgets/refinement-list/refinement-list.js +4 -2
- package/es/widgets/relevant-sort/relevant-sort.js +4 -2
- package/es/widgets/search-box/defaultTemplates.js +0 -1
- package/es/widgets/search-box/search-box.js +4 -2
- package/es/widgets/sort-by/sort-by.js +4 -2
- package/es/widgets/stats/stats.js +4 -2
- package/es/widgets/toggle-refinement/toggle-refinement.js +4 -2
- package/es/widgets/voice-search/defaultTemplates.js +0 -1
- package/es/widgets/voice-search/voice-search.js +4 -2
- package/package.json +7 -7
- package/scripts/transforms/__tests__/addWidget-to-addWidgets.test.js +1 -0
|
@@ -5,12 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = historyRouter;
|
|
7
7
|
var _qs = _interopRequireDefault(require("qs"));
|
|
8
|
-
var
|
|
8
|
+
var _utils = require("../utils");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
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); }
|
|
10
11
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
-
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); } }
|
|
12
|
+
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
13
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
-
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; }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
17
|
var setWindowTitle = function setWindowTitle(title) {
|
|
15
18
|
if (title) {
|
|
16
19
|
// This function is only executed on browsers so we can disable this check.
|
|
@@ -47,7 +50,7 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
47
50
|
this._createURL = createURL;
|
|
48
51
|
this.parseURL = parseURL;
|
|
49
52
|
this.getLocation = getLocation;
|
|
50
|
-
(0,
|
|
53
|
+
(0, _utils.safelyRunOnBrowser)(function (_ref2) {
|
|
51
54
|
var window = _ref2.window;
|
|
52
55
|
var title = _this.windowTitle && _this.windowTitle(_this.read());
|
|
53
56
|
setWindowTitle(title);
|
|
@@ -74,7 +77,7 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
74
77
|
key: "write",
|
|
75
78
|
value: function write(routeState) {
|
|
76
79
|
var _this2 = this;
|
|
77
|
-
(0,
|
|
80
|
+
(0, _utils.safelyRunOnBrowser)(function (_ref3) {
|
|
78
81
|
var window = _ref3.window;
|
|
79
82
|
var url = _this2.createURL(routeState);
|
|
80
83
|
var title = _this2.windowTitle && _this2.windowTitle(routeState);
|
|
@@ -101,24 +104,18 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
101
104
|
key: "onUpdate",
|
|
102
105
|
value: function onUpdate(callback) {
|
|
103
106
|
var _this3 = this;
|
|
104
|
-
this._onPopState = function (
|
|
107
|
+
this._onPopState = function () {
|
|
105
108
|
if (_this3.writeTimer) {
|
|
106
109
|
clearTimeout(_this3.writeTimer);
|
|
107
110
|
_this3.writeTimer = undefined;
|
|
108
111
|
}
|
|
109
112
|
_this3.inPopState = true;
|
|
110
|
-
var routeState = event.state;
|
|
111
113
|
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
if (!routeState) {
|
|
116
|
-
callback(_this3.read());
|
|
117
|
-
} else {
|
|
118
|
-
callback(routeState);
|
|
119
|
-
}
|
|
114
|
+
// We always read the state from the URL because the state of the history
|
|
115
|
+
// can be incorect in some cases (e.g. using React Router).
|
|
116
|
+
callback(_this3.read());
|
|
120
117
|
};
|
|
121
|
-
(0,
|
|
118
|
+
(0, _utils.safelyRunOnBrowser)(function (_ref4) {
|
|
122
119
|
var window = _ref4.window;
|
|
123
120
|
window.addEventListener('popstate', _this3._onPopState);
|
|
124
121
|
});
|
|
@@ -149,7 +146,7 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
149
146
|
value: function dispose() {
|
|
150
147
|
var _this4 = this;
|
|
151
148
|
this.isDisposed = true;
|
|
152
|
-
(0,
|
|
149
|
+
(0, _utils.safelyRunOnBrowser)(function (_ref5) {
|
|
153
150
|
var window = _ref5.window;
|
|
154
151
|
if (_this4._onPopState) {
|
|
155
152
|
window.removeEventListener('popstate', _this4._onPopState);
|
|
@@ -164,7 +161,7 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
164
161
|
key: "shouldWrite",
|
|
165
162
|
value: function shouldWrite(url) {
|
|
166
163
|
var _this5 = this;
|
|
167
|
-
return (0,
|
|
164
|
+
return (0, _utils.safelyRunOnBrowser)(function (_ref6) {
|
|
168
165
|
var window = _ref6.window;
|
|
169
166
|
// We do want to `pushState` if:
|
|
170
167
|
// - the router is not disposed, IS.js needs to update the URL
|
|
@@ -231,7 +228,7 @@ function historyRouter() {
|
|
|
231
228
|
windowTitle = _ref7.windowTitle,
|
|
232
229
|
_ref7$getLocation = _ref7.getLocation,
|
|
233
230
|
getLocation = _ref7$getLocation === void 0 ? function () {
|
|
234
|
-
return (0,
|
|
231
|
+
return (0, _utils.safelyRunOnBrowser)(function (_ref10) {
|
|
235
232
|
var window = _ref10.window;
|
|
236
233
|
return window.location;
|
|
237
234
|
}, {
|
package/cjs/lib/routers/index.js
CHANGED
|
@@ -9,5 +9,5 @@ Object.defineProperty(exports, "history", {
|
|
|
9
9
|
return _history.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var _history = _interopRequireDefault(require("./history
|
|
12
|
+
var _history = _interopRequireDefault(require("./history"));
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -15,6 +15,6 @@ Object.defineProperty(exports, "singleIndex", {
|
|
|
15
15
|
return _singleIndex.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
var _simple = _interopRequireDefault(require("./simple
|
|
19
|
-
var _singleIndex = _interopRequireDefault(require("./singleIndex
|
|
18
|
+
var _simple = _interopRequireDefault(require("./simple"));
|
|
19
|
+
var _singleIndex = _interopRequireDefault(require("./singleIndex"));
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
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
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = simpleStateMapping;
|
|
8
|
+
var _excluded = ["configure"];
|
|
7
9
|
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; }
|
|
8
10
|
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; }
|
|
9
|
-
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; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
14
|
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; }
|
|
11
15
|
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
16
|
function getIndexStateWithoutConfigure(uiState) {
|
|
13
17
|
var configure = uiState.configure,
|
|
14
|
-
trackedUiState = _objectWithoutProperties(uiState,
|
|
18
|
+
trackedUiState = _objectWithoutProperties(uiState, _excluded);
|
|
15
19
|
return trackedUiState;
|
|
16
20
|
}
|
|
17
21
|
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
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
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = singleIndexStateMapping;
|
|
7
|
-
|
|
8
|
+
var _excluded = ["configure"];
|
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
12
|
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; }
|
|
9
13
|
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; }
|
|
10
14
|
function getIndexStateWithoutConfigure(uiState) {
|
|
11
15
|
var configure = uiState.configure,
|
|
12
|
-
trackedUiState = _objectWithoutProperties(uiState,
|
|
16
|
+
trackedUiState = _objectWithoutProperties(uiState, _excluded);
|
|
13
17
|
return trackedUiState;
|
|
14
18
|
}
|
|
15
19
|
function singleIndexStateMapping(indexName) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _prepareTemplateProps = require("./prepareTemplateProps
|
|
6
|
+
var _prepareTemplateProps = require("./prepareTemplateProps");
|
|
7
7
|
Object.keys(_prepareTemplateProps).forEach(function (key) {
|
|
8
8
|
if (key === "default" || key === "__esModule") return;
|
|
9
9
|
if (key in exports && exports[key] === _prepareTemplateProps[key]) return;
|
|
@@ -14,7 +14,7 @@ Object.keys(_prepareTemplateProps).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
-
var _renderTemplate = require("./renderTemplate
|
|
17
|
+
var _renderTemplate = require("./renderTemplate");
|
|
18
18
|
Object.keys(_renderTemplate).forEach(function (key) {
|
|
19
19
|
if (key === "default" || key === "__esModule") return;
|
|
20
20
|
if (key in exports && exports[key] === _renderTemplate[key]) return;
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
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
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.prepareTemplateProps = prepareTemplateProps;
|
|
7
|
-
var _uniq = require("../utils/uniq
|
|
8
|
+
var _uniq = require("../utils/uniq");
|
|
8
9
|
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
10
|
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; }
|
|
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; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
14
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
15
|
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."); }
|
|
13
16
|
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); }
|
|
14
17
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
15
18
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
19
|
+
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; }
|
|
17
20
|
function prepareTemplates(
|
|
18
21
|
// can not use = {} here, since the template could have different constraints
|
|
19
22
|
defaultTemplates) {
|
|
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.renderTemplate = renderTemplate;
|
|
7
7
|
var _hogan = _interopRequireDefault(require("hogan.js"));
|
|
8
8
|
var _preact = require("htm/preact");
|
|
9
|
-
var
|
|
9
|
+
var _components = require("../../helpers/components");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
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); }
|
|
12
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
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; }
|
|
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; }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
17
|
// We add all our template helper methods to the template as lambdas. Note
|
|
16
18
|
// that lambdas in Mustache are supposed to accept a second argument of
|
|
17
19
|
// `render` to get the rendered value, not the literal `{{value}}`. But
|
|
@@ -50,10 +52,10 @@ function renderTemplate(_ref) {
|
|
|
50
52
|
params.html = _preact.html;
|
|
51
53
|
params.sendEvent = sendEvent;
|
|
52
54
|
params.components = {
|
|
53
|
-
Highlight:
|
|
54
|
-
ReverseHighlight:
|
|
55
|
-
Snippet:
|
|
56
|
-
ReverseSnippet:
|
|
55
|
+
Highlight: _components.Highlight,
|
|
56
|
+
ReverseHighlight: _components.ReverseHighlight,
|
|
57
|
+
Snippet: _components.Snippet,
|
|
58
|
+
ReverseSnippet: _components.ReverseSnippet
|
|
57
59
|
};
|
|
58
60
|
return template(data, params);
|
|
59
61
|
}
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.checkIndexUiState = checkIndexUiState;
|
|
7
|
-
var _capitalize = require("./capitalize
|
|
8
|
-
var _logger = require("./logger
|
|
9
|
-
var _typedObject = require("./typedObject
|
|
7
|
+
var _capitalize = require("./capitalize");
|
|
8
|
+
var _logger = require("./logger");
|
|
9
|
+
var _typedObject = require("./typedObject");
|
|
10
10
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
11
|
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."); }
|
|
12
12
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -14,8 +14,8 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
14
14
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
15
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
16
|
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); }
|
|
17
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
18
|
-
function _iterableToArrayLimit(arr, i) { var _i =
|
|
17
|
+
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; }
|
|
18
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
19
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
20
|
// Some connectors are responsible for multiple widgets so we need
|
|
21
21
|
// to map them.
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.checkRendering = checkRendering;
|
|
7
|
-
var _getObjectType = require("./getObjectType
|
|
7
|
+
var _getObjectType = require("./getObjectType");
|
|
8
8
|
function checkRendering(rendering, usage) {
|
|
9
9
|
if (rendering === undefined || typeof rendering !== 'function') {
|
|
10
10
|
throw new Error("The render function is not valid (received type ".concat((0, _getObjectType.getObjectType)(rendering), ").\n\n").concat(usage));
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.concatHighlightedParts = concatHighlightedParts;
|
|
7
|
-
var _escapeHighlight = require("./escape-highlight
|
|
7
|
+
var _escapeHighlight = require("./escape-highlight");
|
|
8
8
|
function concatHighlightedParts(parts) {
|
|
9
9
|
var highlightPreTag = _escapeHighlight.TAG_REPLACEMENT.highlightPreTag,
|
|
10
10
|
highlightPostTag = _escapeHighlight.TAG_REPLACEMENT.highlightPostTag;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createSendEventForFacet = createSendEventForFacet;
|
|
7
|
-
var _isFacetRefined = require("./isFacetRefined
|
|
7
|
+
var _isFacetRefined = require("./isFacetRefined");
|
|
8
8
|
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); }
|
|
9
9
|
function createSendEventForFacet(_ref) {
|
|
10
10
|
var instantSearchInstance = _ref.instantSearchInstance,
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createBindEventForHits = createBindEventForHits;
|
|
7
7
|
exports.createSendEventForHits = createSendEventForHits;
|
|
8
|
-
var _serializer = require("./serializer
|
|
8
|
+
var _serializer = require("./serializer");
|
|
9
9
|
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); }
|
|
10
10
|
function chunk(arr) {
|
|
11
11
|
var chunkSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.hasDetectedInsightsClient = hasDetectedInsightsClient;
|
|
7
|
-
var _safelyRunOnBrowser = require("./safelyRunOnBrowser
|
|
7
|
+
var _safelyRunOnBrowser = require("./safelyRunOnBrowser");
|
|
8
8
|
function hasDetectedInsightsClient() {
|
|
9
9
|
return (0, _safelyRunOnBrowser.safelyRunOnBrowser)(function (_ref) {
|
|
10
10
|
var window = _ref.window;
|
|
@@ -6,12 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.TAG_REPLACEMENT = exports.TAG_PLACEHOLDER = void 0;
|
|
7
7
|
exports.escapeFacets = escapeFacets;
|
|
8
8
|
exports.escapeHits = escapeHits;
|
|
9
|
-
var _escapeHtml = require("./escape-html
|
|
10
|
-
var _isPlainObject = require("./isPlainObject
|
|
9
|
+
var _escapeHtml = require("./escape-html");
|
|
10
|
+
var _isPlainObject = require("./isPlainObject");
|
|
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); }
|
|
12
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
11
13
|
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
14
|
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
15
|
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
|
-
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; }
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
19
|
var TAG_PLACEHOLDER = {
|
|
16
20
|
highlightPreTag: '__ais-highlight__',
|
|
17
21
|
highlightPostTag: '__/ais-highlight__'
|
|
@@ -43,7 +47,7 @@ function escapeHits(hits) {
|
|
|
43
47
|
// We don't override the value on hit because it will mutate the raw results
|
|
44
48
|
// instead we make a shallow copy and we assign the escaped values on it.
|
|
45
49
|
hits = hits.map(function (_ref) {
|
|
46
|
-
var hit = _extends({}, _ref);
|
|
50
|
+
var hit = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
47
51
|
if (hit._highlightResult) {
|
|
48
52
|
hit._highlightResult = recursiveEscape(hit._highlightResult);
|
|
49
53
|
}
|
|
@@ -8,8 +8,8 @@ exports.insideBoundingBoxToBoundingBox = insideBoundingBoxToBoundingBox;
|
|
|
8
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
9
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
10
|
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); }
|
|
11
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
12
|
-
function _iterableToArrayLimit(arr, i) { var _i =
|
|
11
|
+
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; }
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
var latLngRegExp = /^(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)$/;
|
|
15
15
|
function aroundLatLngToPosition(value) {
|
|
@@ -27,13 +27,15 @@ function aroundLatLngToPosition(value) {
|
|
|
27
27
|
}
|
|
28
28
|
function insideBoundingBoxArrayToBoundingBox(value) {
|
|
29
29
|
var _value = _slicedToArray(value, 1),
|
|
30
|
-
_value$ = _value[0]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
neLat = _value$
|
|
34
|
-
neLng = _value$
|
|
35
|
-
swLat = _value$
|
|
36
|
-
swLng = _value$
|
|
30
|
+
_value$ = _value[0],
|
|
31
|
+
_value$2 = _value$ === void 0 ? [undefined, undefined, undefined, undefined] : _value$,
|
|
32
|
+
_value$3 = _slicedToArray(_value$2, 4),
|
|
33
|
+
neLat = _value$3[0],
|
|
34
|
+
neLng = _value$3[1],
|
|
35
|
+
swLat = _value$3[2],
|
|
36
|
+
swLng = _value$3[3];
|
|
37
|
+
|
|
38
|
+
// Since the value provided is the one send with the request, the API should
|
|
37
39
|
// throw an error due to the wrong format. So throw an error should be safe.
|
|
38
40
|
if (!neLat || !neLng || !swLat || !swLng) {
|
|
39
41
|
throw new Error("Invalid value for \"insideBoundingBox\" parameter: [".concat(value, "]"));
|
|
@@ -55,7 +57,9 @@ function insideBoundingBoxStringToBoundingBox(value) {
|
|
|
55
57
|
neLat = _value$split$map2[0],
|
|
56
58
|
neLng = _value$split$map2[1],
|
|
57
59
|
swLat = _value$split$map2[2],
|
|
58
|
-
swLng = _value$split$map2[3];
|
|
60
|
+
swLng = _value$split$map2[3];
|
|
61
|
+
|
|
62
|
+
// Since the value provided is the one send with the request, the API should
|
|
59
63
|
// throw an error due to the wrong format. So throw an error should be safe.
|
|
60
64
|
if (!neLat || !neLng || !swLat || !swLng) {
|
|
61
65
|
throw new Error("Invalid value for \"insideBoundingBox\" parameter: \"".concat(value, "\""));
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getContainerNode = getContainerNode;
|
|
7
|
-
var _isDomElement = require("./isDomElement
|
|
7
|
+
var _isDomElement = require("./isDomElement");
|
|
8
8
|
/**
|
|
9
9
|
* Return the container. If it's a string, it is considered a
|
|
10
10
|
* css selector and retrieves the first matching element. Otherwise
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getHighlightFromSiblings = getHighlightFromSiblings;
|
|
7
|
-
var _escapeHtml = require("./escape-html
|
|
7
|
+
var _escapeHtml = require("./escape-html");
|
|
8
8
|
var hasAlphanumeric = new RegExp(/\w/i);
|
|
9
9
|
function getHighlightFromSiblings(parts, i) {
|
|
10
10
|
var _parts, _parts2;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getHighlightedParts = getHighlightedParts;
|
|
7
|
-
var _escapeHighlight = require("./escape-highlight
|
|
7
|
+
var _escapeHighlight = require("./escape-highlight");
|
|
8
8
|
function getHighlightedParts(highlightedValue) {
|
|
9
9
|
var highlightPostTag = _escapeHighlight.TAG_REPLACEMENT.highlightPostTag,
|
|
10
10
|
highlightPreTag = _escapeHighlight.TAG_REPLACEMENT.highlightPreTag;
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getRefinements = getRefinements;
|
|
7
|
-
var _find = require("./find
|
|
8
|
-
var _escapeFacetValue = require("./escapeFacetValue
|
|
7
|
+
var _find = require("./find");
|
|
8
|
+
var _escapeFacetValue = require("./escapeFacetValue");
|
|
9
9
|
function getRefinement(state, type, attribute, name) {
|
|
10
10
|
var resultsFacets = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
11
11
|
var res = {
|
|
@@ -19,24 +19,22 @@ function getRefinement(state, type, attribute, name) {
|
|
|
19
19
|
});
|
|
20
20
|
var count;
|
|
21
21
|
if (type === 'hierarchical') {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
return facetData[refinementKey];
|
|
28
|
-
};
|
|
22
|
+
var facetDeclaration = state.getHierarchicalFacetByName(attribute);
|
|
23
|
+
var nameParts = name.split(facetDeclaration.separator);
|
|
24
|
+
var getFacetRefinement = function getFacetRefinement(facetData) {
|
|
25
|
+
return function (refinementKey) {
|
|
26
|
+
return facetData[refinementKey];
|
|
29
27
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
};
|
|
29
|
+
var _loop = function _loop(i) {
|
|
30
|
+
facet = facet && facet.data && (0, _find.find)(Object.keys(facet.data).map(getFacetRefinement(facet.data)), function (refinement) {
|
|
31
|
+
return refinement.name === nameParts[i];
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
for (var i = 0; facet !== undefined && i < nameParts.length; ++i) {
|
|
35
|
+
_loop(i);
|
|
36
|
+
}
|
|
37
|
+
count = facet && facet.count;
|
|
40
38
|
} else {
|
|
41
39
|
count = facet && facet.data && facet.data[res.name];
|
|
42
40
|
}
|
|
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.addAbsolutePosition = addAbsolutePosition;
|
|
7
|
+
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); }
|
|
7
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; }
|
|
8
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; }
|
|
9
|
-
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; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
13
|
function addAbsolutePosition(hits, page, hitsPerPage) {
|
|
11
14
|
return hits.map(function (hit, idx) {
|
|
12
15
|
return _objectSpread(_objectSpread({}, hit), {}, {
|
|
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.addQueryID = addQueryID;
|
|
7
|
+
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); }
|
|
7
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; }
|
|
8
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; }
|
|
9
|
-
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; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
13
|
function addQueryID(hits, queryID) {
|
|
11
14
|
if (!queryID) {
|
|
12
15
|
return hits;
|