humanbehavior-js 0.3.5 → 0.3.6

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.
@@ -199,8 +199,7 @@ declare class HumanBehaviorTracker {
199
199
  * Add user identification information to the tracker
200
200
  * If userId is not provided, will use userProperties.email as the userId (if present)
201
201
  */
202
- identifyUser({ userId, userProperties }: {
203
- userId?: string;
202
+ identifyUser({ userProperties }: {
204
203
  userProperties: Record<string, any>;
205
204
  }): Promise<string>;
206
205
  /**
@@ -20,8 +20,7 @@ declare const useRedaction: () => {
20
20
  getRedactedFields: () => string[];
21
21
  };
22
22
  declare const useUserTracking: () => {
23
- identifyUser: ({ userId, userProperties }: {
24
- userId?: string;
23
+ identifyUser: ({ userProperties }: {
25
24
  userProperties: Record<string, any>;
26
25
  }) => Promise<{
27
26
  success: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "humanbehavior-js",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "SDK for HumanBehavior session and event recording",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -8,7 +8,7 @@ const isBrowser = () => typeof window !== 'undefined';
8
8
  // Define the public interface that components will interact with
9
9
  interface HumanBehaviorInterface {
10
10
  addEvent: (event: any) => void;
11
- identifyUser: ({ userId, userProperties }: { userId?: string, userProperties: Record<string, any> }) => Promise<string>;
11
+ identifyUser: ({ userProperties }: { userProperties: Record<string, any> }) => Promise<string>;
12
12
  start: () => void;
13
13
  stop: () => void;
14
14
  logout: () => void;
@@ -136,7 +136,7 @@ export const HumanBehaviorProvider = ({ apiKey, client, children, options }: Hum
136
136
  if (event.type === 'identify') {
137
137
  logDebug('Processing queued identify event', event);
138
138
  try {
139
- await tracker.identifyUser({ userId: event.userId, userProperties: event.userProperties });
139
+ await tracker.identifyUser({ userProperties: event.userProperties });
140
140
  } catch (error) {
141
141
  logError('Failed to process queued user info:', error);
142
142
  }
@@ -180,8 +180,8 @@ export const HumanBehaviorProvider = ({ apiKey, client, children, options }: Hum
180
180
  // Default implementation for when tracker is not available
181
181
  const defaultImplementation: HumanBehaviorInterface = {
182
182
  addEvent: () => {},
183
- identifyUser: async ({ userId, userProperties }: { userId?: string, userProperties: Record<string, any> }) => {
184
- return userId || '';
183
+ identifyUser: async ({ userProperties }: { userProperties: Record<string, any> }) => {
184
+ return '';
185
185
  },
186
186
  start: () => {},
187
187
  stop: () => {},
@@ -194,13 +194,12 @@ const createQueuingImplementation = (queueEvent: (event: any) => void): HumanBeh
194
194
  addEvent: (event: any) => {
195
195
  queueEvent(event);
196
196
  },
197
- identifyUser: async ({ userId, userProperties }: { userId?: string, userProperties: Record<string, any> }) => {
197
+ identifyUser: async ({ userProperties }: { userProperties: Record<string, any> }) => {
198
198
  queueEvent({
199
199
  type: 'identify',
200
- userId,
201
200
  userProperties,
202
201
  });
203
- return userId || ''; // Return userId or empty string to match interface
202
+ return ''; // Return empty string to match interface
204
203
  },
205
204
  start: () => {
206
205
  // Start will be called automatically when initialized
@@ -251,9 +250,9 @@ export const useRedaction = () => {
251
250
  export const useUserTracking = () => {
252
251
  const tracker = useHumanBehavior();
253
252
 
254
- const identifyUser = useCallback(async ({ userId, userProperties }: { userId?: string, userProperties: Record<string, any> }) => {
253
+ const identifyUser = useCallback(async ({ userProperties }: { userProperties: Record<string, any> }) => {
255
254
  try {
256
- await tracker.identifyUser({ userId, userProperties });
255
+ await tracker.identifyUser({ userProperties });
257
256
  return { success: true };
258
257
  } catch (error) {
259
258
  logError('Failed to identify user:', error);
package/src/tracker.ts CHANGED
@@ -718,7 +718,7 @@ export class HumanBehaviorTracker {
718
718
  * If userId is not provided, will use userProperties.email as the userId (if present)
719
719
  */
720
720
  public async identifyUser(
721
- { userId, userProperties }: { userId?: string, userProperties: Record<string, any> }
721
+ { userProperties }: { userProperties: Record<string, any> }
722
722
  ): Promise<string> {
723
723
  await this.ensureInitialized();
724
724