musora-content-services 2.24.1 → 2.25.0
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,13 @@
|
|
|
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.25.0](https://github.com/railroadmedia/musora-content-services/compare/v2.24.1...v2.25.0) (2025-07-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **BEH-38:** add context data to tab results ([#344](https://github.com/railroadmedia/musora-content-services/issues/344)) ([02fe932](https://github.com/railroadmedia/musora-content-services/commit/02fe9321dfa56e74d7c73cb7a80e54f5818d1427))
|
|
11
|
+
|
|
5
12
|
### [2.24.1](https://github.com/railroadmedia/musora-content-services/compare/v2.24.0...v2.24.1) (2025-07-16)
|
|
6
13
|
|
|
7
14
|
## [2.24.0](https://github.com/railroadmedia/musora-content-services/compare/v2.21.3...v2.24.0) (2025-07-16)
|
package/package.json
CHANGED
package/src/services/content.js
CHANGED
|
@@ -66,7 +66,6 @@ export async function getTabResults(brand, pageName, tabName, {
|
|
|
66
66
|
sort = 'recommended',
|
|
67
67
|
selectedFilters = []
|
|
68
68
|
} = {}) {
|
|
69
|
-
|
|
70
69
|
// Extract and handle 'progress' filter separately
|
|
71
70
|
const progressFilter = selectedFilters.find(f => f.startsWith('progress,')) || 'progress,all';
|
|
72
71
|
const progressValue = progressFilter.split(',')[1].toLowerCase();
|
|
@@ -76,9 +75,23 @@ export async function getTabResults(brand, pageName, tabName, {
|
|
|
76
75
|
const mergedIncludedFields = [...filteredSelectedFilters, `tab,${tabName.toLowerCase()}`];
|
|
77
76
|
|
|
78
77
|
// Fetch data
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
let results
|
|
79
|
+
if( tabName === Tabs.ForYou.name ) {
|
|
80
|
+
results = await addContextToContent(getLessonContentRows, brand, pageName, {
|
|
81
|
+
dataField: 'items',
|
|
82
|
+
addNextLesson: true,
|
|
83
|
+
addProgressPercentage: true,
|
|
84
|
+
addProgressStatus: true
|
|
85
|
+
})
|
|
86
|
+
} else {
|
|
87
|
+
let temp = await fetchTabData(brand, pageName, { page, limit, sort, includedFields: mergedIncludedFields, progress: progressValue });
|
|
88
|
+
results = await addContextToContent(() => temp.entity, {
|
|
89
|
+
addNextLesson: true,
|
|
90
|
+
addProgressPercentage: true,
|
|
91
|
+
addProgressStatus: true
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
82
95
|
|
|
83
96
|
// Fetch metadata
|
|
84
97
|
const metaData = await fetchMetadata(brand, pageName);
|
|
@@ -108,7 +121,7 @@ export async function getTabResults(brand, pageName, tabName, {
|
|
|
108
121
|
|
|
109
122
|
return {
|
|
110
123
|
type: tabName === Tabs.ForYou.name ? TabResponseType.SECTIONS : TabResponseType.CATALOG,
|
|
111
|
-
data: results
|
|
124
|
+
data: results,
|
|
112
125
|
meta: { filters, sort: sortOptions }
|
|
113
126
|
};
|
|
114
127
|
}
|
|
@@ -173,13 +186,7 @@ export async function getContentRows(brand, pageName, contentRowSlug = null, {
|
|
|
173
186
|
page = 1,
|
|
174
187
|
limit = 10
|
|
175
188
|
} = {}) {
|
|
176
|
-
const sanityData = await
|
|
177
|
-
dataField: 'content',
|
|
178
|
-
dataField_parentIsArray: true,
|
|
179
|
-
addProgressStatus: true,
|
|
180
|
-
addProgressPercentage: true,
|
|
181
|
-
addNextLesson: true
|
|
182
|
-
})
|
|
189
|
+
const sanityData = await fetchContentRows(brand, pageName, contentRowSlug)
|
|
183
190
|
if (!sanityData) {
|
|
184
191
|
return []
|
|
185
192
|
}
|
|
@@ -79,12 +79,8 @@ export async function getNextLesson(data)
|
|
|
79
79
|
nextLessonData[content.id] = findIncompleteLesson(childrenStates, lastInteracted, content.type)
|
|
80
80
|
} else if (content.type === 'pack') {
|
|
81
81
|
const packBundles = content.children ?? []
|
|
82
|
-
console.log('pack', content)
|
|
83
|
-
console.log('bundles', packBundles)
|
|
84
82
|
const packBundleProgressData = await getNextLesson(packBundles)
|
|
85
83
|
const parentId = await getLastInteractedOf(packBundles.map(bundle => bundle.id));
|
|
86
|
-
console.log('parentId', parentId)
|
|
87
|
-
console.log('bundleprogressData', packBundleProgressData)
|
|
88
84
|
nextLessonData[content.id] = packBundleProgressData[parentId];
|
|
89
85
|
}
|
|
90
86
|
}
|
|
File without changes
|
package/src/services/sanity.js
CHANGED
|
@@ -551,7 +551,10 @@ export async function fetchContentRows(brand, pageName, contentRowSlug)
|
|
|
551
551
|
brand,
|
|
552
552
|
name,
|
|
553
553
|
'slug': slug.current,
|
|
554
|
-
'content': content[]->{
|
|
554
|
+
'content': content[]->{
|
|
555
|
+
'children': child[]->{ 'id': railcontent_id, 'children': child[]->{'id': railcontent_id}, },
|
|
556
|
+
${getFieldsForContentType('tab-data')}
|
|
557
|
+
},
|
|
555
558
|
}`, true)
|
|
556
559
|
}
|
|
557
560
|
|