Skip to content

Conversation

brionmario
Copy link
Member

@brionmario brionmario commented Jul 11, 2025

Purpose

This pull request introduces several enhancements and refactorings across multiple files in the project. Key changes include adding optional storage support in client initialization, refactoring the logging system to use string-based log levels, updating the build configuration for better modularity, and improving error handling and logging in the Next.js client.

Enhancements to client initialization:

  • Updated the initialize method in AsgardeoJavaScriptClient and AsgardeoNextClient to accept an optional Storage parameter for better data persistence. ([[1]](https://github.com/asgardeo/javascript/pull/106/files#diff-1de99ccf9a6555feff096d35ba4d4626b4d42ce6da23d9b9ed996bb3f65e1bcbL37-R38), [[2]](https://github.com/asgardeo/javascript/pull/106/files#diff-47d1628f385e7a95ba078012412f6b43a3af85373b276c74b1a7f620f89d8581R91-R94), [[3]](https://github.com/asgardeo/javascript/pull/106/files#diff-6dd1988c5d19f9da1aad558bd53b5424d32b61a9e3a26456e3db82aa18cc384cL102-R103), [[4]](https://github.com/asgardeo/javascript/pull/106/files#diff-6dd1988c5d19f9da1aad558bd53b5424d32b61a9e3a26456e3db82aa18cc384cL140-R144))

Refactoring of logging system:

  • Replaced the LogLevel enum with string-based log levels ('debug', 'info', 'warn', 'error') for simplicity and consistency. ([packages/javascript/src/utils/logger.tsL22-R22](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL22-R22))
  • Updated all references to log levels in Logger methods and configuration to use the new string-based format. ([[1]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL52-R46), [[2]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL143-R143), [[3]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL178-R181), [[4]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL251-R254), [[5]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL275-R278), [[6]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL300-R303), [[7]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL321-R336), [[8]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL414-R408))

Build configuration updates:

  • Modified the Next.js package build script to generate separate CommonJS and ES modules, and added support for server-specific entry points. ([[1]](https://github.com/asgardeo/javascript/pull/106/files#diff-9b3cb413bdb66a14a059f23f28f0c80e103a2e9f3db9bd4b41cf0c74760d51beL23-R38), [[2]](https://github.com/asgardeo/javascript/pull/106/files#diff-e5237f683dda3354b835c7c7c94b9759db2c743d4ba94d47d7f8b8e0b2bfb442L18-R30), [[3]](https://github.com/asgardeo/javascript/pull/106/files#diff-e5237f683dda3354b835c7c7c94b9759db2c743d4ba94d47d7f8b8e0b2bfb442L39-R45))

Improvements in error handling and logging:

  • Added debug and error logs in SignOutButton and AsgardeoClientProvider to improve traceability during sign-out operations. ([[1]](https://github.com/asgardeo/javascript/pull/106/files#diff-7d41802bc94382af01f812891286ad0a2e15bb4cb743536d3456f462d71186fbR61-R77), [[2]](https://github.com/asgardeo/javascript/pull/106/files#diff-0abb0e8335a4c28dd6a42d47ce2048fcc129577d530a5e071c2443e597fc1204R252-R277))
  • Replaced runtime errors in SignOutButton with logger-based error reporting for better debugging. ([packages/nextjs/src/client/components/actions/SignOutButton/SignOutButton.tsxR61-R77](https://github.com/asgardeo/javascript/pull/106/files#diff-7d41802bc94382af01f812891286ad0a2e15bb4cb743536d3456f462d71186fbR61-R77))

Miscellaneous updates:

  • Enhanced the getAccessToken method in AsgardeoNextClient to handle session cookies and provide detailed runtime error information when token retrieval fails. ([packages/nextjs/src/AsgardeoNextClient.tsL380-R410](https://github.com/asgardeo/javascript/pull/106/files#diff-6dd1988c5d19f9da1aad558bd53b5424d32b61a9e3a26456e3db82aa18cc384cL380-R410))

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

@brionmario brionmario changed the title [Draft] User Components fix(nextjs): fix getAccessToken imperative usage Jul 14, 2025
@brionmario brionmario merged commit 48e7eff into asgardeo:main Jul 14, 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