Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
feat(client): remove algoliaClient, appId & apiKey (#2338)
Browse files Browse the repository at this point in the history
* feat(client): remove algoliaClient alias

* chore(error): remove duplicate colon

* docs(examples): use searchClient everywhere

* feat(searchClient): remove other options

* adds back user agent tests & remove defaultAlgoliaClient

* remove algoliasearch from dependencies

* remove algoliasearch usage

* chore: update max size

* fix(propTypes): more strict searchClient type

* chore(examples): add algoliasearch as dependency

* chore(stories): memoize search client

* chore: update proptype
  • Loading branch information
Haroenv committed Jun 27, 2019
1 parent 935bf31 commit b84a0b5
Show file tree
Hide file tree
Showing 81 changed files with 672 additions and 560 deletions.
1 change: 1 addition & 0 deletions examples/autocomplete/package.json
Expand Up @@ -13,6 +13,7 @@
"react-test-renderer": "16.8.6"
},
"dependencies": {
"algoliasearch": "3.32.1",
"antd": "3.19.8",
"lodash": "4.17.11",
"prop-types": "15.6.0",
Expand Down
12 changes: 7 additions & 5 deletions examples/autocomplete/src/App-Mentions.js
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import Mention from 'antd/lib/mention';
import algoliasearch from 'algoliasearch/lite';
import { InstantSearch, connectAutoComplete } from 'react-instantsearch-dom';
import 'antd/lib/mention/style/css';

Expand All @@ -22,12 +23,13 @@ AsyncMention.propTypes = {

const ConnectedAsyncMention = connectAutoComplete(AsyncMention);

const searchClient = algoliasearch(
'latency',
'6be0576ff61c053d5f9a3225e2a90f76'
);

const App = () => (
<InstantSearch
appId="latency"
apiKey="6be0576ff61c053d5f9a3225e2a90f76"
indexName="actors"
>
<InstantSearch searchClient={searchClient} indexName="actors">
<ConnectedAsyncMention />
</InstantSearch>
);
Expand Down
12 changes: 7 additions & 5 deletions examples/autocomplete/src/App-Multi-Index.js
Expand Up @@ -8,13 +8,15 @@ import {
Highlight,
connectAutoComplete,
} from 'react-instantsearch-dom';
import algoliasearch from 'algoliasearch/lite';

const searchClient = algoliasearch(
'latency',
'6be0576ff61c053d5f9a3225e2a90f76'
);

const App = () => (
<InstantSearch
appId="latency"
apiKey="6be0576ff61c053d5f9a3225e2a90f76"
indexName="instant_search"
>
<InstantSearch searchClient={searchClient} indexName="instant_search">
<AutoComplete />
<Configure hitsPerPage={1} />
<Index indexName="bestbuy" />
Expand Down
21 changes: 21 additions & 0 deletions examples/autocomplete/yarn.lock
Expand Up @@ -1892,6 +1892,27 @@ algoliasearch-helper@^2.26.0:
qs "^6.5.1"
util "^0.10.3"

algoliasearch@3.32.1:
version "3.32.1"
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.32.1.tgz#605f8a2c17ab8da2af4456110f4d0a02b384e3d0"
integrity sha512-NaaHMboU9tKwrU3aim7LlzSDqKb+1TGaC+Lx3NOttSnuMHbPpaf+7LtJL4KlosbRWEwqb9t5wSYMVDrPTH2dNA==
dependencies:
agentkeepalive "^2.2.0"
debug "^2.6.9"
envify "^4.0.0"
es6-promise "^4.1.0"
events "^1.1.0"
foreach "^2.0.5"
global "^4.3.2"
inherits "^2.0.1"
isarray "^2.0.1"
load-script "^1.0.0"
object-keys "^1.0.11"
querystring-es3 "^0.2.1"
reduce "^1.0.1"
semver "^5.1.0"
tunnel-agent "^0.6.0"

algoliasearch@^3.27.1:
version "3.30.0"
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.30.0.tgz#355585e49b672e5f71d45b9c2b371ecdff129cd1"
Expand Down
1 change: 1 addition & 0 deletions examples/geo-search/package.json
Expand Up @@ -13,6 +13,7 @@
"react-test-renderer": "16.8.6"
},
"dependencies": {
"algoliasearch": "3.32.1",
"instantsearch.css": "7.3.1",
"qs": "6.7.0",
"react": "16.8.6",
Expand Down
9 changes: 7 additions & 2 deletions examples/geo-search/src/App.js
@@ -1,5 +1,6 @@
import qs from 'qs';
import React, { Component, Fragment } from 'react';
import algoliasearch from 'algoliasearch/lite';
import { InstantSearch, SearchBox, Configure } from 'react-instantsearch-dom';
import {
GoogleMapsLoader,
Expand All @@ -8,6 +9,11 @@ import {
Marker,
} from 'react-instantsearch-dom-maps';

const searchClient = algoliasearch(
'latency',
'6be0576ff61c053d5f9a3225e2a90f76'
);

const updateAfter = 700;
const searchStateToUrl = searchState =>
searchState ? `${window.location.pathname}?${qs.stringify(searchState)}` : '';
Expand Down Expand Up @@ -72,8 +78,7 @@ class App extends Component {

return (
<InstantSearch
appId="latency"
apiKey="6be0576ff61c053d5f9a3225e2a90f76"
searchClient={searchClient}
indexName="airbnb"
searchState={searchState}
onSearchStateChange={this.onSearchStateChange}
Expand Down
21 changes: 21 additions & 0 deletions examples/geo-search/yarn.lock
Expand Up @@ -1830,6 +1830,27 @@ algoliasearch-helper@^2.26.0:
qs "^6.5.1"
util "^0.10.3"

algoliasearch@3.32.1:
version "3.32.1"
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.32.1.tgz#605f8a2c17ab8da2af4456110f4d0a02b384e3d0"
integrity sha512-NaaHMboU9tKwrU3aim7LlzSDqKb+1TGaC+Lx3NOttSnuMHbPpaf+7LtJL4KlosbRWEwqb9t5wSYMVDrPTH2dNA==
dependencies:
agentkeepalive "^2.2.0"
debug "^2.6.9"
envify "^4.0.0"
es6-promise "^4.1.0"
events "^1.1.0"
foreach "^2.0.5"
global "^4.3.2"
inherits "^2.0.1"
isarray "^2.0.1"
load-script "^1.0.0"
object-keys "^1.0.11"
querystring-es3 "^0.2.1"
reduce "^1.0.1"
semver "^5.1.0"
tunnel-agent "^0.6.0"

algoliasearch@^3.27.1:
version "3.30.0"
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.30.0.tgz#355585e49b672e5f71d45b9c2b371ecdff129cd1"
Expand Down
1 change: 1 addition & 0 deletions examples/multi-index/package.json
Expand Up @@ -13,6 +13,7 @@
"react-test-renderer": "16.8.6"
},
"dependencies": {
"algoliasearch": "3.32.1",
"instantsearch.css": "7.3.1",
"prop-types": "15.6.0",
"react": "16.8.6",
Expand Down
12 changes: 7 additions & 5 deletions examples/multi-index/src/App.js
@@ -1,12 +1,14 @@
import React from 'react';
import { InstantSearch, Hits, SearchBox, Index } from 'react-instantsearch-dom';
import algoliasearch from 'algoliasearch/lite';

const searchClient = algoliasearch(
'latency',
'6be0576ff61c053d5f9a3225e2a90f76'
);

const App = () => (
<InstantSearch
appId="latency"
apiKey="6be0576ff61c053d5f9a3225e2a90f76"
indexName="airbnb"
>
<InstantSearch searchClient={searchClient} indexName="airbnb">
<SearchBox />
<p>Results in first dataset</p>
<Hits />
Expand Down
21 changes: 21 additions & 0 deletions examples/multi-index/yarn.lock
Expand Up @@ -1830,6 +1830,27 @@ algoliasearch-helper@^2.26.0:
qs "^6.5.1"
util "^0.10.3"

algoliasearch@3.32.1:
version "3.32.1"
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.32.1.tgz#605f8a2c17ab8da2af4456110f4d0a02b384e3d0"
integrity sha512-NaaHMboU9tKwrU3aim7LlzSDqKb+1TGaC+Lx3NOttSnuMHbPpaf+7LtJL4KlosbRWEwqb9t5wSYMVDrPTH2dNA==
dependencies:
agentkeepalive "^2.2.0"
debug "^2.6.9"
envify "^4.0.0"
es6-promise "^4.1.0"
events "^1.1.0"
foreach "^2.0.5"
global "^4.3.2"
inherits "^2.0.1"
isarray "^2.0.1"
load-script "^1.0.0"
object-keys "^1.0.11"
querystring-es3 "^0.2.1"
reduce "^1.0.1"
semver "^5.1.0"
tunnel-agent "^0.6.0"

algoliasearch@^3.27.1:
version "3.30.0"
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.30.0.tgz#355585e49b672e5f71d45b9c2b371ecdff129cd1"
Expand Down
9 changes: 7 additions & 2 deletions examples/next/components/app.js
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import algoliasearch from 'algoliasearch/lite';
import {
RefinementList,
SearchBox,
Expand All @@ -10,6 +11,11 @@ import {
} from 'react-instantsearch-dom';
import { InstantSearch } from './instantsearch';

const searchClient = algoliasearch(
'latency',
'6be0576ff61c053d5f9a3225e2a90f76'
);

const HitComponent = ({ hit }) => (
<div className="hit">
<div>
Expand Down Expand Up @@ -48,8 +54,7 @@ export default class extends React.Component {
render() {
return (
<InstantSearch
appId="latency"
apiKey="6be0576ff61c053d5f9a3225e2a90f76"
searchClient={searchClient}
indexName="instant_search"
resultsState={this.props.resultsState}
onSearchStateChange={this.props.onSearchStateChange}
Expand Down
1 change: 1 addition & 0 deletions examples/next/package.json
Expand Up @@ -18,6 +18,7 @@
"style-loader": "0.23.1"
},
"dependencies": {
"algoliasearch": "3.32.1",
"next": "8.1.0",
"prop-types": "15.6.2",
"qs": "6.7.0",
Expand Down
23 changes: 22 additions & 1 deletion examples/next/yarn.lock
Expand Up @@ -912,6 +912,27 @@ algoliasearch-helper@^2.26.0:
qs "^6.5.1"
util "^0.10.3"

algoliasearch@3.32.1:
version "3.32.1"
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.32.1.tgz#605f8a2c17ab8da2af4456110f4d0a02b384e3d0"
integrity sha512-NaaHMboU9tKwrU3aim7LlzSDqKb+1TGaC+Lx3NOttSnuMHbPpaf+7LtJL4KlosbRWEwqb9t5wSYMVDrPTH2dNA==
dependencies:
agentkeepalive "^2.2.0"
debug "^2.6.9"
envify "^4.0.0"
es6-promise "^4.1.0"
events "^1.1.0"
foreach "^2.0.5"
global "^4.3.2"
inherits "^2.0.1"
isarray "^2.0.1"
load-script "^1.0.0"
object-keys "^1.0.11"
querystring-es3 "^0.2.1"
reduce "^1.0.1"
semver "^5.1.0"
tunnel-agent "^0.6.0"

algoliasearch@^3.27.1:
version "3.30.0"
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.30.0.tgz#355585e49b672e5f71d45b9c2b371ecdff129cd1"
Expand Down Expand Up @@ -2027,7 +2048,7 @@ date-now@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"

debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8:
debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
dependencies:
Expand Down
9 changes: 7 additions & 2 deletions examples/react-native-query-suggestions/App.js
Expand Up @@ -10,6 +10,7 @@ import {
Keyboard,
TouchableHighlight,
} from 'react-native';
import algoliasearch from 'algoliasearch/lite';
import {
connectSearchBox,
connectInfiniteHits,
Expand All @@ -21,6 +22,11 @@ import Highlight from './Highlight';
import { omit } from 'lodash';
import Icon from 'react-native-vector-icons/FontAwesome';

const searchClient = algoliasearch(
'latency',
'6be0576ff61c053d5f9a3225e2a90f76'
);

const styles = StyleSheet.create({
container: {
marginTop: 30,
Expand Down Expand Up @@ -150,8 +156,7 @@ export default class App extends React.Component {
return (
<View style={styles.container}>
<InstantSearch
appId="latency"
apiKey="6be0576ff61c053d5f9a3225e2a90f76"
searchClient={searchClient}
indexName="instant_search"
onSearchStateChange={this.onSearchStateChange}
searchState={this.state.searchState}
Expand Down
1 change: 1 addition & 0 deletions examples/react-native-query-suggestions/package.json
Expand Up @@ -20,6 +20,7 @@
"react-test-renderer": "16.8.6"
},
"dependencies": {
"algoliasearch": "3.32.1",
"expo": "25.1.2",
"lodash": "4.17.11",
"prop-types": "15.6.0",
Expand Down
23 changes: 22 additions & 1 deletion examples/react-native-query-suggestions/yarn.lock
Expand Up @@ -264,6 +264,27 @@ algoliasearch-helper@^2.26.0:
qs "^6.5.1"
util "^0.10.3"

algoliasearch@3.32.1:
version "3.32.1"
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.32.1.tgz#605f8a2c17ab8da2af4456110f4d0a02b384e3d0"
integrity sha512-NaaHMboU9tKwrU3aim7LlzSDqKb+1TGaC+Lx3NOttSnuMHbPpaf+7LtJL4KlosbRWEwqb9t5wSYMVDrPTH2dNA==
dependencies:
agentkeepalive "^2.2.0"
debug "^2.6.9"
envify "^4.0.0"
es6-promise "^4.1.0"
events "^1.1.0"
foreach "^2.0.5"
global "^4.3.2"
inherits "^2.0.1"
isarray "^2.0.1"
load-script "^1.0.0"
object-keys "^1.0.11"
querystring-es3 "^0.2.1"
reduce "^1.0.1"
semver "^5.1.0"
tunnel-agent "^0.6.0"

algoliasearch@^3.27.1:
version "3.30.0"
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.30.0.tgz#355585e49b672e5f71d45b9c2b371ecdff129cd1"
Expand Down Expand Up @@ -2014,7 +2035,7 @@ dateformat@^2.0.0:
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-2.2.0.tgz#4065e2013cf9fb916ddfd82efb506ad4c6769062"
integrity sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=

debug@2, debug@2.6.9, debug@^2.2.0, debug@^2.6.2, debug@^2.6.8:
debug@2, debug@2.6.9, debug@^2.2.0, debug@^2.6.2, debug@^2.6.8, debug@^2.6.9:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
Expand Down
1 change: 1 addition & 0 deletions examples/react-native/package.json
Expand Up @@ -21,6 +21,7 @@
},
"dependencies": {
"@ptomasroos/react-native-multi-slider": "1.0.0",
"algoliasearch": "3.32.1",
"expo": "25.1.2",
"lodash": "4.17.11",
"prop-types": "15.6.0",
Expand Down
9 changes: 7 additions & 2 deletions examples/react-native/src/Categories.js
Expand Up @@ -10,6 +10,7 @@ import {
TouchableHighlight,
Keyboard,
} from 'react-native';
import algoliasearch from 'algoliasearch/lite';
import { InstantSearch } from 'react-instantsearch/native';
import {
connectMenu,
Expand All @@ -22,6 +23,11 @@ import Icon from 'react-native-vector-icons/FontAwesome';
import Highlight from './components/Highlight';
import Spinner from './components/Spinner';

const searchClient = algoliasearch(
'latency',
'6be0576ff61c053d5f9a3225e2a90f76'
);

const styles = StyleSheet.create({
mainContainer: {
backgroundColor: 'white',
Expand Down Expand Up @@ -75,8 +81,7 @@ class Filters extends Component {
return (
<View style={styles.mainContainer}>
<InstantSearch
appId="latency"
apiKey="6be0576ff61c053d5f9a3225e2a90f76"
searchClient={searchClient}
indexName="instant_search"
onSearchStateChange={this.onSearchStateChange}
searchState={this.state.searchState}
Expand Down

0 comments on commit b84a0b5

Please sign in to comment.