Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge smart camera web #76

Closed
wants to merge 61 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
450f061
Initial commit
tamssokari Feb 26, 2021
30bb339
Create README.md
tamssokari Feb 26, 2021
3a30f42
v1.0.0-beta.0: capture selfie and liveness images (#1)
tamssokari Apr 29, 2021
05f5030
1.0.0-beta.1
Apr 29, 2021
49a72aa
enh: image cropping, UI and documentation enhancements (beta.2) (#2)
tamssokari May 18, 2021
8216fa1
enh: add "ID Card Capture" option (#3)
tamssokari Jul 1, 2021
8ae694c
enh: add ability to capture back of ID card (#4)
tamssokari Aug 3, 2021
68d7f1c
fix: selfie camera should not have a negative z-index (#5)
tamssokari Oct 25, 2021
a5094f6
refactor: fix stacking context for id-cameras (#6)
tamssokari Oct 26, 2021
b909aea
redesign: back of id should have `image_type_id` of 7 (#7)
tamssokari Oct 27, 2021
ef26c39
v1.0.0-beta.8: remove all links to smileidentity.com (#8)
tamssokari Feb 7, 2022
772c91b
refactor(IDImage): change id image dimensions (#9)
tamssokari Jun 9, 2022
9bb96d8
fix: fix clip-path regression (#10)
tamssokari Oct 25, 2022
f99debd
version: update to v1.0.0-beta.10
tamssokari Oct 26, 2022
72c9d97
redesign: increase liveness image capture duration (#11)
tamssokari Dec 7, 2022
cf82a1f
enh(DocumentCapture): add zoom level for samsung multi-camera devices…
tamssokari Dec 9, 2022
70c30a4
v1.0.0-beta.11: Enhance Liveness and Document Capture Features (#13)
tamssokari Dec 9, 2022
73f5b5c
Refactor render (#14)
ayinloya Feb 9, 2023
6bb52df
config: set up new workflows for test, deploy, deploy-preview (#16)
tamssokari Feb 20, 2023
4abc55a
enh: add `hide-attribution` attribute to hide attribution (#18)
tamssokari Apr 12, 2023
0d4e54a
Add back button (#17)
ayinloya Apr 12, 2023
028fb13
Update package version (#19)
ayinloya Apr 13, 2023
ef42965
Pump version in smartcamera file (#20)
ayinloya Apr 13, 2023
14d4b6c
enh: upgrade dependencies, and cypress tests / config (#21)
tamssokari Apr 18, 2023
5545a28
config: use `deploy` workflow in place of `main` for tagged deploys (…
tamssokari Apr 19, 2023
d438053
refactor: replace `set-output` call with environment files (#23)
tamssokari Apr 19, 2023
c33f30f
config: separate `share-preview-url` action (#27)
tamssokari May 12, 2023
113183e
Implement portrait capture view with 1.4 aspect ratio (#25)
nii-mants3 May 24, 2023
5f1232b
enh: add "document upload" functionality (#24)
tamssokari Jun 8, 2023
cab9e06
redesign: apply branding updates - font, buttons, attribution (#28)
tamssokari Jul 19, 2023
18b7554
enh: update badge in README.md (#29)
tamssokari Jul 20, 2023
5aa061d
lint (#30)
mldangelo Aug 11, 2023
12f6a47
rgb images (#31)
mldangelo Aug 11, 2023
fd47bf3
deploy: bump version number for publishing (#32)
tamssokari Aug 11, 2023
d30ef3c
redesign: remove cropping for face images (#33)
tamssokari Aug 16, 2023
6e5771c
Publish/v1.0.0 beta.21 (#34)
tamssokari Aug 16, 2023
6fab3f2
redesign: check if explicit calls to video.play() prevents black / gr…
tamssokari Aug 25, 2023
1e3896e
enh: improve document capture, fix icon buttons, add capture tips (#36)
tamssokari Sep 29, 2023
b830b25
Prepare smart-camera-web for merge into hosted-web-integration
mldangelo Oct 1, 2023
8aa34fb
Prepare hosted-web-integration for merge with smart-camera-web
mldangelo Oct 1, 2023
73cefbe
Merge remote-tracking branch 'smart-camera-web/main' into merge-smart…
mldangelo Oct 1, 2023
9186b61
common setup
mldangelo Oct 1, 2023
f5f88e2
move smart camera web github actions
mldangelo Oct 1, 2023
70a56bb
merge test workflows
mldangelo Oct 1, 2023
b2051bf
combine preview urls
mldangelo Oct 1, 2023
949bb90
combine deploy workflows
mldangelo Oct 1, 2023
a0dd95e
fix license
mldangelo Oct 1, 2023
0cb2e26
fix test action
mldangelo Oct 1, 2023
30b23a0
add dummy package.json to appease ci
mldangelo Oct 1, 2023
7499f89
revert to default working directories
mldangelo Oct 1, 2023
2a21852
fix test workflow
mldangelo Oct 1, 2023
b01275b
set working directories
mldangelo Oct 1, 2023
70e8675
Merge branch 'main' into merge-smart-camera-web
mldangelo Oct 2, 2023
8786622
fix lint
mldangelo Oct 2, 2023
43b1512
update lint command
mldangelo Oct 2, 2023
0137146
wait on
mldangelo Oct 2, 2023
51068c6
update lock file
mldangelo Oct 2, 2023
a4c2066
move lint action
mldangelo Oct 2, 2023
7728bcb
Merge branch 'main' into merge-smart-camera-web
mldangelo Oct 2, 2023
c8b5a6a
update path
mldangelo Oct 3, 2023
d8f5137
limit lint action
mldangelo Oct 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 41 additions & 6 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,52 @@
name: deploy-preview
on:
workflow_call:
pull_request:
branches: [ 'main' ]
types:
- opened
- edited
- synchronize
push:
branches: [ 'main' ]

jobs:
test:
uses: ./.github/workflows/test.yml
deploy-preview:
deploy-preview-camera-web:
needs: [test]
defaults:
run:
working-directory: ./smart-camera-web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build
- name: set destination directory
id: set_dest_dir_camera_web
run: echo "DEST_DIR_CAMERA_WEB=js/preview-$GITHUB_HEAD_REF" >> "$GITHUB_ENV"
- name: deploy preview to s3
uses: jakejarvis/[email protected]
with:
args: --follow-symlinks --delete --exclude '*' --include 'smart-camera-web.js'
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
DEST_DIR: ${{ env.DEST_DIR_CAMERA_WEB }}

deploy-preview-hosted-web:
needs: [test]
defaults:
run:
working-directory: ./hosted-web-integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -22,8 +58,8 @@ jobs:
- run: npm ci
- run: npm run build && npm run build:dist
- name: set destination directory
id: set_dest_dir
run: echo "DEST_DIR=inline/preview-$GITHUB_HEAD_REF" >> "$GITHUB_OUTPUT"
id: set_dest_dir_hosted_web
run: echo "DEST_DIR_HOSTED_WEB=inline/preview-$GITHUB_HEAD_REF" >> "$GITHUB_ENV"
- name: deploy preview to s3
uses: jakejarvis/[email protected]
with:
Expand All @@ -33,6 +69,5 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: "./dist"
DEST_DIR: ${{ steps.set_dest_dir.outputs.DEST_DIR }}

SOURCE_DIR: "./hosted-web-integration/dist"
DEST_DIR: ${{ env.DEST_DIR_HOSTED_WEB }}
42 changes: 42 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: deploy
on:
push:
tags: v[1-9]+.[0-9]+.[0-9]+*
defaults:
run:
working-directory: ./smart-camera-web
jobs:
test:
uses: ./.github/workflows/test.yml
deploy:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build
- name: get version number
id: get_version
run: |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: set destination directory
id: set_destination
env:
TAG: ${{ steps.get_version.outputs.VERSION }}
run: |
echo "DEST_DIR=js/$TAG" >> $GITHUB_OUTPUT
- name: deploy to s3
uses: jakejarvis/[email protected]
with:
args: --follow-symlinks --delete --exclude '*' --include 'smart-camera-web.js'
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
DEST_DIR: ${{ steps.set_destination.outputs.DEST_DIR }}
41 changes: 30 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
name: lint
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run lint:html
lint-hosted-web-integration:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./hosted-web-integration
steps:
- uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run lint:html
lint-smart-camera-web:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./smart-camera-web
steps:
- uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run lint
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ on:
push:
tags: v1
branches: main

defaults:
run:
working-directory: ./hosted-web-integration
jobs:
test:
uses: ./.github/workflows/test.yml
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/share-preview-url.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,27 @@ jobs:
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: get dest dir
id: get_dest_dir
run: echo "DEST_DIR=inline/preview-$GITHUB_HEAD_REF" >> "$GITHUB_OUTPUT"
- name: share preview url as PR comment

- name: get dest dir for camera-web
id: get_dest_dir_camera_web
working-directory: ./smart-camera-web
run: echo "DEST_DIR_CAMERA_WEB=js/preview-$GITHUB_HEAD_REF" >> "$GITHUB_ENV"

- name: get dest dir for hosted-web
id: get_dest_dir_hosted_web
working-directory: ./hosted-web-integration
run: echo "DEST_DIR_HOSTED_WEB=inline/preview-$GITHUB_HEAD_REF" >> "$GITHUB_ENV"

- name: share preview urls as PR comment
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: "This branch has been deployed to s3 / cloudfront.\n\n✅ Preview URL: https://cdn.smileidentity.com/${{ steps.get_dest_dir.outputs.DEST_DIR }}/js/script.js"
msg: |
This branch has been deployed to s3 / cloudfront.

✅ Preview URL for Smart Camera Web:
https://cdn.smileidentity.com/${{ env.DEST_DIR_CAMERA_WEB }}/smart-camera-web.js

✅ Preview URL for Hosted Web Integration:
https://cdn.smileidentity.com/${{ env.DEST_DIR_HOSTED_WEB }}/js/script.js
33 changes: 27 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
name: test
on:
workflow_call:

jobs:
test:
test-smart-camera-web:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./smart-camera-web
steps:
- name: checkout code, and install dependencies
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build
- name: run tests
uses: cypress-io/github-action@v6
with:
start: npm start
working-directory: ./smart-camera-web
wait-on: 'http://localhost:8000'
test-hosted-web-integration:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./hosted-web-integration
steps:
- uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- name: run tests
uses: cypress-io/github-action@v6
with:
start: npm start
working-directory: ./hosted-web-integration
wait-on: 'http://localhost:8000'
- name: upload test failure artifacts
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots

path: cypress/screenshots
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.17.1
v18.18.0
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Smile Identity

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
81 changes: 26 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,43 @@
# hosted-web-integration

[![Cypress Tests](https://github.com/smileidentity/hosted-web-integration/actions/workflows/main.yml/badge.svg)](https://github.com/smileidentity/hosted-web-integration/actions/workflows/main.yml)
# Smile Identity Hosted-Web Mono-Repo

## Overview

This repository provides a self-hosted integration for Smile ID on the Web. It encompasses a comprehensive set of utilities for KYC processes, biometric verification, and more. Public documentation [here](https://docs.usesmileid.com/integration-options/web-mobile-web/web-integration).

## Prerequisites

- Ensure you have [Node.js](https://nodejs.org/) installed.
- Install [nvm (Node Version Manager)](https://github.com/nvm-sh/nvm) for managing Node.js versions.

## Setup

1. Clone the repository:

```bash
git clone https://github.com/smileidentity/hosted-web-integration.git
cd hosted-web-integration
```

2. Switch to the appropriate Node version using `nvm`:

```bash
nvm install
nvm use
```

3. Install project dependencies:

```bash
npm install
```
- **Smart Camera Web** acts as a user interface client that works together with the [Server to Server](https://docs.smileidentity.com/server-to-server) libraries. For more detailed information, you can refer to the [Smart Camera Web documentation](./smart-camera-web/README.md).

## Running the Project
- **Hosted Web Integration** provides the necessary structure for self-hosted integration on the web. Detailed information about this can be found in the [Hosted Web Integration documentation](./hosted-web-integration/README.md).

1. Build the project:
## Quick Start

```bash
npm run build
```
### Setting Up Your Environment

2. Start the local server:
1. **Node.js with NVM**: Ensure you're using the correct Node.js version. If you don't have [NVM (Node Version Manager)](https://github.com/nvm-sh/nvm) installed:

```bash
npm start
```
Activate the right Node version for this project:

3. Access the application on `http://localhost:8000`.
```sh
nvm use
```

### Configuration
2. **Installing Dependencies**:

- `.git-blame-ignore-revs`: File used to ignore certain commits in `git blame`.
- `.gitignore`: Specifies files to ignore in git. These include [./dist](./dist) and [./build](./build).
- `.nvmrc`: Node Version Manager configuration file.
- `.nycrc`: [NYC](https://github.com/istanbuljs/nyc) configuration file.
```sh
npm install
```

## Testing
### Running Tests

Run Cypress tests using:
Both projects in this mono-repo come equipped with test suites to ensure code quality and functionality. Here's how to run them:

```bash
npm test
```
1. **Smart Camera Web**:

NOTE: the `npm start` command must be running in a separate terminal window.
```sh
cd smart-camera-web
npm test
```

### Cypress Configuration & Pages
2. **Hosted Web Integration**:

- `cypress.config.js`: Main Cypress configuration file.
- `cypress/pages/`: Contains all the utility pages.
```sh
cd hosted-web-integration
npm test
```
File renamed without changes.
Loading