hevy-shared 1.0.605 → 1.0.606
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 +1 -1
- package/built/utils.d.ts +1 -9
- package/built/utils.js +11 -32
- package/package.json +1 -1
package/built/index.d.ts
CHANGED
|
@@ -1589,7 +1589,7 @@ export interface CancelSubscriptionFeedback extends BaseFeedback {
|
|
|
1589
1589
|
};
|
|
1590
1590
|
}
|
|
1591
1591
|
export type Feedback = GeneralFeedback | FeatureRequestFeedback | BugReportFeedback | GetHelpFeedback | ReportCommentFeedback | ReportWorkoutFeedback | ReportProfileFeedback | RatingPromptFeedback | CancelSubscriptionFeedback;
|
|
1592
|
-
export type SuggestedUserSource = 'popular' | 'local' | 'contact' | 'mutual_follows' | 'follows_you' | 'featured'
|
|
1592
|
+
export type SuggestedUserSource = 'popular' | 'local' | 'contact' | 'mutual_follows' | 'follows_you' | 'featured';
|
|
1593
1593
|
export type SuggestedUserLabel = 'contact' | 'mutual_friends' | 'follows_you' | 'featured';
|
|
1594
1594
|
export interface SuggestedUser {
|
|
1595
1595
|
id: string;
|
package/built/utils.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ export interface TotalSetCountWorkout {
|
|
|
167
167
|
* Calculate the set weight for a given user exercise set
|
|
168
168
|
* to be used in the exercise stats calculations on the web and coach app
|
|
169
169
|
*/
|
|
170
|
-
export declare const userExerciseSetWeight: (set: UserExerciseSet, exerciseStore: BaseExerciseTemplate[]) => number;
|
|
170
|
+
export declare const userExerciseSetWeight: (set: UserExerciseSet, exerciseStore: BaseExerciseTemplate[], hundredPercentBodyweightExercise: boolean) => number;
|
|
171
171
|
export declare const workoutSetCount: (w: TotalSetCountWorkout) => number;
|
|
172
172
|
export declare const oneRepMaxPercentageMap: {
|
|
173
173
|
[s: number]: number;
|
|
@@ -199,14 +199,6 @@ type GenerateUserGroupError = 'invalid-number-of-groups' | 'invalid-uuid' | 'uui
|
|
|
199
199
|
* `(userId, numGroups)` pair, or an error, inside a Result<T> object
|
|
200
200
|
*/
|
|
201
201
|
export declare const generateUserGroup: (userId: string, numGroups: number) => Result<number, GenerateUserGroupError>;
|
|
202
|
-
/**
|
|
203
|
-
* Get the user group value for a given user id and number of groups.
|
|
204
|
-
* @param userId a v4 UUID; _must_ be v4 to ensure random distribution
|
|
205
|
-
* @param numGroups number of possible groups, from 2 to 2^32
|
|
206
|
-
* @returns User group value (A, B, C, etc.), or undefined if the user id is not a v4 UUID
|
|
207
|
-
* or if an error occurs.
|
|
208
|
-
*/
|
|
209
|
-
export declare const generateUserGroupValue: (userId: string, numGroups: 2 | 3) => "A" | "B" | "C" | undefined;
|
|
210
202
|
/**
|
|
211
203
|
* @example
|
|
212
204
|
* isVersionAGreaterOrEqualToVersionB('1.2.3', '1.2') // true
|
package/built/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getYoutubeVideoId = exports.validateYoutubeUrl = exports.splitAtUsernamesAndLinks = exports.isVersionAGreaterOrEqualToVersionB = exports.
|
|
3
|
+
exports.getYoutubeVideoId = exports.validateYoutubeUrl = exports.splitAtUsernamesAndLinks = exports.isVersionAGreaterOrEqualToVersionB = exports.generateUserGroup = exports.isBaseExerciseTemplate = exports.getStrengthLevelFromPercentile = exports.numberToLocaleString = exports.numberWithCommas = exports.setVolume = exports.oneRepMax = exports.oneRepMaxPercentageMap = exports.workoutSetCount = exports.userExerciseSetWeight = exports.workoutDistanceMeters = exports.workoutReps = exports.workoutDurationSeconds = exports.removeAccents = exports.getClosestDataPointAroundTargetDate = exports.getClosestDataPointBeforeTargetDate = exports.findMapped = exports.stringToNumber = exports.forceStringToNumber = exports.formatDurationInput = exports.isValidFormattedTime = exports.isWholeNumber = exports.isNumber = exports.isValidUuid = exports.isValidPhoneNumber = exports.isValidWebUrl = exports.URL_REGEX = exports.isValidEmail = exports.secondsToWordFormatMinutes = exports.secondsToWordFormat = exports.secondsToClockFormat = exports.isValidUsername = exports.roundToWholeNumber = exports.roundToOneDecimal = exports.roundToTwoDecimal = exports.divide = exports.clampNumber = exports.num = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Doesn't matter what you throw in the function it'll
|
|
6
6
|
* always return a number. Non number values will return
|
|
@@ -404,20 +404,25 @@ exports.workoutDistanceMeters = workoutDistanceMeters;
|
|
|
404
404
|
* Calculate the set weight for a given user exercise set
|
|
405
405
|
* to be used in the exercise stats calculations on the web and coach app
|
|
406
406
|
*/
|
|
407
|
-
const userExerciseSetWeight = (set, exerciseStore) => {
|
|
407
|
+
const userExerciseSetWeight = (set, exerciseStore, hundredPercentBodyweightExercise) => {
|
|
408
408
|
if (!set)
|
|
409
409
|
return 0;
|
|
410
410
|
const exercise = exerciseStore.find((e) => e.id === set.exercise_template_id);
|
|
411
411
|
if (!exercise) {
|
|
412
412
|
return (0, exports.num)(set.weight_kg);
|
|
413
413
|
}
|
|
414
|
-
//!! This is wrong!!
|
|
415
|
-
// TODO: we should check if it's a hundred percent bodyweight exercise or not first
|
|
416
414
|
if (exercise.exercise_type === 'bodyweight_reps') {
|
|
417
|
-
return
|
|
415
|
+
return hundredPercentBodyweightExercise
|
|
416
|
+
? (0, exports.num)(set.user_bodyweight_kg) + (0, exports.num)(set.weight_kg)
|
|
417
|
+
: (0, exports.num)(set.weight_kg);
|
|
418
418
|
}
|
|
419
419
|
else if (exercise.exercise_type === 'bodyweight_assisted_reps') {
|
|
420
|
-
return
|
|
420
|
+
return hundredPercentBodyweightExercise
|
|
421
|
+
? Math.max((0, exports.num)(set.user_bodyweight_kg) - (0, exports.num)(set.weight_kg), 0)
|
|
422
|
+
: 0;
|
|
423
|
+
}
|
|
424
|
+
else if (exercise.exercise_type === 'reps_only') {
|
|
425
|
+
return hundredPercentBodyweightExercise ? (0, exports.num)(set.user_bodyweight_kg) : 0;
|
|
421
426
|
}
|
|
422
427
|
else {
|
|
423
428
|
return (0, exports.num)(set.weight_kg);
|
|
@@ -542,32 +547,6 @@ const generateUserGroup = (userId, numGroups) => {
|
|
|
542
547
|
};
|
|
543
548
|
};
|
|
544
549
|
exports.generateUserGroup = generateUserGroup;
|
|
545
|
-
/**
|
|
546
|
-
* Get the user group value for a given user id and number of groups.
|
|
547
|
-
* @param userId a v4 UUID; _must_ be v4 to ensure random distribution
|
|
548
|
-
* @param numGroups number of possible groups, from 2 to 2^32
|
|
549
|
-
* @returns User group value (A, B, C, etc.), or undefined if the user id is not a v4 UUID
|
|
550
|
-
* or if an error occurs.
|
|
551
|
-
*/
|
|
552
|
-
const generateUserGroupValue = (userId, numGroups) => {
|
|
553
|
-
const group = (0, exports.generateUserGroup)(userId, numGroups);
|
|
554
|
-
if (group.isSuccess) {
|
|
555
|
-
switch (group.value) {
|
|
556
|
-
case 0:
|
|
557
|
-
return 'A';
|
|
558
|
-
case 1:
|
|
559
|
-
return 'B';
|
|
560
|
-
case 2:
|
|
561
|
-
return 'C';
|
|
562
|
-
default:
|
|
563
|
-
return undefined;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
else {
|
|
567
|
-
return undefined;
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
exports.generateUserGroupValue = generateUserGroupValue;
|
|
571
550
|
/**
|
|
572
551
|
* @example
|
|
573
552
|
* isVersionAGreaterOrEqualToVersionB('1.2.3', '1.2') // true
|