Skip to content

Commit e1df491

Browse files
authored
Merge pull request #1597 from algolia/feature/MAGE-999
MAGE-999: algoliaBundle dependency removed from autocomplete.js
2 parents bb2e38c + ff9408b commit e1df491

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

view/frontend/requirejs-config.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,20 @@ var config = {
1818
// Recommend templates
1919
'recommendProductsHtml': 'Algolia_AlgoliaSearch/js/template/recommend/products',
2020

21-
// Unbundling
21+
// Unbundling
2222
'algoliaTemplateEngine': 'Algolia_AlgoliaSearch/js/internals/template-engine'
2323
}
2424
},
2525
paths : {
26-
'algoliaBundle' : 'Algolia_AlgoliaSearch/js/internals/algoliaBundle.min',
27-
'algoliaSearchLib' : 'Algolia_AlgoliaSearch/js/lib/algolia-search.min',
28-
'algoliaAutocompleteLib': 'Algolia_AlgoliaSearch/js/lib/algolia-autocomplete.min',
29-
'algoliaAnalytics' : 'Algolia_AlgoliaSearch/js/internals/search-insights',
30-
'recommend' : 'Algolia_AlgoliaSearch/js/internals/recommend.min',
31-
'recommendJs' : 'Algolia_AlgoliaSearch/js/internals/recommend-js.min',
32-
'rangeSlider' : 'Algolia_AlgoliaSearch/js/navigation/range-slider-widget',
33-
// Legacy
26+
'algoliaBundle' : 'Algolia_AlgoliaSearch/js/internals/algoliaBundle.min',
27+
'algoliaSearchLib' : 'Algolia_AlgoliaSearch/js/lib/algolia-search.min',
28+
'algoliaAutocompleteLib' : 'Algolia_AlgoliaSearch/js/lib/algolia-autocomplete.min',
29+
'algoliaAnalytics' : 'Algolia_AlgoliaSearch/js/internals/search-insights',
30+
'algoliaQuerySuggestionsPluginLib' : 'Algolia_AlgoliaSearch/js/lib/query-suggestions-plugin.min',
31+
'recommend' : 'Algolia_AlgoliaSearch/js/internals/recommend.min',
32+
'recommendJs' : 'Algolia_AlgoliaSearch/js/internals/recommend-js.min',
33+
'rangeSlider' : 'Algolia_AlgoliaSearch/js/navigation/range-slider-widget',
34+
// Legacy
3435
'algoliaHoganLib' : 'Algolia_AlgoliaSearch/js/lib/hogan.min',
3536
'algoliaMustacheLib' : 'Algolia_AlgoliaSearch/js/lib/mustache.min'
3637
},
@@ -47,7 +48,7 @@ var config = {
4748
},
4849
shim: {
4950
'algoliaHoganLib': {
50-
exports: 'Hogan'
51+
exports: 'Hogan'
5152
}
5253
}
5354
};

view/frontend/web/js/autocomplete.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ define([
33
'algoliaBundle',
44
'algoliaSearchLib',
55
'algoliaAutocompleteLib',
6+
'algoliaQuerySuggestionsPluginLib',
67
'pagesHtml',
78
'categoriesHtml',
89
'productsHtml',
@@ -17,6 +18,7 @@ define([
1718
algoliaBundle,
1819
algoliasearch,
1920
autocomplete,
21+
querySuggestionsPlugin,
2022
pagesHtml,
2123
categoriesHtml,
2224
productsHtml,
@@ -431,7 +433,7 @@ define([
431433
};
432434

433435
const buildSuggestionsPlugin = function () {
434-
return algoliaBundle.createQuerySuggestionsPlugin.createQuerySuggestionsPlugin(
436+
return querySuggestionsPlugin.createQuerySuggestionsPlugin(
435437
{
436438
searchClient,
437439
indexName: `${algoliaConfig.indexName}_suggestions`,
@@ -621,7 +623,7 @@ define([
621623
return;
622624
}
623625
const getItems = ({query}) => {
624-
return algoliaBundle.getAlgoliaResults({
626+
return autocomplete.getAlgoliaResults({
625627
searchClient,
626628
queries: [
627629
{
@@ -659,8 +661,8 @@ define([
659661
options = algolia.triggerHooks('afterAutocompleteOptions', options);
660662

661663
/** Bind autocomplete feature to the input */
662-
let algoliaAutocompleteInstance = algoliaBundle.autocomplete(options);
663-
algoliaAutocompleteInstance = algolia.triggerHooks(
664+
let algoliaAutocompleteInstance = autocomplete.autocomplete(options);
665+
algolia.triggerHooks(
664666
'afterAutocompleteStart',
665667
algoliaAutocompleteInstance
666668
);

view/frontend/web/js/lib/query-suggestions-plugin.min.js

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)