forked from algolia/instantsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.es.ts
46 lines (37 loc) · 1.26 KB
/
index.es.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { InstantSearchOptions } from './types';
import InstantSearch from './lib/InstantSearch';
import version from './lib/version';
import {
snippet,
highlight,
insights,
getInsightsAnonymousUserToken,
} from './helpers';
import { createInfiniteHitsSessionStorageCache } from './lib/infiniteHitsCache';
const instantsearch = (options: InstantSearchOptions): InstantSearch =>
new InstantSearch(options);
instantsearch.version = version;
instantsearch.snippet = snippet;
instantsearch.highlight = highlight;
instantsearch.insights = insights;
instantsearch.getInsightsAnonymousUserToken = getInsightsAnonymousUserToken;
instantsearch.createInfiniteHitsSessionStorageCache = createInfiniteHitsSessionStorageCache;
Object.defineProperty(instantsearch, 'widgets', {
get() {
throw new ReferenceError(
`"instantsearch.widgets" are not available from the ES build.
To import the widgets:
import { searchBox } from 'instantsearch.js/es/widgets'`
);
},
});
Object.defineProperty(instantsearch, 'connectors', {
get() {
throw new ReferenceError(
`"instantsearch.connectors" are not available from the ES build.
To import the connectors:
import { connectSearchBox } from 'instantsearch.js/es/connectors'`
);
},
});
export default instantsearch;