musora-content-services 2.37.0 → 2.39.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 +21 -0
- package/docs/ContentOrganization.html +2 -2
- package/docs/Forums.html +245 -0
- package/docs/Gamification.html +2 -2
- package/docs/UserManagementSystem.html +2 -2
- package/docs/api_types.js.html +2 -2
- package/docs/config.js.html +2 -2
- package/docs/content-org_content-org.js.html +2 -2
- package/docs/content-org_guided-courses.ts.html +11 -19
- package/docs/content-org_playlists-types.js.html +2 -2
- package/docs/content-org_playlists.js.html +2 -2
- package/docs/content.js.html +2 -2
- package/docs/forums_categories.ts.html +114 -0
- package/docs/forums_discussions.js.html +95 -0
- package/docs/forums_forum.js.html +95 -0
- package/docs/forums_forums.ts.html +76 -0
- package/docs/gamification_awards.ts.html +5 -3
- package/docs/gamification_gamification.js.html +2 -2
- package/docs/global.html +2 -2
- package/docs/index.html +2 -2
- package/docs/module-Accounts.html +2 -2
- package/docs/module-Awards.html +4 -4
- package/docs/module-Config.html +2 -2
- package/docs/module-Content-Services-V2.html +2 -2
- package/docs/module-ForumCategories.html +491 -0
- package/docs/module-ForumDiscussions.html +370 -0
- package/docs/module-Forums.html +370 -0
- package/docs/module-GuidedCourses.html +2 -2
- package/docs/module-Interests.html +2 -2
- package/docs/module-Payments.html +36 -6
- package/docs/module-Permissions.html +2 -2
- package/docs/module-Playlists.html +2 -2
- package/docs/module-Railcontent-Services.html +174 -26
- package/docs/module-Sanity-Services.html +11 -11
- package/docs/module-Sessions.html +3 -3
- package/docs/module-UserActivity.html +6 -30
- package/docs/module-UserChat.html +2 -2
- package/docs/module-UserManagement.html +2 -2
- package/docs/module-UserMemberships.html +2 -2
- package/docs/module-UserNotifications.html +2 -2
- package/docs/module-UserProfile.html +2 -2
- package/docs/railcontent.js.html +12 -2
- package/docs/sanity.js.html +5 -8
- package/docs/userActivity.js.html +24 -48
- package/docs/user_account.ts.html +2 -2
- package/docs/user_chat.js.html +2 -2
- package/docs/user_interests.js.html +2 -2
- package/docs/user_management.js.html +2 -2
- package/docs/user_memberships.js.html +2 -2
- package/docs/user_notifications.js.html +2 -2
- package/docs/user_payments.ts.html +17 -8
- package/docs/user_permissions.js.html +2 -2
- package/docs/user_profile.js.html +2 -2
- package/docs/user_sessions.js.html +32 -2
- package/docs/user_types.js.html +2 -2
- package/docs/user_user-management-system.js.html +2 -2
- package/jsdoc.json +1 -0
- package/package.json +1 -1
- package/src/index.d.ts +14 -9
- package/src/index.js +14 -9
- package/src/services/content-org/guided-courses.ts +9 -12
- package/src/services/contentProgress.js +11 -21
- package/src/services/forums/categories.ts +42 -0
- package/src/services/forums/forums.ts +4 -0
- package/src/services/forums/types.ts +23 -0
- package/src/services/gamification/awards.ts +3 -1
- package/src/services/imageSRCVerify.js +0 -0
- package/src/services/railcontent.js +4 -4
- package/src/services/sanity.js +0 -1
- package/src/services/user/payments.ts +1 -1
- package/src/services/user/sessions.js +28 -13
- package/src/services/userActivity.js +4 -11
|
@@ -1037,15 +1037,13 @@ function generateContentsMap(contents, playlistsContents) {
|
|
|
1037
1037
|
export async function getProgressRows({ brand = null, limit = 8 } = {}) {
|
|
1038
1038
|
// TODO slice progress to a reasonable number, say 100
|
|
1039
1039
|
|
|
1040
|
-
const [recentPlaylists, progressContents, userPinnedItem
|
|
1040
|
+
const [recentPlaylists, progressContents, userPinnedItem] =
|
|
1041
1041
|
await Promise.all([
|
|
1042
1042
|
fetchUserPlaylists(brand, { sort: '-last_progress', limit: limit }),
|
|
1043
1043
|
getAllStartedOrCompleted({ onlyIds: false, brand: brand }),
|
|
1044
1044
|
getUserPinnedItem(brand),
|
|
1045
|
-
guidedCourses()
|
|
1046
1045
|
])
|
|
1047
1046
|
|
|
1048
|
-
const enrolledGuidedCoursesIds = enrolledGuidedCourses.map(course => String(course.content_id));
|
|
1049
1047
|
const playlists = recentPlaylists?.data || []
|
|
1050
1048
|
const eligiblePlaylistItems = await getEligiblePlaylistItems(playlists)
|
|
1051
1049
|
const playlistEngagedOnContents = eligiblePlaylistItems.map(
|
|
@@ -1053,9 +1051,6 @@ export async function getProgressRows({ brand = null, limit = 8 } = {}) {
|
|
|
1053
1051
|
)
|
|
1054
1052
|
|
|
1055
1053
|
const nonPlaylistContentIds = Object.keys(progressContents)
|
|
1056
|
-
if (enrolledGuidedCoursesIds.length > 0) {
|
|
1057
|
-
nonPlaylistContentIds.push(...enrolledGuidedCoursesIds)
|
|
1058
|
-
}
|
|
1059
1054
|
if (userPinnedItem?.progressType === 'content') {
|
|
1060
1055
|
nonPlaylistContentIds.push(userPinnedItem.id)
|
|
1061
1056
|
}
|
|
@@ -1423,7 +1418,6 @@ export async function pinProgressRow(brand, id, progressType) {
|
|
|
1423
1418
|
* Unpins the current pinned progress row for a user, scoped by brand.
|
|
1424
1419
|
*
|
|
1425
1420
|
* @param {string} brand - The brand context for the unpin action.
|
|
1426
|
-
* @param {string} id - The content or playlist id to unpin.
|
|
1427
1421
|
* @returns {Promise<Object>} - A promise resolving to the response from the unpin API.
|
|
1428
1422
|
*
|
|
1429
1423
|
* @example
|
|
@@ -1431,11 +1425,10 @@ export async function pinProgressRow(brand, id, progressType) {
|
|
|
1431
1425
|
* .then(response => console.log(response))
|
|
1432
1426
|
* .catch(error => console.error(error));
|
|
1433
1427
|
*/
|
|
1434
|
-
export async function unpinProgressRow(brand
|
|
1435
|
-
|
|
1436
|
-
const url = `/api/user-management-system/v1/progress/unpin?brand=${brand}&id=${id}`
|
|
1428
|
+
export async function unpinProgressRow(brand) {
|
|
1429
|
+
const url = `/api/user-management-system/v1/progress/unpin?brand=${brand}`
|
|
1437
1430
|
const response = await fetchHandler(url, 'PUT', null)
|
|
1438
|
-
if (response && !response.error
|
|
1431
|
+
if (response && !response.error) {
|
|
1439
1432
|
await updateUserPinnedProgressRow(brand, null)
|
|
1440
1433
|
}
|
|
1441
1434
|
return response
|