musora-content-services 2.142.0 → 2.143.1
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,20 @@
|
|
|
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.143.1](https://github.com/railroadmedia/musora-content-services/compare/v2.143.0...v2.143.1) (2026-03-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **progress-row:** get children count without looking at permissions ([#885](https://github.com/railroadmedia/musora-content-services/issues/885)) ([0bf807c](https://github.com/railroadmedia/musora-content-services/commit/0bf807c330724c894d2a34df180326219df280dc))
|
|
11
|
+
|
|
12
|
+
## [2.143.0](https://github.com/railroadmedia/musora-content-services/compare/v2.142.0...v2.143.0) (2026-03-25)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **MU2-1407:** account setup updates ([#874](https://github.com/railroadmedia/musora-content-services/issues/874)) ([c8c2322](https://github.com/railroadmedia/musora-content-services/commit/c8c2322d0949bc37e348c57d5a79dcf3ed151188))
|
|
18
|
+
|
|
5
19
|
## [2.142.0](https://github.com/railroadmedia/musora-content-services/compare/v2.141.2...v2.142.0) (2026-03-25)
|
|
6
20
|
|
|
7
21
|
|
package/package.json
CHANGED
|
@@ -19,31 +19,32 @@ import { PARENT_ID_TOP_LEVEL } from '../../sync/models/ContentProgress'
|
|
|
19
19
|
* Fetch any content IDs with some progress, include the userPinnedItem,
|
|
20
20
|
* and generate a map of the cards keyed by the content IDs
|
|
21
21
|
*/
|
|
22
|
-
export async function getContentCardMap(brand, limit, userPinnedItem
|
|
22
|
+
export async function getContentCardMap(brand, limit, userPinnedItem) {
|
|
23
23
|
const metadata = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
brand: brand,
|
|
25
|
+
contentTypes: Object.values(recentTypes.homeRow),
|
|
26
|
+
parentId: PARENT_ID_TOP_LEVEL,
|
|
27
|
+
}
|
|
28
28
|
let recentContentIds = await getAllStartedOrCompleted({ metadata, limit })
|
|
29
29
|
if (userPinnedItem?.progressType === 'content') {
|
|
30
30
|
recentContentIds.push(userPinnedItem.id)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
let contents =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
let contents =
|
|
34
|
+
recentContentIds.length > 0
|
|
35
|
+
? await addContextToContent(
|
|
36
|
+
fetchByRailContentIds,
|
|
37
|
+
recentContentIds,
|
|
38
|
+
'progress-tracker',
|
|
39
|
+
brand,
|
|
40
|
+
{
|
|
41
|
+
addNavigateTo: true,
|
|
42
|
+
addProgressStatus: true,
|
|
43
|
+
addProgressPercentage: true,
|
|
44
|
+
addProgressTimestamp: true,
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
: []
|
|
47
48
|
contents = postProcessBadge(contents)
|
|
48
49
|
|
|
49
50
|
const contentCards = await Promise.all(generateContentPromises(contents))
|
|
@@ -62,7 +63,8 @@ function generateContentPromises(contents) {
|
|
|
62
63
|
contents.forEach((content) => {
|
|
63
64
|
const type = content.type
|
|
64
65
|
if (!allRecentTypeSet.has(type)) return
|
|
65
|
-
let childHasParent =
|
|
66
|
+
let childHasParent =
|
|
67
|
+
Array.isArray(content.parent_content_data) && content.parent_content_data.length > 0
|
|
66
68
|
if (!childHasParent) {
|
|
67
69
|
promises.push(processContentItem(content))
|
|
68
70
|
if (showsLessonTypes.includes(type)) {
|
|
@@ -80,7 +82,7 @@ export async function processContentItem(content) {
|
|
|
80
82
|
const isLive = content.isLive ?? false
|
|
81
83
|
let ctaText = getDefaultCTATextForContent(content, contentType)
|
|
82
84
|
|
|
83
|
-
const {completedChildren, allChildren} = await getCompletedChildren(content, contentType)
|
|
85
|
+
const { completedChildren, allChildren } = await getCompletedChildren(content, contentType)
|
|
84
86
|
content.completed_children = completedChildren
|
|
85
87
|
content.all_children = allChildren
|
|
86
88
|
|
|
@@ -125,7 +127,7 @@ export async function processContentItem(content) {
|
|
|
125
127
|
isLocked: content.is_locked ?? false,
|
|
126
128
|
subtitle:
|
|
127
129
|
collectionLessonTypes.includes(content.type) || content.lesson_count > 1
|
|
128
|
-
? `${content.completed_children} of ${content.all_children ?? content.lesson_count ?? content.child_count} Lessons Complete`
|
|
130
|
+
? `${content.completed_children ?? 0} of ${content.all_children ?? content.lesson_count ?? content.child_count} Lessons Complete`
|
|
129
131
|
: (contentType === 'lesson' || contentType === 'show') && isLive === false
|
|
130
132
|
? `${content.progressPercentage}% Complete`
|
|
131
133
|
: `${content.difficulty_string} • ${content.artist_name}`,
|
|
@@ -163,8 +165,9 @@ function getDefaultCTATextForContent(content, contentType) {
|
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
async function getCompletedChildren(content, contentType) {
|
|
166
|
-
let completedChildren =
|
|
167
|
-
let allChildren =
|
|
168
|
+
let completedChildren = 0
|
|
169
|
+
let allChildren = 0
|
|
170
|
+
|
|
168
171
|
if (contentType === 'show') {
|
|
169
172
|
const shows = await addContextToContent(fetchShows, content.brand, content.type, {
|
|
170
173
|
addProgressStatus: true,
|
|
@@ -173,7 +176,7 @@ async function getCompletedChildren(content, contentType) {
|
|
|
173
176
|
(show) => show.progressStatus === 'completed'
|
|
174
177
|
).length
|
|
175
178
|
allChildren = Object.values(shows).length
|
|
176
|
-
} else if (content.
|
|
179
|
+
} else if (content.children.length > 0) {
|
|
177
180
|
const lessonIds = getLeafNodes(content)
|
|
178
181
|
const progressOnItems = await getProgressStateByIds(lessonIds)
|
|
179
182
|
completedChildren = Array.from(progressOnItems.values()).filter(
|
|
@@ -181,7 +184,8 @@ async function getCompletedChildren(content, contentType) {
|
|
|
181
184
|
).length
|
|
182
185
|
allChildren = lessonIds.length
|
|
183
186
|
}
|
|
184
|
-
|
|
187
|
+
|
|
188
|
+
return { completedChildren, allChildren }
|
|
185
189
|
}
|
|
186
190
|
|
|
187
191
|
function getLeafNodes(content) {
|
|
@@ -43,6 +43,7 @@ export interface AccountSetupProps {
|
|
|
43
43
|
revenuecatAppUserId?: string
|
|
44
44
|
deviceName?: string
|
|
45
45
|
from?: string
|
|
46
|
+
hasSkippedPaywall?: boolean
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
export interface AccountSetupResponse {
|
|
@@ -66,7 +67,11 @@ export interface AccountSetupResponse {
|
|
|
66
67
|
*/
|
|
67
68
|
export async function setupAccount(props: AccountSetupProps): Promise<AccountSetupResponse> {
|
|
68
69
|
const httpClient = new HttpClient(globalConfig.baseUrl)
|
|
69
|
-
if (
|
|
70
|
+
if (
|
|
71
|
+
!props.hasSkippedPaywall &&
|
|
72
|
+
(!globalConfig.isMA || props.from === 'mobile-ios-app') &&
|
|
73
|
+
!props.token
|
|
74
|
+
) {
|
|
70
75
|
throw new Error('Token is required for non-MA environments')
|
|
71
76
|
}
|
|
72
77
|
|
|
@@ -78,6 +83,8 @@ export async function setupAccount(props: AccountSetupProps): Promise<AccountSet
|
|
|
78
83
|
password_confirmation: props.passwordConfirmation,
|
|
79
84
|
token: props.token,
|
|
80
85
|
from: props.from,
|
|
86
|
+
has_skipped_paywall: props.hasSkippedPaywall,
|
|
87
|
+
mobile_app_id: props.revenuecatAppUserId,
|
|
81
88
|
}
|
|
82
89
|
)
|
|
83
90
|
|