@dgpholdings/greatoak-shared 1.1.48 → 1.1.50

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.
@@ -1,4 +1,4 @@
1
- import { TAuthType, TGender, TUserMetric } from "./TApiUser";
1
+ import { TAuthType, TFitnessGoal, TGender, TUserMetric } from "./TApiUser";
2
2
  export type TApiSignupReq = {
3
3
  email: string;
4
4
  password: string;
@@ -11,6 +11,9 @@ export type TOnboardingData = {
11
11
  userWeightKg: number;
12
12
  dob: Date;
13
13
  gender: TGender;
14
+ fitnessGoal: TFitnessGoal;
15
+ fitnessLevel: number;
16
+ email?: string;
14
17
  };
15
18
  export type TApiSignupRes = TApiSigninRes & {
16
19
  authType: "email";
@@ -1,7 +1,6 @@
1
1
  export type TAuthType = "email" | "apple" | "anonymous";
2
2
  export type TGender = "male" | "female" | "unmentioned";
3
3
  export type TFitnessGoal = "strength" | "hypertrophy" | "endurance" | "general" | "fat_burn" | "flexibility";
4
- export type TUserFitnessGoal = "strength" | "hypertrophy" | "endurance" | "general";
5
4
  export type TUserMetric = {
6
5
  dob: Date;
7
6
  weightKg?: number;
@@ -39,7 +38,6 @@ export type TUser = {
39
38
  billingPlanType: "monthly" | "annually" | "free";
40
39
  billingPlanVersion?: string;
41
40
  billingPlanGeoCountryCode: string;
42
- fitnessLevel?: number;
43
41
  paymentMethod?: "credit_card" | "paypal" | "apple_pay" | "upi";
44
42
  billingPlanNextDueDate?: string;
45
43
  devices: {
@@ -54,5 +52,6 @@ export type TUser = {
54
52
  weightKg?: number;
55
53
  heightCm?: number;
56
54
  bodyFatPercentage?: number;
57
- fitnessGoal: TUserFitnessGoal;
55
+ fitnessGoal: TFitnessGoal;
56
+ fitnessLevel: number;
58
57
  };
@@ -1,5 +1,5 @@
1
1
  import { TRefinedRecord } from "./record.utils";
2
- import { TExercise, TGender, TUserFitnessGoal, TUserMetric } from "../types";
2
+ import { TExercise, TGender, TFitnessGoal, TUserMetric } from "../types";
3
3
  export type TUserProfile = {
4
4
  age?: number;
5
5
  gender?: TGender;
@@ -7,7 +7,7 @@ export type TUserProfile = {
7
7
  heightCm?: number;
8
8
  bodyFatPercentage?: number;
9
9
  fitnessLevel?: TUserMetric["fitnessLevel"];
10
- fitnessGoal?: TUserFitnessGoal;
10
+ fitnessGoal?: TFitnessGoal;
11
11
  };
12
12
  export type TScoreBreakdown = {
13
13
  baseScore: number;
@@ -331,18 +331,28 @@ const computeScoreFromRecord = ({ avgRestDurationSecs, record, exercise, userPro
331
331
  plus.push({
332
332
  exerciseDifficulty: parseFloat((difficultyMultiplier - 1).toFixed(3)),
333
333
  });
334
- // Goal alignment bonus
334
+ // ENHANCED Goal alignment bonus
335
335
  if (userProfile === null || userProfile === void 0 ? void 0 : userProfile.fitnessGoal) {
336
336
  let goalMultiplier = 1;
337
- switch (userProfile.fitnessGoal) {
337
+ const goal = userProfile.fitnessGoal;
338
+ switch (goal) {
338
339
  case "strength":
339
- goalMultiplier = 1 + (exercise.strengthGainLevel / 10) * 0.12;
340
+ goalMultiplier = 1 + (exercise.strengthGainLevel / 10) * 0.15; // Increased from 0.12
340
341
  break;
341
342
  case "hypertrophy":
342
- goalMultiplier = 1 + (exercise.hypertrophyLevel / 10) * 0.12;
343
+ goalMultiplier = 1 + (exercise.hypertrophyLevel / 10) * 0.15;
343
344
  break;
344
345
  case "endurance":
345
- goalMultiplier = 1 + (exercise.enduranceLevel / 10) * 0.12;
346
+ goalMultiplier = 1 + (exercise.enduranceLevel / 10) * 0.15;
347
+ break;
348
+ case "fat_burn":
349
+ // For fat burn, prioritize calorie burn level and high MET exercises
350
+ const calorieBurnBonus = (exercise.calorieBurnLevel / 10) * 0.18; // Higher bonus for calorie burn
351
+ const metBonus = exercise.metabolicData.baseMET > 6 ? 0.08 : 0; // 8% bonus for high MET exercises
352
+ goalMultiplier = 1 + calorieBurnBonus + metBonus;
353
+ break;
354
+ case "flexibility":
355
+ goalMultiplier = 1 + (exercise.flexibilityLevel / 10) * 0.15;
346
356
  break;
347
357
  case "general":
348
358
  const avgLevel = (exercise.strengthGainLevel +
@@ -350,7 +360,7 @@ const computeScoreFromRecord = ({ avgRestDurationSecs, record, exercise, userPro
350
360
  exercise.enduranceLevel +
351
361
  exercise.flexibilityLevel) /
352
362
  4;
353
- goalMultiplier = 1 + (avgLevel / 10) * 0.08;
363
+ goalMultiplier = 1 + (avgLevel / 10) * 0.1;
354
364
  break;
355
365
  }
356
366
  if (goalMultiplier > 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dgpholdings/greatoak-shared",
3
- "version": "1.1.48",
3
+ "version": "1.1.50",
4
4
  "description": "Shared TypeScript types and utilities for @dgpholdings projects",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",