@umituz/react-native-onboarding 2.2.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/README.md CHANGED
@@ -185,6 +185,8 @@ const slides: OnboardingSlide[] = [
185
185
  | `showProgressText` | `boolean` | `true` | Show progress text (1 of 5) |
186
186
  | `storageKey` | `string` | - | Custom storage key for completion state |
187
187
  | `autoComplete` | `boolean` | `false` | Auto-complete on last slide |
188
+ | `enableDeviceTracking` | `boolean` | `false` | Collect device info during onboarding |
189
+ | `userId` | `string` | - | User ID for device tracking (optional) |
188
190
 
189
191
  ### OnboardingSlide Interface
190
192
 
@@ -328,6 +330,69 @@ const isComplete = userData.completedAt !== undefined;
328
330
 
329
331
  // Check if onboarding was skipped
330
332
  const wasSkipped = userData.skipped === true;
333
+
334
+ // Get device info (if device tracking was enabled)
335
+ const deviceInfo = userData.deviceInfo;
336
+ ```
337
+
338
+ ## 📱 Device Tracking (Optional)
339
+
340
+ Collect device information during onboarding for analytics or support purposes.
341
+
342
+ ### Installation
343
+
344
+ First, install the device tracking package:
345
+
346
+ ```bash
347
+ npm install @umituz/react-native-device
348
+ ```
349
+
350
+ ### Usage
351
+
352
+ ```tsx
353
+ import { OnboardingScreen } from '@umituz/react-native-onboarding';
354
+
355
+ <OnboardingScreen
356
+ slides={slides}
357
+ enableDeviceTracking={true}
358
+ userId="user123" // Optional
359
+ onComplete={async () => {
360
+ const userData = onboardingStore.getUserData();
361
+
362
+ // Device info is now available
363
+ console.log('Device:', userData.deviceInfo?.platform);
364
+ console.log('OS:', userData.deviceInfo?.osVersion);
365
+ console.log('App:', userData.deviceInfo?.appVersion);
366
+ }}
367
+ />
368
+ ```
369
+
370
+ ### Device Info Structure
371
+
372
+ ```typescript
373
+ {
374
+ deviceId: string;
375
+ platform: 'ios' | 'android' | 'web';
376
+ osVersion: string;
377
+ appVersion: string;
378
+ deviceName: string;
379
+ manufacturer: string;
380
+ brand: string;
381
+ timestamp: number;
382
+ userId?: string; // If provided
383
+ }
384
+ ```
385
+
386
+ ### Manual Device Info Collection
387
+
388
+ ```tsx
389
+ import { OnboardingDeviceTrackingService } from '@umituz/react-native-onboarding';
390
+
391
+ // Collect device info manually
392
+ const deviceInfo = await OnboardingDeviceTrackingService.collectDeviceInfo('user123');
393
+
394
+ // Check if device tracking is available
395
+ const isAvailable = await OnboardingDeviceTrackingService.isDeviceTrackingAvailable();
331
396
  ```
332
397
 
333
398
  ## 🔄 Resetting Onboarding
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-onboarding",
3
- "version": "2.2.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",
@@ -85,5 +85,17 @@ export interface OnboardingOptions {
85
85
  * Show paywall modal on onboarding completion (default: false)
86
86
  */
87
87
  showPaywallOnComplete?: boolean;
88
+
89
+ /**
90
+ * Enable device tracking (default: false)
91
+ * When enabled, collects device information during onboarding
92
+ */
93
+ enableDeviceTracking?: boolean;
94
+
95
+ /**
96
+ * User ID for device tracking (optional)
97
+ * Only used when enableDeviceTracking is true
98
+ */
99
+ userId?: string;
88
100
  }
89
101
 
@@ -39,5 +39,17 @@ export interface OnboardingUserData {
39
39
  gender?: string;
40
40
  [key: string]: any;
41
41
  };
42
+
43
+ /**
44
+ * Device information (optional)
45
+ * Only collected when enableDeviceTracking is true
46
+ */
47
+ deviceInfo?: {
48
+ deviceId?: string;
49
+ platform?: string;
50
+ osVersion?: string;
51
+ appVersion?: string;
52
+ [key: string]: any;
53
+ };
42
54
  }
43
55
 
package/src/index.ts CHANGED
@@ -52,6 +52,7 @@ export {
52
52
  useOnboardingNavigation,
53
53
  type UseOnboardingNavigationReturn,
54
54
  } from "./infrastructure/hooks/useOnboardingNavigation";
55
+ export { OnboardingDeviceTrackingService } from "./infrastructure/services/OnboardingDeviceTrackingService";
55
56
 
56
57
  // =============================================================================
57
58
  // PRESENTATION LAYER - Components and Screens
@@ -75,6 +75,7 @@ export const useOnboardingStore = create<OnboardingStore>((set, get) => ({
75
75
  // Update user data with completion timestamp
76
76
  const userData = get().userData;
77
77
  userData.completedAt = new Date().toISOString();
78
+
78
79
  await storageRepository.setObject(USER_DATA_STORAGE_KEY, userData);
79
80
 
80
81
  set({
@@ -217,16 +217,18 @@ export const OnboardingScreen: React.FC<OnboardingScreenProps> = ({
217
217
  useGradient={useGradient}
218
218
  />
219
219
  )}
220
- {renderSlide ? (
221
- renderSlide(currentSlide)
222
- ) : currentSlide.type === "question" && currentSlide.question ? (
223
- <QuestionSlide
224
- slide={currentSlide}
225
- value={currentAnswer}
226
- onChange={setCurrentAnswer}
227
- />
228
- ) : (
229
- <OnboardingSlideComponent slide={currentSlide} />
220
+ {currentSlide && (
221
+ renderSlide ? (
222
+ renderSlide(currentSlide)
223
+ ) : currentSlide.type === "question" && currentSlide.question ? (
224
+ <QuestionSlide
225
+ slide={currentSlide}
226
+ value={currentAnswer}
227
+ onChange={setCurrentAnswer}
228
+ />
229
+ ) : (
230
+ <OnboardingSlideComponent slide={currentSlide} />
231
+ )
230
232
  )}
231
233
  {renderFooter ? (
232
234
  renderFooter({