@bytem/bytem-tracker-app 0.0.10 → 0.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytem/bytem-tracker-app",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Bytem Tracker SDK for React Native",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -134,6 +134,23 @@ declare class BytemTracker {
134
134
  */
135
135
  trackUser(userId: string, traits?: UserTraits): Promise<void>;
136
136
  private sendUserDetails;
137
+ /**
138
+ * Clears the current user info and resets visitor ID.
139
+ */
140
+ clearUser(): Promise<void>;
141
+ /**
142
+ * Sets a custom API path for subsequent requests.
143
+ * @param path - The new API path (e.g., '/api/track').
144
+ */
145
+ setPath(path: string): void;
146
+ /**
147
+ * Resets the API path to the default value.
148
+ */
149
+ resetPath(): void;
150
+ /**
151
+ * Retrieves system/device information.
152
+ */
153
+ getSystemInfo(): Promise<Record<string, any>>;
137
154
  }
138
155
  declare const _default: BytemTracker;
139
156
  export default _default;
@@ -571,5 +571,56 @@ class BytemTracker {
571
571
  body['user_details'] = JSON.stringify(userData);
572
572
  await this.sendRequest(this.apiPath, body, 'User Details');
573
573
  }
574
+ /**
575
+ * Clears the current user info and resets visitor ID.
576
+ */
577
+ async clearUser() {
578
+ this.ensureInitialized();
579
+ // Clear visitor ID from storage
580
+ await (0, storage_1.removeItem)(storage_1.StorageKeys.VISITOR_ID);
581
+ // Generate new visitor ID
582
+ this.visitorId = (0, device_1.generateUUID)();
583
+ await (0, storage_1.setItem)(storage_1.StorageKeys.VISITOR_ID, this.visitorId);
584
+ if (this.debug)
585
+ console.log(`[BytemTracker] User cleared, new visitor ID: ${this.visitorId}`);
586
+ }
587
+ /**
588
+ * Sets a custom API path for subsequent requests.
589
+ * @param path - The new API path (e.g., '/api/track').
590
+ */
591
+ setPath(path) {
592
+ this.apiPath = path.startsWith('/') ? path : '/' + path;
593
+ if (this.debug)
594
+ console.log(`[BytemTracker] API path set to: ${this.apiPath}`);
595
+ }
596
+ /**
597
+ * Resets the API path to the default value.
598
+ */
599
+ resetPath() {
600
+ this.apiPath = this.DEFAULT_API_PATH;
601
+ if (this.debug)
602
+ console.log(`[BytemTracker] API path reset to default: ${this.apiPath}`);
603
+ }
604
+ /**
605
+ * Retrieves system/device information.
606
+ */
607
+ async getSystemInfo() {
608
+ const info = await (0, device_1.getDeviceInfo)();
609
+ return {
610
+ platform: info.platform,
611
+ os: info.os,
612
+ os_version: info.osVersion,
613
+ model: info.model,
614
+ resolution: `${Math.round(info.screenWidth)}x${Math.round(info.screenHeight)}`,
615
+ language: info.language,
616
+ user_agent: info.userAgent,
617
+ sdk_version: this.SDK_VERSION,
618
+ app_key: this.appKey,
619
+ visitor_id: this.visitorId,
620
+ device_id_type: this.deviceIdType,
621
+ api_path: this.apiPath,
622
+ base_url: this.baseUrl,
623
+ };
624
+ }
574
625
  }
575
626
  exports.default = BytemTracker.getInstance();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytem/bytem-tracker-app",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Bytem Tracker SDK for React Native",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",