Skip to content

Commit

Permalink
partial
Browse files Browse the repository at this point in the history
  • Loading branch information
markzegarelli committed Sep 17, 2021
1 parent 602daaa commit 5e240c1
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
PLATFORM_API_TOKEN=look for me in chamber
PAPI_TOKEN=get one from a papi-enabled workspace
ALGOLIA_APP_ID=
ALGOLIA_SEARCH_KEY=
14 changes: 11 additions & 3 deletions js/algolia/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ import {createAlgoliaInsightsPlugin} from '@algolia/autocomplete-plugin-algolia-
import insightsClient from 'search-insights';


const appId = 'UINQ2M4D9S';
const apiKey = '3ecd0f228971adf2d5a4217789ae1765';
const sampleAppId = 'latency';
const sampleApiKey = '6be0576ff61c053d5f9a3225e2a90f76';
const envAppId = process.env.ALGOLIA_APP_ID;
const envApiKey = process.env.ALGOLIA_SEARCH_KEY;


const appId = envAppId != null ? envAppId : sampleAppId;
const apiKey = envApiKey != null ? envApiKey : sampleApiKey;
const placeHolder = envApiKey != null ? 'Search the Segment documentation' : 'Search disabled locally'

const searchClient = algoliasearch(appId, apiKey);

//insights
Expand All @@ -19,7 +27,7 @@ const locations = ['#autocomplete','#autocomplete-mobile'];
function initAutocomplete(item){
const search = autocomplete({
container: item,
placeholder: 'Search the Segment documentation',
placeholder: placeHolder,
debug: false,
openOnFocus: false,
keyboardShortcuts: ['s', 191],
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"search-insights": "^1.7.1",
"tap-spot": "^1.1.1",
"tippy.js": "^5.2.0",
"typewriter": "7.0.1"
"typewriter": "7.0.1",
"webpack-dotenv-plugin": "^2.1.0"
}
}
5 changes: 4 additions & 1 deletion src/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@
// analytics.identify();
}}();
</script>

{%- if site.env.CONTEXT != "production" -%}
<script src="{{ "./assets/docs.delay.js" | relative_url}}"></script>

{%- endif -%}
</body>
</html>
3 changes: 3 additions & 0 deletions src/assets/docs.delay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
setTimeout(function() {
// document.getElementById("autocomplete-0-input").disabled = true;
}, 1000);
9 changes: 9 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const path = require('path');
const DotenvPlugin = require('webpack-dotenv-plugin');


module.exports = {
entry: './js/index.js',
Expand All @@ -11,6 +13,13 @@ module.exports = {
'analytics': path.resolve('analytics')
}
},
plugins: [
new DotenvPlugin({
sample: './.env.example',
path: './.env',
allowEmptyValues: true,
})
],
module: {
rules: [
{
Expand Down
19 changes: 19 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3016,11 +3016,23 @@ dot-prop@^5.2.0:
dependencies:
is-obj "^2.0.0"

dotenv-safe@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/dotenv-safe/-/dotenv-safe-5.0.1.tgz#8c4a79b8978fd4271b3d8ef17be2b2f04588af71"
integrity sha512-NiS92uLQHKThcQIB4pNEQHLaosz+O1VaJ1yuBaZNj0BASGpQliSzfPKgaoFs/WvE+p8pS9STXOMW30b5uxBZog==
dependencies:
dotenv "^5.0.0"

[email protected]:
version "8.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==

dotenv@^5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-5.0.1.tgz#a5317459bd3d79ab88cff6e44057a6a3fbb1fcef"
integrity sha512-4As8uPrjfwb7VXC+WnLCbXK7y+Ueb2B3zgNCePYfhxS1PYeaO1YTeplffTEcbfLhvFNGLAz90VvJs9yomG7bow==

duplexer3@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
Expand Down Expand Up @@ -8780,6 +8792,13 @@ [email protected]:
v8-compile-cache "2.0.3"
yargs "13.2.4"

webpack-dotenv-plugin@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/webpack-dotenv-plugin/-/webpack-dotenv-plugin-2.1.0.tgz#366bb18712f414e8b86aa66408a9039d03dd7165"
integrity sha1-NmuxhxL0FOi4aqZkCKkDnQPdcWU=
dependencies:
dotenv-safe "^5.0.1"

webpack-sources@^1.4.0, webpack-sources@^1.4.1:
version "1.4.3"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933"
Expand Down

0 comments on commit 5e240c1

Please sign in to comment.