Skip to content

Comments

v0.3.11#71

Merged
roncodes merged 11 commits intomainfrom
dev-v0.3.11
Feb 11, 2026
Merged

v0.3.11#71
roncodes merged 11 commits intomainfrom
dev-v0.3.11

Conversation

@roncodes
Copy link
Member

No description provided.

roncodes and others added 11 commits January 16, 2026 14:48
- Add analytics event triggering to crud service (delete, bulk actions, import)
- Add analytics event triggering to resource-action service (create, update, delete)
- Add session analytics events (initialized, terminated with duration)
- Emit both generic (resource.created) and specific (order.created) events
- Use dot notation naming convention for all events
- Non-breaking changes, events are optional and don't affect existing functionality
- Add resource.exported and {model}.exported events to crud service export method
- Remove incorrect session tracking from session service (was in wrong place)
- Session events should be tracked via current-user service's existing 'user.loaded' event
- Current-user service already extends Evented and triggers 'user.loaded' on lines 72 and 99

The current-user service is the proper place for user/session lifecycle events since it:
1. Already extends Evented mixin
2. Already triggers 'user.loaded' event when user is authenticated
3. Is called by session.loadCurrentUser() and session.promiseCurrentUser()
4. Has access to user and organization data

For logout/session termination tracking, consumers should subscribe to ember-simple-auth's
'invalidationSucceeded' event or add a 'user.logout' event to current-user service.
- Created centralized analytics service for event tracking
- Refactored crud, resource-action, and current-user services to use analytics service
- Removed scattered _triggerResourceEvent() methods
- Added global service exports via host-services and services
- Implemented private methods using native # syntax
- Added comprehensive documentation in ANALYTICS_SERVICE.md

Benefits:
- Single responsibility: One service handles all analytics
- Reusable: Any engine can inject and use it
- Consistent API: Standardized methods for tracking
- Cleaner services: CRUD/resource-action stay focused
- Better testability: Can mock/stub analytics service easily
- Analytics service now extends Evented
- Events fire on both analytics service and universe service
- Allows local listeners (analytics.on) and cross-engine listeners (universe.on)
- Updated documentation with dual event system examples
- Follows Fleetbase patterns (like current-user service)

Benefits:
- Local listeners for UI updates and debugging
- Cross-engine listeners for analytics integrations
- More flexible event subscription options
- Renamed service from 'analytics' to 'events' for better clarity
- Updated class name from AnalyticsService to EventsService
- Updated all service injections (@service events)
- Updated all method calls (this.events.*)
- Updated configuration namespace (config.events)
- Renamed documentation file to EVENTS_SERVICE.md
- Updated global exports in host-services and services

Rationale:
- 'events' is more accurate - it's an event emitter
- More generic and flexible - not limited to analytics use cases
- Can be used for analytics, logging, UI updates, webhooks, etc.
- Clearer purpose and intent
feat: Add universe-based analytics events to core services
@roncodes roncodes merged commit c0c1941 into main Feb 11, 2026
6 checks passed
@roncodes roncodes deleted the dev-v0.3.11 branch February 11, 2026 10:53
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