humanbehavior-js 0.2.2 → 0.2.3
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/cjs/index.js +14 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +14 -22
- package/dist/esm/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/types/index.d.ts +5 -6
- package/package.json +1 -1
- package/src/tracker.ts +15 -22
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/.tsbuildinfo +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/api.js +0 -312
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/api.js.map +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/index.js +0 -19
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/index.js.map +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/react/index.js +0 -222
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/react/index.js.map +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/redact.js +0 -416
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/redact.js.map +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/tracker.js +0 -950
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/tracker.js.map +0 -1
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/utils/logger.js +0 -117
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/utils/logger.js.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -5478,34 +5478,26 @@ class HumanBehaviorTracker {
|
|
|
5478
5478
|
logError('Failed to read logs:', e);
|
|
5479
5479
|
}
|
|
5480
5480
|
}
|
|
5481
|
-
addUserInfo(_a) {
|
|
5482
|
-
return __awaiter$1(this, arguments, void 0, function* ({ userId, userProperties }) {
|
|
5483
|
-
yield this.ensureInitialized();
|
|
5484
|
-
if (!this.endUserId) {
|
|
5485
|
-
throw new Error('Cannot add user info before tracker initialization');
|
|
5486
|
-
}
|
|
5487
|
-
this.userProperties = userProperties;
|
|
5488
|
-
yield this.api.sendUserData(this.endUserId, userProperties, this.sessionId);
|
|
5489
|
-
if (userId) {
|
|
5490
|
-
this.endUserId = userId;
|
|
5491
|
-
}
|
|
5492
|
-
});
|
|
5493
|
-
}
|
|
5494
5481
|
/**
|
|
5495
5482
|
* Add user identification information to the tracker
|
|
5496
|
-
*
|
|
5483
|
+
* If userId is not provided, will use userProperties.email as the userId (if present)
|
|
5497
5484
|
*/
|
|
5498
|
-
|
|
5499
|
-
return __awaiter$1(this,
|
|
5485
|
+
addUserInfo(_a) {
|
|
5486
|
+
return __awaiter$1(this, arguments, void 0, function* ({ userId, userProperties }) {
|
|
5500
5487
|
yield this.ensureInitialized();
|
|
5501
|
-
|
|
5502
|
-
|
|
5488
|
+
// Determine the userId to use
|
|
5489
|
+
const resolvedUserId = userId || userProperties.email;
|
|
5490
|
+
if (!resolvedUserId) {
|
|
5491
|
+
return this.endUserId || '';
|
|
5503
5492
|
}
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5493
|
+
this.userProperties = userProperties;
|
|
5494
|
+
yield this.api.sendUserData(resolvedUserId, userProperties, this.sessionId);
|
|
5495
|
+
// Update endUserId and cookie if changed
|
|
5496
|
+
if (resolvedUserId !== this.endUserId) {
|
|
5497
|
+
this.endUserId = resolvedUserId;
|
|
5498
|
+
this.setCookie(`human_behavior_end_user_id_${this.apiKey}`, resolvedUserId, 365);
|
|
5508
5499
|
}
|
|
5500
|
+
return this.endUserId || '';
|
|
5509
5501
|
});
|
|
5510
5502
|
}
|
|
5511
5503
|
start() {
|