@teardown/react-native 2.0.30 → 2.0.33

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/docs/logging.mdx CHANGED
@@ -54,17 +54,6 @@ The internal `Logger` class provides these methods:
54
54
  | `debug()` | verbose | `console.debug` |
55
55
  | `trace()` | verbose | `console.trace` |
56
56
 
57
- ### Debug Variants
58
-
59
- Additional debug methods for categorized output:
60
-
61
- ```typescript
62
- logger.debugError('Something went wrong', { error }); // Error: [prefix] ...
63
- logger.debugWarn('Warning message'); // Warning: [prefix] ...
64
- logger.debugInfo('Info message'); // Info: [prefix] ...
65
- logger.debugVerbose('Verbose details'); // Verbose: [prefix] ...
66
- ```
67
-
68
57
  ## Production Logging
69
58
 
70
59
  For production builds, set log level to `none` or `error`:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teardown/react-native",
3
- "version": "2.0.30",
3
+ "version": "2.0.33",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -52,9 +52,9 @@
52
52
  "prepublishOnly": "bun run build"
53
53
  },
54
54
  "dependencies": {
55
- "@teardown/ingest-api": "2.0.30",
56
- "@teardown/schemas": "2.0.30",
57
- "@teardown/types": "2.0.30",
55
+ "@teardown/ingest-api": "2.0.33",
56
+ "@teardown/schemas": "2.0.33",
57
+ "@teardown/types": "2.0.33",
58
58
  "eventemitter3": "^5.0.1",
59
59
  "react-native-get-random-values": "^2.0.0",
60
60
  "uuid": "^13.0.0",
@@ -64,7 +64,7 @@
64
64
  "@biomejs/biome": "2.3.10",
65
65
  "@elysiajs/eden": "1.4.5",
66
66
  "@react-native-firebase/messaging": "*",
67
- "@teardown/tsconfig": "2.0.30",
67
+ "@teardown/tsconfig": "2.0.33",
68
68
  "@types/bun": "1.3.5",
69
69
  "@types/react": "~19.1.0",
70
70
  "@types/uuid": "^11.0.0",
@@ -92,7 +92,7 @@ export class EventsClient {
92
92
  this.logger.debug(`Successfully tracked ${events.length} event(s)`);
93
93
  return { success: true, data: undefined };
94
94
  } catch (error) {
95
- this.logger.debugError("Error tracking events", { error });
95
+ this.logger.error("Error tracking events", { error });
96
96
  return {
97
97
  success: false,
98
98
  error: error instanceof Error ? error.message : "Unknown error",
@@ -180,7 +180,7 @@ export class ForceUpdateClient {
180
180
 
181
181
  return parsed;
182
182
  } catch (error) {
183
- this.logger.debugError("Error getting version status from storage", { error });
183
+ this.logger.error("Error getting version status from storage", { error });
184
184
  return InitializingVersionStatusSchema.parse({ type: "initializing" });
185
185
  }
186
186
  }
@@ -636,7 +636,7 @@ describe("IdentityClient", () => {
636
636
 
637
637
  // Should have debug logs about state transitions
638
638
  // When already identified, identify() will transition: identified -> identifying -> identified
639
- const debugLogs = mockLogging.getLogs().filter((l) => l.level === "debug" || l.level === "debugInfo");
639
+ const debugLogs = mockLogging.getLogs().filter((l) => l.level === "debug" || l.level === "info");
640
640
  expect(debugLogs.length).toBeGreaterThan(0);
641
641
  // Check that state transitions are logged
642
642
  expect(debugLogs.some((l) => l.message.includes("Identify state"))).toBe(true);
@@ -174,7 +174,7 @@ export class IdentityClient {
174
174
  this.logger.debug(`Initialized with state: ${this.identifyState.type}`);
175
175
  } catch (error) {
176
176
  // Silently fail on errors - we'll re-identify on app boot if needed
177
- this.logger.debugError("Error initializing IdentityClient", { error });
177
+ this.logger.error("Error initializing IdentityClient", { error });
178
178
  this.identifyState = { type: "unidentified" };
179
179
  }
180
180
 
@@ -187,17 +187,17 @@ export class IdentityClient {
187
187
  const stored = this.storage.getItem(IDENTIFY_STORAGE_KEY);
188
188
 
189
189
  if (stored == null) {
190
- this.logger.debugInfo("No stored identity state, returning unidentified");
190
+ this.logger.info("No stored identity state, returning unidentified");
191
191
  return UnidentifiedSessionStateSchema.parse({ type: "unidentified" });
192
192
  }
193
193
 
194
194
  const parsed = IdentifyStateSchema.parse(JSON.parse(stored));
195
- this.logger.debugInfo(`Parsed identity state from storage: ${parsed.type}`);
195
+ this.logger.info(`Parsed identity state from storage: ${parsed.type}`);
196
196
 
197
197
  // "identifying" is a transient state - if we restore it, treat as unidentified
198
198
  // This can happen if the app was killed during an identify call
199
199
  if (parsed.type === "identifying") {
200
- this.logger.debugInfo("Found stale 'identifying' state in storage, resetting to unidentified");
200
+ this.logger.info("Found stale 'identifying' state in storage, resetting to unidentified");
201
201
  // Clear the stale state from storage immediately
202
202
  this.storage.removeItem(IDENTIFY_STORAGE_KEY);
203
203
  return UnidentifiedSessionStateSchema.parse({ type: "unidentified" });
@@ -205,7 +205,7 @@ export class IdentityClient {
205
205
 
206
206
  return parsed;
207
207
  } catch (error) {
208
- this.logger.debugError("Error getting identify state from storage", { error });
208
+ this.logger.error("Error getting identify state from storage", { error });
209
209
  return { type: "unidentified" };
210
210
  }
211
211
  }
@@ -216,11 +216,11 @@ export class IdentityClient {
216
216
 
217
217
  private setIdentifyState(newState: IdentifyState): void {
218
218
  if (this.identifyState.type === newState.type) {
219
- this.logger.debugInfo(`Identify state already set: ${this.identifyState.type}`);
219
+ this.logger.info(`Identify state already set: ${this.identifyState.type}`);
220
220
  return;
221
221
  }
222
222
 
223
- this.logger.debugInfo(`Identify state: ${this.identifyState.type} -> ${newState.type}`);
223
+ this.logger.info(`Identify state: ${this.identifyState.type} -> ${newState.type}`);
224
224
  this.identifyState = newState;
225
225
  this.saveIdentifyStateToStorage(newState);
226
226
  this.emitter.emit("IDENTIFY_STATE_CHANGED", newState);
@@ -274,7 +274,7 @@ export class IdentityClient {
274
274
  * @returns AsyncResult indicating success/failure of the event send
275
275
  */
276
276
  async signOut(options?: SignOutOptions): AsyncResult<void> {
277
- this.logger.debugInfo("Signing out user");
277
+ this.logger.info("Signing out user");
278
278
 
279
279
  const session = this.getSessionState();
280
280
  const waitForEvent = options?.waitForEvent ?? true;
@@ -316,7 +316,7 @@ export class IdentityClient {
316
316
  * @returns AsyncResult indicating success/failure of the event send
317
317
  */
318
318
  async signOutAll(options?: SignOutOptions): AsyncResult<void> {
319
- this.logger.debugInfo("Signing out all - full reset");
319
+ this.logger.info("Signing out all - full reset");
320
320
 
321
321
  const session = this.getSessionState();
322
322
  const waitForEvent = options?.waitForEvent ?? true;
@@ -459,7 +459,7 @@ export class IdentityClient {
459
459
  }
460
460
 
461
461
  async identify(user?: Persona): AsyncResult<IdentityUser> {
462
- this.logger.debugInfo(`Identifying user with persona: ${user?.name ?? "none"}`);
462
+ this.logger.info(`Identifying user with persona: ${user?.name ?? "none"}`);
463
463
  const previousState = this.identifyState;
464
464
  this.setIdentifyState({ type: "identifying" });
465
465
 
@@ -493,7 +493,7 @@ export class IdentityClient {
493
493
  },
494
494
  });
495
495
 
496
- this.logger.debugInfo(`Identify API response received`);
496
+ this.logger.info(`Identify API response received`);
497
497
  if (response.error != null) {
498
498
  this.logger.warn("Identify API error", response.error.status, response.error.value);
499
499
  this.setIdentifyState(previousState);
@@ -57,10 +57,6 @@ export class Logger {
57
57
  warn: console.warn.bind(console),
58
58
  trace: console.trace.bind(console),
59
59
  debug: console.debug.bind(console),
60
- debugError: console.debug.bind(console, "Error: "),
61
- debugWarn: console.debug.bind(console, "Warning: "),
62
- debugInfo: console.debug.bind(console, "Info: "),
63
- debugVerbose: console.debug.bind(console, "Verbose: "),
64
60
  };
65
61
 
66
62
  constructor(private readonly options: LoggerOptions) {}
@@ -93,24 +89,4 @@ export class Logger {
93
89
  if (!this.options.loggingClient.shouldLog("verbose")) return;
94
90
  this.boundConsole.debug(`${this.prefix} ${message}`, ...args);
95
91
  }
96
-
97
- debugError(message: string, ...args: unknown[]) {
98
- if (!this.options.loggingClient.shouldLog("verbose")) return;
99
- this.boundConsole.debugError(`${this.prefix} ${message}`, ...args);
100
- }
101
-
102
- debugWarn(message: string, ...args: unknown[]) {
103
- if (!this.options.loggingClient.shouldLog("verbose")) return;
104
- this.boundConsole.debugWarn(`${this.prefix} ${message}`, ...args);
105
- }
106
-
107
- debugInfo(message: string, ...args: unknown[]) {
108
- if (!this.options.loggingClient.shouldLog("verbose")) return;
109
- this.boundConsole.debugInfo(`${this.prefix} ${message}`, ...args);
110
- }
111
-
112
- debugVerbose(message: string, ...args: unknown[]) {
113
- if (!this.options.loggingClient.shouldLog("verbose")) return;
114
- this.boundConsole.debugVerbose(`${this.prefix} ${message}`, ...args);
115
- }
116
92
  }
@@ -40,7 +40,6 @@ export class TeardownCore {
40
40
  this.options = options;
41
41
 
42
42
  this.logging = new LoggingClient();
43
- this.setLogLevel("verbose");
44
43
 
45
44
  this.logger = this.logging.createLogger({
46
45
  name: "TeardownCore",