@teardown/react-native 2.0.16 → 2.0.18

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": "@teardown/react-native",
3
- "version": "2.0.16",
3
+ "version": "2.0.18",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -107,9 +107,15 @@ export class IdentityClient {
107
107
  }
108
108
  this.initialized = true;
109
109
 
110
- // Load state from storage first (for fallback if identify fails)
111
- this.identifyState = this.getIdentifyStateFromStorage();
112
- this.logger.debug(`Initialized with state: ${this.identifyState.type}`);
110
+ try {
111
+ // Load state from storage first (for fallback if identify fails)
112
+ this.identifyState = this.getIdentifyStateFromStorage();
113
+ this.logger.debug(`Initialized with state: ${this.identifyState.type}`);
114
+ } catch (error) {
115
+ // Silently fail on errors - we'll re-identify on app boot if needed
116
+ this.logger.debug("Error initializing IdentityClient", { error });
117
+ this.identifyState = { type: "unidentified" };
118
+ }
113
119
 
114
120
  // Always identify on app boot to refresh version status
115
121
  await this.identify();
@@ -2,8 +2,8 @@ import { ApiClient } from "./clients/api";
2
2
  import { DeviceClient, type DeviceClientOptions } from "./clients/device/device.client";
3
3
  import { ForceUpdateClient, type ForceUpdateClientOptions } from "./clients/force-update";
4
4
  import { IdentityClient } from "./clients/identity";
5
- import { LoggingClient, type LogLevel, type Logger } from "./clients/logging";
6
- import { StorageClient, type StorageAdapter } from "./clients/storage";
5
+ import { type Logger, LoggingClient, type LogLevel } from "./clients/logging";
6
+ import { type StorageAdapter, StorageClient } from "./clients/storage";
7
7
  import { UtilsClient } from "./clients/utils/utils.client";
8
8
 
9
9
  export type TeardownCoreOptions = {
@@ -51,30 +51,32 @@ export class TeardownCore {
51
51
  this.device = new DeviceClient(this.logging, this.utils, this.storage, {
52
52
  adapter: this.options.deviceAdapter,
53
53
  });
54
- this.identity = new IdentityClient(
55
- this.logging,
56
- this.utils,
57
- this.storage,
58
- this.api,
59
- this.device
60
- );
61
- this.forceUpdate = new ForceUpdateClient(this.logging, this.storage, this.identity, this.options.forceUpdate)
62
-
63
- void this.initialize().catch((error) => {
64
- this.logger.error("Error initializing TeardownCore", { error });
65
- }).then(() => {
66
- this.logger.debug("TeardownCore initialized");
67
- });
54
+ this.identity = new IdentityClient(this.logging, this.utils, this.storage, this.api, this.device);
55
+ this.forceUpdate = new ForceUpdateClient(this.logging, this.storage, this.identity, this.options.forceUpdate);
68
56
 
57
+ void this.initialize()
58
+ .catch((error) => {
59
+ this.logger.error("Error initializing TeardownCore", { error });
60
+ })
61
+ .then(() => {
62
+ this.logger.debug("TeardownCore initialized");
63
+ });
69
64
  }
70
65
 
71
66
  async initialize(): Promise<void> {
72
67
  // Wait for all storage hydration to complete
68
+ this.logger.debug("Waiting for storage to be ready");
73
69
  await this.storage.whenReady();
74
70
  // Initialize identity (loads from storage, then identifies if needed)
71
+ this.logger.debug("Initializing identity");
75
72
  await this.identity.initialize();
73
+ this.logger.debug("Identity initialized");
76
74
  // Then initialize force update (subscribes to identity events)
75
+ this.logger.debug("Initializing force update");
77
76
  this.forceUpdate.initialize();
77
+ this.logger.debug("Force update initialized");
78
+
79
+ this.logger.debug("TeardownCore initialized");
78
80
  }
79
81
 
80
82
  setLogLevel(level: LogLevel): void {