diff --git a/client/package-lock.json b/client/package-lock.json index 506fa61a21..58da1b76fb 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -2135,6 +2135,11 @@ } } }, + "@types/algoliasearch": { + "version": "3.34.2", + "resolved": "https://registry.npmjs.org/@types/algoliasearch/-/algoliasearch-3.34.2.tgz", + "integrity": "sha512-a+ztY3iL+Dpor7wYaF4CO6obUYcVEyXue1ppQklP1VCUP+VGZyzMcYiZodNs9DFV1HEOW5VCLTIqiZ4ikQpKzA==" + }, "@types/anymatch": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz", @@ -2759,13 +2764,11 @@ } }, "algoliasearch-helper": { - "version": "2.28.0", - "resolved": "https://registry.npmjs.org/algoliasearch-helper/-/algoliasearch-helper-2.28.0.tgz", - "integrity": "sha512-ZWczpkns2tw9sAtFL+1Cn3XAGkaunYS+ckldBrHHHQZj1/vw9n8SOGUO7lwpjuKXG9+TWgzx6XP3ZsG3iM+6hw==", + "version": "0.0.0-27095c0", + "resolved": "https://registry.npmjs.org/algoliasearch-helper/-/algoliasearch-helper-0.0.0-27095c0.tgz", + "integrity": "sha512-d0wlSReMpnz7sT5ibojXucYsWHTigu83ge+qktQ9m0u+kG7bHqRErzBUOZ03BMr9zd1sWSNR1TMR9l6AHHrqow==", "requires": { - "events": "^1.1.1", - "lodash": "^4.17.5", - "qs": "^6.5.1" + "events": "^1.1.1" } }, "alphanum-sort": { @@ -9723,9 +9726,9 @@ "integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ==" }, "handlebars": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", - "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.3.1.tgz", + "integrity": "sha512-c0HoNHzDiHpBt4Kqe99N8tdLPKAnGCQ73gYMPWtAYM4PwGnf7xl8PBUHJqh9ijlzt2uQKaSRxbXRt+rZ7M2/kA==", "dev": true, "requires": { "neo-async": "^2.6.0", @@ -16609,57 +16612,64 @@ "integrity": "sha512-r+nCigLoQMffpf8gZo6l0we8RaRkgEIeRY6xS1vjp5ANxdTd3QwA2tjBTfmgf+4kFqYnaL2XvJH+iZ4mKqnb8Q==" }, "react-instantsearch-core": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/react-instantsearch-core/-/react-instantsearch-core-5.7.0.tgz", - "integrity": "sha512-fjexlv+hR8OyZraAmjwM+GmiVcJFzLUnufIKPMLO7/L4Mg5h0pETSXNBT22cCXTnda6XML//+GqQmWJFf+PBrA==", + "version": "6.0.0-beta.0", + "resolved": "https://registry.npmjs.org/react-instantsearch-core/-/react-instantsearch-core-6.0.0-beta.0.tgz", + "integrity": "sha512-Fp8x564WJaTvC4e6JiueHRIVTCyCO7l+5F3RhHxmn9UKjzGhgWEok5159jEV3LlrtfINYUMAiLWslPw5o7u9Hg==", "requires": { "@babel/runtime": "^7.1.2", - "algoliasearch-helper": "^2.26.0", - "lodash": "^4.17.4", + "@types/algoliasearch": "^3.30.16", + "algoliasearch-helper": "0.0.0-6ac260d", + "fast-deep-equal": "^2.0.1", "prop-types": "^15.5.10" }, "dependencies": { "@babel/runtime": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.5.tgz", - "integrity": "sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.6.2.tgz", + "integrity": "sha512-EXxN64agfUqqIGeEjI5dL5z0Sw0ZwWo1mLTi4mQowCZ42O59b7DRpZAnTC6OqdF28wMBMFKNb/4uFGrVaigSpg==", "requires": { "regenerator-runtime": "^0.13.2" } }, + "algoliasearch-helper": { + "version": "0.0.0-6ac260d", + "resolved": "https://registry.npmjs.org/algoliasearch-helper/-/algoliasearch-helper-0.0.0-6ac260d.tgz", + "integrity": "sha512-wG1oVPEq4bXmNUeF2voio+0UpNRtDLTG7+OPCvTxMDIQvD2Exc0s2UsWl5fh6/Dc7O++b8Ic2g+YSVo5l+nBFg==", + "requires": { + "events": "^1.1.1" + } + }, "regenerator-runtime": { - "version": "0.13.2", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz", - "integrity": "sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==" + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", + "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==" } } }, "react-instantsearch-dom": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/react-instantsearch-dom/-/react-instantsearch-dom-5.7.0.tgz", - "integrity": "sha512-FwFZZXwgaYtLrXD9KJNlrPVkfw8JOqVgpDBvra547udF4zbacZUuX7/qTyMHjVW/Lz59t5T25vCGLzmQiO89YA==", + "version": "6.0.0-beta.0", + "resolved": "https://registry.npmjs.org/react-instantsearch-dom/-/react-instantsearch-dom-6.0.0-beta.0.tgz", + "integrity": "sha512-jOHYTHTOc+QWMhC8XPDjR0tKw9uySSMvkeo0hOAUvZihals6pk+b34cBKE08btfxZzwpxkidrWSUJMlrbV9geQ==", "requires": { "@babel/runtime": "^7.1.2", - "algoliasearch": "^3.27.1", - "algoliasearch-helper": "^2.26.0", + "algoliasearch-helper": "0.0.0-27095c0", "classnames": "^2.2.5", - "lodash": "^4.17.4", "prop-types": "^15.5.10", - "react-instantsearch-core": "^5.7.0" + "react-instantsearch-core": "^6.0.0-beta.0" }, "dependencies": { "@babel/runtime": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.5.tgz", - "integrity": "sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.6.2.tgz", + "integrity": "sha512-EXxN64agfUqqIGeEjI5dL5z0Sw0ZwWo1mLTi4mQowCZ42O59b7DRpZAnTC6OqdF28wMBMFKNb/4uFGrVaigSpg==", "requires": { "regenerator-runtime": "^0.13.2" } }, "regenerator-runtime": { - "version": "0.13.2", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz", - "integrity": "sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==" + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", + "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==" } } }, diff --git a/client/package.json b/client/package.json index d16ab7c9f8..5beed67496 100644 --- a/client/package.json +++ b/client/package.json @@ -55,7 +55,7 @@ "react-helmet": "^5.2.1", "react-hotkeys": "^2.0.0", "react-identicons": "^1.1.7", - "react-instantsearch-dom": "^5.7.0", + "react-instantsearch-dom": "^6.0.0-beta.0", "react-monaco-editor": "^0.30.1", "react-redux": "^5.0.7", "react-reflex": "^3.0.16", diff --git a/client/src/components/search/WithInstantSearch.js b/client/src/components/search/WithInstantSearch.js index 25211f674a..70c7c79b34 100644 --- a/client/src/components/search/WithInstantSearch.js +++ b/client/src/components/search/WithInstantSearch.js @@ -6,6 +6,7 @@ import { InstantSearch, Configure } from 'react-instantsearch-dom'; import qs from 'query-string'; import { navigate } from 'gatsby'; import Media from 'react-responsive'; +import algoliasearch from 'algoliasearch/lite'; import { isSearchDropdownEnabledSelector, @@ -13,11 +14,14 @@ import { toggleSearchDropdown, updateSearchQuery } from './redux'; +import { algoliaAppId, algoliaAPIKey } from '../../../config/env.json'; import { createSelector } from 'reselect'; const DEBOUNCE_TIME = 100; +const searchClient = algoliasearch(algoliaAppId, algoliaAPIKey); + const propTypes = { children: PropTypes.any, isDropdownEnabled: PropTypes.bool, @@ -120,10 +124,9 @@ class InstantSearchRoot extends Component { const MAX_MOBILE_HEIGHT = 768; return ( {this.isSearchPage() ? ( diff --git a/config/env.js b/config/env.js index dd682234d2..f32cb93bad 100644 --- a/config/env.js +++ b/config/env.js @@ -11,7 +11,9 @@ const { FORUM_LOCATION: forum, NEWS_LOCATION: news, LOCALE: locale, - STRIPE_PUBLIC: stripePublicKey + STRIPE_PUBLIC: stripePublicKey, + ALGOLIA_APP_ID: algoliaAppId, + ALGOLIA_API_KEY: algoliaAPIKey } = process.env; const locations = { @@ -21,4 +23,9 @@ const locations = { newsLocation: news }; -module.exports = Object.assign(locations, { locale, stripePublicKey }); +module.exports = Object.assign(locations, { + locale, + stripePublicKey, + algoliaAppId, + algoliaAPIKey +}); diff --git a/sample.env b/sample.env index 428dc9d206..d2f6e14bce 100644 --- a/sample.env +++ b/sample.env @@ -6,6 +6,7 @@ ROLLBAR_CLIENT_ID='post_client_id from rollbar dashboard' ALGOLIA_ADMIN_KEY=123abc ALGOLIA_APP_ID=ACDEFG +ALGOLIA_API_KEY=123abc AUTH0_CLIENT_ID=stuff AUTH0_CLIENT_SECRET=stuff @@ -35,4 +36,4 @@ LOCALE=english TEST_CHALLENGES_FOR_LANGS=english DOCKER_HOST_LOCATION=localhost -GHOST_CLIENT_KEY=123abc \ No newline at end of file +GHOST_CLIENT_KEY=123abc