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

Upgraded onfido-sdk-ui to v14.42.0 #56940

Merged
merged 5 commits into from
Feb 21, 2025
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
6 changes: 4 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"lodash-es": "4.17.21",
"lottie-react-native": "6.5.1",
"mapbox-gl": "^2.15.0",
"onfido-sdk-ui": "14.15.0",
"onfido-sdk-ui": "14.42.0",
"process": "^0.11.10",
"pusher-js": "8.3.0",
"react": "18.3.1",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Onfido/BaseOnfidoWeb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import variables from '@styles/variables';
import CONST from '@src/CONST';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import './index.css';
import type {OnfidoElement, OnfidoError, OnfidoProps} from './types';
import type {OnfidoElement, OnfidoProps} from './types';

type InitializeOnfidoProps = OnfidoProps &
Pick<LocaleContextProps, 'translate' | 'preferredLocale'> & {
Expand Down Expand Up @@ -94,7 +94,7 @@ function initializeOnfido({sdkToken, onSuccess, onError, onUserExit, preferredLo
}
onSuccess(data);
},
onError: (error: OnfidoError) => {
onError: (error) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import type {SdkErrorTypes} from 'onfido-sdk-ui/types/shared/Error';

type OnfidoError = {
    // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
    exception?: Error | unknown;
    type: SdkErrorTypes;
    message: string;
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why do we need that. Since everything is typed here already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting the following TS errors when deleting the OnfidoError type

Screenshot 2025-02-18 at 19 35 46 Screenshot 2025-02-18 at 19 35 36

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just vscode having problems. Restart the lint server to fix this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, that did the trick!
I still think there might be value in extending the type so it's consistent with actual errors thrown, but that's NAB, let's resolve the issues In #56940 (comment) first

const errorType = error.type;
const errorMessage: string = error.message ?? CONST.ERROR.UNKNOWN_ERROR;
Log.hmmm('Onfido error', {errorType, errorMessage});
Expand Down
2 changes: 1 addition & 1 deletion src/components/Onfido/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {OnfidoResult} from '@onfido/react-native-sdk';
import type {Handle} from 'onfido-sdk-ui/types/Onfido';
import type {CompleteData} from 'onfido-sdk-ui/types/Types';
import type {CompleteData} from 'onfido-sdk-ui/types/shared/SdkParameters';
import type {OnyxEntry} from 'react-native-onyx';

type OnfidoData = CompleteData | OnfidoResult;
Expand Down
Loading