Skip to content

Commit 2fdcbcc

Browse files
committed
MAGE-998 Minimal mock bundle for instantsearch with deprecation notice
1 parent a31bbc5 commit 2fdcbcc

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

view/frontend/requirejs-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ var config = {
3232
'recommend' : 'Algolia_AlgoliaSearch/js/internals/recommend.min',
3333
'recommendJs' : 'Algolia_AlgoliaSearch/js/internals/recommend-js.min',
3434
'rangeSlider' : 'Algolia_AlgoliaSearch/js/navigation/range-slider-widget',
35+
3536
// Legacy
3637
'algoliaHoganLib' : 'Algolia_AlgoliaSearch/js/lib/hogan.min',
3738
'algoliaMustacheLib' : 'Algolia_AlgoliaSearch/js/lib/mustache.min'

view/frontend/web/js/instantsearch.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,36 @@ define([
88
// Algolia integration dependencies
99
'algoliaTemplateEngine',
1010

11-
// Magento libs
11+
// Magento core libs
1212
'Magento_Catalog/js/price-utils',
1313

14-
// DEPRECATED: Legacy bundle libs to be removed in a future release
15-
'algoliaHoganLib',
16-
'algoliaAutocompleteLib',
17-
1814
// TODO: Refactor legacy global object dependencies
1915
'algoliaCommon',
2016
'algoliaInsights',
2117
'algoliaHooks',
22-
], function ($, algoliasearch, instantsearch, templateEngine, priceUtils, Hogan, autocomplete) {
23-
24-
// @deprecated algoliaBundle is going away!
25-
// Howver if you've used it in any of your customizations it can be mocked - documentation to come on how to do this...
18+
], function ($, algoliasearch, instantsearch, templateEngine, priceUtils) {
19+
20+
/**
21+
* @deprecated algoliaBundle is going away!
22+
* This mock only includes libraries available to this module
23+
* The following have been removed:
24+
* - Hogan
25+
* - algoliasearchHelper
26+
* - autocomplete
27+
* - createAlgoliaInsightsPlugin
28+
* - createLocalStorageRecentSearchesPlugin
29+
* - createQuerySuggestionsPlugin
30+
* - getAlgoliaResults
31+
* However if you've used or require any of these additional libs in your customizations,
32+
* you can either augment this mock as you need or include the global dependency in your module
33+
* and make it available to your hook.
34+
* TODO: Mixin and documentation to come on how to do this...
35+
*/
2636
const mockAlgoliaBundle = {
2737
$,
28-
Hogan,
2938
algoliasearch,
30-
// algoliasearchHelper ???
31-
autocomplete
39+
instantsearch
3240
};
33-
console.log("Mock bundle:", mockAlgoliaBundle);
3441

3542
$(async function ($) {
3643
const templateProcessor = await templateEngine.getSelectedEngineAdapter();

0 commit comments

Comments
 (0)