Skip to content

Commit

Permalink
Merge pull request #138 from onfido/feat/update-example
Browse files Browse the repository at this point in the history
feat: update examples
  • Loading branch information
DannyOnfido authored Mar 18, 2024
2 parents 7316147 + b8882e6 commit 959d003
Show file tree
Hide file tree
Showing 33 changed files with 5,495 additions and 44,452 deletions.
16 changes: 0 additions & 16 deletions .babelrc

This file was deleted.

18 changes: 18 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
34 changes: 0 additions & 34 deletions .eslintrc.js

This file was deleted.

38 changes: 25 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
/node_modules
/lib
/.DS_Store
/dist
/secrets.json
/key.pem
/cert.pem
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
/appBin
/bin
/src/**/bin
/src/**/build
/src/**/node_modules
/src/react/.eslintcache
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.DS_Store
.vscode
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

36 changes: 9 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,17 @@ By use of script tags you can see the example in the
## Run the app

Firstly, clone the project and run `npm install`. There're two ways to run the demo app:
The vanilla way & the React way.
The javascript way & the React way.

### The vanilla way
### Javascript

- Start with `npm run start:vanilla`
- Access it via HTTPS: `https://localhost:8010`
- The app is located at `src/vanilla/index.js`
1. Add your token to `src/javascript/index.html`
2. Start with `npm run start:javascript`
3. Access it at https://localhost:3000

### The React way
### React

- Start with `npm run start:react`
- Access it via HTTPS: `https://localhost:8020`
- The app is located at `src/react/src/index.js`
1. Add your token to `src/react/App.js`
2. Start with `npm run start:react`
3. Access it at: https://localhost:5173

## Build the app

### The vanilla way

- Bundle with `npm run build:vanilla`
- The production bundle is located at `src/vanilla/bin`

### The React way

- Bundle with `npm run build:react`
- The production bundle is located at `src/react/build`

## Internals

- The `getToken` function will send a request to an internal Onfido service
called `sdk-token-factory` that generates JWTs that allows internal contributors to test the app.
- In a real-life integration, the JWT would have to be requested from the host app server,
which will then serve it to its front-end before initialising the SDK.
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/react/index.tsx"></script>
</body>
</html>
Loading

0 comments on commit 959d003

Please sign in to comment.