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

Fix for required flowSteps if workflowRunId exists. #159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LeeviKopakkala
Copy link

@LeeviKopakkala LeeviKopakkala commented Feb 22, 2024

Description

If workflowRunId exists (and is not undefined), flowSteps will be completely ignored.
In the workflow documentation, the config is passed without flowSteps but in the current type, it's always required.

Link to documentation: https://developers.onfido.com/guide/studio-react-native-sdk-integration#start-here

Fix and what has changed.

Use conditional typing.

export type OnfidoConfig = {
  sdkToken: string;
  hideLogo?: boolean;
  logoCoBrand?: boolean;
  disableNFC?: boolean;
  disableMobileSdkAnalytics?: boolean;
  localisation?: {
    ios_strings_file_name?: string;
  };
  theme: OnfidoTheme;
} & (
  | { workflowRunId: undefined; flowSteps: OnfidoFlowSteps }
  | { workflowRunId: string; flowSteps?: OnfidoFlowSteps } // Note! flowSteps is now optional because it allows the configuration to be used as a fallback incase workflowRunId is undefined by mistake.
);
``

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.

1 participant