musora-content-services 2.117.2 → 2.117.6

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/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [2.117.6](https://github.com/railroadmedia/musora-content-services/compare/v2.117.5...v2.117.6) (2026-01-13)
6
+
7
+ ### [2.117.5](https://github.com/railroadmedia/musora-content-services/compare/v2.117.4...v2.117.5) (2026-01-13)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **auth:** client platform header on login ([52d5927](https://github.com/railroadmedia/musora-content-services/commit/52d5927fddd79db807440cccd541c09ae8ce770a))
13
+
14
+ ### [2.117.4](https://github.com/railroadmedia/musora-content-services/compare/v2.117.3...v2.117.4) (2026-01-13)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **pins:** user pins local storage ([#704](https://github.com/railroadmedia/musora-content-services/issues/704)) ([ca7c172](https://github.com/railroadmedia/musora-content-services/commit/ca7c1722b759c1a4711a1f6ee2213b7392d2632e))
20
+
21
+ ### [2.117.3](https://github.com/railroadmedia/musora-content-services/compare/v2.117.2...v2.117.3) (2026-01-13)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * resolve foryou issue on mpf ([#703](https://github.com/railroadmedia/musora-content-services/issues/703)) ([3e8f0dd](https://github.com/railroadmedia/musora-content-services/commit/3e8f0ddc60eb51a5c510df6433e1cca1c5f5496a))
27
+
5
28
  ### [2.117.2](https://github.com/railroadmedia/musora-content-services/compare/v2.117.1...v2.117.2) (2026-01-13)
6
29
 
7
30
  ### [2.117.1](https://github.com/railroadmedia/musora-content-services/compare/v2.117.0...v2.117.1) (2026-01-13)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.117.2",
3
+ "version": "2.117.6",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -1,8 +1,6 @@
1
1
  // Metadata is taken from the 'common' element and then merged with the <brand> metadata.
2
2
  // Brand values are prioritized and will override the same property in the 'common' element.
3
3
 
4
- import { ALWAYS_VISIBLE_TABS } from './services/sanity.js'
5
-
6
4
  const PROGRESS_NAMES = ['All', 'In Progress', 'Completed', 'Not Started']
7
5
  const DIFFICULTY_STRINGS = ['Introductory', 'Beginner', 'Intermediate', 'Advanced', 'Expert']
8
6
 
@@ -128,6 +126,13 @@ export class Tabs {
128
126
  static Entertainment = { name: 'Entertainment', short_name: 'Entertainment', value: 'type,Entertainment' }
129
127
  }
130
128
 
129
+ /**
130
+ * Song/Lesson tabs that are always visible.
131
+ *
132
+ * @type {object[]}
133
+ */
134
+ export const ALWAYS_VISIBLE_TABS = [Tabs.ForYou, Tabs.ExploreAll]
135
+
131
136
  export const TabResponseType = {
132
137
  SECTIONS: 'sections',
133
138
  CATALOG: 'catalog',
@@ -16,6 +16,7 @@ import { fetchPlaylist } from '../content-org/playlists.js'
16
16
  import { TabResponseType } from '../../contentMetaData.js'
17
17
  import { PUT } from '../../infrastructure/http/HttpClient.ts'
18
18
 
19
+ export const USER_PIN_PROGRESS_KEY = 'user_pin_progress_row'
19
20
 
20
21
  /**
21
22
  * Fetches and combines recent user progress rows and playlists, excluding certain types and parents.
@@ -33,7 +34,7 @@ import { PUT } from '../../infrastructure/http/HttpClient.ts'
33
34
  export async function getProgressRows({ brand = 'drumeo', limit = 8 } = {}) {
34
35
  const [userPinnedItem, recentPlaylists] = await Promise.all([
35
36
  getUserPinnedItem(brand),
36
- getRecentPlaylists(brand, limit)
37
+ getRecentPlaylists(brand, limit),
37
38
  ])
38
39
  const playlistEngagedOnContent = await getPlaylistEngagedOnContent(recentPlaylists)
39
40
  const [contentCardMap, playlistCards, methodCard] = await Promise.all([
@@ -101,10 +102,10 @@ export async function unpinProgressRow(brand) {
101
102
  }
102
103
 
103
104
  async function getUserPinnedItem(brand) {
104
- const userRaw = await globalConfig.localStorage.getItem('user')
105
- const user = userRaw ? JSON.parse(userRaw) : {}
106
- user.brand_pinned_progress = user.brand_pinned_progress || {}
107
- return user.brand_pinned_progress[brand] ?? null
105
+ const pinnedProgressRaw = await globalConfig.localStorage.getItem(USER_PIN_PROGRESS_KEY)
106
+ let pinnedProgress = pinnedProgressRaw ? JSON.parse(pinnedProgressRaw) : {}
107
+ pinnedProgress = pinnedProgress || {}
108
+ return pinnedProgress[brand] ?? null
108
109
  }
109
110
 
110
111
  /**
@@ -112,7 +113,7 @@ async function getUserPinnedItem(brand) {
112
113
  * If userPinnedItem is not found, generate the pinned card from scratch.
113
114
  *
114
115
  **/
115
- async function popPinnedItem(userPinnedItem, contentCardMap, playlistCards, methodCard){
116
+ async function popPinnedItem(userPinnedItem, contentCardMap, playlistCards, methodCard) {
116
117
  if (!userPinnedItem) return null
117
118
  const pinnedId = parseInt(userPinnedItem.id)
118
119
  const pinnedAt = userPinnedItem.pinnedAt
@@ -126,13 +127,15 @@ async function popPinnedItem(userPinnedItem, contentCardMap, playlistCards, meth
126
127
  } else {
127
128
  // we use fetchByRailContentIds so that we don't have the _type restriction in the query
128
129
  let data = await fetchByRailContentIds([pinnedId], 'progress-tracker')
129
- item = await processContentItem(await addContextToContent(() => data[0] ?? null, {
130
- addNextLesson: true,
131
- addNavigateTo: true,
132
- addProgressStatus: true,
133
- addProgressPercentage: true,
134
- addProgressTimestamp: true,
135
- }))
130
+ item = await processContentItem(
131
+ await addContextToContent(() => data[0] ?? null, {
132
+ addNextLesson: true,
133
+ addNavigateTo: true,
134
+ addProgressStatus: true,
135
+ addProgressPercentage: true,
136
+ addProgressTimestamp: true,
137
+ })
138
+ )
136
139
  }
137
140
  } else if (progressType === 'playlist') {
138
141
  const pinnedPlaylist = playlistCards.find((p) => p.playlist.id === pinnedId)
@@ -197,9 +200,9 @@ function mergeAndSortItems(items, limit) {
197
200
  }
198
201
 
199
202
  async function updateUserPinnedProgressRow(brand, pinnedData) {
200
- const userRaw = await globalConfig.localStorage.getItem('user')
201
- const user = userRaw ? JSON.parse(userRaw) : {}
202
- user.brand_pinned_progress = user.brand_pinned_progress || {}
203
- user.brand_pinned_progress[brand] = pinnedData
204
- await globalConfig.localStorage.setItem('user', JSON.stringify(user))
203
+ const pinnedProgressRaw = await globalConfig.localStorage.getItem(USER_PIN_PROGRESS_KEY)
204
+ let pinnedProgress = pinnedProgressRaw ? JSON.parse(pinnedProgressRaw) : {}
205
+ pinnedProgress = pinnedProgress || {}
206
+ pinnedProgress[brand] = pinnedData
207
+ await globalConfig.localStorage.setItem(USER_PIN_PROGRESS_KEY, JSON.stringify(pinnedProgress))
205
208
  }
@@ -33,7 +33,7 @@ import {
33
33
  SONG_TYPES_WITH_CHILDREN,
34
34
  } from '../contentTypeConfig.js'
35
35
  import { fetchSimilarItems, recommendations } from './recommendations.js'
36
- import { getSongType, processMetadata, Tabs } from '../contentMetaData.js'
36
+ import { getSongType, processMetadata, ALWAYS_VISIBLE_TABS } from '../contentMetaData.js'
37
37
  import { GET } from '../infrastructure/http/HttpClient.ts'
38
38
 
39
39
  import { globalConfig } from './config.js'
@@ -50,13 +50,6 @@ import { fetchRecentActivitiesActiveTabs } from './userActivity.js'
50
50
  */
51
51
  const excludeFromGeneratedIndex = ['fetchRelatedByLicense']
52
52
 
53
- /**
54
- * Song/Lesson tabs that are always visible.
55
- *
56
- * @type {object[]}
57
- */
58
- export const ALWAYS_VISIBLE_TABS = [Tabs.ForYou, Tabs.ExploreAll]
59
-
60
53
  /**
61
54
  * Mapping from tab names to their underlying Sanity content types.
62
55
  * Used to determine if a tab has any content available.
@@ -2,6 +2,7 @@
2
2
  * @module Sessions
3
3
  */
4
4
  import { globalConfig } from '../config.js'
5
+ import { USER_PIN_PROGRESS_KEY } from '../progress-row/base.js'
5
6
  import './types.js'
6
7
 
7
8
  /**
@@ -29,10 +30,10 @@ const excludeFromGeneratedIndex = []
29
30
  */
30
31
  export async function login(email, password, deviceName, deviceToken, platform) {
31
32
  const baseUrl = `${globalConfig.baseUrl}/api/user-management-system`
32
- return fetch(`${baseUrl}/v1/sessions`, {
33
+ const res = await fetch(`${baseUrl}/v1/sessions`, {
33
34
  method: 'POST',
34
35
  headers: {
35
- 'X-Client-Platform': 'mobile',
36
+ 'X-Client-Platform': globalConfig.isMA ? 'mobile' : 'web',
36
37
  'Content-Type': 'application/json',
37
38
  Authorization: null,
38
39
  },
@@ -44,6 +45,17 @@ export async function login(email, password, deviceName, deviceToken, platform)
44
45
  platform: platform,
45
46
  }),
46
47
  })
48
+
49
+ // TODO: refactor this. I don't think this is the place for it but we need it fixed for the system test
50
+ if (res.ok) {
51
+ const user = await res.json()
52
+
53
+ globalConfig.localStorage.setItem(
54
+ USER_PIN_PROGRESS_KEY,
55
+ JSON.stringify(user.pinned_progress_rows || {})
56
+ )
57
+ }
58
+ return res
47
59
  }
48
60
  //Removing 3rdParty OAuth2 for now => https://musora.atlassian.net/browse/BEH-624?focusedCommentId=21492
49
61
  /*export async function loginWithProvider(provider, providerIdToken, deviceToken, deviceName, platform) {