@bytem/bytem-tracker-app 0.0.13 → 0.0.16

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/README.md CHANGED
@@ -7,7 +7,7 @@ This is the official Bytem Tracker SDK for React Native applications.
7
7
  Install the package and its peer dependencies using Yarn:
8
8
 
9
9
  ```bash
10
- yarn add @bytem/bytem-tracker-app
10
+ yarn add @bytem/bytem-tracker-app react-native-device-info
11
11
  ```
12
12
 
13
13
  ### iOS Setup
@@ -29,7 +29,7 @@ const App = () => {
29
29
  useEffect(() => {
30
30
  const initTracker = async () => {
31
31
  await BytemTracker.init({
32
- appId: 'your-app-id',
32
+ appKey: 'your-app-key',
33
33
  endpoint: 'https://api.bytem.com/track',
34
34
  debug: __DEV__, // Enable debug logs in development
35
35
  });
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytem/bytem-tracker-app",
3
- "version": "0.0.13",
3
+ "version": "0.0.16",
4
4
  "description": "Bytem Tracker SDK for React Native",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -49,7 +49,7 @@ class BytemTracker {
49
49
  console.warn('[BytemTracker] Already initialized');
50
50
  return;
51
51
  }
52
- this.appKey = config.appId;
52
+ this.appKey = config.appKey;
53
53
  if (config.endpoint) {
54
54
  this.baseUrl = config.endpoint;
55
55
  }
@@ -1,2 +1,2 @@
1
1
  import { BaseParams } from '../types';
2
- export declare const buildBaseRequestParams: (appId: string, visitorId: string) => Promise<BaseParams>;
2
+ export declare const buildBaseRequestParams: (appKey: string, visitorId: string) => Promise<BaseParams>;
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildBaseRequestParams = void 0;
4
4
  const device_1 = require("./device");
5
5
  const session_1 = require("./session");
6
- const buildBaseRequestParams = async (appId, visitorId) => {
6
+ const buildBaseRequestParams = async (appKey, visitorId) => {
7
7
  const deviceInfo = await (0, device_1.getDeviceInfo)();
8
8
  const sessionInfo = (0, session_1.getSessionInfo)();
9
9
  return {
10
- app_id: appId,
10
+ app_key: appKey,
11
11
  device_id: visitorId,
12
12
  session_id: sessionInfo ? sessionInfo.sessionId : '',
13
13
  timestamp: Date.now(),
@@ -2,8 +2,8 @@
2
2
  * Configuration for initializing the BytemTracker.
3
3
  */
4
4
  export interface TrackerConfig {
5
- /** The unique application ID provided by Bytem. */
6
- appId: string;
5
+ /** The unique application Key provided by Bytem. */
6
+ appKey: string;
7
7
  /** Custom endpoint URL for tracking requests. */
8
8
  endpoint?: string;
9
9
  /** Custom path for the API endpoint (default: '/i'). */
@@ -47,7 +47,7 @@ export interface SessionInfo {
47
47
  startTime: number;
48
48
  }
49
49
  export interface BaseParams {
50
- app_id: string;
50
+ app_key: string;
51
51
  device_id: string;
52
52
  session_id: string;
53
53
  timestamp: number;
@@ -9,7 +9,7 @@ const async_storage_1 = __importDefault(require("@react-native-async-storage/asy
9
9
  const types_1 = require("../src/types");
10
10
  describe('BytemTracker SDK', () => {
11
11
  const mockConfig = {
12
- appId: 'test-app-id',
12
+ appKey: 'test-app-id',
13
13
  endpoint: 'https://api.example.com/track',
14
14
  debug: true,
15
15
  };
@@ -46,11 +46,11 @@ describe('BytemTracker SDK', () => {
46
46
  // Verify Storage was checked for Visitor ID
47
47
  expect(async_storage_1.default.getItem).toHaveBeenCalledWith(storage_1.StorageKeys.VISITOR_ID);
48
48
  // Verify Session was initialized (checks storage)
49
- expect(async_storage_1.default.getItem).toHaveBeenCalledWith(`${mockConfig.appId}/cly_session`);
49
+ expect(async_storage_1.default.getItem).toHaveBeenCalledWith(`${mockConfig.appKey}/cly_session`);
50
50
  });
51
51
  it('should use default endpoint when not provided', async () => {
52
52
  await BytemTracker_1.default.init({
53
- appId: 'test-app-id',
53
+ appKey: 'test-app-id',
54
54
  // endpoint is omitted
55
55
  debug: true,
56
56
  });
@@ -63,7 +63,7 @@ describe('BytemTracker SDK', () => {
63
63
  });
64
64
  it('should override endpoint path when path is configured', async () => {
65
65
  await BytemTracker_1.default.init({
66
- appId: 'test-app-id-2',
66
+ appKey: 'test-app-id-2',
67
67
  endpoint: 'https://api.example.com/track',
68
68
  path: '/collect',
69
69
  debug: true,
@@ -89,7 +89,7 @@ describe('BytemTracker SDK', () => {
89
89
  expect(eventCall).toBeDefined();
90
90
  const options = eventCall[1];
91
91
  const body = options.body;
92
- expect(body).toContain(`app_key=${mockConfig.appId}`);
92
+ expect(body).toContain(`app_key=${mockConfig.appKey}`);
93
93
  expect(body).toContain('events=%5B%7B%22key%22%3A%22test_event%22');
94
94
  });
95
95
  it('should track event with count and sum', async () => {
@@ -306,7 +306,7 @@ describe('BytemTracker SDK', () => {
306
306
  const info = await BytemTracker_1.default.getSystemInfo();
307
307
  expect(info.device_id).toBeDefined();
308
308
  expect(typeof info.device_id).toBe('string');
309
- expect(info.app_key).toBe(mockConfig.appId);
309
+ expect(info.app_key).toBe(mockConfig.appKey);
310
310
  });
311
311
  });
312
312
  });
@@ -7,7 +7,7 @@ const BytemTracker_1 = __importDefault(require("../src/BytemTracker"));
7
7
  const async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
8
8
  describe('Debug Scenarios', () => {
9
9
  const mockConfig = {
10
- appId: 'debug-app-id',
10
+ appKey: 'debug-app-id',
11
11
  endpoint: 'https://debug-api.bytem.com/track',
12
12
  debug: true,
13
13
  };
@@ -7,7 +7,7 @@ const BytemTracker_1 = __importDefault(require("../src/BytemTracker"));
7
7
  const async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
8
8
  describe('BytemTracker Network Error Resilience', () => {
9
9
  const mockConfig = {
10
- appId: 'test-app-id',
10
+ appKey: 'test-app-id',
11
11
  endpoint: 'https://api.example.com/track',
12
12
  debug: true,
13
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytem/bytem-tracker-app",
3
- "version": "0.0.13",
3
+ "version": "0.0.16",
4
4
  "description": "Bytem Tracker SDK for React Native",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",