Skip to content

Commit

Permalink
Merge pull request #4 from watson-developer-cloud/analytics
Browse files Browse the repository at this point in the history
Add analytics
  • Loading branch information
lpatino10 authored Jan 21, 2020
2 parents e86a8e4 + 4d895e0 commit 3f3e34e
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</p>
</p>

**Demo:** https://speech-to-text-code-pattern.mybluemix.net/
**Demo:** https://speech-to-text-code-pattern.ng.bluemix.net/

## Flow

Expand Down
8 changes: 4 additions & 4 deletions build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"files": {
"main.css": "/static/css/main.7cc9301b.chunk.css",
"main.js": "/static/js/main.a33677a6.chunk.js",
"main.js.map": "/static/js/main.a33677a6.chunk.js.map",
"main.js": "/static/js/main.e75e603b.chunk.js",
"main.js.map": "/static/js/main.e75e603b.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.39f04a74.js",
"runtime-main.js.map": "/static/js/runtime-main.39f04a74.js.map",
"static/js/2.4070f991.chunk.js": "/static/js/2.4070f991.chunk.js",
"static/js/2.4070f991.chunk.js.map": "/static/js/2.4070f991.chunk.js.map",
"index.html": "/index.html",
"precache-manifest.f456d5cb40ceb0ff5e090af78ecbf176.js": "/precache-manifest.f456d5cb40ceb0ff5e090af78ecbf176.js",
"precache-manifest.5a232ee8c4418509be470e7e4d91151d.js": "/precache-manifest.5a232ee8c4418509be470e7e4d91151d.js",
"service-worker.js": "/service-worker.js",
"static/css/main.7cc9301b.chunk.css.map": "/static/css/main.7cc9301b.chunk.css.map",
"static/js/2.4070f991.chunk.js.LICENSE": "/static/js/2.4070f991.chunk.js.LICENSE"
Expand All @@ -17,6 +17,6 @@
"static/js/runtime-main.39f04a74.js",
"static/js/2.4070f991.chunk.js",
"static/css/main.7cc9301b.chunk.css",
"static/js/main.a33677a6.chunk.js"
"static/js/main.e75e603b.chunk.js"
]
}
2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="IBM Watson Speech to Text is a cloud-native API that transforms voice into written text"/><link rel="manifest" href="/manifest.json"/><title>Speech to Text</title><link href="/static/css/main.7cc9301b.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(i){function e(e){for(var t,r,n=e[0],o=e[1],u=e[2],a=0,p=[];a<n.length;a++)r=n[a],Object.prototype.hasOwnProperty.call(c,r)&&c[r]&&p.push(c[r][0]),c[r]=0;for(t in o)Object.prototype.hasOwnProperty.call(o,t)&&(i[t]=o[t]);for(s&&s(e);p.length;)p.shift()();return f.push.apply(f,u||[]),l()}function l(){for(var e,t=0;t<f.length;t++){for(var r=f[t],n=!0,o=1;o<r.length;o++){var u=r[o];0!==c[u]&&(n=!1)}n&&(f.splice(t--,1),e=a(a.s=r[0]))}return e}var r={},c={1:0},f=[];function a(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return i[e].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=i,a.c=r,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(r,n,function(e){return t[e]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="/";var t=this["webpackJsonp@ibm-watson/speech-to-text-code-pattern"]=this["webpackJsonp@ibm-watson/speech-to-text-code-pattern"]||[],n=t.push.bind(t);t.push=e,t=t.slice();for(var o=0;o<t.length;o++)e(t[o]);var s=n;l()}([])</script><script src="/static/js/2.4070f991.chunk.js"></script><script src="/static/js/main.a33677a6.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="IBM Watson Speech to Text is a cloud-native API that transforms voice into written text"/><link rel="manifest" href="/manifest.json"/><title>Speech to Text</title><link href="/static/css/main.7cc9301b.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(i){function e(e){for(var t,r,n=e[0],o=e[1],u=e[2],a=0,p=[];a<n.length;a++)r=n[a],Object.prototype.hasOwnProperty.call(c,r)&&c[r]&&p.push(c[r][0]),c[r]=0;for(t in o)Object.prototype.hasOwnProperty.call(o,t)&&(i[t]=o[t]);for(s&&s(e);p.length;)p.shift()();return f.push.apply(f,u||[]),l()}function l(){for(var e,t=0;t<f.length;t++){for(var r=f[t],n=!0,o=1;o<r.length;o++){var u=r[o];0!==c[u]&&(n=!1)}n&&(f.splice(t--,1),e=a(a.s=r[0]))}return e}var r={},c={1:0},f=[];function a(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return i[e].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=i,a.c=r,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(r,n,function(e){return t[e]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="/";var t=this["webpackJsonp@ibm-watson/speech-to-text-code-pattern"]=this["webpackJsonp@ibm-watson/speech-to-text-code-pattern"]||[],n=t.push.bind(t);t.push=e,t=t.slice();for(var o=0;o<t.length;o++)e(t[o]);var s=n;l()}([])</script><script src="/static/js/2.4070f991.chunk.js"></script><script src="/static/js/main.e75e603b.chunk.js"></script></body></html>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "43c85ab3ef2598e1dcd7623e605f854f",
"revision": "7d2039ecf4a3a0f47d093cf6c85c132c",
"url": "/index.html"
},
{
"revision": "dabfde008b6acee801b9",
"revision": "396e970b5f7fac029ad2",
"url": "/static/css/main.7cc9301b.chunk.css"
},
{
Expand All @@ -16,8 +16,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/js/2.4070f991.chunk.js.LICENSE"
},
{
"revision": "dabfde008b6acee801b9",
"url": "/static/js/main.a33677a6.chunk.js"
"revision": "396e970b5f7fac029ad2",
"url": "/static/js/main.e75e603b.chunk.js"
},
{
"revision": "dd3c31bd507a68d5adc3",
Expand Down
2 changes: 1 addition & 1 deletion build/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

importScripts(
"/precache-manifest.f456d5cb40ceb0ff5e090af78ecbf176.js"
"/precache-manifest.5a232ee8c4418509be470e7e4d91151d.js"
);

self.addEventListener('message', (event) => {
Expand Down
1 change: 0 additions & 1 deletion build/static/js/main.a33677a6.chunk.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/static/js/main.e75e603b.chunk.js.map

Large diffs are not rendered by default.

27 changes: 17 additions & 10 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Launch16 from '@carbon/icons-react/lib/launch/16';
import LogoGithub24 from '@carbon/icons-react/lib/logo--github/24';
import Header from './components/Header';
import ServiceContainer from './components/ServiceContainer';
import useScript from './hooks/useScript';

const HEADER_TITLE = 'Watson Speech to Text';
const HEADER_DESCRIPTION =
Expand Down Expand Up @@ -56,15 +57,21 @@ const HEADER_LINKS = [
</Link>,
];

export const App = () => (
<div className="app-container">
<Header
description={HEADER_DESCRIPTION}
links={HEADER_LINKS}
title={HEADER_TITLE}
/>
<ServiceContainer />
</div>
);
export const App = () => {
useScript(
'https://cdn.jsdelivr.net/gh/watson-developer-cloud/watson-developer-cloud.github.io@master/analytics.js',
);

return (
<div className="app-container">
<Header
description={HEADER_DESCRIPTION}
links={HEADER_LINKS}
title={HEADER_TITLE}
/>
<ServiceContainer />
</div>
);
};

export default App;
18 changes: 18 additions & 0 deletions src/hooks/useScript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useEffect } from 'react';

const useScript = url => {
useEffect(() => {
const script = document.createElement('script');

script.src = url;
script.async = true;

document.body.appendChild(script);

return () => {
document.body.removeChild(script);
};
}, [url]);
};

export default useScript;

0 comments on commit 3f3e34e

Please sign in to comment.