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/esm/index.js
CHANGED
|
@@ -5474,34 +5474,26 @@ class HumanBehaviorTracker {
|
|
|
5474
5474
|
logError('Failed to read logs:', e);
|
|
5475
5475
|
}
|
|
5476
5476
|
}
|
|
5477
|
-
addUserInfo(_a) {
|
|
5478
|
-
return __awaiter$1(this, arguments, void 0, function* ({ userId, userProperties }) {
|
|
5479
|
-
yield this.ensureInitialized();
|
|
5480
|
-
if (!this.endUserId) {
|
|
5481
|
-
throw new Error('Cannot add user info before tracker initialization');
|
|
5482
|
-
}
|
|
5483
|
-
this.userProperties = userProperties;
|
|
5484
|
-
yield this.api.sendUserData(this.endUserId, userProperties, this.sessionId);
|
|
5485
|
-
if (userId) {
|
|
5486
|
-
this.endUserId = userId;
|
|
5487
|
-
}
|
|
5488
|
-
});
|
|
5489
|
-
}
|
|
5490
5477
|
/**
|
|
5491
5478
|
* Add user identification information to the tracker
|
|
5492
|
-
*
|
|
5479
|
+
* If userId is not provided, will use userProperties.email as the userId (if present)
|
|
5493
5480
|
*/
|
|
5494
|
-
|
|
5495
|
-
return __awaiter$1(this,
|
|
5481
|
+
addUserInfo(_a) {
|
|
5482
|
+
return __awaiter$1(this, arguments, void 0, function* ({ userId, userProperties }) {
|
|
5496
5483
|
yield this.ensureInitialized();
|
|
5497
|
-
|
|
5498
|
-
|
|
5484
|
+
// Determine the userId to use
|
|
5485
|
+
const resolvedUserId = userId || userProperties.email;
|
|
5486
|
+
if (!resolvedUserId) {
|
|
5487
|
+
return this.endUserId || '';
|
|
5499
5488
|
}
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5489
|
+
this.userProperties = userProperties;
|
|
5490
|
+
yield this.api.sendUserData(resolvedUserId, userProperties, this.sessionId);
|
|
5491
|
+
// Update endUserId and cookie if changed
|
|
5492
|
+
if (resolvedUserId !== this.endUserId) {
|
|
5493
|
+
this.endUserId = resolvedUserId;
|
|
5494
|
+
this.setCookie(`human_behavior_end_user_id_${this.apiKey}`, resolvedUserId, 365);
|
|
5504
5495
|
}
|
|
5496
|
+
return this.endUserId || '';
|
|
5505
5497
|
});
|
|
5506
5498
|
}
|
|
5507
5499
|
start() {
|