Skip to content

Conversation

@franm91
Copy link
Member

@franm91 franm91 commented Jan 19, 2026

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Jan 19, 2026

🦋 Changeset detected

Latest commit: 86d01f7

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch front-kyc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @franm91, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly overhauls the application's Know Your Customer (KYC) integration. The primary goal is to modernize and simplify how users interact with the KYC process, from initial verification to status checks. By introducing a new unified function for starting KYC and standardizing API responses, the changes aim to improve the robustness and maintainability of the identity verification system.

Highlights

  • Refactored KYC Flow: The application's Know Your Customer (KYC) process has been completely refactored to use a new, streamlined flow.
  • Consolidated KYC Initiation: The previous createInquiry and resumeInquiry functions have been replaced by a single startKYC utility, simplifying the initiation and resumption of KYC.
  • Standardized KYC Status Handling: The getKYCStatus function now returns a structured object with a code property, and error messages have been updated for consistency (e.g., "no kyc", "bad kyc").
  • Removed Legacy KYC Template IDs: Constants for KYC_TEMPLATE_ID and LEGACY_KYC_TEMPLATE_ID have been removed, indicating a shift away from template-specific KYC logic.
  • Simplified KYC API Integration: The getKYCLink function has been replaced by getKYCTokens, which is used to obtain necessary tokens for the KYC process.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the KYC flow to use a new, unified startKYC function, which simplifies the client-side logic across several components. The changes are largely consistent and improve maintainability by centralizing the KYC initiation process. I've identified a critical regression in the web platform logic that affects mini-app functionality, and a medium-severity issue concerning redundant error reporting in one component. Addressing these points will ensure the new flow is both robust and correct.

Comment on lines 20 to 28
const embeddingContext = queryClient.getQueryData<EmbeddingContext>(["embedding-context"]);
if (embeddingContext && !embeddingContext.endsWith("-web")) {
window.location.replace(url);
window.location.replace(otl);
return;
}
window.open(url);
return;
}

const { Inquiry } = await import("react-native-persona");
Inquiry.fromTemplate(KYC_TEMPLATE_ID)
.environment(environment)
.referenceId(credential.credentialId)
.onCanceled(() => {
queryClient.invalidateQueries({ queryKey: ["kyc", "status"] }).catch(reportError);
router.replace("/(main)/(home)");
})
.onComplete(() => {
queryClient.invalidateQueries({ queryKey: ["kyc", "status"] }).catch(reportError);
queryClient.setQueryData(["card-upgrade"], 1);
router.replace("/(main)/(home)");
})
.onError((error) => reportError(error))
.build()
.start();
}

export async function resumeInquiry(inquiryId: string, sessionToken: string) {
if (Platform.OS === "web") {
const url = await getKYCLink(KYC_TEMPLATE_ID);
if (await sdk.isInMiniApp()) {
await sdk.actions.openUrl(url);
return;
}
const embeddingContext = queryClient.getQueryData<EmbeddingContext>(["embedding-context"]);
if (embeddingContext && !embeddingContext.endsWith("-web")) {
window.location.replace(url);
await sdk.actions.openUrl(otl);
return;
}

Choose a reason for hiding this comment

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

critical

The order of checks for the web platform is incorrect and introduces a regression for mini-apps. The check for embeddingContext now comes before the sdk.isInMiniApp() check. In a mini-app environment, embeddingContext can be a value like "farcaster", which doesn't end with "-web". This would cause window.location.replace(otl) to be called, which is incorrect for mini-apps. The correct behavior is to use sdk.actions.openUrl(otl).

To fix this, the sdk.isInMiniApp() check should be performed before the embeddingContext check, as it was in the previous implementation.

Suggested change
const embeddingContext = queryClient.getQueryData<EmbeddingContext>(["embedding-context"]);
if (embeddingContext && !embeddingContext.endsWith("-web")) {
window.location.replace(url);
window.location.replace(otl);
return;
}
window.open(url);
return;
}
const { Inquiry } = await import("react-native-persona");
Inquiry.fromTemplate(KYC_TEMPLATE_ID)
.environment(environment)
.referenceId(credential.credentialId)
.onCanceled(() => {
queryClient.invalidateQueries({ queryKey: ["kyc", "status"] }).catch(reportError);
router.replace("/(main)/(home)");
})
.onComplete(() => {
queryClient.invalidateQueries({ queryKey: ["kyc", "status"] }).catch(reportError);
queryClient.setQueryData(["card-upgrade"], 1);
router.replace("/(main)/(home)");
})
.onError((error) => reportError(error))
.build()
.start();
}
export async function resumeInquiry(inquiryId: string, sessionToken: string) {
if (Platform.OS === "web") {
const url = await getKYCLink(KYC_TEMPLATE_ID);
if (await sdk.isInMiniApp()) {
await sdk.actions.openUrl(url);
return;
}
const embeddingContext = queryClient.getQueryData<EmbeddingContext>(["embedding-context"]);
if (embeddingContext && !embeddingContext.endsWith("-web")) {
window.location.replace(url);
await sdk.actions.openUrl(otl);
return;
}
if (await sdk.isInMiniApp()) {
await sdk.actions.openUrl(otl);
return;
}
const embeddingContext = queryClient.getQueryData<EmbeddingContext>(["embedding-context"]);
if (embeddingContext && !embeddingContext.endsWith("-web")) {
window.location.replace(otl);
return;
}

Comment on lines 31 to 40
} catch (error) {
if (!(error instanceof APIError)) {
reportError(error);
return;
throw error;
}
if (error.text === "kyc required" || error.text === "kyc not found" || error.text === "kyc not started") {
await createInquiry(credential);
return;
if (error.text !== "not started" && error.text !== "no kyc") {
reportError(error);
throw error;
}
reportError(error);
}

Choose a reason for hiding this comment

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

medium

The reportError calls within the catch block of the mutationFn are redundant. Since the errors are re-thrown, they will be handled by the onError callback of the useMutation hook, which also calls reportError. This results in double reporting of the same error.

To fix this, you should remove the reportError calls from within the mutationFn's catch block.

      } catch (error) {
        if (!(error instanceof APIError)) {
          throw error;
        }
        if (error.text !== "not started" && error.text !== "no kyc") {
          throw error;
        }
      }

@sentry
Copy link

sentry bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.33%. Comparing base (9d72247) to head (86d01f7).
⚠️ Report is 30 commits behind head on kyc.

Additional details and impacted files
@@            Coverage Diff             @@
##              kyc     #653      +/-   ##
==========================================
- Coverage   68.20%   67.33%   -0.87%     
==========================================
  Files          41       30      -11     
  Lines        1346     1292      -54     
  Branches      337      332       -5     
==========================================
- Hits          918      870      -48     
+ Misses        276      271       -5     
+ Partials      152      151       -1     
Flag Coverage Δ
github 67.33% <ø> (-0.87%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants