[SELF-1891] feat(kyc): Other IDs button (#1660)

* feat(kyc): Other IDs button

* trigger sumsub flow directly from event listener

* formatting

* formatting

* add todo

* add feature flag

---------

Co-authored-by: Justin Hernandez <justin.hernandez@self.xyz>
This commit is contained in:
Leszek Stachowski
2026-01-27 23:03:36 +01:00
committed by GitHub
parent e0c0c37372
commit 80d9e2d625
12 changed files with 245 additions and 56 deletions

View File

@@ -21,19 +21,25 @@ export interface SumsubConfig {
const FETCH_TIMEOUT_MS = 30000; // 30 seconds
export const fetchAccessToken = async (
phoneNumber: string,
phoneNumber?: string,
): Promise<AccessTokenResponse> => {
const apiUrl = SUMSUB_TEE_URL;
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
try {
const requestBody: Record<string, string> = {};
if (phoneNumber) {
requestBody.phone = phoneNumber;
}
const response = await fetch(`${apiUrl}/access-token`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ phone: phoneNumber }),
body: JSON.stringify(requestBody),
signal: controller.signal,
});

View File

@@ -21,6 +21,7 @@ import {
} from '@selfxyz/mobile-sdk-alpha';
import { logNFCEvent, logProofEvent } from '@/config/sentry';
import { fetchAccessToken, launchSumsub } from '@/integrations/sumsub';
import type { RootStackParamList } from '@/navigation';
import { navigationRef } from '@/navigation';
import {
@@ -298,6 +299,16 @@ export const SelfClientProvider = ({ children }: PropsWithChildren) => {
navigationRef.navigate('AadhaarUpload', { countryCode });
}
break;
case 'kyc':
fetchAccessToken()
.then(accessToken => {
launchSumsub({ accessToken: accessToken.token });
})
// TODO: show sumsub error screen
.catch(error => {
console.error('Error launching Sumsub:', error);
});
break;
default:
if (countryCode) {
navigationRef.navigate('ComingSoon', { countryCode });