hevy-shared 1.0.960 → 1.0.962

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.
Files changed (88) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc +21 -0
  3. package/.github/workflows/ci.yml +15 -0
  4. package/.github/workflows/npm-publish.yml +59 -0
  5. package/.github/workflows/pr-auto-assign.yml +15 -0
  6. package/.prettierrc.js +5 -0
  7. package/README.md +2 -17
  8. package/built/chat.d.ts +23 -25
  9. package/built/coachPlans.d.ts +1 -2
  10. package/built/coachPlans.js +2 -2
  11. package/built/filterExercises.d.ts +3 -19
  12. package/built/filterExercises.js +60 -72
  13. package/built/index.d.ts +304 -1140
  14. package/built/index.js +75 -269
  15. package/built/setIndicatorUtils.d.ts +3 -4
  16. package/built/setIndicatorUtils.js +1 -15
  17. package/built/tests/utils.test.js +0 -748
  18. package/built/tests/workoutVolume.test.js +49 -165
  19. package/built/units.d.ts +7 -14
  20. package/built/units.js +14 -24
  21. package/built/utils.d.ts +5 -192
  22. package/built/utils.js +85 -598
  23. package/built/websocket.d.ts +2 -14
  24. package/built/workoutVolume.d.ts +5 -24
  25. package/built/workoutVolume.js +34 -25
  26. package/jest.config.js +4 -0
  27. package/package.json +10 -32
  28. package/src/chat.ts +130 -0
  29. package/src/coachPlans.ts +57 -0
  30. package/src/constants.ts +14 -0
  31. package/src/filterExercises.ts +222 -0
  32. package/src/index.ts +1576 -0
  33. package/src/setIndicatorUtils.ts +137 -0
  34. package/src/tests/utils.test.ts +156 -0
  35. package/src/tests/workoutVolume.test.ts +93 -0
  36. package/src/units.ts +41 -0
  37. package/src/utils.ts +516 -0
  38. package/src/websocket.ts +36 -0
  39. package/src/workoutVolume.ts +175 -0
  40. package/tsconfig.json +70 -0
  41. package/built/API/APIClient.d.ts +0 -157
  42. package/built/API/APIClient.js +0 -381
  43. package/built/API/index.d.ts +0 -2
  44. package/built/API/index.js +0 -18
  45. package/built/API/types.d.ts +0 -38
  46. package/built/API/types.js +0 -18
  47. package/built/adjustEventTokens.d.ts +0 -16
  48. package/built/adjustEventTokens.js +0 -18
  49. package/built/adminPermissions.d.ts +0 -4
  50. package/built/adminPermissions.js +0 -22
  51. package/built/async.d.ts +0 -50
  52. package/built/async.js +0 -170
  53. package/built/cue.d.ts +0 -12
  54. package/built/cue.js +0 -22
  55. package/built/exerciseLocaleUtils.d.ts +0 -17
  56. package/built/exerciseLocaleUtils.js +0 -62
  57. package/built/hevyTrainer.d.ts +0 -250
  58. package/built/hevyTrainer.js +0 -676
  59. package/built/muscleHeatmaps.d.ts +0 -31
  60. package/built/muscleHeatmaps.js +0 -68
  61. package/built/muscleSplits.d.ts +0 -36
  62. package/built/muscleSplits.js +0 -100
  63. package/built/normalizedWorkoutUtils.d.ts +0 -88
  64. package/built/normalizedWorkoutUtils.js +0 -112
  65. package/built/notifications.d.ts +0 -215
  66. package/built/notifications.js +0 -9
  67. package/built/routineUtils.d.ts +0 -14
  68. package/built/routineUtils.js +0 -186
  69. package/built/schemas.d.ts +0 -6
  70. package/built/schemas.js +0 -12
  71. package/built/tests/async.test.d.ts +0 -1
  72. package/built/tests/async.test.js +0 -49
  73. package/built/tests/hevyTrainer.test.d.ts +0 -1
  74. package/built/tests/hevyTrainer.test.js +0 -1199
  75. package/built/tests/muscleSplit.test.d.ts +0 -1
  76. package/built/tests/muscleSplit.test.js +0 -153
  77. package/built/tests/routineUtils.test.d.ts +0 -1
  78. package/built/tests/routineUtils.test.js +0 -745
  79. package/built/tests/testUtils.d.ts +0 -85
  80. package/built/tests/testUtils.js +0 -319
  81. package/built/translations/index.d.ts +0 -2
  82. package/built/translations/index.js +0 -18
  83. package/built/translations/translationUtils.d.ts +0 -2
  84. package/built/translations/translationUtils.js +0 -61
  85. package/built/translations/types.d.ts +0 -8
  86. package/built/translations/types.js +0 -20
  87. package/built/typeUtils.d.ts +0 -70
  88. package/built/typeUtils.js +0 -55
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ built
package/.eslintrc ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "root": true,
3
+ "parser": "@typescript-eslint/parser",
4
+ "plugins": [
5
+ "@typescript-eslint"
6
+ ],
7
+ "extends": [
8
+ "eslint:recommended",
9
+ "plugin:@typescript-eslint/eslint-recommended",
10
+ "plugin:@typescript-eslint/recommended",
11
+ "plugin:prettier/recommended"
12
+ ],
13
+ "rules": {
14
+ "@typescript-eslint/no-extra-boolean-cast": "off",
15
+ "@typescript-eslint/no-inferrable-types": "off",
16
+ "no-extra-boolean-cast": "off",
17
+ "@typescript-eslint/ban-types": "off",
18
+ "@typescript-eslint/no-explicit-any": "off",
19
+ "@typescript-eslint/no-unused-vars": "error"
20
+ }
21
+ }
@@ -0,0 +1,15 @@
1
+ name: CI
2
+ on: push
3
+ jobs:
4
+ build:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v2
8
+ - name: Install modules
9
+ run: npm install
10
+ - name: Run tests
11
+ run: npm run test
12
+ - name: Run Types
13
+ run: npm run types
14
+ - name: Run Linting
15
+ run: npm run lint
@@ -0,0 +1,59 @@
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ push:
8
+ branches: master
9
+ workflow_dispatch:
10
+ inputs:
11
+ version:
12
+ required: false
13
+ type: string
14
+
15
+ jobs:
16
+ publish-npm:
17
+ permissions:
18
+ id-token: write # for publishing to npm via oidc
19
+ contents: write # actions/checkout needs read, git tag needs write
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v3
23
+ - uses: actions/setup-node@v4
24
+ with:
25
+ node-version: '20.17.0'
26
+ registry-url: https://registry.npmjs.org/
27
+ - name: Set git user info
28
+ run: |
29
+ git config --global user.email "ci@hevyapp.com"
30
+ git config --global user.name "ci"
31
+ - name: Update npm # needs 11.5.1+ for Trusted Publishing
32
+ run: npm install -g npm@11.5.1
33
+ - run: npm ci
34
+ - run: npm run types
35
+ - run: npm run lint
36
+ - run: npm run test
37
+ - name: Set npm version
38
+ run: |
39
+ npm config set allow-same-version true
40
+ npm config set git-tag-version false
41
+ if [ -z "${{ inputs.version }}" ]; then
42
+ echo 'Latest version currenly on npm:' >&2
43
+ npm version $(npm show hevy-shared version) >&2
44
+ echo 'New version:' >&2
45
+ VERSION="$(npm version patch)"
46
+ echo $VERSION >&2
47
+ echo "NPM_VERSION=$VERSION" >>"$GITHUB_ENV"
48
+ else
49
+ echo 'Override version:' >&2
50
+ VERSION="$(npm version ${{ inputs.version }})"
51
+ echo $VERSION >&2
52
+ echo "NPM_VERSION=$VERSION" >>"$GITHUB_ENV"
53
+ fi
54
+ - name: Tag release
55
+ run: |
56
+ git tag "$NPM_VERSION"
57
+ git push --tags
58
+ - run: npm run build
59
+ - run: npm publish
@@ -0,0 +1,15 @@
1
+ name: PR Auto-Assign
2
+
3
+ on:
4
+ pull_request_target:
5
+ types: [opened]
6
+
7
+ jobs:
8
+ assign:
9
+ name: Auto-assign PR to author
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - env:
13
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14
+ run: |
15
+ gh pr edit ${{ github.event.number }} --add-assignee ${{ github.event.sender.login }} -R ${{ github.event.repository.full_name }}
package/.prettierrc.js ADDED
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ singleQuote: true,
3
+ tabWidth: 2,
4
+ trailingComma: 'all',
5
+ };
package/README.md CHANGED
@@ -1,20 +1,5 @@
1
1
  # hevy-shared
