hevy-shared 1.0.685 → 1.0.687
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.
- package/built/index.d.ts +36 -3
- package/built/index.js +9 -2
- package/built/notifications.d.ts +5 -2
- package/built/tests/testUtils.js +1 -0
- package/built/utils.d.ts +1 -1
- package/built/utils.js +15 -1
- package/package.json +1 -1
package/built/index.d.ts
CHANGED
|
@@ -105,6 +105,8 @@ export interface UserAccountResponse {
|
|
|
105
105
|
birthday?: string;
|
|
106
106
|
sex?: Sex;
|
|
107
107
|
email_consent: boolean;
|
|
108
|
+
/** Indicates whether the account needs additional (email) verification to access certain APIs */
|
|
109
|
+
sensitive_api_requires_verification: boolean;
|
|
108
110
|
}
|
|
109
111
|
export interface CoachAppPushTarget {
|
|
110
112
|
type: 'android' | 'ios';
|
|
@@ -451,7 +453,6 @@ export interface UserHevyProSubcription {
|
|
|
451
453
|
subscription_cancels_on?: string;
|
|
452
454
|
};
|
|
453
455
|
}
|
|
454
|
-
export type CalendarViewOption = 'month' | 'year' | 'multi_year';
|
|
455
456
|
export interface UserPreferences {
|
|
456
457
|
username: string;
|
|
457
458
|
language?: Language;
|
|
@@ -473,7 +474,6 @@ export interface UserPreferences {
|
|
|
473
474
|
default_workout_biometrics_visibility_public?: boolean;
|
|
474
475
|
/** Only updateable by the backend within a special API */
|
|
475
476
|
volume_includes_warmup_sets?: boolean;
|
|
476
|
-
calendar_view_selection?: CalendarViewOption;
|
|
477
477
|
}
|
|
478
478
|
export type UpdateUserPreferencesRequest = Omit<UserPreferences, 'username' | 'volume_includes_warmup_sets'>;
|
|
479
479
|
export type FollowingStatus = 'not-following' | 'following' | 'requested';
|
|
@@ -600,6 +600,10 @@ export declare const exerciseCategories: readonly ["isolation", "compound", "ass
|
|
|
600
600
|
export type TrainingGoal = Lookup<typeof trainingGoals>;
|
|
601
601
|
export type TrainingLevel = Lookup<typeof trainingLevels>;
|
|
602
602
|
export type ExerciseCategory = Lookup<typeof exerciseCategories>;
|
|
603
|
+
export type HevyTrainerProgramEquipment = Extract<Equipment, 'barbell' | 'dumbbell' | 'machine'>;
|
|
604
|
+
export declare const hevyTrainerProgramEquipments: readonly ["barbell", "dumbbell", "machine"];
|
|
605
|
+
export declare const weeklyTrainingFrequencies: readonly [1, 2, 3, 4, 5, 6];
|
|
606
|
+
export type WeeklyTrainingFrequency = Lookup<typeof weeklyTrainingFrequencies>;
|
|
603
607
|
/**
|
|
604
608
|
* Base properties that all exercise templates must have
|
|
605
609
|
*/
|
|
@@ -1009,13 +1013,23 @@ export interface BaseRoutine {
|
|
|
1009
1013
|
coach_id: string | null;
|
|
1010
1014
|
notes: string | null;
|
|
1011
1015
|
coach_force_rpe_enabled: boolean;
|
|
1016
|
+
hevy_trainer_program_id: string | null;
|
|
1012
1017
|
}
|
|
1013
1018
|
export interface Routine extends BaseRoutine {
|
|
1014
1019
|
username: string;
|
|
1020
|
+
coach_id: null;
|
|
1015
1021
|
}
|
|
1016
|
-
export
|
|
1022
|
+
export interface HevyTrainerRoutine extends Routine {
|
|
1023
|
+
hevy_trainer_program_id: string;
|
|
1024
|
+
program_id: null;
|
|
1025
|
+
coach_force_rpe_enabled: false;
|
|
1026
|
+
folder_id: null;
|
|
1027
|
+
}
|
|
1028
|
+
export type CoachsShallowLibraryRoutine = Omit<BaseRoutine, 'exercises' | 'profile_pic' | 'hevy_trainer_program_id' | 'username'>;
|
|
1017
1029
|
export interface CoachesRoutine extends BaseRoutine {
|
|
1018
1030
|
coach_id: string;
|
|
1031
|
+
username: null;
|
|
1032
|
+
hevy_trainer_program_id: null;
|
|
1019
1033
|
}
|
|
1020
1034
|
export interface CoachAndCoachsClientsRoutineSyncResponse {
|
|
1021
1035
|
updated: BaseRoutine[];
|
|
@@ -1178,6 +1192,25 @@ export interface GetTeamInviteResponse {
|
|
|
1178
1192
|
export interface OutstandingInvitesForCoachTeamResponse {
|
|
1179
1193
|
invites: CoachTeamInvite[];
|
|
1180
1194
|
}
|
|
1195
|
+
export interface HevyTrainerProgram {
|
|
1196
|
+
title: string;
|
|
1197
|
+
level: TrainingLevel;
|
|
1198
|
+
goal: TrainingGoal;
|
|
1199
|
+
equipments: HevyTrainerProgramEquipment[];
|
|
1200
|
+
weekly_frequency: WeeklyTrainingFrequency;
|
|
1201
|
+
routines: HevyTrainerRoutine[];
|
|
1202
|
+
next_workout_index: number;
|
|
1203
|
+
}
|
|
1204
|
+
export interface PostHevyTrainerProgramRequestBody {
|
|
1205
|
+
program: {
|
|
1206
|
+
title: string;
|
|
1207
|
+
level: TrainingLevel;
|
|
1208
|
+
goal: TrainingGoal;
|
|
1209
|
+
equipments: HevyTrainerProgramEquipment[];
|
|
1210
|
+
weekly_frequency: WeeklyTrainingFrequency;
|
|
1211
|
+
routines: RoutineUpdate[];
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1181
1214
|
export declare const measurementsList: readonly ["weight_kg", "fat_percent", "neck_cm", "shoulder_cm", "chest_cm", "left_bicep_cm", "right_bicep_cm", "left_forearm_cm", "right_forearm_cm", "abdomen", "waist", "hips", "left_thigh", "right_thigh", "left_calf", "right_calf"];
|
|
1182
1215
|
type MeasurementProperties = {
|
|
1183
1216
|
[key in typeof measurementsList[number]]?: number;
|
package/built/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.isSuggestedUserSource = void 0;
|
|
17
|
+
exports.measurementsList = exports.isWorkoutBiometrics = exports.isHeartRateSamples = exports.isPublicWorkout = exports.isSetType = exports.isRPE = exports.validRpeValues = exports.isSetPersonalRecordType = exports.supportedInstructionsLanguages = exports.weeklyTrainingFrequencies = exports.hevyTrainerProgramEquipments = exports.exerciseCategories = exports.trainingLevels = exports.trainingGoals = exports.isCustomExerciseType = exports.customExericseTypes = exports.isExerciseType = exports.exerciseTypes = exports.isExerciseRepType = exports.exerciseRepTypes = exports.isEquipmentFilter = exports.equipmentFilters = exports.isEquipment = exports.equipments = exports.isMuscleGroupFilter = exports.muscleGroupFilters = exports.isMuscleGroup = exports.muscleGroups = exports.isSimplifiedMuscleGroup = exports.simplifiedMuscleGroups = exports.miscellaneousMuscles = exports.chestMuscles = exports.backMuscles = exports.legMuscles = exports.armMuscles = exports.shoulderMuscles = exports.coreMuscles = exports.DefaultClientConfiguration = exports.isCoachRole = exports.isErrorResponse = exports.isLivePRVolumeOption = exports.isTimerVolumeOption = exports.isWeekday = exports.orderedWeekdays = exports.isBodyMeasurementUnit = exports.isDistanceUnitShort = exports.isDistanceUnit = exports.isWeightUnit = exports.isLanguage = exports.supportedLanguages = void 0;
|
|
18
|
+
exports.isSuggestedUserSource = exports.isValidUserWorkoutMetricsType = exports.isBodyMeasurementKey = void 0;
|
|
19
19
|
const typeUtils_1 = require("./typeUtils");
|
|
20
20
|
__exportStar(require("./constants"), exports);
|
|
21
21
|
__exportStar(require("./utils"), exports);
|
|
@@ -208,6 +208,7 @@ exports.isExerciseType = isExerciseType;
|
|
|
208
208
|
exports.customExericseTypes = exports.exerciseTypes.filter((type) => type !== 'floors_duration' && type !== 'steps_duration');
|
|
209
209
|
const isCustomExerciseType = (x) => (0, typeUtils_1.isInArray)(x, exports.customExericseTypes);
|
|
210
210
|
exports.isCustomExerciseType = isCustomExerciseType;
|
|
211
|
+
// Hevy Trainer related types
|
|
211
212
|
exports.trainingGoals = ['strength', 'build_muscle', 'fat_loss'];
|
|
212
213
|
exports.trainingLevels = ['beginner', 'intermediate', 'advanced'];
|
|
213
214
|
exports.exerciseCategories = [
|
|
@@ -215,6 +216,12 @@ exports.exerciseCategories = [
|
|
|
215
216
|
'compound',
|
|
216
217
|
'assistance-compound',
|
|
217
218
|
];
|
|
219
|
+
exports.hevyTrainerProgramEquipments = [
|
|
220
|
+
'barbell',
|
|
221
|
+
'dumbbell',
|
|
222
|
+
'machine',
|
|
223
|
+
];
|
|
224
|
+
exports.weeklyTrainingFrequencies = [1, 2, 3, 4, 5, 6];
|
|
218
225
|
exports.supportedInstructionsLanguages = [
|
|
219
226
|
'en',
|
|
220
227
|
'it',
|
package/built/notifications.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ export type NotificationMobilePushDataType = NotificationType | 'chat-update' |
|
|
|
141
141
|
* For iOS/Apple see https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app
|
|
142
142
|
* For Android see https://firebase.google.com/docs/cloud-messaging/concept-options#data_messages
|
|
143
143
|
*/
|
|
144
|
-
export type DataOnlyMobilePushDataType = 'coach-data-changed' | 'coach-program-changed' | 'sync-workouts' | 'sync-routines' | 'sync-routine-folders' | 'sync-exercise-templates-and-customizations' | 'hevy-pro-status-changed' | 'hevy-pro-subscription-renewed';
|
|
144
|
+
export type DataOnlyMobilePushDataType = 'coach-data-changed' | 'coach-program-changed' | 'sync-workouts' | 'sync-routines' | 'sync-routine-folders' | 'sync-exercise-templates-and-customizations' | 'sync-account' | 'hevy-pro-status-changed' | 'hevy-pro-subscription-renewed' | never;
|
|
145
145
|
export interface CoachDataChangedMobilePushData extends BaseMobilePushData {
|
|
146
146
|
type: 'coach-data-changed';
|
|
147
147
|
additionalHevyData: ClientsCoachData;
|
|
@@ -170,6 +170,9 @@ export interface SyncRoutineFoldersMobilePushData extends BaseMobilePushData {
|
|
|
170
170
|
export interface SyncCustomExercisesAndCoachCustomizationsMobilePushData extends BaseMobilePushData {
|
|
171
171
|
type: 'sync-exercise-templates-and-customizations';
|
|
172
172
|
}
|
|
173
|
+
export interface SyncAccountMobilePushData extends BaseMobilePushData {
|
|
174
|
+
type: 'sync-account';
|
|
175
|
+
}
|
|
173
176
|
export interface CoachProgramFinishesNextWeekMobilePushData extends BaseMobilePushData {
|
|
174
177
|
type: 'coach-program-finishes-next-week';
|
|
175
178
|
}
|
|
@@ -203,4 +206,4 @@ export interface GracePeriodResolveMobilePushData extends BaseMobilePushData {
|
|
|
203
206
|
type: 'grace-period-resolve';
|
|
204
207
|
deeplink: string;
|
|
205
208
|
}
|
|
206
|
-
export type MobilePushData = ChatUpdateMobilePushData | SyncCustomExercisesAndCoachCustomizationsMobilePushData | SyncWorkoutsMobilePushData | SyncRoutineFoldersMobilePushData | SyncRoutinesMobilePushData | ProStatusChangedPushMobilePushData | HevyProSubscriptionRenewedMobilePushData | CoachProgramChangedMobilePushData | CoachDataChangedMobilePushData | ContactOnHevyMobilePushData | CoachClientInviteMobilePushData | AcceptFollowRequestMobilePushData | FollowRequestMobilePushData | FollowMobilePushData | WorkoutLikeMobilePushData | WorkoutCommentLikeMobilePushData | WorkoutCommentMentionMobilePushData | WorkoutCommentDiscussionMobilePushData | WorkoutCommentReplyMobilePushData | WorkoutCommentMobilePushData | WorkoutMentionMobilePushData | WorkoutCompleteMobilePushData | CoachProgramFinishesNextWeekMobilePushData | CoachProgramStartsTodayMobilePushData | CoachLoggedYourWorkoutMobilePushData | CoachLoggedYourMeasurementsMobilePushData | MonthlyReportMobilePushData | GracePeriodEnterMobilePushData | GracePeriodResolveMobilePushData;
|
|
209
|
+
export type MobilePushData = ChatUpdateMobilePushData | SyncCustomExercisesAndCoachCustomizationsMobilePushData | SyncWorkoutsMobilePushData | SyncRoutineFoldersMobilePushData | SyncRoutinesMobilePushData | SyncAccountMobilePushData | ProStatusChangedPushMobilePushData | HevyProSubscriptionRenewedMobilePushData | CoachProgramChangedMobilePushData | CoachDataChangedMobilePushData | ContactOnHevyMobilePushData | CoachClientInviteMobilePushData | AcceptFollowRequestMobilePushData | FollowRequestMobilePushData | FollowMobilePushData | WorkoutLikeMobilePushData | WorkoutCommentLikeMobilePushData | WorkoutCommentMentionMobilePushData | WorkoutCommentDiscussionMobilePushData | WorkoutCommentReplyMobilePushData | WorkoutCommentMobilePushData | WorkoutMentionMobilePushData | WorkoutCompleteMobilePushData | CoachProgramFinishesNextWeekMobilePushData | CoachProgramStartsTodayMobilePushData | CoachLoggedYourWorkoutMobilePushData | CoachLoggedYourMeasurementsMobilePushData | MonthlyReportMobilePushData | GracePeriodEnterMobilePushData | GracePeriodResolveMobilePushData;
|
package/built/tests/testUtils.js
CHANGED
package/built/utils.d.ts
CHANGED
|
@@ -206,7 +206,7 @@ export declare const generateUserGroup: (userId: string, numGroups: number) => R
|
|
|
206
206
|
* @returns User group value (A, B, C, etc.), or undefined if the user id is not a v4 UUID
|
|
207
207
|
* or if an error occurs.
|
|
208
208
|
*/
|
|
209
|
-
export declare const generateUserGroupValue: (userId: string, numGroups: 2 | 3) => "A" | "B" | "C" | undefined;
|
|
209
|
+
export declare const generateUserGroupValue: (userId: string, numGroups: 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10) => "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | undefined;
|
|
210
210
|
/**
|
|
211
211
|
* @example
|
|
212
212
|
* isVersionAGreaterOrEqualToVersionB('1.2.3', '1.2') // true
|
package/built/utils.js
CHANGED
|
@@ -97,7 +97,7 @@ exports.secondsToWordFormat = secondsToWordFormat;
|
|
|
97
97
|
*/
|
|
98
98
|
const secondsToWordFormatMinutes = (seconds) => {
|
|
99
99
|
const hours = Math.floor(seconds / 3600);
|
|
100
|
-
const minutes = Math.
|
|
100
|
+
const minutes = Math.round((seconds - hours * 3600) / 60);
|
|
101
101
|
if (hours) {
|
|
102
102
|
return `${hours}h ${minutes}min`;
|
|
103
103
|
}
|
|
@@ -564,6 +564,20 @@ const generateUserGroupValue = (userId, numGroups) => {
|
|
|
564
564
|
return 'B';
|
|
565
565
|
case 2:
|
|
566
566
|
return 'C';
|
|
567
|
+
case 3:
|
|
568
|
+
return 'D';
|
|
569
|
+
case 4:
|
|
570
|
+
return 'E';
|
|
571
|
+
case 5:
|
|
572
|
+
return 'F';
|
|
573
|
+
case 6:
|
|
574
|
+
return 'G';
|
|
575
|
+
case 7:
|
|
576
|
+
return 'H';
|
|
577
|
+
case 8:
|
|
578
|
+
return 'I';
|
|
579
|
+
case 9:
|
|
580
|
+
return 'J';
|
|
567
581
|
default:
|
|
568
582
|
return undefined;
|
|
569
583
|
}
|