@@ -166,6 +166,24 @@ define([
166
166
options . debug = true ;
167
167
}
168
168
169
+ // DEPRECATED Do not use - Retained for backward compatibility but `algoliaHookBeforeAutocompleteStart` will be removed in a future version
170
+ if ( typeof algoliaHookBeforeAutocompleteStart === 'function' ) {
171
+ console . warn (
172
+ "Deprecated! You are using an old API for Algolia's front end hooks. " +
173
+ 'Please, replace your hook method with new hook API. ' +
174
+ 'More information you can find on https://www.algolia.com/doc/integration/magento-2/customize/custom-front-end-events/'
175
+ ) ;
176
+
177
+ const hookResult = algoliaHookBeforeAutocompleteStart (
178
+ sources ,
179
+ options ,
180
+ searchClient
181
+ ) ;
182
+
183
+ sources = hookResult . shift ( ) ;
184
+ options = hookResult . shift ( ) ;
185
+ }
186
+
169
187
sources . forEach ( ( data ) => {
170
188
if ( ! data . sourceId ) {
171
189
console . error (
@@ -544,27 +562,9 @@ define([
544
562
* @param options
545
563
* @returns the Algolia Autocomplete instance
546
564
*/
547
- startAutocomplete ( searchClient , sources , options ) {
548
- // DEPRECATED Do not use - Retained for backward compatibility but `algoliaHookBeforeAutocompleteStart` will be removed in a future version
549
- if ( typeof algoliaHookBeforeAutocompleteStart === 'function' ) {
550
- console . warn (
551
- "Deprecated! You are using an old API for Algolia's front end hooks. " +
552
- 'Please, replace your hook method with new hook API. ' +
553
- 'More information you can find on https://www.algolia.com/doc/integration/magento-2/customize/custom-front-end-events/'
554
- ) ;
555
-
556
- const hookResult = algoliaHookBeforeAutocompleteStart (
557
- sources ,
558
- options ,
559
- searchClient
560
- ) ;
561
-
562
- sources = hookResult . shift ( ) ;
563
- options = hookResult . shift ( ) ;
564
- }
565
-
565
+ startAutocomplete ( options ) {
566
566
/** Bind autocomplete feature to the input */
567
- let algoliaAutocompleteInstance = autocomplete . autocomplete ( options ) ;
567
+ const algoliaAutocompleteInstance = autocomplete . autocomplete ( options ) ;
568
568
return algoliaCommon . triggerHooks (
569
569
'afterAutocompleteStart' ,
570
570
algoliaAutocompleteInstance
0 commit comments