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.
Files changed (72) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/docs/ContentOrganization.html +2 -2
  3. package/docs/Forums.html +245 -0
  4. package/docs/Gamification.html +2 -2
  5. package/docs/UserManagementSystem.html +2 -2
  6. package/docs/api_types.js.html +2 -2
  7. package/docs/config.js.html +2 -2
  8. package/docs/content-org_content-org.js.html +2 -2
  9. package/docs/content-org_guided-courses.ts.html +11 -19
  10. package/docs/content-org_playlists-types.js.html +2 -2
  11. package/docs/content-org_playlists.js.html +2 -2
  12. package/docs/content.js.html +2 -2
  13. package/docs/forums_categories.ts.html +114 -0
  14. package/docs/forums_discussions.js.html +95 -0
  15. package/docs/forums_forum.js.html +95 -0
  16. package/docs/forums_forums.ts.html +76 -0
  17. package/docs/gamification_awards.ts.html +5 -3
  18. package/docs/gamification_gamification.js.html +2 -2
  19. package/docs/global.html +2 -2
  20. package/docs/index.html +2 -2
  21. package/docs/module-Accounts.html +2 -2
  22. package/docs/module-Awards.html +4 -4
  23. package/docs/module-Config.html +2 -2
  24. package/docs/module-Content-Services-V2.html +2 -2
  25. package/docs/module-ForumCategories.html +491 -0
  26. package/docs/module-ForumDiscussions.html +370 -0
  27. package/docs/module-Forums.html +370 -0
  28. package/docs/module-GuidedCourses.html +2 -2
  29. package/docs/module-Interests.html +2 -2
  30. package/docs/module-Payments.html +36 -6
  31. package/docs/module-Permissions.html +2 -2
  32. package/docs/module-Playlists.html +2 -2
  33. package/docs/module-Railcontent-Services.html +174 -26
  34. package/docs/module-Sanity-Services.html +11 -11
  35. package/docs/module-Sessions.html +3 -3
  36. package/docs/module-UserActivity.html +6 -30
  37. package/docs/module-UserChat.html +2 -2
  38. package/docs/module-UserManagement.html +2 -2
  39. package/docs/module-UserMemberships.html +2 -2
  40. package/docs/module-UserNotifications.html +2 -2
  41. package/docs/module-UserProfile.html +2 -2
  42. package/docs/railcontent.js.html +12 -2
  43. package/docs/sanity.js.html +5 -8
  44. package/docs/userActivity.js.html +24 -48
  45. package/docs/user_account.ts.html +2 -2
  46. package/docs/user_chat.js.html +2 -2
  47. package/docs/user_interests.js.html +2 -2
  48. package/docs/user_management.js.html +2 -2
  49. package/docs/user_memberships.js.html +2 -2
  50. package/docs/user_notifications.js.html +2 -2
  51. package/docs/user_payments.ts.html +17 -8
  52. package/docs/user_permissions.js.html +2 -2
  53. package/docs/user_profile.js.html +2 -2
  54. package/docs/user_sessions.js.html +32 -2
  55. package/docs/user_types.js.html +2 -2
  56. package/docs/user_user-management-system.js.html +2 -2
  57. package/jsdoc.json +1 -0
  58. package/package.json +1 -1
  59. package/src/index.d.ts +14 -9
  60. package/src/index.js +14 -9
  61. package/src/services/content-org/guided-courses.ts +9 -12
  62. package/src/services/contentProgress.js +11 -21
  63. package/src/services/forums/categories.ts +42 -0
  64. package/src/services/forums/forums.ts +4 -0
  65. package/src/services/forums/types.ts +23 -0
  66. package/src/services/gamification/awards.ts +3 -1
  67. package/src/services/imageSRCVerify.js +0 -0
  68. package/src/services/railcontent.js +4 -4
  69. package/src/services/sanity.js +0 -1
  70. package/src/services/user/payments.ts +1 -1
  71. package/src/services/user/sessions.js +28 -13
  72. 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, enrolledGuidedCourses] =
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, id) {
1435
- if (!(brand && id)) throw new Error(`undefined parameter brand: ${brand} or id: ${id}`)
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 && response['action'] === 'clear_user_pin') {
1431
+ if (response && !response.error) {
1439
1432
  await updateUserPinnedProgressRow(brand, null)
1440
1433
  }
1441
1434
  return response