musora-content-services 2.117.3 → 2.117.7
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.7](https://github.com/railroadmedia/musora-content-services/compare/v2.117.6...v2.117.7) (2026-01-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **auth:** login data ([a1b72d8](https://github.com/railroadmedia/musora-content-services/commit/a1b72d8145e230cfc850e208f147080c7ef8c6df))
|
|
11
|
+
|
|
12
|
+
### [2.117.6](https://github.com/railroadmedia/musora-content-services/compare/v2.117.5...v2.117.6) (2026-01-13)
|
|
13
|
+
|
|
14
|
+
### [2.117.5](https://github.com/railroadmedia/musora-content-services/compare/v2.117.4...v2.117.5) (2026-01-13)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **auth:** client platform header on login ([52d5927](https://github.com/railroadmedia/musora-content-services/commit/52d5927fddd79db807440cccd541c09ae8ce770a))
|
|
20
|
+
|
|
21
|
+
### [2.117.4](https://github.com/railroadmedia/musora-content-services/compare/v2.117.3...v2.117.4) (2026-01-13)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **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))
|
|
27
|
+
|
|
5
28
|
### [2.117.3](https://github.com/railroadmedia/musora-content-services/compare/v2.117.2...v2.117.3) (2026-01-13)
|
|
6
29
|
|
|
7
30
|
|
package/package.json
CHANGED
|
@@ -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
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return
|
|
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(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
await globalConfig.localStorage.setItem(
|
|
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
|
}
|
|
@@ -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
|
-
|
|
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,18 @@ export async function login(email, password, deviceName, deviceToken, platform)
|
|
|
44
45
|
platform: platform,
|
|
45
46
|
}),
|
|
46
47
|
})
|
|
48
|
+
|
|
49
|
+
const data = await res.json()
|
|
50
|
+
|
|
51
|
+
// TODO: refactor this. I don't think this is the place for it but we need it fixed for the system test
|
|
52
|
+
if (res.ok) {
|
|
53
|
+
globalConfig.localStorage.setItem(
|
|
54
|
+
USER_PIN_PROGRESS_KEY,
|
|
55
|
+
JSON.stringify(data.pinned_progress_rows || {})
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return data
|
|
47
60
|
}
|
|
48
61
|
//Removing 3rdParty OAuth2 for now => https://musora.atlassian.net/browse/BEH-624?focusedCommentId=21492
|
|
49
62
|
/*export async function loginWithProvider(provider, providerIdToken, deviceToken, deviceName, platform) {
|