Skip to content

Commit 338d61b

Browse files
committed
fix(demo): load the proper widget files for demo
1 parent b853068 commit 338d61b

File tree

4 files changed

+65
-5
lines changed

4 files changed

+65
-5
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"eslint": "eslint packages",
1818
"serve": "npm run start",
1919
"stylelint": "stylelint \"packages/node_modules/**/*.css\"",
20-
"start": "NODE_ENV=development webpack-dev-server --config scripts/webpack/webpack.dev.babel.js --hot --inline --history-api-fallback"
20+
"start": "NODE_ENV=development webpack-dev-server --config scripts/webpack/webpack.dev.babel.js --hot --inline --history-api-fallback",
21+
"start:demo": "NODE_ENV=development webpack-dev-server --config scripts/webpack/webpack.demo.babel.js --hot --inline --history-api-fallback"
2122
},
2223
"repository": {
2324
"type": "git",
@@ -99,6 +100,7 @@
99100
"postcss-cssnext": "^2.9.0",
100101
"postcss-loader": "^1.2.1",
101102
"postcss-reporter": "^3.0.0",
103+
"react-cookie": "^1.0.4",
102104
"react-router": "^3.0.2",
103105
"react-tap-event-plugin": "^2.0.1",
104106
"react-test-renderer": "^15.4.1",

packages/node_modules/@ciscospark/widget-message-meet/src/index.js

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/webpack/webpack.demo.babel.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* In development we assume that the code generated is going to be consumed by
3+
* webpack dev server and we are bundling into a single js file.
4+
*/
5+
6+
import webpack from 'webpack';
7+
import webpackConfigBase from './webpack.base.babel';
8+
import HtmlWebpackPlugin from 'html-webpack-plugin';
9+
10+
const plugins = [
11+
new HtmlWebpackPlugin({
12+
template: `index.html`
13+
}),
14+
new webpack.EnvironmentPlugin([
15+
`CISCOSPARK_ACCESS_TOKEN`,
16+
`MESSAGE_DEMO_CLIENT_ID`,
17+
`MESSAGE_DEMO_CLIENT_SECRET`,
18+
`TO_PERSON_EMAIL`,
19+
`TO_PERSON_ID`
20+
])
21+
];
22+
23+
export default webpackConfigBase({
24+
entry: `./demo.js`,
25+
plugins,
26+
devtool: `cheap-module-eval-source-map`,
27+
devServer: {
28+
port: 8000,
29+
stats: {
30+
colors: true,
31+
hash: false,
32+
version: false,
33+
timings: false,
34+
assets: true,
35+
chunks: false,
36+
modules: false,
37+
reasons: false,
38+
children: false,
39+
source: false,
40+
errors: true,
41+
errorDetails: true,
42+
warnings: true,
43+
publicPath: false
44+
}
45+
}
46+
});

src/demo-widget-message-meet/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable react/no-set-state */
22
import React, {Component} from 'react';
33
import classNames from 'classnames';
4+
import cookie from 'react-cookie';
45

56
import SparkLogo from '@ciscospark/react-component-spark-logo';
67
import SparkOAuth from '@ciscospark/react-component-spark-oauth';
@@ -19,8 +20,8 @@ class DemoWidgetMessageMeet extends Component {
1920
this.state = {
2021
authenticate: false,
2122
mode: MODE_INLINE,
22-
accessToken: ``,
23-
toPersonEmail: ``,
23+
accessToken: cookie.load(`accessToken`) || ``,
24+
toPersonEmail: cookie.load(`toPersonEmail`) || ``,
2425
running: false,
2526
clientId: process.env.MESSAGE_DEMO_CLIENT_ID,
2627
clientSecret: process.env.MESSAGE_DEMO_CLIENT_SECRET,
@@ -41,6 +42,8 @@ class DemoWidgetMessageMeet extends Component {
4142

4243
handleSubmit(e) {
4344
e.preventDefault();
45+
cookie.save(`accessToken`, this.state.accessToken);
46+
cookie.save(`toPersonEmail`, this.state.toPersonEmail);
4447
this.setState({running: true});
4548
}
4649

0 commit comments

Comments
 (0)