hevy-shared 1.0.956 → 1.0.958
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/exerciseLocaleUtils.d.ts +17 -0
- package/built/exerciseLocaleUtils.js +62 -0
- package/built/index.d.ts +13 -2
- package/built/index.js +3 -10
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LibraryExercise, Lookup } from '.';
|
|
2
|
+
import { Language } from './translations';
|
|
3
|
+
/** Keeping exercise instruction/title localization utils here instead of translations
|
|
4
|
+
* so I don't need to import exercise types from here in translations (translations was
|
|
5
|
+
* created so that hevy-web can import utils from shared without importing something from
|
|
6
|
+
* that isn't allowed in Edge Runtime)
|
|
7
|
+
*/
|
|
8
|
+
export declare const supportedInstructionsLanguages: readonly ["en", "it", "de", "es", "fr", "pt"];
|
|
9
|
+
export type InstructionsLanguage = Lookup<typeof supportedInstructionsLanguages>;
|
|
10
|
+
export declare const isSupportedInstructionsLanguage: (lang: string) => lang is InstructionsLanguage;
|
|
11
|
+
type LocalizableExerciseTemplate = Pick<LibraryExercise, 'title' | 'es_title' | 'de_title' | 'fr_title' | 'it_title' | 'ja_title' | 'ko_title' | 'pt_title' | 'ru_title' | 'tr_title' | 'zh_cn_title' | 'zh_tw_title' | 'localised_instructions' | 'is_custom'>;
|
|
12
|
+
export declare const localisedExerciseTitle: (locale: Language, template: LocalizableExerciseTemplate) => string;
|
|
13
|
+
export declare const localisedExerciseInstructions: (locale: Language, exerciseTemplate: LocalizableExerciseTemplate) => string;
|
|
14
|
+
export declare const localeSelect: <T>(locale: Language, options: {
|
|
15
|
+
en: T;
|
|
16
|
+
} & { [language in Exclude<Language, "en">]?: T | null; }) => T;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.localeSelect = exports.localisedExerciseInstructions = exports.localisedExerciseTitle = exports.isSupportedInstructionsLanguage = exports.supportedInstructionsLanguages = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
/** Keeping exercise instruction/title localization utils here instead of translations
|
|
6
|
+
* so I don't need to import exercise types from here in translations (translations was
|
|
7
|
+
* created so that hevy-web can import utils from shared without importing something from
|
|
8
|
+
* that isn't allowed in Edge Runtime)
|
|
9
|
+
*/
|
|
10
|
+
exports.supportedInstructionsLanguages = [
|
|
11
|
+
'en',
|
|
12
|
+
'it',
|
|
13
|
+
'de',
|
|
14
|
+
'es',
|
|
15
|
+
'fr',
|
|
16
|
+
'pt',
|
|
17
|
+
];
|
|
18
|
+
const isSupportedInstructionsLanguage = (lang) => {
|
|
19
|
+
return (0, _1.isInArray)(lang, exports.supportedInstructionsLanguages);
|
|
20
|
+
};
|
|
21
|
+
exports.isSupportedInstructionsLanguage = isSupportedInstructionsLanguage;
|
|
22
|
+
const localisedExerciseTitle = (locale, template) => {
|
|
23
|
+
var _a;
|
|
24
|
+
if (template.is_custom) {
|
|
25
|
+
return template.title;
|
|
26
|
+
}
|
|
27
|
+
return ((_a = (0, exports.localeSelect)(locale, {
|
|
28
|
+
en: template.title,
|
|
29
|
+
es: template.es_title,
|
|
30
|
+
de: template.de_title,
|
|
31
|
+
fr: template.fr_title,
|
|
32
|
+
it: template.it_title,
|
|
33
|
+
pt: template.pt_title,
|
|
34
|
+
tr: template.tr_title,
|
|
35
|
+
zh_CN: template.zh_cn_title,
|
|
36
|
+
zh_TW: template.zh_tw_title,
|
|
37
|
+
ru: template.ru_title,
|
|
38
|
+
ja: template.ja_title,
|
|
39
|
+
ko: template.ko_title,
|
|
40
|
+
})) !== null && _a !== void 0 ? _a : template.title);
|
|
41
|
+
};
|
|
42
|
+
exports.localisedExerciseTitle = localisedExerciseTitle;
|
|
43
|
+
const localisedExerciseInstructions = (locale, exerciseTemplate) => {
|
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
45
|
+
if (exerciseTemplate.is_custom) {
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
48
|
+
return (0, exports.localeSelect)(locale, {
|
|
49
|
+
en: (_b = (_a = exerciseTemplate === null || exerciseTemplate === void 0 ? void 0 : exerciseTemplate.localised_instructions) === null || _a === void 0 ? void 0 : _a.en) !== null && _b !== void 0 ? _b : '',
|
|
50
|
+
pt: (_c = exerciseTemplate === null || exerciseTemplate === void 0 ? void 0 : exerciseTemplate.localised_instructions) === null || _c === void 0 ? void 0 : _c.pt,
|
|
51
|
+
de: (_d = exerciseTemplate === null || exerciseTemplate === void 0 ? void 0 : exerciseTemplate.localised_instructions) === null || _d === void 0 ? void 0 : _d.de,
|
|
52
|
+
es: (_e = exerciseTemplate === null || exerciseTemplate === void 0 ? void 0 : exerciseTemplate.localised_instructions) === null || _e === void 0 ? void 0 : _e.es,
|
|
53
|
+
it: (_f = exerciseTemplate === null || exerciseTemplate === void 0 ? void 0 : exerciseTemplate.localised_instructions) === null || _f === void 0 ? void 0 : _f.it,
|
|
54
|
+
fr: (_g = exerciseTemplate === null || exerciseTemplate === void 0 ? void 0 : exerciseTemplate.localised_instructions) === null || _g === void 0 ? void 0 : _g.fr,
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
exports.localisedExerciseInstructions = localisedExerciseInstructions;
|
|
58
|
+
const localeSelect = (locale, options) => {
|
|
59
|
+
var _a;
|
|
60
|
+
return (_a = options[locale]) !== null && _a !== void 0 ? _a : options.en;
|
|
61
|
+
};
|
|
62
|
+
exports.localeSelect = localeSelect;
|
package/built/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InstructionsLanguage } from './exerciseLocaleUtils';
|
|
1
2
|
import { WorkoutDurationMinutes } from './hevyTrainer';
|
|
2
3
|
import { Language } from './translations';
|
|
3
4
|
import { Lookup } from './typeUtils';
|
|
@@ -22,6 +23,7 @@ export * from './adminPermissions';
|
|
|
22
23
|
export * from './adjustEventTokens';
|
|
23
24
|
export * from './hevyTrainer';
|
|
24
25
|
export * from './translations';
|
|
26
|
+
export * from './exerciseLocaleUtils';
|
|
25
27
|
export type WeightUnit = 'kg' | 'lbs';
|
|
26
28
|
export declare const isWeightUnit: (x: string) => x is WeightUnit;
|
|
27
29
|
export type DistanceUnit = 'kilometers' | 'miles';
|
|
@@ -718,8 +720,6 @@ export interface CustomExercise extends BaseExerciseTemplate {
|
|
|
718
720
|
/** Used for Hevy Coach: in Hevy Coach, changes to a parent template propagate to children, and clients can't edit the children */
|
|
719
721
|
parent_exercise_template_id?: string;
|
|
720
722
|
}
|
|
721
|
-
export declare const supportedInstructionsLanguages: readonly ["en", "it", "de", "es", "fr", "pt"];
|
|
722
|
-
export type InstructionsLanguage = Lookup<typeof supportedInstructionsLanguages>;
|
|
723
723
|
declare const _setPersonalRecordTypes: readonly ["best_weight", "best_reps", "best_volume", "best_1rm", "best_duration", "best_distance", "most_floors", "most_steps"];
|
|
724
724
|
export type SetPersonalRecordType = Lookup<typeof _setPersonalRecordTypes>;
|
|
725
725
|
export declare const isSetPersonalRecordType: (x: string) => x is SetPersonalRecordType;
|
|
@@ -1987,3 +1987,14 @@ export interface GetAccountsByEmailResponse {
|
|
|
1987
1987
|
wellhub_email: string | null;
|
|
1988
1988
|
}[];
|
|
1989
1989
|
}
|
|
1990
|
+
export interface UserReportSummaryBackoffice {
|
|
1991
|
+
reported_by: string;
|
|
1992
|
+
reported_at: string;
|
|
1993
|
+
report_type: string | null;
|
|
1994
|
+
reason: string;
|
|
1995
|
+
data: unknown;
|
|
1996
|
+
}
|
|
1997
|
+
export interface GetReportedUserSummaryBackofficeResponse {
|
|
1998
|
+
username: string;
|
|
1999
|
+
user_reports: UserReportSummaryBackoffice[];
|
|
2000
|
+
}
|
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.isPublicWorkout = exports.isSetType = exports.isRPE = exports.validRpeValues = exports.isSetPersonalRecordType = exports.
|
|
18
|
-
exports.isOAuthScope = exports.supportedScopes = exports.isSuggestedUserSource = exports.isValidUserWorkoutMetricsType = exports.isBodyMeasurementKey = exports.measurementsList = exports.isHevyTrainerRoutine = exports.isWorkoutBiometrics =
|
|
17
|
+
exports.isHeartRateSamples = exports.isPublicWorkout = exports.isSetType = exports.isRPE = exports.validRpeValues = exports.isSetPersonalRecordType = exports.weeklyTrainingFrequencies = exports.isGranularEquipment = exports.granularEquipments = exports.hevyTrainerProgramEquipments = exports.restTimerLengths = 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.simplifiedMuscleGroupToMuscleGroups = 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.parseClientAuthTokenResponse = exports.isCoachRole = exports.isErrorResponse = exports.isLivePRVolumeOption = exports.isTimerVolumeOption = exports.isWeekday = exports.orderedWeekdays = exports.isBodyMeasurementUnit = exports.isDistanceUnitShort = exports.isDistanceUnit = exports.isWeightUnit = void 0;
|
|
18
|
+
exports.isOAuthScope = exports.supportedScopes = exports.isSuggestedUserSource = exports.isValidUserWorkoutMetricsType = exports.isBodyMeasurementKey = exports.measurementsList = exports.isHevyTrainerRoutine = exports.isWorkoutBiometrics = void 0;
|
|
19
19
|
const typeUtils_1 = require("./typeUtils");
|
|
20
20
|
__exportStar(require("./constants"), exports);
|
|
21
21
|
__exportStar(require("./utils"), exports);
|
|
@@ -38,6 +38,7 @@ __exportStar(require("./adminPermissions"), exports);
|
|
|
38
38
|
__exportStar(require("./adjustEventTokens"), exports);
|
|
39
39
|
__exportStar(require("./hevyTrainer"), exports);
|
|
40
40
|
__exportStar(require("./translations"), exports);
|
|
41
|
+
__exportStar(require("./exerciseLocaleUtils"), exports);
|
|
41
42
|
const isWeightUnit = (x) => {
|
|
42
43
|
return x === 'kg' || x === 'lbs';
|
|
43
44
|
};
|
|
@@ -270,14 +271,6 @@ exports.granularEquipments = [
|
|
|
270
271
|
const isGranularEquipment = (x) => (0, typeUtils_1.isInArray)(x, exports.granularEquipments);
|
|
271
272
|
exports.isGranularEquipment = isGranularEquipment;
|
|
272
273
|
exports.weeklyTrainingFrequencies = [1, 2, 3, 4, 5, 6];
|
|
273
|
-
exports.supportedInstructionsLanguages = [
|
|
274
|
-
'en',
|
|
275
|
-
'it',
|
|
276
|
-
'de',
|
|
277
|
-
'es',
|
|
278
|
-
'fr',
|
|
279
|
-
'pt',
|
|
280
|
-
];
|
|
281
274
|
// Workouts
|
|
282
275
|
const _setPersonalRecordTypes = [
|
|
283
276
|
'best_weight',
|