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,12 +1,11 @@
import each from 'lodash/each';
import pick from 'lodash/pick';
import i18n from '../i18n';
import {
NotAuthorized,
} from '../libs/errors';
import updateUserBalance from './updateUserBalance';
export default async function reroll (user, tasks = [], req = {}, analytics) {
export default async function reroll (user, tasks = [], req = {}) {
if (user.balance < 1) {
throw new NotAuthorized(i18n.t('notEnoughGems', req.language));
}
@@ -22,17 +21,6 @@ export default async function reroll (user, tasks = [], req = {}, analytics) {
}
});
if (analytics) {
analytics.track('Fortify Potion', {
user: pick(user, ['preferences', 'registeredThrough']),
uuid: user._id,
currency: 'Gems',
gemCost: 4,
category: 'behavior',
headers: req.headers,
});
}
return [
{ user, tasks },
i18n.t('fortifyComplete'),