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

v14.17.0 #2201

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ This documents the breaking changes between the Web SDK v13.7.0 and the Web SDK
- `useMemoryHistory` has been deprecated
- `handle.setOptions()` has been deprecated, no longer allowing changing options after bootstrapping the SDK
- The fallback options under the `face` step now only occur on the mobile session of a user as all fallbacks due to device capabilities will always trigger a cross-device flow first.
- `tearDown` now returns a Promise
- `safeTearDown` has been deprecated, please use `tearDown` instead
120 changes: 98 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Based on the same major version, the minor and patch versions of the library can
The specific version of the Onfido Web SDK that should be loaded as part of this initialization. A full version (e.g. `v14.12.1`) or just a minor version (e.g. `v14.13`) can be specified. When a minor version is specified, the latest patch version for that minor release will be loaded.
Example: `version: "14.12.1"`

**Note**: This parameter is ineffective when the library is impoart as a full bundle from NPM (as opposed to the default CDN-powered NPM package).
**Note**: This parameter is ineffective when the library is imported as a full bundle from NPM (as opposed to the default CDN-powered NPM package).

### Styling customization

Expand Down Expand Up @@ -522,20 +522,13 @@ For the face step, an object is returned with the `variant` used for the face ca

Callback that fires when an error occurs. The callback returns the following error types:

- `exception`
This will be returned for the following errors:

- timeout and server errors
- authorization
- invalid token
- missing data in `onComplete` callback

This data can be used for debugging purposes.
- `invalid_token`
This error will be returned when the SDK token is invalid or missing.

```javascript
{
type: "exception",
message: "The request could not be understood by the server, please check your request is correctly formatted"
type: "invalid_token",
message: "The token is invalid."
}
```

Expand All @@ -549,9 +542,28 @@ Callback that fires when an error occurs. The callback returns the following err
}
```

- `permissions_unavailable`
- `expired_trial`
This error will be returned when the trial has expired.

```javascript
{
type: "expired_trial",
message: "The trial period is expired."
}
```

- `geoblocked_request`
This error will be returned when the request is geo-blocked.

```javascript
{
type: "geoblocked_request",
message: "The request is not allowed from this location."
}
```

`permissions_unavailable` will be returned if the SDK was unable to access or request the necessary permissions. This may occur when the Web SDK is loaded within a webview or other custom browsers.
- `permissions_unavailable`
This error will be returned if the SDK was unable to access or request the necessary permissions. This may occur when the Web SDK is loaded within a webview or other custom browsers.

```javascript
{
Expand All @@ -560,34 +572,98 @@ Callback that fires when an error occurs. The callback returns the following err
}
```

- `user_consent_denied`
- `unsupported`
This error will be returned when the a module is not supported in the current environment.

```javascript
{
type: "unsupported",
message: "The module is not supported in the current environment."
}
```

- `unsupported_feature`
This error will be returned when a feature is not supported.

```javascript
{
type: "unsupported_feature",
message: "The feature is no longer supported."
}
```

`user_consent_denied` will be returned if the user exits the flow because they declined the consent prompt.
- `invalid_sdk_parameter`
This error will be returned when the SDK is initialized with invalid parameters.

```javascript
{
type: "invalid_sdk_parameter",
message: "The SDK is initialized with invalid parameters."
}
```

- `unsupported_sdk_version`
This error will be returned when the workflow is not supported by the SDK version.

```javascript
{
type: "unsupported_sdk_version",
message: "The SDK version is not compatible with the workflow."
}
```

- `no_camera`
This error will be returned when the camera is not available and no other capture method is available.

```javascript
{
type: "no_camera",
message: "The camera is not available."
}
```

- `user_consent_denied`
This error will be returned when the user exits the flow because they declined the consent.

```javascript
{
type: "user_consent_denied",
message: "Unable to proceed without user consent"
message: "The user has declined the consent."
}
```

- `exception`
This will be returned for all unknown errors, including:
- timeout and server errors
- unexpected javascript errors

This data can be used for debugging purposes.

```javascript
{
type: "exception",
message: "The request could not be understood by the server, please check your request is correctly formatted"
exception: Error
}
```

**Note** that from version 14 onwards, the optional `onUserExit` callback, that was used to return the `USER_CONSENT_DENIED` message, has been deprecated and merged with the `onError` callback, as detailed above.

### SDK tear-down

If you have embedded the SDK inside a single page app, you can call the `safeTearDown` function to remove the SDK completely from the current webpage. It will reset the state and you can safely re-initialize the SDK inside the same webpage later on.
If you have embedded the SDK inside a single page app, you can call the `tearDown` function to remove the SDK completely from the current webpage. It will reset the state and you can safely re-initialize the SDK inside the same webpage later on.

```javascript
onfidoOut = Onfido.init({...})
...
await onfidoOut.safeTearDown()
await onfidoOut.tearDown()
```

⚠️ **Warning**: The `safeTearDown` method is a Promise. If you plan on mounting the SDK a second (or nth) time, please await the promise first.
⚠️ **Warning**: The `tearDown` method is a Promise. If you plan on mounting the SDK a second (or nth) time, please await the promise first.

```javascript
onfidoOut = Onfido.init({...})
await onfidoOut.safeTearDown()
await onfidoOut.tearDown()
onfidoOut2 = Onfido.init({...})
```

Expand Down Expand Up @@ -1503,4 +1579,4 @@ Previous versions of the SDK will be supported for a month after a new major ver

### Licence Information

Please see [LICENSE](https://github.com/onfido/onfido-sdk-ui/blob/master/LICENSE) for licensing details.
Please see [LICENSE](https://github.com/onfido/onfido-sdk-ui/blob/master/LICENSE) for licensing details.
Loading