Skip to content

Commit 25a44e8

Browse files
authored
Update custom agent demo to use vite (#16)
1 parent 7c6a649 commit 25a44e8

File tree

10 files changed

+2498
-27346
lines changed

10 files changed

+2498
-27346
lines changed

custom-agent-demo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Agent SDK Example
22

3-
This example shows how you can custommize the agent-side UI for Cobrowse. You can try it out online: navigate to our [Custom Agent Demo Page](https://cobrowseio.github.io/cobrowse-agent-sdk-examples/custom-agent-demo/) to automatically start an agent session and simulate the agent and customer experience.
3+
This example shows how you can customize the agent-side UI for Cobrowse. You can try it out online: navigate to our [Custom Agent Demo Page](https://cobrowseio.github.io/cobrowse-agent-sdk-examples/custom-agent-demo/) to automatically start an agent session and simulate the agent and customer experience.
44

55
This demo page uses our [Agent JS API (JavaScript SDK)](https://www.npmjs.com/package/cobrowse-agent-sdk) in this example project which you can run locally.
66

custom-agent-demo/public/index.html renamed to custom-agent-demo/index.html

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,20 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
5+
<link rel="icon" href="/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77
<meta name="theme-color" content="#000000" />
88
<meta
99
name="description"
10-
content="Web site created using create-react-app"
10+
content="Example customised agent experience using the Cobrowse.IO Agent SDK"
1111
/>
12-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
12+
<link rel="apple-touch-icon" href="/logo192.png" />
1313
<!--
1414
manifest.json provides metadata used when your web app is installed on a
1515
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1616
-->
17-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18-
<!--
19-
Notice the use of %PUBLIC_URL% in the tags above.
20-
It will be replaced with the URL of the `public` folder during the build.
21-
Only files inside the `public` folder can be referenced from the HTML.
22-
23-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24-
work correctly both with client-side routing and a non-root public URL.
25-
Learn how to configure a non-root public URL by running `npm run build`.
26-
-->
27-
<title>React App</title>
17+
<link rel="manifest" href="/manifest.json" />
18+
<title>Cobrowse.IO Custom Agent Demo Page</title>
2819
</head>
2920
<body>
3021
<noscript>You need to enable JavaScript to run this app.</noscript>
@@ -39,5 +30,6 @@
3930
To begin the development, run `npm start` or `yarn start`.
4031
To create a production bundle, use `npm run build` or `yarn build`.
4132
-->
33+
<script type="module" src="/src/index.jsx"></script>
4234
</body>
4335
</html>

custom-agent-demo/package-lock.json

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

custom-agent-demo/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
"@fortawesome/fontawesome-svg-core": "^1.2.36",
88
"@fortawesome/free-solid-svg-icons": "^5.15.4",
99
"@fortawesome/react-fontawesome": "^0.1.16",
10+
"@vitejs/plugin-react": "^4.6.0",
11+
"browserslist-to-esbuild": "^2.1.1",
1012
"cobrowse-agent-sdk": "^2.0.0",
1113
"moment": "^2.29.1",
1214
"react": "^17.0.2",
1315
"react-dom": "^17.0.2",
14-
"react-scripts": "^5.0.1"
16+
"vite": "^7.0.0"
1517
},
1618
"scripts": {
17-
"start": "react-scripts start",
18-
"build": "react-scripts build",
19-
"test": "react-scripts test",
20-
"eject": "react-scripts eject"
19+
"start": "vite",
20+
"build": "vite build",
21+
"test": "vite test"
2122
},
2223
"eslintConfig": {
2324
"extends": [
File renamed without changes.
File renamed without changes.

custom-agent-demo/vite.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { defineConfig } from 'vite'
2+
import browserslistToEsbuild from 'browserslist-to-esbuild'
3+
import react from '@vitejs/plugin-react'
4+
5+
export default defineConfig({
6+
base: '',
7+
build: {
8+
target: browserslistToEsbuild(),
9+
outDir: 'build',
10+
},
11+
plugins: [react()],
12+
server: {
13+
open: true,
14+
port: 3000,
15+
},
16+
})

0 commit comments

Comments
 (0)