@koolbase/react-native 12.3.0 → 12.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/dist/cjs/index.js CHANGED
@@ -34,6 +34,8 @@ let _realtime = null;
34
34
  let _functions = null;
35
35
  let _flags = null;
36
36
  let _analytics = null;
37
+ // While analytics is off, calls are harmless no-ops rather than a crash.
38
+ const analyticsOff = (0, core_1.disabledAnalytics)();
37
39
  let _messaging = null;
38
40
  let _initialized = false;
39
41
  // The in-flight initialize, so overlapping callers await the same one.
@@ -75,7 +77,8 @@ exports.Koolbase = {
75
77
  const deviceId = await (0, core_1.getOrCreateDeviceId)();
76
78
  _flags = new core_1.KoolbaseFlags(config, deviceId);
77
79
  // Initialize analytics
78
- if (config.analyticsEnabled !== false) {
80
+ // Opt-in: nothing is sent unless the app asks for it.
81
+ if (config.analyticsEnabled === true) {
79
82
  _analytics = new core_1.KoolbaseAnalytics(config, () => _auth?.currentUser?.id ?? null);
80
83
  await _analytics.init(config.appVersion);
81
84
  }
@@ -137,7 +140,7 @@ exports.Koolbase = {
137
140
  },
138
141
  get analytics() {
139
142
  ensureInitialized();
140
- return _analytics;
143
+ return _analytics ?? analyticsOff;
141
144
  },
142
145
  get messaging() {
143
146
  ensureInitialized();
package/dist/esm/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  // React Native platform adapter and keychain-backed session storage.
7
7
  export * from '@koolbase/core';
8
8
  export { reactNativePlatform } from './platform.js';
9
- import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseFlags, KoolbaseAnalytics, KoolbaseMessaging, getOrCreateDeviceId, setPlatform, } from '@koolbase/core';
9
+ import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseFlags, KoolbaseAnalytics, disabledAnalytics, KoolbaseMessaging, getOrCreateDeviceId, setPlatform, } from '@koolbase/core';
10
10
  import { reactNativePlatform } from './platform.js';
11
11
  let _auth = null;
12
12
  let _db = null;
@@ -16,6 +16,8 @@ let _realtime = null;
16
16
  let _functions = null;
17
17
  let _flags = null;
18
18
  let _analytics = null;
19
+ // While analytics is off, calls are harmless no-ops rather than a crash.
20
+ const analyticsOff = disabledAnalytics();
19
21
  let _messaging = null;
20
22
  let _initialized = false;
21
23
  // The in-flight initialize, so overlapping callers await the same one.
@@ -57,7 +59,8 @@ export const Koolbase = {
57
59
  const deviceId = await getOrCreateDeviceId();
58
60
  _flags = new KoolbaseFlags(config, deviceId);
59
61
  // Initialize analytics
60
- if (config.analyticsEnabled !== false) {
62
+ // Opt-in: nothing is sent unless the app asks for it.
63
+ if (config.analyticsEnabled === true) {
61
64
  _analytics = new KoolbaseAnalytics(config, () => _auth?.currentUser?.id ?? null);
62
65
  await _analytics.init(config.appVersion);
63
66
  }
@@ -119,7 +122,7 @@ export const Koolbase = {
119
122
  },
120
123
  get analytics() {
121
124
  ensureInitialized();
122
- return _analytics;
125
+ return _analytics ?? analyticsOff;
123
126
  },
124
127
  get messaging() {
125
128
  ensureInitialized();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@koolbase/react-native",
3
- "version": "12.3.0",
4
- "description": "React Native SDK for Koolbase — auth, database, storage, realtime, feature flags, and functions in one package.",
3
+ "version": "12.4.0",
4
+ "description": "React Native SDK for Koolbase \u2014 auth, database, storage, realtime, feature flags, and functions in one package.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
7
7
  "files": [
@@ -24,7 +24,7 @@
24
24
  "url": "https://github.com/koolbase/koolbase-react-native"
25
25
  },
26
26
  "dependencies": {
27
- "@koolbase/core": "12.3.0"
27
+ "@koolbase/core": "12.4.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@react-native-async-storage/async-storage": "^3.0.2",