2
2
  Common code shared by the other repos.
3
3
 
4
- ## Publishing to npm
5
-
6
- There are two ways of publishing a new version of `hevy-shared` to npm.
7
-
8
- ### Automatically
9
-
10
- Merging PRs to `master` will automatically trigger the publishing of a new patch version to npm using Github Actions (see .github/workflows). Go to https://www.npmjs.com/package/hevy-shared for more information.
11
-
12
- **Important note:** Please do **NOT** merge your `hevy-shared` PRs into `master` until _all_ the other repos (regardless of whether they use npm or Git submodules) which depend on your `hevy-shared` PR have their respective PRs merged into their respective main branches.
13
- Doing so should help avoid type errors and conflicts more than doing it the other way around, even though they can still happen.
14
-
15
- ### Manually
16
-
17
- To publish manually, run `npm run ci-build` _on the branch of your choice_. This is useful if you need to get your changes into a repo which doesn't use Git submodules.
18
-
19
- Running the command will print the next unused version number, which should be the version of the newly published package. You will just have to wait until it's actually published before you can install it.
20
- You can run `npm view hevy-shared version` to check the current `latest` version that's available on npm at any given moment.
4
+ ## Deploying
5
+ Merging PRs to `master` will automatically trigger the deployment of a new patch version to npm using github actions (see ./github/workflows). Go to https://www.npmjs.com/package/hevy-shared for more information
package/built/chat.d.ts CHANGED
@@ -6,15 +6,7 @@ export interface PostCreateConversationResponse {
6
6
  }
