hevy-shared 1.0.615 → 1.0.616
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 +8 -0
- package/built/utils.js +27 -1
- package/package.json +1 -1
package/built/index.d.ts
CHANGED
|
@@ -1598,7 +1598,7 @@ export interface CancelSubscriptionFeedback extends BaseFeedback {
|
|
|
1598
1598
|
};
|
|
1599
1599
|
}
|
|
1600
1600
|
export type Feedback = GeneralFeedback | FeatureRequestFeedback | BugReportFeedback | GetHelpFeedback | ReportCommentFeedback | ReportWorkoutFeedback | ReportProfileFeedback | RatingPromptFeedback | CancelSubscriptionFeedback;
|
|
1601
|
-
export type SuggestedUserSource = 'popular' | 'local' | 'contact' | 'mutual_follows' | 'follows_you' | 'featured';
|
|
1601
|
+
export type SuggestedUserSource = 'popular' | 'local' | 'contact' | 'mutual_follows' | 'follows_you' | 'featured' | 'hyper_local';
|
|
1602
1602
|
export type SuggestedUserLabel = 'contact' | 'mutual_friends' | 'follows_you' | 'featured';
|
|
1603
1603
|
export interface SuggestedUser {
|
|
1604
1604
|
id: string;
|
package/built/utils.d.ts
CHANGED
|
@@ -199,6 +199,14 @@ 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;
|
|
202
210
|
/**
|
|
203
211
|
* @example
|
|
204
212
|
* 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.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;
|
|
3
|
+
exports.getYoutubeVideoId = exports.validateYoutubeUrl = exports.splitAtUsernamesAndLinks = exports.isVersionAGreaterOrEqualToVersionB = exports.generateUserGroupValue = 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
|
|
@@ -547,6 +547,32 @@ const generateUserGroup = (userId, numGroups) => {
|
|
|
547
547
|
};
|
|
548
548
|
};
|
|
549
549
|
exports.generateUserGroup = generateUserGroup;
|
|
550
|
+
/**
|
|
551
|
+
* Get the user group value for a given user id and number of groups.
|
|
552
|
+
* @param userId a v4 UUID; _must_ be v4 to ensure random distribution
|
|
553
|
+
* @param numGroups number of possible groups, from 2 to 2^32
|
|
554
|
+
* @returns User group value (A, B, C, etc.), or undefined if the user id is not a v4 UUID
|
|
555
|
+
* or if an error occurs.
|
|
556
|
+
*/
|
|
557
|
+
const generateUserGroupValue = (userId, numGroups) => {
|
|
558
|
+
const group = (0, exports.generateUserGroup)(userId, numGroups);
|
|
559
|
+
if (group.isSuccess) {
|
|
560
|
+
switch (group.value) {
|
|
561
|
+
case 0:
|
|
562
|
+
return 'A';
|
|
563
|
+
case 1:
|
|
564
|
+
return 'B';
|
|
565
|
+
case 2:
|
|
566
|
+
return 'C';
|
|
567
|
+
default:
|
|
568
|
+
return undefined;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
else {
|
|
572
|
+
return undefined;
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
exports.generateUserGroupValue = generateUserGroupValue;
|
|
550
576
|
/**
|
|
551
577
|
* @example
|
|
552
578
|
* isVersionAGreaterOrEqualToVersionB('1.2.3', '1.2') // true
|