Skip to content

Commit

Permalink
chore/rename readme and fix readme (#218)
Browse files Browse the repository at this point in the history
* refactor: reorganise components for publishing

* redesign(Embed): update dependencies to new format

* config(GH-Actions): modify lint action for new folder name

* config(gitignore): remove build files

* fix: remove test code for published document-capture component

* chore(gh-actions): update versions for setup-node, upload-artifact

* fix: update package-lock.json

* config(gh-actions): add cache and cache-dependency-path

* config(gh-actions): use root file as cache-dependency-path

* config: update package-lock.json

* refactor: set up publishing for components

* config: change components directory in embed

* fix: run linter on web-components

* refactor for publication

* remove cypress screenshots

* move components to components dir
Add readme

* move components to components folder

* Fix lint

* add back exports

* export selfie-capture

* Fix lint issue

Resolve lint issue with modules not resolving

* Add custom resolver

* rename readme

* remove unused file

* rename readmes

* remove empty readmes

* Remove empty file

* add file upload readme

* add camera readme

* remove duplicate readme

* revert file changes

---------

Co-authored-by: tams sokari <[email protected]>
Co-authored-by: tams sokari <[email protected]>
Co-authored-by: Michael D'Angelo <[email protected]>
  • Loading branch information
4 people authored Mar 6, 2024
1 parent ba4eedc commit 40f9232
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ document.querySelector('document-capture').addEventListener('imagesComputed', fu

`DocumentCapture` relies on the following modules:

- [document-instructions](./document-instructions/src/README.md)
- [id-capture](./id-capture/src/README.md)
- [id-review](./id-review/src/README.md)
- [SmartCamera](/packages/smart-camera-web/README.md)
- [document-instructions](./document-instructions/README.md)
- [id-capture](./id-capture/README.md)
- [id-review](./id-review/README.md)
- [SmartCamera](../../../domain/camera/src/README.md)
- [FileUpload](../../../domain/file-upload/README.md)

These dependencies are automatically imported with the component.

Expand Down
38 changes: 38 additions & 0 deletions packages/web-components/domain/camera/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SmartCamera.js

SmartCamera.js is a JavaScript class that provides an interface for interacting with the user's camera device. It has special handling for multi-camera Samsung devices to mitigate issues with blurry images at the edges.

## Usage

### Getting Media Stream

To get the media stream from the user's camera, call the `getMedia` method with the desired constraints. This method returns a Promise that resolves to a MediaStream object.

```javascript
const constraints = {
video: true,
audio: false,
};
const stream = await SmartCamera.getMedia(constraints);
```

`StartCamera` is a singleton so the `stream` can be accessed anytime via `SmartCamera.stream`.

```javascript
let video = document.createElement('video');

video.autoplay = true;
video.playsInline = true;
video.muted = true;

if ('srcObject' in video) {
video.srcObject = stream;
} else {
video.src = window.URL.createObjectURL(stream);
}
video.play();
```

### Stopping Media Stream

To stop the media stream, call the stopMedia method. This will stop all tracks in the stream and set the stream to null.
30 changes: 30 additions & 0 deletions packages/web-components/domain/file-upload/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SmartFileUpload.js

This exports a class for dealing with file-uploads in SmileID's web components

## Usage
Suppose you have an file input field

```html
<input type='file' id='upload-photo' name='document' accept='image/png, image/jpeg' />
```

```javascript
// get the element
const uploadDocumentPhotoButton = document.getElementById('upload-photo');
// add a change event listener
uploadDocumentPhotoButton.addEventListener('change', async (event) => {
try {
const { files } = event.target;

// validate file, and convert file to data url
// returns the data url for the first file
const fileData = await SmartFileUpload.retrieve(files);

// use the data url
} catch (error) {
// handle error
}
},
);
```
3 changes: 3 additions & 0 deletions packages/web-components/styles/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @smileid/styles

This is a package that contains global styles exported as a string to be used in composing CSS in Web Components and anywhere else

0 comments on commit 40f9232

Please sign in to comment.