Skip to content

Commit a717ec3

Browse files
authored
Merge pull request #303 from brionmario/refactor-thunder-flows
Gracefully handle missing component mappings
2 parents 15e7102 + d89a096 commit a717ec3

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

.changeset/rich-forks-tickle.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@asgardeo/javascript': patch
3+
'@asgardeo/react': patch
4+
---
5+
6+
Fix component type issues

packages/javascript/src/models/v2/embedded-flow-v2.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ export enum EmbeddedFlowComponentType {
4747
/** Email input field with validation for email addresses. */
4848
EmailInput = 'EMAIL_INPUT',
4949

50+
/** One-time password input field for multi-factor authentication */
51+
OtpInput = 'OTP_INPUT',
52+
53+
/** Phone number input field with country code support */
54+
PhoneInput = 'PHONE_INPUT',
55+
5056
/** Text display component for labels, headings, and messages */
5157
Text = 'TEXT',
5258

packages/react/src/components/presentation/auth/AuthOptionFactory.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,9 @@ const createAuthComponentFromFlow = (
265265
}
266266

267267
default:
268-
throw new AsgardeoRuntimeError(
269-
`Unsupported component type: ${component.type}`,
270-
`${authType === 'signin' ? 'SignIn' : 'SignUp'}-UnsupportedComponentType-001`,
271-
'react',
272-
`Something went wrong while rendering the ${authType} component. Please try again later.`,
273-
);
268+
// Gracefully handle unsupported component types by returning null
269+
console.warn(`Unsupported component type: ${component.type}. Skipping render.`);
270+
return null;
274271
}
275272
};
276273

0 commit comments

Comments
 (0)