Skip to content

Conversation

@NicolasMassart
Copy link
Contributor

@NicolasMassart NicolasMassart commented Nov 6, 2025

Important

This is an unreleased package which will continue to be improved until ready for release.

Explanation

  • Added onSetupCompleted lifecycle hook for post-initialization setup

  • Added UUIDv4 validation for analyticsId

  • Added getter methods: getAnalyticsId(), isEnabled(), isOptedIn()

  • Added AnalyticsPlatformAdapterSetupError for setup failures

  • Made identify and view required in AnalyticsPlatformAdapter

  • Renamed controller method: trackPagetrackView for platform agnostic usage

  • Renamed adapter type method: trackEventtrack to better match Segment SDKs

  • Refactored identify: removed userId parameter, uses analyticsId from state, added AnalyticsUserTraits type

  • Updated action types for new methods and renames

  • Updated tests for new API and lifecycle hook

  • Updated README with lifecycle hook documentation

References

fixes #7079

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

- Add onSetupCompleted lifecycle hook to AnalyticsPlatformAdapter interface
- Remove add method from interface (breaking change)
- Change AnalyticsPlatformAdapter from type alias to interface
- Add UUIDv4 validation for analyticsId with error handling
- Add AnalyticsUserTraits type for better semantic separation
- Rename trackEvent to track and trackPage to view in adapter interface
- Update controller to call onSetupCompleted after initialization
- Add comprehensive tests for lifecycle hook and validation
- Update documentation with lifecycle hook usage examples
@NicolasMassart NicolasMassart self-assigned this Nov 6, 2025
@NicolasMassart NicolasMassart changed the title feat(analytics-controller): update controller and adapter interface for mobile integration feat(analytics-controller): update controller and adapter interface for mobile integration [Phase 1.4] Nov 7, 2025
…y method

- Add isOptedIn method and corresponding action type
- Refactor identify method to use analyticsId from state instead of userId parameter
- Update tests to use realistic traits (ENABLE_OPENSEA_API, NFT_AUTODETECTION) instead of email
- Update UUID test example from v1 to v5
- Remove obsolete tests
- Fix formatting issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(analytics-controller): update controller and adapter interface for mobile integration [Phase 1.4]

2 participants