@dgpholdings/greatoak-shared 1.2.76 → 1.2.79

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.
@@ -13,6 +13,7 @@ export type TApiAiQuickStartWorkoutReq = {
13
13
  /**
14
14
  * Optional: How much time the user has for the workout.
15
15
  * Helps the AI determine the number of exercises and sets.
16
+ * If not provided, defaults to user's saved preferredDurationMinutes preference.
16
17
  */
17
18
  availableTimeMinutes?: number;
18
19
  /**
@@ -22,6 +23,7 @@ export type TApiAiQuickStartWorkoutReq = {
22
23
  timezone: string;
23
24
  /**
24
25
  * Whether the user intends to work out at home or at the gym today.
26
+ * If not provided, defaults to user's saved trainingLocation preference.
25
27
  */
26
28
  workoutLocation: "home" | "gym";
27
29
  /**
@@ -29,6 +31,22 @@ export type TApiAiQuickStartWorkoutReq = {
29
31
  * Can influence warm-up duration and intensity (e.g., morning stiffness vs. evening fatigue, Afternoon: (Peak Performance)).
30
32
  */
31
33
  workoutTime: "morning" | "afternoon" | "evening" | "night";
34
+ /**
35
+ * Optional: Female health context override for this specific workout.
36
+ * Indicates if the user is on their period today, which helps the AI:
37
+ * - Adjust workout intensity and volume appropriately
38
+ * - Include more stretching and mobility work
39
+ * - Avoid high-impact movements if needed
40
+ * - Consider energy levels more conservatively
41
+ *
42
+ * If provided, this overrides the user's saved femaleHealth.isOnPeriod preference for this workout only.
43
+ * If not provided, the worker will use the value from the user's profile.
44
+ *
45
+ * Note: This is a session-level override. The createJobController will optionally sync this
46
+ * value back to the user's profile asynchronously (fire-and-forget) to keep preferences in sync,
47
+ * but the job creation and processing are not dependent on this sync succeeding.
48
+ */
49
+ isOnPeriod?: boolean;
32
50
  };
33
51
  export type TAiEnrichedContext = {
34
52
  qdrantFilters: {
@@ -1,13 +1,18 @@
1
1
  import type { TAiFitnessGoal, TAiBodyArea } from "../constants/AiExerciseVocabulary";
2
2
  import { TAuthType, TGender, TProfessionalCategory, TUserMetric, TUserType, TInjuryInfo } from "./TApiUser";
3
- import { TActivityLevel } from "./TUserPreferences";
3
+ import { TActivityLevel, TStablePreferences, TFemaleHealthContext } from "./TUserPreferences";
4
+ /**
5
+ * TOnboardingData: Core user profile data collected during onboarding
6
+ * Does NOT include workout preferences - those come from TStablePreferences
7
+ */
4
8
  export type TOnboardingData = {
5
- userWeightKg: number;
9
+ weightKg: number;
10
+ heightCm: number;
6
11
  dob: Date;
7
12
  gender: TGender;
8
- userHeightCm: number;
9
- metricSystem: "US" | "EU";
10
13
  bodyFatPercentage: number;
14
+ metricSystem: "US" | "EU";
15
+ appLanguage: string;
11
16
  fitnessGoals: TAiFitnessGoal[];
12
17
  fitnessLevel: TActivityLevel;
13
18
  avoidBodyAreas?: TAiBodyArea[];
@@ -21,10 +26,23 @@ export type TOnboardingData = {
21
26
  email?: string;
22
27
  fullName?: string;
23
28
  };
29
+ /**
30
+ * Anonymous signup request
31
+ * = Core onboarding data + device info + OPTIONAL workout preferences
32
+ */
24
33
  export type TApiSignupAnonymousReq = Omit<TOnboardingData, "userCode"> & {
25
34
  model: string;
26
- appLanguage: string;
27
35
  deviceUniqueId: string;
36
+ trainingLocation?: TStablePreferences["trainingLocation"];
37
+ preferredDurationMinutes?: TStablePreferences["preferredDurationMinutes"];
38
+ preferredEquipment?: TStablePreferences["preferredEquipment"];
39
+ preferCompoundMovements?: TStablePreferences["preferCompoundMovements"];
40
+ includeWarmup?: TStablePreferences["includeWarmup"];
41
+ includeCooldown?: TStablePreferences["includeCooldown"];
42
+ warmupStyle?: TStablePreferences["warmupStyle"];
43
+ favouriteMuscleGroups?: TStablePreferences["favouriteMuscleGroups"];
44
+ blacklistedExerciseIds?: TStablePreferences["blacklistedExerciseIds"];
45
+ femaleHealth?: TFemaleHealthContext | null;
28
46
  };
29
47
  export type TApiSignupAnonymousRes = TSignInRes & {
30
48
  authType: "anonymous";
@@ -25,15 +25,7 @@ const getDaysAndHoursDifference = ({ oldDate, newDate, }) => {
25
25
  };
26
26
  exports.getDaysAndHoursDifference = getDaysAndHoursDifference;
27
27
  const isUserAllowedToUpdate = ({ createdAt, updatedAt }) => {
28
- const now = new Date();
29
- const sinceLastUpdated = (0, exports.getDaysAndHoursDifference)({
30
- oldDate: updatedAt,
31
- newDate: now,
32
- });
33
- const diffUserCreationAndLastUpdate = (0, exports.getDaysAndHoursDifference)({
34
- oldDate: createdAt,
35
- newDate: updatedAt,
36
- });
37
- return diffUserCreationAndLastUpdate.hours <= 1 || sinceLastUpdated.hours > 8;
28
+ // Time restriction removed - users can always update their profile
29
+ return true;
38
30
  };
39
31
  exports.isUserAllowedToUpdate = isUserAllowedToUpdate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dgpholdings/greatoak-shared",
3
- "version": "1.2.76",
3
+ "version": "1.2.79",
4
4
  "description": "Shared TypeScript types and utilities for @dgpholdings projects",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",