@umituz/react-native-firebase 1.13.6 → 1.13.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/package.json +3 -4
  2. package/src/index.ts +2 -10
  3. package/src/infrastructure/config/FirebaseClient.ts +2 -19
  4. package/src/infrastructure/config/services/FirebaseServiceInitializer.ts +5 -20
  5. package/src/analytics/application/ports/IAnalyticsService.ts +0 -92
  6. package/src/analytics/index.ts +0 -20
  7. package/src/analytics/infrastructure/adapters/index.ts +0 -10
  8. package/src/analytics/infrastructure/adapters/native-analytics.adapter.ts +0 -63
  9. package/src/analytics/infrastructure/adapters/web-analytics.adapter.ts +0 -63
  10. package/src/analytics/infrastructure/services/FirebaseAnalyticsService.ts +0 -165
  11. package/src/analytics/infrastructure/services/PerformanceTracker.ts +0 -49
  12. package/src/analytics/infrastructure/services/analytics-event.service.ts +0 -72
  13. package/src/analytics/infrastructure/services/analytics-initializer.service.ts +0 -141
  14. package/src/analytics/infrastructure/services/analytics-user.service.ts +0 -98
  15. package/src/analytics/infrastructure/services/index.ts +0 -12
  16. package/src/analytics/presentation/decorators/PerformanceDecorator.ts +0 -73
  17. package/src/analytics/presentation/decorators/TrackingDecorator.ts +0 -38
  18. package/src/analytics/presentation/hooks/useNavigationAnalytics.ts +0 -118
  19. package/src/analytics/presentation/hooks/useNavigationTracking.ts +0 -62
  20. package/src/analytics/presentation/hooks/useScreenTime.ts +0 -69
  21. package/src/analytics/presentation/hooks/useScreenView.ts +0 -70
  22. package/src/analytics/presentation/utils/analyticsUtils.ts +0 -78
@@ -1,70 +0,0 @@
1
- /**
2
- * useScreenView Hook
3
- *
4
- * Comprehensive screen tracking hook that combines:
5
- * - Screen view tracking (when screen is focused)
6
- * - Screen time tracking (how long user stays on screen)
7
- * - Navigation tracking (from/to screen transitions)
8
- *
9
- * Platform-agnostic: Works on Web, iOS, and Android
10
- *
11
- * @example
12
- * ```typescript
13
- * import { useScreenView } from '@umituz/react-native-firebase-analytics';
14
- *
15
- * function MyScreen() {
16
- * useScreenView('home', 'HomeScreen');
17
- * // ... rest of component
18
- * }
19
- * ```
20
- */
21
-
22
- import { useCallback } from "react";
23
- import { useFocusEffect } from "@react-navigation/native";
24
- import { InteractionManager } from "react-native";
25
- import { firebaseAnalyticsService } from "../../infrastructure/services/FirebaseAnalyticsService";
26
- import { useScreenTime } from "./useScreenTime";
27
- import { useNavigationTracking } from "./useNavigationTracking";
28
-
29
- /**
30
- * Track screen view, time, and navigation when screen is focused
31
- * @param screenName - Screen name (e.g., 'home', 'decks', 'settings')
32
- * @param screenClass - Screen class name (e.g., 'HomeScreen', 'DecksScreen')
33
- */
34
- export function useScreenView(screenName: string, screenClass?: string): void {
35
- // Track screen time (how long user stays on screen)
36
- useScreenTime(screenName, screenClass);
37
-
38
- // Track navigation (from/to screen transitions)
39
- useNavigationTracking(screenName, screenClass);
40
-
41
- // Track screen view (when screen is focused)
42
- useFocusEffect(
43
- useCallback(() => {
44
- // Defer analytics until screen transition animation completes
45
- const task = InteractionManager.runAfterInteractions(() => {
46
- /* eslint-disable-next-line no-console */
47
- if (__DEV__) {
48
- console.log("📊 Screen view tracked:", {
49
- screen: screenName,
50
- screenClass: screenClass || screenName,
51
- });
52
- }
53
-
54
- firebaseAnalyticsService
55
- .logScreenView({
56
- screen_name: screenName,
57
- screen_class: screenClass || screenName,
58
- })
59
- .catch(() => {
60
- // Silent fail - analytics is non-critical
61
- });
62
- });
63
-
64
- return () => {
65
- task.cancel();
66
- };
67
- }, [screenName, screenClass]),
68
- );
69
- }
70
-
@@ -1,78 +0,0 @@
1
- /**
2
- * Analytics Utilities
3
- *
4
- * Helper functions for tracking user interactions and events.
5
- * Platform-agnostic: Works on Web, iOS, and Android
6
- */
7
-
8
- import { firebaseAnalyticsService } from "../../infrastructure/services/FirebaseAnalyticsService";
9
-
10
- /**
11
- * Track button click
12
- * @param buttonId - Unique button identifier (e.g., 'create_deck', 'delete_card')
13
- * @param options - Optional parameters
14
- */
15
- export function trackButtonClick(
16
- buttonId: string,
17
- options?: {
18
- buttonName?: string;
19
- screenName?: string;
20
- screenClass?: string;
21
- [key: string]: string | number | boolean | null | undefined;
22
- },
23
- ): void {
24
- const { buttonName, screenName, screenClass, ...additionalParams } =
25
- options || {};
26
-
27
- const params = {
28
- button_id: buttonId,
29
- button_name: buttonName || buttonId,
30
- screen_name: screenName || "unknown",
31
- screen_class: screenClass || screenName || "unknown",
32
- ...additionalParams,
33
- };
34
-
35
- /* eslint-disable-next-line no-console */
36
- if (__DEV__) {
37
- console.log("📊 Button click tracked:", {
38
- buttonId,
39
- buttonName: buttonName || buttonId,
40
- screenName: screenName || "unknown",
41
- ...additionalParams,
42
- });
43
- }
44
-
45
- firebaseAnalyticsService
46
- .logButtonClick(params)
47
- .catch(() => {
48
- // Silent fail - analytics is non-critical
49
- });
50
- }
51
-
52
- /**
53
- * Track CRUD operation
54
- * @param operation - Operation type ('create', 'update', 'delete', 'read')
55
- * @param entityType - Entity type ('deck', 'card', 'category', etc.)
56
- * @param entityId - Entity ID
57
- * @param additionalParams - Additional parameters to track
58
- */
59
- export function trackCRUDOperation(
60
- operation: "create" | "update" | "delete" | "read",
61
- entityType: string,
62
- entityId: string,
63
- additionalParams?: Record<string, string | number | boolean | null>,
64
- ): void {
65
- const eventName = `${entityType}_${operation}d`;
66
-
67
- firebaseAnalyticsService
68
- .logEvent(eventName, {
69
- [`${entityType}_id`]: entityId,
70
- operation,
71
- entity_type: entityType,
72
- ...additionalParams,
73
- })
74
- .catch(() => {
75
- // Silent fail - analytics is non-critical
76
- });
77
- }
78
-