Skip to content

Commit

Permalink
chore: merge in smart-camera-web (#91)
Browse files Browse the repository at this point in the history
* Initial commit

* Create README.md

* v1.0.0-beta.0: capture selfie and liveness images (#1)

* 1.0.0-beta.1

1.0.0-beta.1

* enh: image cropping, UI and documentation enhancements (beta.2) (#2)

* enh: add "ID Card Capture" option (#3)

* fix(layout-shift): add image dimension hints for preview image

* tests: add cypress test for id-capture flow

* docs: add `capture-id`, and other enhancements.

* refactor: use graphical 1k (1024)

* 1.0.0-beta.3

* enh: add ability to capture back of ID card (#4)

* enh: add `back of ID` capture

* tests: add tests for capture back of id

* 1.0.0-beta.4

* refactor: use `setActiveScreen` and `activeScreen` to switch screens

* 1.0.0-beta.4

* fix: selfie camera should not have a negative z-index (#5)

* refactor: do not set z-index of video

* refactor: use `prepend` for selfie video

* refactor: use single `<video>` element, do not re-create on each retry

* refactor: change version number

* 1.0.0-beta.5

* 1.0.0-beta.5

* refactor: fix stacking context for id-cameras (#6)

* refactor: fix stacking context for id-images

* refactor: bump version

* 1.0.0-beta.6

* redesign: back of id should have `image_type_id` of 7 (#7)

* redesign: back of id should have `image_type_id` of 7

* version: update version in docs / source

* 1.0.0-beta.7

* v1.0.0-beta.8: remove all links to smileidentity.com (#8)

* fix: remove all links to smileidentity.com

* 1.0.0-beta.8

* refactor(IDImage): change id image dimensions (#9)

* refactor(IDImage): change id image dimensions

* refactor: use rounded height dimension

* refactor: maintain aspect ratio in dimensions

* fix: fix clip-path regression (#10)

* version: update to v1.0.0-beta.10

* redesign: increase liveness image capture duration (#11)

* redesign: increase liveness image capture duration

* refactor: change animation duration for smile prompt

* enh(DocumentCapture): add zoom level for samsung multi-camera devices (#12)

* enh: add zoom level for samsung multi-camera devices

* fix: typo in `isSamsungMultiCameraDevice`

* fix: add ui style tweaks

* fix

* enh: add some UI enhancements

* v1.0.0-beta.11: Enhance Liveness and Document Capture Features (#13)

* Enhance Liveness and Document Capture Features

- Increase Liveness Image capture duration to 8s
- Add Zoom Level for Document Capture for multi-camera Android devices
- Change Document capture image frame from white to red
- Remove Document capture image frame from review screens

* build: revert package.json update, update deps

* 1.0.0-beta.11

* Refactor render (#14)

* Refactor render logic
Remove listeners on disconnect

* Reset shadow root to prevent duplicate when removed and appended to parent

* Remove the resetlisteners function

* Allow reset of component

* Add test for smart camera screen reset

* Verify request-screen is visible after reset
reduce wait time in test
reindent template

* config: set up new workflows for test, deploy, deploy-preview (#16)

* enh: add `hide-attribution` attribute to hide attribution (#18)

* meta: update VERSION number

* fix: fix font url

* refactor: change markup function to named function

* redesign: use `hide-attribution` attribute to hide attribution

* tests: test `hide-attribution` atttribute

* config: update version to beta.14

* config: bump version to v1.0.0-beta.15

* Add back button (#17)

* Add slot for custom back button

* Add test for custom back button

* Add back button tests for all screens

* Update smart-camera-web.js

Co-authored-by: tams sokari <[email protected]>

* Update smart-camera-web.js

* Update back button and exit buttons
Update tests

* remove unused variable

* Add option to hide back buttons that go back to the host app

* Increase back button text size

* Add test:  back to host button

---------

Co-authored-by: tams sokari <[email protected]>

* Update package version (#19)


* Update package version
Add cypress test output to gitignore

* Pump version in smartcamera file (#20)

* enh: upgrade dependencies, and cypress tests / config (#21)

* config: bump node version to v18.16.0

* deps: upgrade dependencies to latest versions

* migration: migrate cypress tests to latest format

* config: bump cypress-io/github-action version

* refactor: move html files into `cypress/pages` folder

* fix: move instrumented files to pages folder on build

* config: use `deploy` workflow in place of `main` for tagged deploys (#22)

* redesign: remove main.yml workflow file

* config: use `deploy` workflow on tags

* refactor: replace `set-output` call with environment files (#23)

* config: separate `share-preview-url` action (#27)

* Implement portrait capture view with 1.4 aspect ratio (#25)

* Implement portrait capture.

* Add eslint.

* Change NATIONAL_ID_DOC to GREEN_BOOK.

* Add an observer for the document type attribute.

* Add logs for QA.

* Update log.

* Cleanups.

* Use inline JS inside the markup template.

* Update package version.

* Use a combination of observer and static get.

* Add logs for QA.

* Update HTML markup when the document type attribute changes.

* Cleanups.

* Include previous change.

* Constrain view within fixed sized area.

* Add extra padding.

* Add left spacing.

* Adjust button width.

* enh: add "document upload" functionality (#24)

* wip

* wip: tying it all together

* redesign: smart-camera-web redesign shelved for separate PR

* redesign: restore legacy smart-camera-web to working code

* wip

* tests: add `do-not-upload` attribute to all existing tests

* redesign: change from "Nunito Sans" to "Nunito" font

* redesign: switch between camera and entry screens for document capture

* refactor: remove todo.txt file

* fix: fix broken tests

* redesign: add upload document functionality

* add styling for document upload, finalize design

* tests: add page for tests / local development

* refactor: remove new smart-camera-web component

* refactor: remove commented code in `handleError`

* refactor: remove redundant async from `SmartFileUpload.getData`, promise is returned

* redesign: handle file reader errors in `SmartFileUpload.getData`

* refactor: add comment explaining why we split dataURL strings

* redesign: switch action button sequence

* redesign: change max file size to 10mb

* redesign: add image resolution check for uploaded documents

* redesign: add `document-capture-mode` attribute, defaults to `both`

* fix: add event listeners conditionally

* redesign: observe `document-capture-mode` attributes for changes

* fix: attach event listeners after rewriting dom

* refactor: extract `setUpEventListeners` into its own function

* refactor: move event listener to `setUpEventListeners` function

* fix(styles): conditionally apply classes when upload document-capture-mode is selected

* fix: clear value when file input is clicked, enabling selection of same file

* refactor: always show entry screens for document capture

* tmp: disable test requirements

* refactor: use getter for `captureBackOfID`

* copy: change copy for document capture entry screens

* redesign: fix conditional rendering

* fix: run linter to minimize merge conflicts

* enh: restart from main

* fix: fix lint config, and run linter

* version: bump version number to 1.0.0-beta.18

* enh: add `SmartFileUpload` class for processing uploads

* redesign: switch from Nunito Sans to Nunito

* redesign: move confirm actions to right, and review to left

* config: bump version number

* redesign: remove unnecessary variable declaration

* refactor: remove redundant code, reorder, and rewrite

* enh: add document upload functionality, without triggers

* refactor: add entry screens for document capture, modify tests

* Revert "tmp: disable test requirements"

This reverts commit 8dfaf4cadc2cf2e16f2926e29d8d8aa39d225c23.

* redesign: remove height restriction on reviewed document images

* redesign: add `document-capture-mode` to observed-attributes

* refactor: make `color-digital-blue` have highest specificity

* fix: fix svg dimension error, remove max-height on preview

* enh: add extra back / close buttons on the document capture entry screens

* styles: use consistent styling in document entry screens

* tests: add command to navigate through face capture screens

* redesign: change image dimension error message copy

* enh: add image dimension tip

* tests: add document-upload tests

* format: run linter

* redesign: remove dimension restriction

* redesign: use `document-capture-modes`, and change default to `camera`

* styles: change entry-screen block-size to 45rem

* refactor: use attributes and conditional rendering for back buttons

* fix: reset `_rawImages` when restarting image capture for POL

* redesign: apply branding updates - font, buttons, attribution (#28)

* styles: change font to DM Sans

* redesign: introduce `powered-by-smile-id` component for attribution

* redesign: change button components to match new brand

* refactor: change image outline color to use interactive color

* refactor: update attribution test

* refactor: change active color

* version: bump to 1.0.0-beta.19

* 1.0.0-beta.19

* deps: update package-lock.json

* redesign: add border to solid buttons

* redesign: add transparent for actions icons

* enh: update badge in README.md (#29)

* lint  (#30)

* update deps

* lint

* resolve all linter errors

* lint

* add linter to github action

* rgb images (#31)

* deploy: bump version number for publishing (#32)

* config: bump version number

* 1.0.0-beta.20

* redesign: remove cropping for face images (#33)

* refactor: move face image functions together

* redesign: do not crop images

* refactor: wrap selfie review image in a container, scale to center

* fix: remove redundant assignment, fix lint error

* redesign: reduce scale of preview image

* redesign: modify selfie review vertical height on mobile screens

* Publish/v1.0.0 beta.21 (#34)

* version: bump to v1.0.0-beta.21

* 1.0.0-beta.21

* redesign: check if explicit calls to video.play() prevents black / green screen issues (#35)

* redesign: check if explicit calls to video.play() prevents black screen issues

* enh: add `muted` attribute to video stream

* version: bump version number to v1.0.0-beta.42

* 1.0.0-beta.22

* enh: improve document capture, fix icon buttons, add capture tips (#36)

* redesign: change back button icon / font color

* redesign: switch close icon

* redesign: reinstate tips for back of document capture

* redesign: remove auto margin for actions on id entry screens

* enh: add "Skip this step" button for back of id photo

this shows up only when a document-type does not exist

* 1.0.0-beta.23

* redesign: use image-frame to crop id image

* bump dependencies (#37)

* fix license (#39)

* add dependabot config (#38)

* Move dependencies to dev dependencies, release version 1.0.0 (#40)

* move to dev dependencies

* increment beta version

* make version 1.0.0

* Introduce bundler with src/ directory, break apart components into individual files  (#41)

* use a bundler

* import version from package.json

* delete empty file

* lint

* revert license

* bump dependencies (#37)

* fix license (#39)

* add dependabot config (#38)

* update readme

* fix test workflow

* refactor: prepare web/embed package for merge

* refactor: move workflows into respective folders

* refactor: reinstate stale pr workflow

* config: write unified github workflows

* fix: fix yml errors

* config: reference .nvmrc from root

* config: bump nvm version

* redesign: pass working directory to npm ci step

* debug(lint): remove working directory, using pwd

* config: pass cache-dependency-path

* config: fix lint workflow

* config: fix deploy preview

* config: add cache-dependency-path to test workflow

* config: remove quote around on

* remove pwd call

* attempt to fix workflow files

* name steps in lint

* deps: set up base npm package

* fix lint scripts

* config: add space after on in workflow definition

* explicitly name all steps

* explicitly name steps

* config: remove prefix for names

* packages: change author to SmileID

* fix components test

* fix: fix components package.json typo

* fix: use single smart-camera-web file without build

* build: add deploy, deploy-staging workflows, delete nested folders

---------

Co-authored-by: tams sokari <[email protected]>
Co-authored-by: Michael <[email protected]>
  • Loading branch information
3 people authored Oct 19, 2023
1 parent 0c94156 commit 61c4790
Show file tree
Hide file tree
Showing 137 changed files with 30,459 additions and 12,707 deletions.
6 changes: 5 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
directory: "/packages/components" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "npm" # See documentation for possible values
directory: "/packages/embed" # Location of package manifests
schedule:
interval: "weekly"
87 changes: 67 additions & 20 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,86 @@
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:
needs: [test]
components:
needs:
- test
defaults:
run:
working-directory: ./packages/components
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: checkout code
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 && npm run build:dist
node-version-file: .nvmrc
cache: npm
cache-dependency-path: ./packages/components/package-lock.json
- name: install dependencies
run: npm ci
- name: build application
run: npm run build
- name: set destination directory
id: set_dest_dir
run: echo "DEST_DIR=inline/preview-$GITHUB_HEAD_REF" >> "$GITHUB_OUTPUT"
id: set_dest_dir_camera_web
run: >-
echo "DEST_DIR_COMPONENTS=js/preview-$GITHUB_HEAD_REF" >>
"$GITHUB_ENV"
- name: deploy preview to s3
uses: jakejarvis/[email protected]
with:
args: --follow-symlinks --delete
args: >-
--follow-symlinks --delete --exclude '*' --include
'packages/components/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 }}
SOURCE_DIR: "./dist"
DEST_DIR: ${{ steps.set_dest_dir.outputs.DEST_DIR }}

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_COMPONENTS }}'
embed:
needs:
- test
defaults:
run:
working-directory: ./packages/embed
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: ./packages/embed/package-lock.json
- name: install dependencies
run: npm ci
- name: build application
run: 'npm run build && npm run build:dist'
- name: set destination directory
id: set_dest_dir_hosted_web
run: echo "DEST_DIR_EMBED=inline/preview-$GITHUB_HEAD_REF" >> "$GITHUB_ENV"
- name: deploy preview to s3
uses: jakejarvis/[email protected]
with:
args: '--follow-symlinks --delete'
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 }}'
SOURCE_DIR: ./packages/embed/dist
DEST_DIR: '${{ env.DEST_DIR_EMBED }}'
45 changes: 36 additions & 9 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,52 @@
name: deploy staging

on:
push:
branches: [ main ]

branches: [main]
jobs:
test:
uses: ./.github/workflows/test.yml
deploy:
components:
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 5
defaults:
run:
working-directory: ./packages/components
steps:
- uses: actions/checkout@v4
- name: checkout code
uses: actions/checkout@v4
- name: deploy to staging to s3
uses: jakejarvis/[email protected]
with:
args: >-
--follow-symlinks --delete --exclude "*" --include
"packages/components/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: "js/staging"
embed:
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 5
defaults:
run:
working-directory: ./packages/embed
steps:
- name: checkout code
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 && npm run build:dist
node-version-file: ".nvmrc"
cache: "npm"
cache-dependency-path: ./packages/embed/package-lock.json
- name: install dependencies
run: npm ci
- name: build site
run: npm run build && npm run build:dist
- name: deploy to s3 / cloudfront
uses: jakejarvis/[email protected]
with:
Expand Down
55 changes: 45 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,60 @@
name: deploy production

name: deploy
on:
push:
tags: v1*

tags: v*
jobs:
test:
uses: ./.github/workflows/test.yml
deploy:
components:
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 5
defaults:
run:
working-directory: ./packages/components
steps:
- uses: actions/checkout@v4
- name: checkout code
uses: actions/checkout@v4
- 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_COMPONENTS=js/$TAG" >> $GITHUB_OUTPUT
- name: deploy to s3 / cloudfront
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_COMPONENTS }}
embed:
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 5
defaults:
run:
working-directory: ./packages/embed
steps:
- name: checkout code
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 && npm run build:dist
node-version-file: ".nvmrc"
cache: "npm"
cache-dependency-path: ./packages/embed/package-lock.json
- name: install dependencies
run: npm ci
- name: build site
run: npm run build && npm run build:dist
- name: deploy to s3 / cloudfront
uses: jakejarvis/[email protected]
with:
Expand Down
57 changes: 37 additions & 20 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,44 @@
name: lint
on:
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
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
- name: lint js
run: npm run lint
components:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/components
steps:
- name: checkout code
uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: ./packages/components/package-lock.json
- name: install dependencies
run: npm ci
- name: lint
run: npm run lint
embed:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/embed
steps:
- name: checkout code
uses: actions/checkout@v4
- name: set node version
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: ./packages/embed/package-lock.json
- name: install dependencies
run: npm ci
- name: lint html
run: npm run lint:html
33 changes: 24 additions & 9 deletions .github/workflows/share-preview-url.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,36 @@ on:
types:
- opened
- ready_for_review

jobs:
comment-on-pr:
runs-on: ubuntu-latest
permissions: write-all
timeout-minutes: 5
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: checkout code
uses: actions/checkout@v4
- name: get dest dir for web components
id: get_dest_dir_components
working-directory: ./packages/components
run: >-
echo "DEST_DIR_COMPONENTS=js/preview-$GITHUB_HEAD_REF" >>
"$GITHUB_ENV"
- name: get dest dir for web embed
id: get_dest_dir_embed
working-directory: ./packages/embed
run: echo "DEST_DIR_EMBED=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 }}
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 Components / Smart Camera Web:
https://cdn.smileidentity.com/${{ env.DEST_DIR_COMPONENTS }}/smart-camera-web.js
✅ Preview URL for Embed:
https://cdn.smileidentity.com/${{ env.DEST_DIR_EMBED }}/js/script.min.js
12 changes: 6 additions & 6 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'Close stale issues and PRs'
name: "Close stale issues and PRs"
on:
schedule:
- cron: '30 16 * * *'
- cron: "30 16 * * *"

jobs:
stale:
Expand All @@ -10,9 +10,9 @@ jobs:
steps:
- uses: actions/stale@v7
with:
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
stale-pr-message: 'This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.'
close-pr-message: 'This PR was closed because it has been stalled for 7 days with no activity.'
stale-issue-message: "This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days."
stale-pr-message: "This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days."
close-issue-message: "This issue was closed because it has been stalled for 7 days with no activity."
close-pr-message: "This PR was closed because it has been stalled for 7 days with no activity."
days-before-stale: 14
days-before-close: 7
Loading

0 comments on commit 61c4790

Please sign in to comment.