7
7
  export interface PostMessageRequest {
8
8
  conversation_id: string;
9
- data: CreateTextMessageData | CreateVideoMessageData | CreateImageMessageData;
10
- }
11
- export interface PostGetDeletedMessagesRequest {
12
- messages_deleted_since_time?: string;
13
- conversation_id: string;
14
- }
15
- export interface PostDeletedMessagesResponse {
16
- deleted_message_ids: string[];
17
- checked_at_time: string;
9
+ data: CreateTextMessageData | CreateNewWorkoutMessageData | CreateNewBodyMeasurementMesageData;
18
10
  }
19
11
  export interface PostMessageResponse {
20
12
  message_id: string;
@@ -23,13 +15,13 @@ export interface CreateTextMessageData {
23
15
  type: 'text';
24
16
  text: string;
25
17
  }
26
- export interface CreateVideoMessageData {
27
- type: 'video';
28
- video_url: string;
18
+ export interface CreateNewWorkoutMessageData {
19
+ type: 'new-workout';
20
+ workout_id: string;
29
21
  }
30
- export interface CreateImageMessageData {
31
- type: 'image';
32
- image_url: string;
22
+ export interface CreateNewBodyMeasurementMesageData {
23
+ type: 'new-body-measurement';
24
+ measurement_id: number;
33
25
  }
34
26
  export interface GetLatestMessageFromAllClientsResponse {
35
27
  conversations: {
@@ -56,7 +48,7 @@ export interface Conversation {
56
48
  conversation_id: string;
57
49
  user_ids: string[];
58
50
  }
59
- export type MessageType = 'text' | 'video' | 'image';
51
+ export type MessageType = 'text' | 'new-workout' | 'new-body-measurement';
60
52
  export interface MessageBase {
61
53
  id: string;
62
54
  sender_user_id: string;
@@ -68,15 +60,21 @@ export interface TextMessage extends MessageBase {
68
60
  type: 'text';
69
61
  text: string;
70
62
  }
71
- export interface VideoMessage extends MessageBase {
72
- type: 'video';
73
- video_url: string;
63
+ export interface NewWorkoutMessageData {
64
+ workout_id: string;
65
+ }
66
+ export interface NewWorkoutMessage extends MessageBase {
67
+ type: 'new-workout';
68
+ data: NewWorkoutMessageData;
69
+ }
70
+ export interface NewBodyMeasurementMessageData {
71
+ measurement_id: number;
74
72
  }
75
- export interface ImageMessage extends MessageBase {
76
- type: 'image';
77
- image_url: string;
73
+ export interface NewBodyMeasurementMessage extends MessageBase {
74
+ type: 'new-body-measurement';
75
+ data: NewBodyMeasurementMessageData;
78
76
  }
79
- export type Message = TextMessage | VideoMessage | ImageMessage;
77
+ export type Message = TextMessage | NewWorkoutMessage | NewBodyMeasurementMessage;
80
78
  export declare const isMessage: (message?: any) => message is Message;
81
79
  export interface NewMessageChatUpdate {
82
80
  type: 'new-message';
@@ -91,5 +89,5 @@ export interface NewConversationChatUpdate {
91
89
  conversation_id: string;
92
90
  conversation_users: string[];
93
91
  }
94
- export type HevyChatUpdateMobilePushData = NewMessageChatUpdate | MessageDeletedChatUpdate | NewConversationChatUpdate;
95
- export declare const isHevyChatUpdatePush: (message?: any) => message is HevyChatUpdateMobilePushData;
92
+ export type HevyChatUpdatePush = NewMessageChatUpdate | MessageDeletedChatUpdate | NewConversationChatUpdate;
93
+ export declare const isHevyChatUpdatePush: (message?: any) => message is HevyChatUpdatePush;
@@ -1,11 +1,10 @@
1
1
  export declare const HevyCoachDefaultPlan: Plan;
2
- export type PlanType = 'none' | 'paid_paddle' | 'trial' | 'beta';
2
+ export type PlanType = 'default' | 'paid_paddle' | 'trial' | 'beta';
3
3
  export interface Plan {
4
4
  title: string;
5
5
  maximum_clients: number;
6
6
  id: string;
7
7
  paddle_update_payment_url?: string;
8
- paddle_subscription_id?: number;
9
8
  renewal_period: 'monthly' | 'lifetime';
10
9
  renewal_price?: string;
11
10
  renewal_currency?: string;
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HevyCoachDefaultPlan = void 0;
4
4
  exports.HevyCoachDefaultPlan = {
5
- maximum_clients: 0,
5
+ maximum_clients: 3,
6
6
  id: 'hevy_coach_free',
7
7
  title: 'Free',
8
8
  renewal_period: 'lifetime',
9
- type: 'none',
9
+ type: 'default',
10
10
  };
@@ -1,19 +1,7 @@
1
- import { EquipmentFilter, LibraryExercise, MuscleGroupFilter, CustomExercise } from './index';
2
- import { Language } from './translations';
3
- export interface SearchableLibraryExercise extends LibraryExercise {
1
+ import { EquipmentFilter, ExerciseTemplate, Language, MuscleGroupFilter } from './index';
2
+ export interface SearchableExerciseTemplate extends ExerciseTemplate {
4
3
  localized_muscle_group_name: string;
5
4
  }
6
- export interface SearchableCustomExercise extends CustomExercise {
7
- localized_muscle_group_name: string;
8
- }
9
- export type SearchableExerciseTemplate = SearchableLibraryExercise | SearchableCustomExercise;
10
- export interface SearchableLibraryExerciseWithStringScore<T = number> extends SearchableLibraryExercise {
11
- searchStringScore?: T;
12
- }
13
- export interface SearchableCustomExerciseWithStringScore<T = number> extends SearchableCustomExercise {
14
- searchStringScore?: T;
15
- }
16
- export type SearchableExerciseTemplateWithStringScore<T = number> = SearchableLibraryExerciseWithStringScore<T> | SearchableCustomExerciseWithStringScore<T>;
17
5
  interface FilterExercisesProps {
18
6
  exercises: SearchableExerciseTemplate[];
19
7
  muscleGroupFilter: MuscleGroupFilter;
@@ -21,11 +9,7 @@ interface FilterExercisesProps {
21
9
  searchText: string;
22
10
  language: Language;
23
11
  }
24
- export declare const getExerciseMatches: ({ exercises, muscleGroupFilter, equipmentType, searchText, language, }: FilterExercisesProps) => ExerciseSearchMatch<SearchableExerciseTemplate>[];
25
- export type ExerciseSearchMatch<T> = {
26
- exercise: T;
27
- matchType: 'title' | 'muscle_group' | 'other' | 'custom';
28
- };
12
+ export declare const filterExercises: ({ exercises, muscleGroupFilter, equipmentType, searchText, language, }: FilterExercisesProps) => ExerciseTemplate[];
29
13
  /**
30
14
  * Exercise templates that are shown at the top of the Exercise Library to
31
15
  * users who don't have any workouts logged.
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.popularExerciseTemplateIds = exports.getExerciseMatches = void 0;
4
- const utils_1 = require("./utils");
3
+ exports.popularExerciseTemplateIds = exports.filterExercises = void 0;
5
4
  const lodash_1 = require("lodash");
6
- const getExerciseMatches = ({ exercises, muscleGroupFilter, equipmentType, searchText, language, }) => {
5
+ const utils_1 = require("./utils");
6
+ const filterExercises = ({ exercises, muscleGroupFilter, equipmentType, searchText, language, }) => {
7
7
  let result = exercises;
8
8
  result = filterExercisesWithMuscleGroup(muscleGroupFilter, result);
9
9
  result = filterExercisesWithEquipment(equipmentType, result);
10
10
  const normalizedSearchText = normalizeSearchText(searchText, language);
11
- let matches = filterExercisesWithSearchText(normalizedSearchText, result, language);
12
- matches = orderExercisesWithSearchText(normalizedSearchText, matches);
13
- return matches;
11
+ result = filterExercisesWithSearchText(normalizedSearchText, result, language);
12
+ result = orderExercisesWithSearchText(normalizedSearchText, result);
13
+ return result;
14
14
  };
15
- exports.getExerciseMatches = getExerciseMatches;
15
+ exports.filterExercises = filterExercises;
16
16
  const filterExercisesWithMuscleGroup = (muscleGroup, exercises) => {
17
17
  if (muscleGroup === 'all_muscles') {
18
18
  return exercises;
@@ -25,52 +25,41 @@ const filterExercisesWithEquipment = (equipmentType, exercises) => {
25
25
  }
26
26
  return exercises.filter((rd) => rd.equipment_category === equipmentType);
27
27
  };
28
- // Old filter exercise functionality, will be removed when new feature goes live
29
28
  const filterExercisesWithSearchText = (searchText, exercises, language) => {
30
29
  if (searchText.length === 0) {
31
- return exercises.map((e) => ({ exercise: e, matchType: 'other' }));
30
+ return exercises;
32
31
  }
33
- const matches = [];
34
- for (const e of exercises) {
32
+ return exercises.filter((e) => {
35
33
  const searchableSearchText = searchable(searchText);
36
34
  const searchableEnglishTitle = searchable(e.title);
37
- const searchableLocalizedTitleMap = !e.is_custom
38
- ? {
39
- en: searchable(e.title),
40
- es: e.es_title ? searchable(e.es_title) : undefined,
41
- de: e.de_title ? searchable(e.de_title) : undefined,
42
- fr: e.fr_title ? searchable(e.fr_title) : undefined,
43
- it: e.it_title ? searchable(e.it_title) : undefined,
44
- pt: e.pt_title ? searchable(e.pt_title) : undefined,
45
- tr: e.tr_title ? searchable(e.tr_title) : undefined,
46
- zh_CN: e.zh_cn_title ? searchable(e.zh_cn_title) : undefined,
47
- zh_TW: e.zh_tw_title ? searchable(e.zh_tw_title) : undefined,
48
- ru: e.ru_title ? searchable(e.ru_title) : undefined,
49
- ja: e.ja_title ? searchable(e.ja_title) : undefined,
50
- ko: e.ko_title ? searchable(e.ko_title) : undefined,
51
- }
52
- : {
53
- en: searchable(e.title),
54
- };
35
+ const searchableLocalizedTitleMap = {
36
+ en: searchable(e.title),
37
+ es: e.es_title ? searchable(e.es_title) : undefined,
38
+ de: e.de_title ? searchable(e.de_title) : undefined,
39
+ fr: e.fr_title ? searchable(e.fr_title) : undefined,
40
+ it: e.it_title ? searchable(e.it_title) : undefined,
41
+ pt: e.pt_title ? searchable(e.pt_title) : undefined,
42
+ tr: e.tr_title ? searchable(e.tr_title) : undefined,
43
+ zh_CN: e.zh_cn_title ? searchable(e.zh_cn_title) : undefined,
44
+ zh_TW: e.zh_tw_title ? searchable(e.zh_tw_title) : undefined,
45
+ ru: e.ru_title ? searchable(e.ru_title) : undefined,
46
+ ja: e.ja_title ? searchable(e.ja_title) : undefined,
47
+ ko: e.ko_title ? searchable(e.ko_title) : undefined,
48
+ };
55
49
  const searchableLocalizedTitle = searchableLocalizedTitleMap[language] || searchableLocalizedTitleMap.en;
56
50
  const searchableLocalizedMuscleGroupName = searchable(e.localized_muscle_group_name);
57
51
  const searchableMuscleGroup = searchable(e.muscle_group);
58
52
  const searchableMisspelledDumbbellEquipment = e.equipment_category === 'dumbbell' ? 'dumbell' : '';
59
- const searchableTags = !e.is_custom && e.manual_tag ? searchable(e.manual_tag) : '';
60
- const searchableAka = !e.is_custom && e.aka ? searchable(e.aka) : '';
53
+ const searchableTags = e.manual_tag ? searchable(e.manual_tag) : '';
54
+ const searchableAka = e.aka ? searchable(e.aka) : '';
61
55
  if (searchableLocalizedTitle.includes(searchableSearchText) ||
62
- searchableEnglishTitle.includes(searchableSearchText)) {
63
- matches.push({ exercise: e, matchType: 'title' });
64
- continue;
65
- }
66
- else if (searchableLocalizedMuscleGroupName.includes(searchableSearchText) ||
56
+ searchableEnglishTitle.includes(searchableSearchText) ||
57
+ searchableLocalizedMuscleGroupName.includes(searchableSearchText) ||
67
58
  searchableMuscleGroup.includes(searchableSearchText)) {
68
- matches.push({ exercise: e, matchType: 'muscle_group' });
69
- continue;
59
+ return true;
70
60
  }
71
61
  if (e.is_custom && 'custom'.includes(searchableSearchText)) {
72
- matches.push({ exercise: e, matchType: 'custom' });
73
- continue;
62
+ return true;
74
63
  }
75
64
  const splitSearch = searchableSearchText.split(' ');
76
65
  const splitTitle = [
@@ -86,29 +75,28 @@ const filterExercisesWithSearchText = (searchText, exercises, language) => {
86
75
  // title ['arnold', 'press', '(barbell)']
87
76
  // search ['press', 'bar']
88
77
  if ((0, lodash_1.intersectionWith)(splitSearch, splitTitle, (search, title) => title.includes(search)).length === splitSearch.length) {
89
- matches.push({ exercise: e, matchType: 'other' });
90
- continue;
78
+ return true;
91
79
  }
92
- }
93
- return matches;
80
+ return false;
81
+ });
94
82
  };
95
- const orderExercisesWithSearchText = (searchText, exerciseMatches) => {
83
+ const orderExercisesWithSearchText = (searchText, exercises) => {
96
84
  if (searchText.length === 0) {
97
- return exerciseMatches;
85
+ return exercises;
98
86
  }
99
- return exerciseMatches
100
- .reduce((accu, currentMatch) => {
101
- const lowercaseTitle = currentMatch.exercise.title.toLowerCase();
87
+ return exercises
88
+ .reduce((accu, currentExercise) => {
89
+ const lowercaseTitle = currentExercise.title.toLowerCase();
102
90
  if (lowercaseTitle.startsWith(searchText)) {
103
91
  accu.push({
104
- exercise: currentMatch,
105
- weight: currentMatch.exercise.priority * 2,
92
+ exercise: currentExercise,
93
+ weight: currentExercise.priority * 2,
106
94
  });
107
95
  return accu;
108
96
  }
109
97
  accu.push({
110
- exercise: currentMatch,
111
- weight: currentMatch.exercise.priority,
98
+ exercise: currentExercise,
99
+ weight: currentExercise.priority,
112
100
  });
113
101
  return accu;
114
102
  }, [])
@@ -138,24 +126,24 @@ const searchable = (str) => {
138
126
  * users who don't have any workouts logged.
139
127
  */
140
128
  exports.popularExerciseTemplateIds = [
141
- 'B8127AD1', // Lying Leg Curl (Machine)"
142
- '11A123F3', // Seated Leg Curl (Machine)"
143
- 'D04AC939', // Squat (Barbell)"
144
- '75A4F6C4', // Leg Extension (Machine)"
145
- '422B08F1', // Lateral Raise (Dumbbell)"
146
- 'C7973E0E', // Leg Press (Machine)"
147
- '07B38369', // Incline Bench Press (Dumbbell)"
148
- '3601968B', // Bench Press (Dumbbell)"
149
- '6A6C31A5', // Lat Pulldown (Cable)"
150
- '0393F233', // Seated Cable Row - V Grip (Cable)"
151
- '37FCC2BB', // Bicep Curl (Dumbbell)"
152
- '55E6546F', // Bent Over Row (Barbell)"
153
- '94B7239B', // Triceps Rope Pushdown"
154
- 'C6272009', // Deadlift (Barbell)"
155
- '878CD1D0', // Shoulder Press (Dumbbell)"
156
- '651F844C', // Cable Fly Crossovers"
157
- '79D0BB3A', // Bench Press (Barbell)"
158
- '93A552C6', // Triceps Pushdown"
159
- '7E3BC8B6', // Hammer Curl (Dumbbell)"
129
+ 'B8127AD1',
130
+ '11A123F3',
131
+ 'D04AC939',
132
+ '75A4F6C4',
133
+ '422B08F1',
134
+ 'C7973E0E',
135
+ '07B38369',
136
+ '3601968B',
137
+ '6A6C31A5',
138
+ '0393F233',
139
+ '37FCC2BB',
140
+ '55E6546F',
141
+ '94B7239B',
142
+ 'C6272009',
143
+ '878CD1D0',
144
+ '651F844C',
145
+ '79D0BB3A',
146
+ '93A552C6',
147
+ '7E3BC8B6',
160
148
  'BE640BA0', // Face Pull
161
149
  ];