Skip to content

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