@@ -4,29 +4,24 @@ import {
44 liteClient as namedConstructor ,
55 default as defaultConstructor ,
66} from 'algoliasearch/lite' ;
7- import instantsearch from '../../src/index.es ' ;
7+ import instantsearch from '../../src' ;
88import defaultPlayground from '../playgrounds/default' ;
99import {
1010 InstantSearch ,
1111 InstantSearchOptions ,
1212 SearchClient ,
1313} from '../../src/types' ;
14- import * as widgets from '../../src/widgets/index.umd' ;
15- import * as connectors from '../../src/connectors/index.umd' ;
16- import { createInsightsMiddleware } from '../../src/middlewares' ;
17- import { reverseSnippet } from '../../src/helpers' ;
1814
1915const algoliasearch = ( namedConstructor || defaultConstructor ) as unknown as (
2016 appId : string ,
2117 apiKey : string
2218) => SearchClient ;
2319
20+ type InstantSearchUMDModule = typeof instantsearch ;
21+
2422export type Playground = ( options : {
2523 search : InstantSearch ;
26- instantsearch : {
27- widgets : typeof widgets ;
28- middlewares : { createInsightsMiddleware : typeof createInsightsMiddleware } ;
29- } ;
24+ instantsearch : InstantSearchUMDModule ;
3025 leftPanel : HTMLDivElement ;
3126 rightPanel : HTMLDivElement ;
3227} ) => void ;
@@ -51,11 +46,7 @@ export const withHits =
5146 search,
5247 } : {
5348 container : HTMLElement ;
54- instantsearch : {
55- widgets : typeof widgets ;
56- connectors : typeof connectors ;
57- reverseSnippet : typeof reverseSnippet ;
58- } ;
49+ instantsearch : InstantSearchUMDModule ;
5950 search : InstantSearch ;
6051 } ) => void ,
6152 searchOptions ?: SearchOptions
@@ -90,7 +81,7 @@ export const withHits =
9081 } ) ;
9182
9283 search . addWidgets ( [
93- widgets . configure ( {
84+ instantsearch . widgets . configure ( {
9485 hitsPerPage : 4 ,
9586 attributesToSnippet : [ 'description:15' ] ,
9687 snippetEllipsisText : '[…]' ,
@@ -119,18 +110,14 @@ export const withHits =
119110
120111 playground ( {
121112 search,
122- instantsearch : { widgets , middlewares : { createInsightsMiddleware } } ,
113+ instantsearch,
123114 leftPanel : leftPanelPlaygroundElement ,
124115 rightPanel : rightPanelPlaygroundElement ,
125116 } ) ;
126117
127118 storyFn ( {
128119 container : previewElement ,
129- instantsearch : {
130- widgets,
131- connectors,
132- reverseSnippet,
133- } ,
120+ instantsearch,
134121 search,
135122 } ) ;
136123
0 commit comments