feat(analytics): initial Habitica-owned solution

This commit is contained in:
Phillip Thelen
2026-04-07 15:33:57 -05:00
committed by Kalista Payne
parent 746fcfff49
commit e6ffd69148
90 changed files with 762 additions and 2479 deletions
+1 -13
View File
@@ -1,4 +1,3 @@
import pick from 'lodash/pick';
import content from '../content/index';
import { beastMasterProgress } from '../count';
import i18n from '../i18n';
@@ -7,7 +6,7 @@ import {
} from '../libs/errors';
import updateUserBalance from './updateUserBalance';
export default function releasePets (user, req = {}, analytics) {
export default function releasePets (user, req = {}) {
if (user.balance < 1) {
throw new NotAuthorized(i18n.t('notEnoughGems', req.language));
}
@@ -42,17 +41,6 @@ export default function releasePets (user, req = {}, analytics) {
user.achievements.beastMasterCount += 1;
}
if (analytics) {
analytics.track('release pets', {
user: pick(user, ['preferences', 'registeredThrough']),
uuid: user._id,
currency: 'Gems',
gemCost: 4,
category: 'behavior',
headers: req.headers,
});
}
return [
user.items.pets,
i18n.t('petsReleased'),