@@ -4,15 +4,11 @@ import {
44 autocomplete ,
55 AutocompleteComponents ,
66 getAlgoliaResults ,
7- } from '@algolia/autocomplete-js' ;
8- import {
97 AutocompleteInsightsApi ,
10- createAlgoliaInsightsPlugin ,
11- } from '@algolia/autocomplete-plugin-algolia-insights' ;
8+ } from '@algolia/autocomplete-js' ;
129import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query-suggestions' ;
1310import algoliasearch from 'algoliasearch/lite' ;
1411import { h , Fragment } from 'preact' ;
15- import insightsClient from 'search-insights' ;
1612
1713import '@algolia/autocomplete-theme-classic' ;
1814
@@ -22,11 +18,6 @@ const appId = 'latency';
2218const apiKey = '6be0576ff61c053d5f9a3225e2a90f76' ;
2319const searchClient = algoliasearch ( appId , apiKey ) ;
2420
25- // @ts -expect-error type error in search-insights
26- insightsClient ( 'init' , { appId, apiKey } ) ;
27-
28- const algoliaInsightsPlugin = createAlgoliaInsightsPlugin ( { insightsClient } ) ;
29-
3021const querySuggestionsPlugin = createQuerySuggestionsPlugin ( {
3122 searchClient,
3223 indexName : 'instant_search_demo_query_suggestions' ,
@@ -41,7 +32,8 @@ autocomplete<ProductHit>({
4132 container : '#autocomplete' ,
4233 placeholder : 'Search' ,
4334 openOnFocus : true ,
44- plugins : [ algoliaInsightsPlugin , querySuggestionsPlugin ] ,
35+ insights : true ,
36+ plugins : [ querySuggestionsPlugin ] ,
4537 getSources ( { query, state } ) {
4638 if ( ! query ) {
4739 return [ ] ;
0 commit comments