@umituz/react-native-onboarding 2.3.0 → 2.4.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-onboarding",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Advanced onboarding flow for React Native apps with personalization questions, theme-aware colors, animations, and customizable slides. SOLID, DRY, KISS principles applied.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -44,11 +44,6 @@
44
44
  "react-native-safe-area-context": "^5.0.0",
45
45
  "zustand": "^5.0.0"
46
46
  },
47
- "peerDependenciesMeta": {
48
- "@umituz/react-native-device": {
49
- "optional": true
50
- }
51
- },
52
47
  "devDependencies": {
53
48
  "@types/react": "^18.2.45",
54
49
  "@types/react-native": "^0.73.0",
@@ -12,7 +12,6 @@ import {
12
12
  unwrap,
13
13
  } from "@umituz/react-native-storage";
14
14
  import type { OnboardingUserData } from "../../domain/entities/OnboardingUserData";
15
- import { OnboardingDeviceTrackingService } from "../services/OnboardingDeviceTrackingService";
16
15
 
17
16
  interface OnboardingStore {
18
17
  // State
@@ -24,7 +23,7 @@ interface OnboardingStore {
24
23
 
25
24
  // Actions
26
25
  initialize: (storageKey?: string) => Promise<void>;
27
- complete: (storageKey?: string, options?: { enableDeviceTracking?: boolean; userId?: string }) => Promise<void>;
26
+ complete: (storageKey?: string) => Promise<void>;
28
27
  skip: (storageKey?: string) => Promise<void>;
29
28
  setCurrentStep: (step: number) => void;
30
29
  reset: (storageKey?: string) => Promise<void>;
@@ -34,7 +33,6 @@ interface OnboardingStore {
34
33
  getAnswer: (questionId: string) => any;
35
34
  getUserData: () => OnboardingUserData;
36
35
  setUserData: (data: OnboardingUserData) => Promise<void>;
37
- collectDeviceInfo: (userId?: string) => Promise<void>;
38
36
  }
39
37
 
40
38
  const DEFAULT_STORAGE_KEY = StorageKey.ONBOARDING_COMPLETED;
@@ -69,7 +67,7 @@ export const useOnboardingStore = create<OnboardingStore>((set, get) => ({
69
67
  });
70
68
  },
71
69
 
72
- complete: async (storageKey = DEFAULT_STORAGE_KEY, options?: { enableDeviceTracking?: boolean; userId?: string }) => {
70
+ complete: async (storageKey = DEFAULT_STORAGE_KEY) => {
73
71
  set({ loading: true, error: null });
74
72
 
75
73
  const result = await storageRepository.setString(storageKey, "true");
@@ -78,11 +76,6 @@ export const useOnboardingStore = create<OnboardingStore>((set, get) => ({
78
76
  const userData = get().userData;
79
77
  userData.completedAt = new Date().toISOString();
80
78
 
81
- // Collect device info if enabled
82
- if (options?.enableDeviceTracking) {
83
- userData.deviceInfo = await OnboardingDeviceTrackingService.collectDeviceInfo(options.userId);
84
- }
85
-
86
79
  await storageRepository.setObject(USER_DATA_STORAGE_KEY, userData);
87
80
 
88
81
  set({
@@ -152,13 +145,6 @@ export const useOnboardingStore = create<OnboardingStore>((set, get) => ({
152
145
  await storageRepository.setObject(USER_DATA_STORAGE_KEY, data);
153
146
  set({ userData: data });
154
147
  },
155
-
156
- collectDeviceInfo: async (userId?: string) => {
157
- const userData = get().userData;
158
- userData.deviceInfo = await OnboardingDeviceTrackingService.collectDeviceInfo(userId);
159
- await storageRepository.setObject(USER_DATA_STORAGE_KEY, userData);
160
- set({ userData: { ...userData } });
161
- },
162
148
  }));
163
149
 
164
150
  /**
@@ -62,18 +62,6 @@ export interface OnboardingScreenProps extends OnboardingOptions {
62
62
  * When true, shows premium paywall before completing onboarding
63
63
  */
64
64
  showPaywallOnComplete?: boolean;
65
-
66
- /**
67
- * Enable device tracking (default: false)
68
- * When enabled, collects device information during onboarding
69
- */
70
- enableDeviceTracking?: boolean;
71
-
72
- /**
73
- * User ID for device tracking (optional)
74
- * Only used when enableDeviceTracking is true
75
- */
76
- userId?: string;
77
65
  }
78
66
 
79
67
  /**
@@ -100,8 +88,6 @@ export const OnboardingScreen: React.FC<OnboardingScreenProps> = ({
100
88
  renderSlide,
101
89
  onUpgrade,
102
90
  showPaywallOnComplete = false,
103
- enableDeviceTracking = false,
104
- userId,
105
91
  }) => {
106
92
  const insets = useSafeAreaInsets();
107
93
  const tokens = useAppDesignTokens();
@@ -126,7 +112,7 @@ export const OnboardingScreen: React.FC<OnboardingScreenProps> = ({
126
112
  } = useOnboardingNavigation(
127
113
  filteredSlides.length,
128
114
  async () => {
129
- await onboardingStore.complete(storageKey, { enableDeviceTracking, userId });
115
+ await onboardingStore.complete(storageKey);
130
116
  if (onComplete) {
131
117
  await onComplete();
132
118
  }
@@ -1,60 +0,0 @@
1
- /**
2
- * Onboarding Device Tracking Service
3
- *
4
- * Handles device information collection during onboarding
5
- * Single Responsibility: Device tracking only
6
- */
7
-
8
- import type { OnboardingUserData } from "../../domain/entities/OnboardingUserData";
9
-
10
- /**
11
- * Service for device tracking during onboarding
12
- * Optional feature - only used when enableDeviceTracking is true
13
- */
14
- export class OnboardingDeviceTrackingService {
15
- /**
16
- * Collect device information
17
- * @param userId - Optional user ID
18
- * @returns Device information object
19
- */
20
- static async collectDeviceInfo(userId?: string): Promise<OnboardingUserData['deviceInfo']> {
21
- try {
22
- // Dynamic import to avoid loading @umituz/react-native-device if not needed
23
- // @ts-expect-error - Optional peer dependency, may not be installed
24
- const { DeviceService } = await import('@umituz/react-native-device');
25
-
26
- const systemInfo = await DeviceService.getSystemInfo({ userId });
27
-
28
- return {
29
- deviceId: systemInfo.device.modelId || 'unknown',
30
- platform: systemInfo.device.platform,
31
- osVersion: systemInfo.device.osVersion || 'unknown',
32
- appVersion: systemInfo.application.nativeApplicationVersion || 'unknown',
33
- deviceName: systemInfo.device.deviceName || 'unknown',
34
- manufacturer: systemInfo.device.manufacturer || 'unknown',
35
- brand: systemInfo.device.brand || 'unknown',
36
- timestamp: systemInfo.timestamp,
37
- ...(userId && { userId }),
38
- };
39
- } catch (error) {
40
- /* eslint-disable-next-line no-console */
41
- if (__DEV__) console.warn('Failed to collect device info:', error);
42
- return undefined;
43
- }
44
- }
45
-
46
- /**
47
- * Check if device tracking is available
48
- * @returns True if @umituz/react-native-device is available
49
- */
50
- static async isDeviceTrackingAvailable(): Promise<boolean> {
51
- try {
52
- // @ts-expect-error - Optional peer dependency, may not be installed
53
- await import('@umituz/react-native-device');
54
- return true;
55
- } catch {
56
- return false;
57
- }
58
- }
59
- }
60
-