mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-21 04:46:41 +02:00
feat(analytics): add custom event tracking to NutriPhi and ManaDeck
Add NutriPhiEvents (mealAdded, mealDeleted, photoAnalyzed, textAnalyzed, goalsUpdated, favoriteSaved, favoriteUsed) to shared analytics utils. Add deckDeleted and cardDeleted to ManaDeckEvents. Wire up event calls in NutriPhi meals store and ManaDeck deck/card stores. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
59c8974af8
commit
1fe8f8902d
4 changed files with 25 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { apiClient } from '$lib/api/client';
|
||||
import type { Meal, MealNutrition, DailySummary } from '@nutriphi/shared';
|
||||
import { NutriPhiEvents } from '@manacore/shared-utils/analytics';
|
||||
|
||||
interface MealWithNutrition extends Meal {
|
||||
nutrition: MealNutrition | null;
|
||||
|
|
@ -59,6 +60,7 @@ class MealsStore {
|
|||
const meal = await apiClient.post<MealWithNutrition>('/meals', mealData);
|
||||
this.meals = [...this.meals, meal];
|
||||
await this.fetchDailySummary();
|
||||
NutriPhiEvents.mealAdded(mealData.mealType, mealData.inputType);
|
||||
return meal;
|
||||
} catch (err) {
|
||||
const message =
|
||||
|
|
@ -74,6 +76,7 @@ class MealsStore {
|
|||
await apiClient.delete(`/meals/${mealId}`);
|
||||
this.meals = this.meals.filter((m) => m.id !== mealId);
|
||||
await this.fetchDailySummary();
|
||||
NutriPhiEvents.mealDeleted();
|
||||
} catch (err) {
|
||||
this.deleteError =
|
||||
err instanceof Error ? err.message : 'Mahlzeit konnte nicht gelöscht werden';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue