Skip to content

Commit

Permalink
feat: Add ui-react-liveness and FaceLivenessDetector component (#3677)
Browse files Browse the repository at this point in the history
* fix: Update error handling (#679)

* WIP

* chore: update error state handling to only user onError, added onFailure callback

* chore: move default error components to separate components (#680)

* chore: move default error components to separate components

* chore: update unit tests

* fix: remove unused variable

* refactor(liveness): move examples/liveness-next to examples/next (#681)

* refactor(liveness): add liveness example to next dir

* refactor(liveness): fix liveness example in next dir

* refactor(liveness): remove examples/liveness-next

* refactor(liveness): update README and env example

Co-authored-by: MJ☔ <zhamujun@amazon.com>

* fix: remove dotted line from liveness oval (#684)

* fix(liveness): update the links after refactor the path (#685)

Co-authored-by: MJ☔ <zhamujun@amazon.com>

* chore: clean up app fixes, remove example logo (#686)

* fix: set liveness width seed to 1.0 (#688)

* fix: added message about multiple faces before countdown (#689)

* fix: set default video bit rate to 1 Mbps (#690)

* fix: handle errors from liveness stream with default server error messaging (#692)

* fix: handle errors from liveness stream with default server error messaging

* fix: unit tests

* refactor(liveness): TS strict helper liveness (#693)

* refactor(liveness): TS Strict for helper liveness

* refactor(liveness): TS Strict for liveness helper

* refactor(liveness): TS Strict for liveness helper

* refactor(liveness): add isClientFreshnessColorSequence helper

* refactor(liveness): remove exclude from getColorsSequencesFromSessionInformation

Co-authored-by: MJ☔ <zhamujun@amazon.com>

* fix(liveness): getColorsSequencesFromSessionInformation type (#695)

Co-authored-by: MJ☔ <zhamujun@amazon.com>

* fix: re-order stop video events to fix empty chunk getting sent before all video events are done (#697)

* fix: add amplify user agent to rekognition streaming client (#698)

* fix: Remove unused deps (#696)

* fix: remove unused deps webrtc-adapater, aws-sdk-liveness, uuid

* fix: add back in xstate dep

* add  yarn.lock

* fix: unit tests

* fix: fix unit test

* fix: analytics events that were negative values (#699)

* fix: more copy updates (#701)

* fix: more copy updates

* fix: unit tests

* chore: update freeze stream to show paused video during uploading (#700)

* add pauseVideo action
* update freezeStream to not wait for animation end

* fix: small ux issues for fnf precheck (#704)

* fix: small ux issues for fnf precheck

* fix: unit test

* Revert "fix: set liveness width seed to 1.0 (#688)" (#708)

This reverts commit 6be24a9.

* test(liveness): set up tests for start screen (#687)

Co-authored-by: MJ☔ <zhamujun@amazon.com>

* fix: ensure that recording has started before continuing (#702)

* testing: added changes to increase video size (not resolution) by 10%, testing this change in beta this has not been reviewed

* fix: switch back to original timestamps (#710)

* fix: switch back to original timestamps

* remove unused method

* Revert "testing: added changes to increase video size (not resolution) by 10%, testing this change in beta this has not been reviewed" (#712)

This reverts commit 6d81f9f.

* chore: update copy from UXSO (#713)

* Update FPS message
* update max to maximum

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* chore: added mobile landscape warning (#714)

* chore: added mobile landscape warning

* add safari friendly orientation detection (#716)

* add safari friendly orientation detection

* Add isMobile check back

* Add back 480 height to LivenessCheck

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* fix lint

* fix unit tests

---------

Co-authored-by: Heather Buchel <hbuchel@gmail.com>
Co-authored-by: Heather Buchel <buchel@amazon.com>

* test(liveness): add more e2e tests (#711)

* test(liveness): add popover icon test

* test(liveness): add liveness detector tests

* test(liveness): add disable start screen tests

* test(liveness): add With Custom Components tests

* test(liveness): modify

---------

Co-authored-by: MJ☔ <zhamujun@amazon.com>

* chore: test new thresholds (#717)

* fix: update facebounding box generation and oval matching thresholds (#718)

* chore: add more unit test coverage for liveness (#694)

* chore: add more unit test coverage for liveness

* chore: update device maxtouchpoints to check full undefined

* chore: added logging for beta (#719)

* chore: more beta logs

* fix: testing an updated fix for oval matching

* chore: add even more logging for beta

* fix: try testing reducing min face match count to 3

* fix: add offset to timestamps based on how long it takes to do initial blazeface detection (#722)

* chore(ci): disable unneeded workflows (#724)

* chore:update test app to match example app

* fix: update min face match logic to be time based rather than count based

* fix: updated unit test, rename function

* fix: remove max resolution cap for mediaRecorder (#731)

* fix: remove max resolution cap for mediaRecorder

* fix: update unit tests

* fix: set recording timeslices to 200ms to fix low score issue (#733)

* fix: make mediaWidth/height logic more device agnostic (#727)

* fix: close icon misaligned (#734)

Co-authored-by: Heather Buchel <buchel@amazon.com>

* chore: add orientation utility tests (#735)

* fix: set recording start timestamp to be the min of calculated record… (#736)

* fix(liveness): stream-provider type (#737)

Co-authored-by: MJ☔ <zhamujun@amazon.com>

* chore: update face matching algorithm for liveness (#741)

* fix: remove all the logging statements we added for debugging (#732)

* chore: switch to using third party cdn for tfjs/blazeface (#742)

* fix: remove analytics calls baked into liveness component (#740)

* fix: remove analytics calls baked into liveness component

* remove analytics flag

* fix: fix linting

* chore: update client-rekognitionstreaming to SDK v3 (#739)

* chore: update magic numbers to use values from challenge config (#743)

* chore: update magic numbers to use values from challenge config

* chore: update to use calibrated pupil distance formula

* chore(liveness): move screen brightness instruction to the top

* chore: update copy per fnf ga and move more strings to use dictionary (#748)

* chore: update FaceLivenessDetector API based on meeting, removed onsu… (#746)

* chore: update FaceLivenessDetector API based on meeting, removed onsuccess/onfailure, combined onError and onPermissionDenied

* chore: fix unnecessary optional chaining

* chore: added options for overriding the tfjs and blazeface cdn urls (#750)

* chore: added options for overriding the tfjs and blazeface cdn urls

* Update packages/ui/src/helpers/liveness/blazeface-face-detection.ts

Co-authored-by: Heather Buchel <hbuchel@gmail.com>

* Update packages/ui/src/helpers/liveness/blazeface-face-detection.ts

Co-authored-by: Heather Buchel <hbuchel@gmail.com>

---------

Co-authored-by: Heather Buchel <hbuchel@gmail.com>

* chore: add VideoEndTimestamp to client info (#749)

* chore: add VideoEndTimestamp to client info
* chore: separate stopVideo and empty chunk dispatch events, update tests

* chore: setting up android, swift, and react liveness docs pages (#752)

* fix: remove extra data selectos from liveness (#753)

* fix: remove extra data selectos from liveness

* fix: rename prop data-testid to testId

* chore: use responsive sizing for video element and 4:3 resolution (#730)

* fix: add missing await when stopping liveenss video (#756)

* fix: use intrinsic videoWidth/videoHeight for video dims for correct face matching (#755)

* chore: set video width/height dims to intrinsic width to fix face matching from blazeface

* chore: remove useMediaDimensions

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* chore: update api based on br review (#754)

* chore: update api based on br review

* chore: more api feedback fixes

* fix: small comment fix and build fix

* fix: update to onAnalysisComplete and config

* fix(liveness): flip drawn oval and update sessionInfo to use normalized face bounding box (#757)

* fix(liveness): flip oval matching logic as well (#758)

* chore(liveness): set up publishing new ui-react-liveness package (#759)

* chore(liveness): set up publishing new ui-react-liveness package

* update package.json and gitignore

* Update packages/react-liveness/package.json

Co-authored-by: Caleb Pollman <cpollman@amazon.com>

* Update packages/react-liveness/package.json

Co-authored-by: Caleb Pollman <cpollman@amazon.com>

* remove coma

---------

Co-authored-by: Caleb Pollman <cpollman@amazon.com>

* chore(liveness): try increase video time chunks to 1000ms (#760)

* chore(liveness): try increase video time chunks to 1000ms

* chore(liveness): reorder events to prevent pauseafter countdown

* fix unit tests

* add android and swift info to docs

* chore: use full screen oval canvas on mobile, anchor video elements (#762)

* chore: use class name to apply mobile styles

* reposition oval drawing

* change translation method

* cleanup

* chore: anchor video ui elements to video frame

* class name cleanup

* remove unused values/cleanup

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* chore: add debug logs and send them to sample app through hug events (#763)

* chore: add debug logs and send them to sample app through hug events

* remove core mocking

* chore(liveness): remove extraneous logging (#761)

* fix: remove webgl dep

* fix: fix breakpoint unit tests

* fix: use main yarn.lock and set eslint config back to error on nullish coalescing

* fix: fix import for react-countdown-circle-timer

* fix: skip unit test for now, fix later

* chore: update instruction texts from UX (#767)

* Revert "chore: add debug logs and send them to sample app through hug events (#763)"

This reverts commit 8e71060.

* chore(react-liveness): add non-code files, setup jest and ts

* chore(ui-react-liveness): migrate FaceLivenessDetector

* fix snapshot

* update FaceLivenessDetector imports

* add top level react-liveness command

* remove Liveness code from ui-react

* add top level react-liveness command

* chore: set opacity of camera view outside oval to 1.0 (#770)

* port update from aws-amplify/amplify-ui-staging#770

* fix snapshot

* fix: add missing react-liveness package to example app (#776)

* chore: clean up + update liveness CSS class names (#764)

* chore: flatten + cleanup classnames and styles

* chore: change initial face distance threshold to be 0.34 (#778)

* chore: change initial face distance threshold to be 0.34

* chore: move to constants folder and add comments explaining the numbers

* chore: updated comment for more clarity

* chore: try updating to .3

* add liveness quick start instructions and best practices

* chore(liveness): add region prop to component (#779)

* chore(liveness): add region prop to component

* chore: update comment to not list out regions and instead add a link in future

* chore(liveness): update threshold to 0.32 for testing

* chore(liveness): text updates

* chore: move instruction to top

* chore(liveness): added border colors, adjusted colors for usability study

* chore(liveness): add instrucitonal image

* Update packages/react-liveness/src/components/FaceLivenessDetector/shared/Toast.tsx

Co-authored-by: MJ Zhang <0618@users.noreply.github.com>

* chore(liveness): update bullet index styling

* chore: try adding test for mouseless navigation (#774)

* chore: try adding test for keyboardless navigation

* chore: updated to get begin check workign with enter button

* chore(react-liveness): prepare for service code migration

* chore: update instructional text

* chore(ui-react-liveness): add styles exports

* update quick start instructions and add credentials provider info

* fix(ui-react-liveness): fix unit tests

* remove console.warn spy

* chore(ui-react-liveness): migrate service code

* add customization info

* Enable client debug logging (#789)

* chore: re-add client logging to aid with session debugging

* Fix copy/paste type in test to wrong videoRecorder path

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* feat: Add Match Progress Indicator for usability testing (#800)

* fix: update 5s text to 8s (#801)

* fix: set initial faceMatchPercentage to 25 to match formula (#802)

Co-authored-by: Heather Buchel <buchel@amazon.com>

* chore: update api calls to match latest SDK changes (#803)

* chore: update api calls to match latest SDK changes

* chore: update to new version published in CA, rename OvalScaleFactors to OvalParameters

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* fix initial face timestamp by ensuring recorder has started (#798)

* fix initial face timestamp by ensuring recoder has started

* Add new timestamp calculation from Science

* update comment

* Use Math.round() on calculated timestamp

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* chore: Add illustration components for start screen, minor default components refactor (#804)

* Add illustration components for start screen

* Fix test. Add background behind figure image to match illustration

* Fix missing title tag

* remove some unneeded imports

* Add basic tests for new components

* fix darkmode by using Text component around text elements

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* chore: adding retry logic for loading CDN files

* chore: update to use the retry logic from js core

* fix: adding args

* chore: update toasts during face matching to only show TOO_FAR, TOO_CLOSE toasts (#807)

* Show progress indicator only when state matches too far

* restrict when we show oval matching instructions to TOO_CLOSE, TOO_FAR, FACE_IDENTIFIED

* Update toasts for matching state

* update some comments, clean up code

* revert changes in LivenessCameraModule, addressed in separate PR

* add other face match state test scenarios during recording state

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* fix: only show match indicator during TOO_FAR, FACE_IDENTIFIED states (#808)

Co-authored-by: Heather Buchel <buchel@amazon.com>

* update android docs

* chore: update face match timeout to 7 seconds (#811)

* chore: update face match timeout to 7 seconds

* update messaging to say 7 seconds instead of 8

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* chore: update illustration tests (#805)

* chore: update tests for illustrations

* add testId props for test

* use nodeName and getByTitle

* use findBy instead of queryBy

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* fix: move closer shouldn't show during MATCHED state (#810)

Co-authored-by: Heather Buchel <buchel@amazon.com>

* chore: update copy from UX/copywriter (#812)

* chore: copy updates

* chore: more copy updates

* fix oval instruction text

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* update dark mode theme colors

* fix: error toast message should have  dark text in darkmode (#813)

Co-authored-by: Heather Buchel <buchel@amazon.com>

* fix: use a css custom property for the match indicator transition (#814)

Co-authored-by: Heather Buchel <buchel@amazon.com>

* fix: uncenter illustrations (#815)

Co-authored-by: Heather Buchel <buchel@amazon.com>

* I18n updates (#787)

* fix: overflow: hidden not working in safari on progress bar (#818)

Co-authored-by: Heather Buchel <buchel@amazon.com>

* Update test-internal-prs.yml (#819)

* chore(ui-react-liveness): add size-limit test

* remove extra file

* update light mode theme colors

* fix: 7 seconds string text (#823)

Co-authored-by: Heather Buchel <buchel@amazon.com>

* add link and update android versions

* chore: remove client side logging (#826)

Co-authored-by: Heather Buchel <buchel@amazon.com>

* fix: Show Match indicator during CANT_IDENTIFY state during recording (#825)

* fix: Show Match indicator during CANT_IDENTIFY state during recording

* consolidate state check into showMatchIndicatorStates

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* add material3 dependency to setup

* remove placeholder for theming image

* test(liveness): add liveness build test (#824)

* test(liveness): add nextjs build test

* test(liveness): change build test nextjs size-limit

* test(liveness): change version to latest

* test(liveness): clean up code

* test(liveness): clean up code

* test(liveness): change version

---------

Co-authored-by: MJ☔ <zhamujun@amazon.com>

* add predictions dependency for liveness

* chore: move error modal to default overridable component (#827)

* chore: move error modal to default overridable component

* chore: move error modal

* chore: more fixes and string fixes

* Update packages/react-liveness/src/components/FaceLivenessDetector/LivenessCheck/LivenessCameraModule.tsx

Co-authored-by: Caleb Pollman <cpollman@amazon.com>

---------

Co-authored-by: Caleb Pollman <cpollman@amazon.com>

* remove instructions to add predictions plugin

* add rekognition liveness links

* remove unneeded dependencies

* fix: remove liveness error modal from export (#835)

* fix: remove liveness error modal from export

* chore: remove more export, update snapshot

* test(liveness): check CDN status (#830)

* test(liveness): check CDN status

* test(liveness): change CDN endpoint

* test(liveness): add jsdelivr CDN back

---------

Co-authored-by: MJ☔️ <zhamujun@amazon.comm>

* chore(liveness): switch to public npm for client-rekognitionstreaming (#841)

* chore: add tests for when MatchIndicator should show in LivenessCameraModule (#839)

* chore: update tests for cases to show MatchIndicator

* remove unnecesary import

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* chore: add tests for MatchIndicator (#833)

* chore: add tests for MatchIndicator

* ensure progress bar can't be less than 0 or more than 100, add tests

---------

Co-authored-by: Heather Buchel <buchel@amazon.com>

* chore: update yarn.lock

* chore: remove codeartifact and fix build issue

* chore: fix docs and tests

* chore: add social preview android/swift

* chore: added web liveness quick start to docs (#834)

* chore: added web liveness quick start to docs

* Update docs/src/pages/[platform]/connected-components/liveness/quick-start-example.react.mdx

Co-authored-by: Heather Buchel <hbuchel@gmail.com>

* chore: merged with android branch

* chore(liveness): add customization for react web

* chore: update text

* chore: added table of customizable components

* Update docs/src/pages/[platform]/connected-components/liveness/quick-start-pull.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/customization/customization.i18n.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/customization/customization.start-view.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/customization/customization.theming.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/customization/customization.theming.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/quick-start-add.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/quick-start-add.react.mdx

Co-authored-by: Scott Rees <6165315+reesscot@users.noreply.github.com>

* chore: address comments

* Update docs/src/pages/[platform]/connected-components/liveness/quick-start-pull.react.mdx

* Update docs/src/pages/[platform]/connected-components/liveness/customization/customization.components.react.mdx

Co-authored-by: Scott Rees <6165315+reesscot@users.noreply.github.com>

* chore: address comments

* Update docs/src/pages/[platform]/connected-components/liveness/quick-start-add.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/customization/customization.components.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/quick-start-add.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/quick-start-add.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* chore: address mor comments

* chore: updated customization table with links

* Update docs/src/pages/[platform]/connected-components/liveness/customization/customization.theming.react.mdx

Co-authored-by: Scott Rees <6165315+reesscot@users.noreply.github.com>

* chore: more comment updates

---------

Co-authored-by: Heather Buchel <hbuchel@gmail.com>
Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>
Co-authored-by: Scott Rees <6165315+reesscot@users.noreply.github.com>

* Liveness web docs examples (#847)

* chore(liveness): added liveness example to start page

* chore: added liveness docs examples

* chore: fixed sidebar errors

* Update docs/src/pages/[platform]/connected-components/liveness/customization/Customizationi18n.tsx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/customization/customization.components.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/customization/customization.theming.react.mdx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update docs/src/pages/[platform]/connected-components/liveness/QuickStartReact.tsx

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* chore: updated comments

* address feedback

---------

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* chore: revert gh actions to match ui/main (#851)

* chore(liveness): add iOS docs content (#837)

* chore: update liveness streaming client (#855)

* chore: update liveness streaming client

* chore: remove CA install step

* chore: remove extraneous github workflows from staging

* chore: remove codeartifact gh action

* chore: remove examples react-native changes

* fix: clean up rn files and fix docs package.json

* chore: add liveness to pr unit tests

* fix(docs): hide install script for swift, fix install scripts format

* fix(liveness): fix unit tests build for react-liveness

* chore: add liveness e2e setup

* chore: setup liveness e2e tests to run

* chore: regenerate yarn.lock from main

* Update packages/react-core/src/Authenticator/hooks/useAuthenticator/constants.ts

Co-authored-by: Caleb Pollman <cpollman@amazon.com>

* Update packages/react-core/src/Authenticator/hooks/useAuthenticator/constants.ts

Co-authored-by: Caleb Pollman <cpollman@amazon.com>

* chore: remove auth mock file

* Create .changeset/brown-moles-grow.md

* Update .changeset/brown-moles-grow.md

Co-authored-by: Caleb Pollman <cpollman@amazon.com>

* fix: workflow runs

* chore: try fix e2e again

* fix: docs snapshot

* Update .github/workflows/reusable-e2e.yml

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* Update .github/workflows/reusable-e2e.yml

Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>

* chore: remove liveness env readme

* chore: fix folder structure for liveness environment (#3679)

* Move liveness backend to a nested folder

* Remove unrelated file

* Use us-east-1

* Update environments/liveness/package.json

* chore(docs): switch all instaces of all to be angular|flutter|react|react-native|vue since we added android and swift

* fix: remove unused livenessCard

* fix: update docs snapshot test

* fix: fix path for liveness env in next app

* fix: also fix export in other places

* fix: broken liveness e2e tests

* fix: fix liveness e2e env

* chore(docs): remove more default pages for android and swift

* chore: switch liveness next app to use prod endpoint

* chore: switch endpoint

* chore: fix region for liveness creds

* chore: fix more pr feedback

* chore: pin version

* update swift customization docs

* Temporarily skip link checker

* Revert "test(liveness): add liveness build test (#824)"

This reverts commit 2e0a816.

* chore: skip liveness canary

* chore: fix ios docs build error

---------

Co-authored-by: MJ Zhang <0618@users.noreply.github.com>
Co-authored-by: MJ☔ <zhamujun@amazon.com>
Co-authored-by: Heather Buchel <hbuchel@gmail.com>
Co-authored-by: Heather Buchel <buchel@amazon.com>
Co-authored-by: William Lee <43682783+wlee221@users.noreply.github.com>
Co-authored-by: Ioana Brooks <68251134+ioanabrooks@users.noreply.github.com>
Co-authored-by: Caleb Pollman <cpollman@amazon.com>
Co-authored-by: Erica Eaton <eatoeric@amazon.com>
Co-authored-by: Chenwei Zhang <40295569+zchenwei@users.noreply.github.com>
Co-authored-by: Ayush Goyal <ayush987goyal@gmail.com>
Co-authored-by: Chenwei Zhang <chenwz@amazon.com>
Co-authored-by: wlee221 <willeea@amazon.com>
Co-authored-by: Erica Eaton <67125657+eeatonaws@users.noreply.github.com>
Co-authored-by: MJ☔️ <zhamujun@amazon.comm>
Co-authored-by: Scott Rees <6165315+reesscot@users.noreply.github.com>
Co-authored-by: Ian Saultz <52051793+atierian@users.noreply.github.com>
  • Loading branch information
17 people committed Apr 10, 2023
1 parent c3918d9 commit bc3fd6d
Show file tree
Hide file tree
Showing 214 changed files with 12,786 additions and 140 deletions.
7 changes: 7 additions & 0 deletions .changeset/brown-moles-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@aws-amplify/ui": minor
"@aws-amplify/ui-react": minor
"@aws-amplify/ui-react-liveness": major
---

feat: Add ui-react-liveness and FaceLivenessDetector component
3 changes: 2 additions & 1 deletion .github/changeset-presets/bump-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
'@aws-amplify/ui-react': minor
'@aws-amplify/ui-react-core': patch
'@aws-amplify/ui-react-native': major
'@aws-amplify/ui-react-liveness': minor
---

Version bump for ui, ui-react, ui-react-native and ui-react-core packages
Version bump for ui, ui-react, ui-react-native, ui-react-liveness and ui-react-core packages
1 change: 1 addition & 0 deletions .github/changeset-presets/bump-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'@aws-amplify/ui-vue': patch
'@aws-amplify/ui-react-core': patch
'@aws-amplify/ui-react-native': patch
'@aws-amplify/ui-react-liveness': patch
---

Version bump for all public packages
1 change: 1 addition & 0 deletions .github/workflow-samples/tagged-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
GEO_E2E_ROLE_ARN: ${{ secrets.GEO_E2E_ROLE_ARN }}
STORAGE_E2E_ROLE_ARN: ${{ secrets.STORAGE_E2E_ROLE_ARN }}
IN_APP_MESSAGING_E2E_ROLE_ARN: ${{ secrets.IN_APP_MESSAGING_E2E_ROLE_ARN }}
LIVENESS_E2E_ROLE_ARN: ${{ secrets.LIVENESS_E2E_ROLE_ARN }}
DOMAIN: ${{ secrets.DOMAIN }}
PHONE_NUMBER: ${{ secrets.PHONE_NUMBER }}
USERNAME: ${{ secrets.USERNAME }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
DATASTORE_E2E_ROLE_ARN: ${{ secrets.DATASTORE_E2E_ROLE_ARN }}
GEO_E2E_ROLE_ARN: ${{ secrets.GEO_E2E_ROLE_ARN }}
STORAGE_E2E_ROLE_ARN: ${{ secrets.STORAGE_E2E_ROLE_ARN }}
LIVENESS_E2E_ROLE_ARN: ${{ secrets.LIVENESS_E2E_ROLE_ARN }}
IN_APP_MESSAGING_E2E_ROLE_ARN: ${{ secrets.IN_APP_MESSAGING_E2E_ROLE_ARN }}
DOMAIN: ${{ secrets.DOMAIN }}
PHONE_NUMBER: ${{ secrets.PHONE_NUMBER }}
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/reusable-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ on:
required: true
IN_APP_MESSAGING_E2E_ROLE_ARN:
required: true
LIVENESS_E2E_ROLE_ARN:
required: true
DOMAIN:
required: true
PHONE_NUMBER:
Expand Down Expand Up @@ -154,6 +156,10 @@ jobs:
if: ${{ matrix.package == 'react' }}
run: yarn react-storage build

- name: Build react-liveness package
if: ${{ matrix.package == 'react' }}
run: yarn react-liveness build

- name: Add Amplify CLI
run: yarn global add @aws-amplify/cli

Expand Down Expand Up @@ -228,6 +234,22 @@ jobs:
- name: Pull down Datastore AWS environments
run: yarn environments datastore pull

- name: Configure liveness credentials
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0 https://github.com/aws-actions/configure-aws-credentials/commit/e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.LIVENESS_E2E_ROLE_ARN }}

- name: Create temp AWS profile
run: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID && \
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY && \
aws configure set aws_session_token $AWS_SESSION_TOKEN && \
aws configure set default.region $AWS_REGION
- name: Pull down Liveness AWS environments
run: yarn environments liveness pull

- name: Configure in-app-messaging credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down Expand Up @@ -255,6 +277,9 @@ jobs:

- name: Start ${{ matrix.example }} example
run: yarn workspace ${{ matrix.example }}-example start & npx wait-on -c waitOnConfig.json -t 20000 http-get://localhost:3000/ui/components/authenticator/sign-in-with-username
env:
# Setting this value temporarily since the beta liveness sample app hits the gamma endpoint
NEXT_PUBLIC_STREAMING_API_URL: wss://streaming-rekognition-gamma.us-east-1.amazonaws.com

- name: Run E2E tests against ${{ matrix.example }} example
id: e2e
Expand Down Expand Up @@ -348,6 +373,9 @@ jobs:
- name: Build react-storage package
run: yarn react-storage build

- name: Build react-liveness package
run: yarn react-liveness build

- name: Build docs package
run: yarn docs build
env:
Expand All @@ -371,6 +399,8 @@ jobs:
VALID_PASSWORD: ${{ secrets.VALID_PASSWORD }}

- name: Run Docs link checker
# TODO: remove continue-on-error after all the links are available
continue-on-error: true
run: yarn docs test:links

- name: Upload failure screenshots and errors
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/reusable-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- react-native
- react-core
- react-storage
- react-liveness

steps:
- name: Checkout Amplify UI
Expand Down Expand Up @@ -76,11 +77,11 @@ jobs:
run: yarn ui build

- name: Build react-core package
if: ${{ matrix.package == 'react' || matrix.package == 'react-native' || matrix.package == 'react-storage' }}
if: ${{ matrix.package == 'react' || matrix.package == 'react-native' || matrix.package == 'react-storage' || matrix.package == 'react-liveness' }}
run: yarn react-core build

- name: Build react package
if: ${{ matrix.package == 'react-storage' && matrix.package != 'react'}}
if: ${{ matrix.package == 'react-storage' || matrix.package == 'react-liveness' && matrix.package != 'react'}}
run: yarn react build

- name: Build ${{ matrix.package }} package
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-internal-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
repository: ${{ github.repository }}

e2e:
uses: aws-amplify/amplify-ui/.github/workflows/reusable-e2e.yml@main
uses: aws-amplify/amplify-ui/.github/workflows/reusable-e2e.yml@liveness-main
needs: unit
with:
commit: ${{ github.event.pull_request.head.sha }}
Expand All @@ -123,6 +123,7 @@ jobs:
DATASTORE_E2E_ROLE_ARN: ${{ secrets.DATASTORE_E2E_ROLE_ARN }}
GEO_E2E_ROLE_ARN: ${{ secrets.GEO_E2E_ROLE_ARN }}
STORAGE_E2E_ROLE_ARN: ${{ secrets.STORAGE_E2E_ROLE_ARN }}
LIVENESS_E2E_ROLE_ARN: ${{ secrets.LIVENESS_E2E_ROLE_ARN }}
IN_APP_MESSAGING_E2E_ROLE_ARN: ${{ secrets.IN_APP_MESSAGING_E2E_ROLE_ARN }}
DOMAIN: ${{ secrets.DOMAIN }}
PHONE_NUMBER: ${{ secrets.PHONE_NUMBER }}
Expand Down
14 changes: 14 additions & 0 deletions canary/e2e/cypress/integration/common/liveness.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/// <reference types="@testing-library/cypress" />
/// <reference types="cypress" />
/// <reference types="../../support/commands" />

import { When } from 'cypress-cucumber-preprocessor/steps';

When(
'I request {string} and get {string}',
(url: string, statusCode: string) => {
cy.request({ url, followRedirect: true }).then(({ status }) => {
expect(status).to.be.equal(+statusCode);
});
}
);
11 changes: 11 additions & 0 deletions canary/e2e/features/liveness/face-detect.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Feature: Liveness Start Screen

Test Liveness CDN

Background:
Given I'm running the example "/"

@react @skip
Scenario: Blazeface CDN is up
Then I request "https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm" and get "200"
And I request "https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/default/1/model.json?tfjs-format=file" and get "200"
Binary file added docs/public/android-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/swift-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 23 additions & 6 deletions docs/src/components/InstallScripts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ interface TerminalCommandProps {
packageManager?: PackageManager;
command?: string;
variant?: 'default' | 'hero';
component?: string;
}

const frameworkInstallScript = (
framework: Framework,
packageManager: PackageManager
packageManager: PackageManager,
component?: string
) => {
const isReactNative = framework === 'react-native';

Expand All @@ -26,18 +28,21 @@ const frameworkInstallScript = (
isReactNative ? ` ${REACT_NATIVE_DEPENDENCIES}` : ''
}`;

return `${packageManagerPrefix} @aws-amplify/ui-${framework} aws-amplify${extraDependencies}`;
const componentSubpackage = component ? `-${component}` : null;

return `${packageManagerPrefix} @aws-amplify/ui-${framework}${componentSubpackage} aws-amplify${extraDependencies}`;
};

export const TerminalCommand = ({
framework,
component,
packageManager,
command,
variant = 'default',
}: TerminalCommandProps) => {
const terminalCommand = command
? command
: frameworkInstallScript(framework, packageManager);
: frameworkInstallScript(framework, packageManager, component);

return (
<div className={`install-code__container ${variant}`}>
Expand All @@ -54,9 +59,13 @@ export const TerminalCommand = ({

interface InstallScriptsProps {
framework?: Framework;
component?: string;
}

export const InstallScripts = ({ framework }: InstallScriptsProps) => {
export const InstallScripts = ({
framework,
component,
}: InstallScriptsProps) => {
const {
query: { platform = 'react' },
} = useRouter();
Expand All @@ -69,10 +78,18 @@ export const InstallScripts = ({ framework }: InstallScriptsProps) => {
return (
<Tabs>
<TabItem title="npm">
<TerminalCommand framework={framework} packageManager="npm" />
<TerminalCommand
framework={framework}
component={component}
packageManager="npm"
/>
</TabItem>
<TabItem title="yarn">
<TerminalCommand framework={framework} packageManager="yarn" />
<TerminalCommand
framework={framework}
component={component}
packageManager="yarn"
/>
</TabItem>
</Tabs>
);
Expand Down
64 changes: 38 additions & 26 deletions docs/src/components/Layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,30 @@ const SecondaryNav = (props) => {

const isFlutter = platform === 'flutter';
const isReactNative = platform === 'react-native';
const isAndroid = platform === 'android';
const isSwift = platform === 'swift';

const hideGettingStarted = isAndroid || isSwift;
const hideTheming = isAndroid || isSwift;
const hideGuidesExpander = isFlutter || isReactNative || isAndroid || isSwift;

return (
<Expander type="multiple" value={value} onValueChange={setValue}>
<ExpanderItem
title={
<ExpanderTitle Icon={MdOutlineChecklist} text="Getting started" />
}
value="getting-started"
>
{gettingStarted.map(({ label, ...rest }) => (
<NavLink key={label} {...rest} onClick={props.onClick}>
{label}
</NavLink>
))}
</ExpanderItem>
{/* Android and Swift don't have getting started at this time */}
{hideGettingStarted ? null : (
<ExpanderItem
title={
<ExpanderTitle Icon={MdOutlineChecklist} text="Getting started" />
}
value="getting-started"
>
{gettingStarted.map(({ label, ...rest }) => (
<NavLink key={label} {...rest} onClick={props.onClick}>
{label}
</NavLink>
))}
</ExpanderItem>
)}
{platform === 'react' ? (
<ExpanderItem
title={<ExpanderTitle Icon={MdOutlineWidgets} text="Components" />}
Expand All @@ -177,26 +186,29 @@ const SecondaryNav = (props) => {
}
value="connected-components"
>
{connectedComponents.map(({ label, ...rest }) => (
<NavLink key={label} {...rest} onClick={props.onClick}>
{connectedComponents.map(({ label, href, ...rest }) => (
<NavLink key={href} href={href} {...rest} onClick={props.onClick}>
{label}
</NavLink>
))}
</ExpanderItem>

<ExpanderItem
title={<ExpanderTitle Icon={MdOutlineAutoAwesome} text="Theming" />}
value="theming"
>
{theming.map(({ label, ...rest }) => (
<NavLink key={label} {...rest} onClick={props.onClick}>
{label}
</NavLink>
))}
</ExpanderItem>
{/* Android and Swift don't have theming at this time */}
{hideTheming ? null : (
<ExpanderItem
title={<ExpanderTitle Icon={MdOutlineAutoAwesome} text="Theming" />}
value="theming"
>
{theming.map(({ label, ...rest }) => (
<NavLink key={label} {...rest} onClick={props.onClick}>
{label}
</NavLink>
))}
</ExpanderItem>
)}

{/* Flutter and React Native don't have guides at this time */}
{isFlutter || isReactNative ? null : (
{/* Flutter, React Native, Android, and Swift don't have guides at this time */}
{hideGuidesExpander ? null : (
<ExpanderItem
title={<ExpanderTitle Icon={MdOutlineArticle} text="Guides" />}
value="guides"
Expand Down
24 changes: 22 additions & 2 deletions docs/src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import * as React from 'react';
import debounce from 'lodash/debounce';
import { useRouter } from 'next/router';
import { Heading, Link, Text, View, useTheme } from '@aws-amplify/ui-react';

import { TableOfContents } from '../TableOfContents';
import { Footer } from './Footer';
import { GITHUB_REPO, GITHUB_REPO_FILE } from '@/data/links';
import {
GITHUB_REPO,
ANDROID_GITHUB_REPO,
SWIFT_GITHUB_REPO,
GITHUB_REPO_FILE,
} from '@/data/links';
import {
DesignTokenIcon,
ReactIcon,
Expand Down Expand Up @@ -72,6 +78,11 @@ export default function Page({
return () => window.removeEventListener('load', scrollToHash);
}, []);

const {
query: { platform: framework = 'react' },
} = useRouter();
const githubRepo = getGitHubRepo(framework as string);

return (
<>
<div className="docs-content">
Expand Down Expand Up @@ -122,7 +133,7 @@ export default function Page({
) : null}
<Link
className="docs-component-link"
href={`${GITHUB_REPO}issues/new/choose`}
href={`${githubRepo}issues/new/choose`}
isExternal
>
<GithubIcon
Expand All @@ -146,3 +157,12 @@ export default function Page({
</>
);
}

function getGitHubRepo(framework = 'react') {
if (framework === 'android') {
return ANDROID_GITHUB_REPO;
} else if (framework === 'swift') {
return SWIFT_GITHUB_REPO;
}
return GITHUB_REPO;
}
Loading

0 comments on commit bc3fd6d

Please sign in to comment.