Skip to content

Conversation

brionmario
Copy link
Member

@brionmario brionmario commented Sep 18, 2025

Purpose

This pull request introduces notable improvements to theme handling, error management, and sign-in option flexibility across the codebase. The changes add a new getActiveTheme utility for consistent theme resolution, update button styling and props for sign-in options, and enhance error handling and accessibility in several components. Additionally, exports are refined for better clarity and usage.

Theme Handling Improvements

  • Added new getActiveTheme utility (packages/browser/src/theme/getActiveTheme.ts) to consistently determine the active theme mode based on user preference or system settings. This is now exported and used in both browser and Next.js packages for unified theme resolution. [1] [2] [3] [4]
  • Introduced and exported DEFAULT_THEME constant for theme mode defaults; updated theme color values for dark mode to improve visual consistency. [1] [2] [3] [4]
  • Refactored theme mode logic in AsgardeoProvider to use useMemo for determining dark mode, improving performance and reliability.

Sign-In Option Component Enhancements

  • Refactored createSignInOption and related props to make authenticator and onSubmit optional, and improved prop passing for federated and local authenticators for greater flexibility and type safety. [1] [2] [3]
  • Updated button styling and prop order for sign-in options (EmailOtp, IdentifierFirst, MultiOptionButton) to ensure consistent appearance and behavior. [1] [2] [3]
  • Corrected import paths for social sign-in buttons to resolve from the appropriate directory, improving maintainability.

Error Handling and Accessibility

  • Improved error reporting in SignInButton by stringifying error objects for clearer runtime messages.
  • Enhanced accessibility in BaseOrganizationSwitcher by setting initialFocus={-1} in FloatingFocusManager.
  • Added a catch block to handle promise rejections in AsgardeoSPAClient for better error propagation.

Export and API Surface Refinements

  • Refined exports in packages/javascript/src/index.ts for clarity, switching from wildcard to named exports for key client and model types.
  • Updated theme-related exports to include DEFAULT_THEME and improved type exports for better developer experience. [1] [2]

These updates collectively improve the consistency, reliability, and maintainability of theme management, sign-in flows, and error handling throughout the codebase.

Related Issues

Related PRs

  • N/A

Checklist

  • e2e cypress tests locally verified.
  • Manual test round performed and verified.
  • UX/UI review done on the final implementation.
  • Documentation provided. (Add links if there are any)
  • Unit tests provided. (Add links if there are any)
  • Integration tests provided. (Add links if there are any)

Security checks

- Updated EmailOtp, IdentifierFirst, MultiOptionButton, SmsOtp, Totp, and UsernamePassword components to ensure consistent button properties (fullWidth, color, variant).
- Removed redundant button properties from the components.
- Refactored SignInOptionFactory to improve the handling of authenticator components, ensuring proper passing of props.
- Deleted unused GoogleButton component from SignUp options and restructured imports.
- Added new social button components for Facebook, GitHub, Google, LinkedIn, Microsoft, and SignInWithEthereum.
- Implemented a new SocialButton component for handling social logins with external identity providers.
@brionmario brionmario changed the title chore(react): refactor sign-In and sign-up components chore(react): refactor SignIn and SignUp components Sep 18, 2025
@brionmario brionmario changed the title chore(react): refactor SignIn and SignUp components chore(react): improve components & error messages Sep 19, 2025
@brionmario brionmario merged commit 80ae17f into asgardeo:main Sep 19, 2025
2 of 4 checks passed
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.

2 participants