@umituz/react-native-firebase 1.13.85 → 1.13.87

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-firebase",
3
- "version": "1.13.85",
3
+ "version": "1.13.87",
4
4
  "description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/index.ts CHANGED
@@ -100,3 +100,9 @@ export {
100
100
  export {
101
101
  getCurrentUserFromGlobal,
102
102
  } from './auth/infrastructure/services/auth-utils.service';
103
+
104
+ // Init Module Factory
105
+ export {
106
+ createFirebaseInitModule,
107
+ type FirebaseInitModuleConfig,
108
+ } from './init';
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Firebase Init Module Factory
3
+ * Creates a ready-to-use InitModule for app initialization
4
+ */
5
+
6
+ import { initializeAllFirebaseServices } from '../infrastructure/config/FirebaseClient';
7
+ import { initializeFirebaseAuth } from '../auth/infrastructure/config/FirebaseAuthClient';
8
+
9
+ declare const __DEV__: boolean;
10
+
11
+ /**
12
+ * InitModule interface (from @umituz/react-native-design-system)
13
+ */
14
+ export interface InitModule {
15
+ name: string;
16
+ init: () => Promise<boolean>;
17
+ critical?: boolean;
18
+ dependsOn?: string[];
19
+ }
20
+
21
+ export interface FirebaseInitModuleConfig {
22
+ /**
23
+ * Custom auth initializer function
24
+ * @default () => initializeFirebaseAuth()
25
+ */
26
+ authInitializer?: () => Promise<void>;
27
+
28
+ /**
29
+ * Whether this module is critical for app startup
30
+ * @default true
31
+ */
32
+ critical?: boolean;
33
+ }
34
+
35
+ /**
36
+ * Creates a Firebase initialization module for use with createAppInitializer
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * import { createAppInitializer } from "@umituz/react-native-design-system";
41
+ * import { createFirebaseInitModule } from "@umituz/react-native-firebase";
42
+ *
43
+ * export const initializeApp = createAppInitializer({
44
+ * modules: [
45
+ * createFirebaseInitModule(),
46
+ * // ... other modules
47
+ * ],
48
+ * });
49
+ * ```
50
+ */
51
+ export function createFirebaseInitModule(
52
+ config: FirebaseInitModuleConfig = {}
53
+ ): InitModule {
54
+ const { authInitializer, critical = true } = config;
55
+
56
+ return {
57
+ name: 'firebase',
58
+ critical,
59
+ init: async () => {
60
+ try {
61
+ await initializeAllFirebaseServices(undefined, {
62
+ authInitializer: authInitializer ?? (() => initializeFirebaseAuth()),
63
+ });
64
+
65
+ if (typeof __DEV__ !== 'undefined' && __DEV__) {
66
+ console.log('[createFirebaseInitModule] Firebase initialized');
67
+ }
68
+
69
+ return true;
70
+ } catch (error) {
71
+ if (typeof __DEV__ !== 'undefined' && __DEV__) {
72
+ console.error('[createFirebaseInitModule] Error:', error);
73
+ }
74
+ // Return false to indicate failure, let the app initializer handle it
75
+ return false;
76
+ }
77
+ },
78
+ };
79
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Firebase Init Module
3
+ * Provides factory for creating app initialization modules
4
+ */
5
+
6
+ export {
7
+ createFirebaseInitModule,
8
+ type FirebaseInitModuleConfig,
9
+ type InitModule,
10
+ } from './createFirebaseInitModule';