musora-content-services 2.31.2 → 2.32.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/docs/ContentOrganization.html +2 -2
  3. package/docs/Gamification.html +2 -2
  4. package/docs/UserManagementSystem.html +2 -2
  5. package/docs/api_types.js.html +2 -2
  6. package/docs/config.js.html +2 -8
  7. package/docs/content-org_content-org.js.html +2 -2
  8. package/docs/content-org_playlists-types.js.html +12 -2
  9. package/docs/content-org_playlists.js.html +16 -16
  10. package/docs/content.js.html +71 -39
  11. package/docs/gamification_awards.js.html +54 -35
  12. package/docs/gamification_gamification.js.html +2 -2
  13. package/docs/gamification_types.js.html +7 -25
  14. package/docs/global.html +298 -322
  15. package/docs/index.html +2 -2
  16. package/docs/module-Awards.html +2 -2
  17. package/docs/module-Config.html +4 -8
  18. package/docs/module-Content-Services-V2.html +455 -8
  19. package/docs/module-Interests.html +2 -2
  20. package/docs/module-Permissions.html +2 -2
  21. package/docs/module-Playlists.html +18 -17
  22. package/docs/module-Railcontent-Services.html +479 -35
  23. package/docs/module-Sanity-Services.html +45 -173
  24. package/docs/module-Sessions.html +2 -2
  25. package/docs/module-UserActivity.html +189 -21
  26. package/docs/module-UserChat.html +2 -2
  27. package/docs/module-UserManagement.html +410 -8
  28. package/docs/module-UserNotifications.html +203 -8
  29. package/docs/module-UserProfile.html +2 -2
  30. package/docs/railcontent.js.html +65 -37
  31. package/docs/sanity.js.html +120 -185
  32. package/docs/userActivity.js.html +448 -466
  33. package/docs/user_chat.js.html +2 -2
  34. package/docs/user_interests.js.html +2 -2
  35. package/docs/user_management.js.html +32 -2
  36. package/docs/user_notifications.js.html +27 -5
  37. package/docs/user_permissions.js.html +2 -2
  38. package/docs/user_profile.js.html +3 -9
  39. package/docs/user_sessions.js.html +2 -2
  40. package/docs/user_types.js.html +10 -2
  41. package/docs/user_user-management-system.js.html +2 -2
  42. package/package.json +1 -1
  43. package/src/contentTypeConfig.js +6 -1
  44. package/src/index.d.ts +6 -0
  45. package/src/index.js +6 -0
  46. package/src/services/sanity.js +14 -19
  47. package/src/services/user/management.js +30 -0
  48. package/src/services/user/types.js +8 -0
@@ -29,7 +29,7 @@
29
29
  <nav >
30
30
 
31
31
 
32
- <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Awards.html">Awards</a><ul class='methods'><li data-type='method'><a href="module-Awards.html#.fetchAwardsForUser">fetchAwardsForUser</a></li></ul></li><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#.initializeService">initializeService</a></li></ul></li><li><a href="module-Content-Services-V2.html">Content-Services-V2</a><ul class='methods'><li data-type='method'><a href="module-Content-Services-V2.html#.getContentRows">getContentRows</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getNewAndUpcoming">getNewAndUpcoming</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getRecent">getRecent</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getRecommendedForYou">getRecommendedForYou</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getScheduleContentRows">getScheduleContentRows</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getTabResults">getTabResults</a></li></ul></li><li><a href="module-Interests.html">Interests</a><ul class='methods'><li data-type='method'><a href="module-Interests.html#.fetchInterests">fetchInterests</a></li><li data-type='method'><a href="module-Interests.html#.fetchUninterests">fetchUninterests</a></li><li data-type='method'><a href="module-Interests.html#.markContentAsInterested">markContentAsInterested</a></li><li data-type='method'><a href="module-Interests.html#.markContentAsNotInterested">markContentAsNotInterested</a></li><li data-type='method'><a href="module-Interests.html#.removeContentAsInterested">removeContentAsInterested</a></li><li data-type='method'><a href="module-Interests.html#.removeContentAsNotInterested">removeContentAsNotInterested</a></li></ul></li><li><a href="module-Permissions.html">Permissions</a><ul class='methods'><li data-type='method'><a href="module-Permissions.html#.fetchUserPermissions">fetchUserPermissions</a></li><li data-type='method'><a href="module-Permissions.html#.reset">reset</a></li></ul></li><li><a href="module-Playlists.html">Playlists</a><ul class='methods'><li data-type='method'><a href="module-Playlists.html#.addItemToPlaylist">addItemToPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.createPlaylist">createPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.deletePlaylist">deletePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.duplicatePlaylist">duplicatePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.fetchPlaylist">fetchPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.fetchPlaylistItems">fetchPlaylistItems</a></li><li data-type='method'><a href="module-Playlists.html#.fetchUserPlaylists">fetchUserPlaylists</a></li><li data-type='method'><a href="module-Playlists.html#.togglePlaylistPrivate">togglePlaylistPrivate</a></li><li data-type='method'><a href="module-Playlists.html#.undeletePlaylist">undeletePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.updatePlaylist">updatePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~deleteItemsFromPlaylist">deleteItemsFromPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~likePlaylist">likePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~reportPlaylist">reportPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~restoreItemFromPlaylist">restoreItemFromPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~unlikePlaylist">unlikePlaylist</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.assignModeratorToComment">assignModeratorToComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.closeComment">closeComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.createComment">createComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.deleteComment">deleteComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.editComment">editComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCarouselCardData">fetchCarouselCardData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchComment">fetchComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCommentRelies">fetchCommentRelies</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchComments">fetchComments</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCompletedContent">fetchCompletedContent</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCompletedState">fetchCompletedState</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentPageUserData">fetchContentPageUserData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchNextContentDataForParent">fetchNextContentDataForParent</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchRecentUserActivities">fetchRecentUserActivities</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchTopComment">fetchTopComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserAward">fetchUserAward</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserBadges">fetchUserBadges</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserPracticeNotes">fetchUserPracticeNotes</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.likeComment">likeComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.openComment">openComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.replyToComment">replyToComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.reportComment">reportComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.restoreComment">restoreComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.setStudentViewForUser">setStudentViewForUser</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.unassignModeratorToComment">unassignModeratorToComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.unlikeComment">unlikeComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#~fetchLastInteractedChild">fetchLastInteractedChild</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllPacks">fetchAllPacks</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtistLessons">fetchArtistLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByReference">fetchByReference</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCoachLessons">fetchCoachLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchComingSoon">fetchComingSoon</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCommentModContentData">fetchCommentModContentData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchFoundation">fetchFoundation</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchGenreLessons">fetchGenreLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLeaving">fetchLeaving</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonContent">fetchLessonContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonsFeaturingThisContent">fetchLessonsFeaturingThisContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMetadata">fetchMetadata</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethod">fetchMethod</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildren">fetchMethodChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildrenIds">fetchMethodChildrenIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodPreviousNextLesson">fetchMethodPreviousNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNewReleases">fetchNewReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNextPreviousLesson">fetchNextPreviousLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchOtherSongVersions">fetchOtherSongVersions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackAll">fetchPackAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackData">fetchPackData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchParentForDownload">fetchParentForDownload</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedLessons">fetchRelatedLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedRecommendedContent">fetchRelatedRecommendedContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedSongs">fetchRelatedSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchReturning">fetchReturning</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSanity">fetchSanity</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchScheduledReleases">fetchScheduledReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchShowsData">fetchShowsData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSiblingContent">fetchSiblingContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongArtistCount">fetchSongArtistCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongById">fetchSongById</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchUpcomingEvents">fetchUpcomingEvents</a></li><li data-type='method'><a href="module-Sanity-Services.html#.jumpToContinueContent">jumpToContinueContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#~fetchRelatedByLicense">fetchRelatedByLicense</a></li><li data-type='method'><a href="module-Sanity-Services.html#~getNextAndPreviousQuarterDates">getNextAndPreviousQuarterDates</a></li><li data-type='method'><a href="module-Sanity-Services.html#~getQueryFromPage">getQueryFromPage</a></li></ul></li><li><a href="module-Sessions.html">Sessions</a><ul class='methods'><li data-type='method'><a href="module-Sessions.html#.login">login</a></li><li data-type='method'><a href="module-Sessions.html#.logout">logout</a></li></ul></li><li><a href="module-UserActivity.html">UserActivity</a><ul class='methods'><li data-type='method'><a href="module-UserActivity.html#.calculateLongestStreaks">calculateLongestStreaks</a></li><li data-type='method'><a href="module-UserActivity.html#.createPracticeNotes">createPracticeNotes</a></li><li data-type='method'><a href="module-UserActivity.html#.deletePracticeSession">deletePracticeSession</a></li><li data-type='method'><a href="module-UserActivity.html#.deleteUserActivity">deleteUserActivity</a></li><li data-type='method'><a href="module-UserActivity.html#.getPracticeNotes">getPracticeNotes</a></li><li data-type='method'><a href="module-UserActivity.html#.getPracticeSessions">getPracticeSessions</a></li><li data-type='method'><a href="module-UserActivity.html#.getProgressRows">getProgressRows</a></li><li data-type='method'><a href="module-UserActivity.html#.getRecentActivity">getRecentActivity</a></li><li data-type='method'><a href="module-UserActivity.html#.getUserMonthlyStats">getUserMonthlyStats</a></li><li data-type='method'><a href="module-UserActivity.html#.getUserWeeklyStats">getUserWeeklyStats</a></li><li data-type='method'><a href="module-UserActivity.html#.pinProgressRow">pinProgressRow</a></li><li data-type='method'><a href="module-UserActivity.html#.recordUserActivity">recordUserActivity</a></li><li data-type='method'><a href="module-UserActivity.html#.recordUserPractice">recordUserPractice</a></li><li data-type='method'><a href="module-UserActivity.html#.removeUserPractice">removeUserPractice</a></li><li data-type='method'><a href="module-UserActivity.html#.restorePracticeSession">restorePracticeSession</a></li><li data-type='method'><a href="module-UserActivity.html#.restoreUserPractice">restoreUserPractice</a></li><li data-type='method'><a href="module-UserActivity.html#.unpinProgressRow">unpinProgressRow</a></li><li data-type='method'><a href="module-UserActivity.html#.updatePracticeNotes">updatePracticeNotes</a></li><li data-type='method'><a href="module-UserActivity.html#.updateUserPractice">updateUserPractice</a></li></ul></li><li><a href="module-UserChat.html">UserChat</a><ul class='methods'><li data-type='method'><a href="module-UserChat.html#.fetchChatSettings">fetchChatSettings</a></li></ul></li><li><a href="module-UserManagement.html">UserManagement</a><ul class='methods'><li data-type='method'><a href="module-UserManagement.html#.blockUser">blockUser</a></li><li data-type='method'><a href="module-UserManagement.html#.deletePicture">deletePicture</a></li><li data-type='method'><a href="module-UserManagement.html#.getUserData">getUserData</a></li><li data-type='method'><a href="module-UserManagement.html#.unblockUser">unblockUser</a></li><li data-type='method'><a href="module-UserManagement.html#.uploadPicture">uploadPicture</a></li><li data-type='method'><a href="module-UserManagement.html#.uploadPictureFromS3">uploadPictureFromS3</a></li></ul></li><li><a href="module-UserNotifications.html">UserNotifications</a><ul class='methods'><li data-type='method'><a href="module-UserNotifications.html#.deleteNotification">deleteNotification</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchLiveEventPollingState">fetchLiveEventPollingState</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchNotificationSettings">fetchNotificationSettings</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchNotifications">fetchNotifications</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchUnreadCount">fetchUnreadCount</a></li><li data-type='method'><a href="module-UserNotifications.html#.markAllNotificationsAsRead">markAllNotificationsAsRead</a></li><li data-type='method'><a href="module-UserNotifications.html#.markNotificationAsRead">markNotificationAsRead</a></li><li data-type='method'><a href="module-UserNotifications.html#.markNotificationAsUnread">markNotificationAsUnread</a></li><li data-type='method'><a href="module-UserNotifications.html#.pauseLiveEventPolling">pauseLiveEventPolling</a></li><li data-type='method'><a href="module-UserNotifications.html#.startLiveEventPolling">startLiveEventPolling</a></li><li data-type='method'><a href="module-UserNotifications.html#.updateNotificationSetting">updateNotificationSetting</a></li></ul></li><li><a href="module-UserProfile.html">UserProfile</a><ul class='methods'><li data-type='method'><a href="module-UserProfile.html#.deleteProfilePicture">deleteProfilePicture</a></li><li data-type='method'><a href="module-UserProfile.html#.otherStats">otherStats</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="ContentOrganization.html">ContentOrganization</a></li><li><a href="Gamification.html">Gamification</a></li><li><a href="UserManagementSystem.html">UserManagementSystem</a></li></ul><h3><a href="global.html">Global</a></h3>
32
+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Awards.html">Awards</a><ul class='methods'><li data-type='method'><a href="module-Awards.html#.fetchAwardsForUser">fetchAwardsForUser</a></li></ul></li><li><a href="module-Config.html">Config</a><ul class='methods'><li data-type='method'><a href="module-Config.html#.initializeService">initializeService</a></li></ul></li><li><a href="module-Content-Services-V2.html">Content-Services-V2</a><ul class='methods'><li data-type='method'><a href="module-Content-Services-V2.html#.getContentRows">getContentRows</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getNewAndUpcoming">getNewAndUpcoming</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getRecent">getRecent</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getRecentForTab">getRecentForTab</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getRecommendedForYou">getRecommendedForYou</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getScheduleContentRows">getScheduleContentRows</a></li><li data-type='method'><a href="module-Content-Services-V2.html#.getTabResults">getTabResults</a></li></ul></li><li><a href="module-Interests.html">Interests</a><ul class='methods'><li data-type='method'><a href="module-Interests.html#.fetchInterests">fetchInterests</a></li><li data-type='method'><a href="module-Interests.html#.fetchUninterests">fetchUninterests</a></li><li data-type='method'><a href="module-Interests.html#.markContentAsInterested">markContentAsInterested</a></li><li data-type='method'><a href="module-Interests.html#.markContentAsNotInterested">markContentAsNotInterested</a></li><li data-type='method'><a href="module-Interests.html#.removeContentAsInterested">removeContentAsInterested</a></li><li data-type='method'><a href="module-Interests.html#.removeContentAsNotInterested">removeContentAsNotInterested</a></li></ul></li><li><a href="module-Permissions.html">Permissions</a><ul class='methods'><li data-type='method'><a href="module-Permissions.html#.fetchUserPermissions">fetchUserPermissions</a></li><li data-type='method'><a href="module-Permissions.html#.reset">reset</a></li></ul></li><li><a href="module-Playlists.html">Playlists</a><ul class='methods'><li data-type='method'><a href="module-Playlists.html#.addItemToPlaylist">addItemToPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.createPlaylist">createPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.deletePlaylist">deletePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.duplicatePlaylist">duplicatePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.fetchPlaylist">fetchPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.fetchPlaylistItems">fetchPlaylistItems</a></li><li data-type='method'><a href="module-Playlists.html#.fetchUserPlaylists">fetchUserPlaylists</a></li><li data-type='method'><a href="module-Playlists.html#.togglePlaylistPrivate">togglePlaylistPrivate</a></li><li data-type='method'><a href="module-Playlists.html#.undeletePlaylist">undeletePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#.updatePlaylist">updatePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~deleteItemsFromPlaylist">deleteItemsFromPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~likePlaylist">likePlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~reportPlaylist">reportPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~restoreItemFromPlaylist">restoreItemFromPlaylist</a></li><li data-type='method'><a href="module-Playlists.html#~unlikePlaylist">unlikePlaylist</a></li></ul></li><li><a href="module-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.assignModeratorToComment">assignModeratorToComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.closeComment">closeComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.createComment">createComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.deleteComment">deleteComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.editComment">editComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchAllCompletedStates">fetchAllCompletedStates</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCarouselCardData">fetchCarouselCardData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchComment">fetchComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCommentRelies">fetchCommentRelies</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchComments">fetchComments</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCompletedContent">fetchCompletedContent</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchCompletedState">fetchCompletedState</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentInProgress">fetchContentInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchContentPageUserData">fetchContentPageUserData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchNextContentDataForParent">fetchNextContentDataForParent</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchRecentUserActivities">fetchRecentUserActivities</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchSongsInProgress">fetchSongsInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchTopComment">fetchTopComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserAward">fetchUserAward</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserBadges">fetchUserBadges</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserPracticeNotes">fetchUserPracticeNotes</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.likeComment">likeComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.openComment">openComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postContentComplete">postContentComplete</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postContentReset">postContentReset</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postContentRestore">postContentRestore</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.replyToComment">replyToComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.reportComment">reportComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.restoreComment">restoreComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.setStudentViewForUser">setStudentViewForUser</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.unassignModeratorToComment">unassignModeratorToComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.unlikeComment">unlikeComment</a></li><li data-type='method'><a href="module-Railcontent-Services.html#~fetchLastInteractedChild">fetchLastInteractedChild</a></li></ul></li><li><a href="module-Sanity-Services.html">Sanity-Services</a><ul class='methods'><li data-type='method'><a href="module-Sanity-Services.html#.fetchAll">fetchAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllFilterOptions">fetchAllFilterOptions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchAllPacks">fetchAllPacks</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtistLessons">fetchArtistLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchArtists">fetchArtists</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentId">fetchByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByRailContentIds">fetchByRailContentIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchByReference">fetchByReference</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCoachLessons">fetchCoachLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchComingSoon">fetchComingSoon</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCommentModContentData">fetchCommentModContentData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchFoundation">fetchFoundation</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchGenreLessons">fetchGenreLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLeaving">fetchLeaving</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonContent">fetchLessonContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchLessonsFeaturingThisContent">fetchLessonsFeaturingThisContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMetadata">fetchMetadata</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethod">fetchMethod</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildren">fetchMethodChildren</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodChildrenIds">fetchMethodChildrenIds</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodPreviousNextLesson">fetchMethodPreviousNextLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNewReleases">fetchNewReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchNextPreviousLesson">fetchNextPreviousLesson</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchOtherSongVersions">fetchOtherSongVersions</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackAll">fetchPackAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackData">fetchPackData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchParentForDownload">fetchParentForDownload</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedLessons">fetchRelatedLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedRecommendedContent">fetchRelatedRecommendedContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedSongs">fetchRelatedSongs</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchReturning">fetchReturning</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSanity">fetchSanity</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchScheduledReleases">fetchScheduledReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchShowsData">fetchShowsData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSiblingContent">fetchSiblingContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongArtistCount">fetchSongArtistCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongById">fetchSongById</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchUpcomingEvents">fetchUpcomingEvents</a></li><li data-type='method'><a href="module-Sanity-Services.html#.jumpToContinueContent">jumpToContinueContent</a></li><li data-type='method'><a href="module-Sanity-Services.html#~fetchRelatedByLicense">fetchRelatedByLicense</a></li><li data-type='method'><a href="module-Sanity-Services.html#~getQueryFromPage">getQueryFromPage</a></li></ul></li><li><a href="module-Sessions.html">Sessions</a><ul class='methods'><li data-type='method'><a href="module-Sessions.html#.login">login</a></li><li data-type='method'><a href="module-Sessions.html#.logout">logout</a></li></ul></li><li><a href="module-UserActivity.html">UserActivity</a><ul class='methods'><li data-type='method'><a href="module-UserActivity.html#.calculateLongestStreaks">calculateLongestStreaks</a></li><li data-type='method'><a href="module-UserActivity.html#.createPracticeNotes">createPracticeNotes</a></li><li data-type='method'><a href="module-UserActivity.html#.deletePracticeSession">deletePracticeSession</a></li><li data-type='method'><a href="module-UserActivity.html#.deleteUserActivity">deleteUserActivity</a></li><li data-type='method'><a href="module-UserActivity.html#.getPracticeNotes">getPracticeNotes</a></li><li data-type='method'><a href="module-UserActivity.html#.getPracticeSessions">getPracticeSessions</a></li><li data-type='method'><a href="module-UserActivity.html#.getProgressRows">getProgressRows</a></li><li data-type='method'><a href="module-UserActivity.html#.getRecentActivity">getRecentActivity</a></li><li data-type='method'><a href="module-UserActivity.html#.getUserMonthlyStats">getUserMonthlyStats</a></li><li data-type='method'><a href="module-UserActivity.html#.getUserWeeklyStats">getUserWeeklyStats</a></li><li data-type='method'><a href="module-UserActivity.html#.pinProgressRow">pinProgressRow</a></li><li data-type='method'><a href="module-UserActivity.html#.recordUserActivity">recordUserActivity</a></li><li data-type='method'><a href="module-UserActivity.html#.recordUserPractice">recordUserPractice</a></li><li data-type='method'><a href="module-UserActivity.html#.removeUserPractice">removeUserPractice</a></li><li data-type='method'><a href="module-UserActivity.html#.restorePracticeSession">restorePracticeSession</a></li><li data-type='method'><a href="module-UserActivity.html#.restoreUserActivity">restoreUserActivity</a></li><li data-type='method'><a href="module-UserActivity.html#.restoreUserPractice">restoreUserPractice</a></li><li data-type='method'><a href="module-UserActivity.html#.unpinProgressRow">unpinProgressRow</a></li><li data-type='method'><a href="module-UserActivity.html#.updatePracticeNotes">updatePracticeNotes</a></li><li data-type='method'><a href="module-UserActivity.html#.updateUserPractice">updateUserPractice</a></li></ul></li><li><a href="module-UserChat.html">UserChat</a><ul class='methods'><li data-type='method'><a href="module-UserChat.html#.fetchChatSettings">fetchChatSettings</a></li></ul></li><li><a href="module-UserManagement.html">UserManagement</a><ul class='methods'><li data-type='method'><a href="module-UserManagement.html#.blockUser">blockUser</a></li><li data-type='method'><a href="module-UserManagement.html#.blockedUsers">blockedUsers</a></li><li data-type='method'><a href="module-UserManagement.html#.deletePicture">deletePicture</a></li><li data-type='method'><a href="module-UserManagement.html#.getUserData">getUserData</a></li><li data-type='method'><a href="module-UserManagement.html#.isDisplayNameAvailable">isDisplayNameAvailable</a></li><li data-type='method'><a href="module-UserManagement.html#.unblockUser">unblockUser</a></li><li data-type='method'><a href="module-UserManagement.html#.updateDisplayName">updateDisplayName</a></li><li data-type='method'><a href="module-UserManagement.html#.uploadPicture">uploadPicture</a></li><li data-type='method'><a href="module-UserManagement.html#.uploadPictureFromS3">uploadPictureFromS3</a></li></ul></li><li><a href="module-UserNotifications.html">UserNotifications</a><ul class='methods'><li data-type='method'><a href="module-UserNotifications.html#.deleteNotification">deleteNotification</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchLiveEventPollingState">fetchLiveEventPollingState</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchNotificationSettings">fetchNotificationSettings</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchNotifications">fetchNotifications</a></li><li data-type='method'><a href="module-UserNotifications.html#.fetchUnreadCount">fetchUnreadCount</a></li><li data-type='method'><a href="module-UserNotifications.html#.markAllNotificationsAsRead">markAllNotificationsAsRead</a></li><li data-type='method'><a href="module-UserNotifications.html#.markNotificationAsRead">markNotificationAsRead</a></li><li data-type='method'><a href="module-UserNotifications.html#.markNotificationAsUnread">markNotificationAsUnread</a></li><li data-type='method'><a href="module-UserNotifications.html#.pauseLiveEventPolling">pauseLiveEventPolling</a></li><li data-type='method'><a href="module-UserNotifications.html#.restoreNotification">restoreNotification</a></li><li data-type='method'><a href="module-UserNotifications.html#.startLiveEventPolling">startLiveEventPolling</a></li><li data-type='method'><a href="module-UserNotifications.html#.updateNotificationSetting">updateNotificationSetting</a></li></ul></li><li><a href="module-UserProfile.html">UserProfile</a><ul class='methods'><li data-type='method'><a href="module-UserProfile.html#.deleteProfilePicture">deleteProfilePicture</a></li><li data-type='method'><a href="module-UserProfile.html#.otherStats">otherStats</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="ContentOrganization.html">ContentOrganization</a></li><li><a href="Gamification.html">Gamification</a></li><li><a href="UserManagementSystem.html">UserManagementSystem</a></li></ul><h3><a href="global.html">Global</a></h3>
33
33
 
34
34
  </nav>
35
35
 
@@ -63,8 +63,10 @@ import {
63
63
  showsTypes,
64
64
  getNewReleasesTypes,
65
65
  coachLessonsTypes,
66
+ getFieldsForContentTypeWithFilteredChildren,
66
67
  getChildFieldsForContentType,
67
68
  SONG_TYPES,
69
+ recentTypes
68
70
  } from '../contentTypeConfig.js'
69
71
  import {fetchSimilarItems, recommendations} from './recommendations.js'
70
72
  import { processMetadata, typeWithSortOrder } from '../contentMetaData.js'
@@ -122,7 +124,7 @@ export async function fetchSongById(documentId) {
122
124
  */
123
125
  export async function fetchLeaving(brand, { pageNumber = 1, contentPerPage = 20 } = {}) {
124
126
  const today = new Date()
125
- const isoDateOnly = today.toISOString().split('T')[0]
127
+ const isoDateOnly = getDateOnly(today)
126
128
  const filterString = `brand == '${brand}' &amp;&amp; quarter_removed > '${isoDateOnly}'`
127
129
  const startEndOrder = getQueryFromPage(pageNumber, contentPerPage)
128
130
  const sortOrder = {
@@ -149,7 +151,7 @@ export async function fetchLeaving(brand, { pageNumber = 1, contentPerPage = 20
149
151
  */
150
152
  export async function fetchReturning(brand, { pageNumber = 1, contentPerPage = 20 } = {}) {
151
153
  const today = new Date()
152
- const isoDateOnly = today.toISOString().split('T')[0]
154
+ const isoDateOnly = getDateOnly(today)
153
155
  const filterString = `brand == '${brand}' &amp;&amp; quarter_published >= '${isoDateOnly}'`
154
156
  const startEndOrder = getQueryFromPage(pageNumber, contentPerPage)
155
157
  const sortOrder = {
@@ -206,41 +208,6 @@ function getQueryFromPage(pageNumber, contentPerPage) {
206
208
  return result
207
209
  }
208
210
 
209
- /**
210
- * returns array of next and previous quarter dates as strings
211
- *
212
- * @returns {string[]}
213
- */
214
- function getNextAndPreviousQuarterDates() {
215
- const january = 1
216
- const april = 4
217
- const july = 7
218
- const october = 10
219
- const month = new Date().getMonth()
220
- let year = new Date().getFullYear()
221
- let nextQuarter = ''
222
- let prevQuarter = ''
223
- if (month &lt; april) {
224
- nextQuarter = `${year}-0${april}-01`
225
- prevQuarter = `${year}-0${january}-01`
226
- } else if (month &lt; july) {
227
- nextQuarter = `${year}-0${july}-01`
228
- prevQuarter = `${year}-0${april}-01`
229
- } else if (month &lt; october) {
230
- nextQuarter = `${year}-${october}-01`
231
- prevQuarter = `${year}-0${july}-01`
232
- } else {
233
- prevQuarter = `${year}-${october}-01`
234
- year++
235
- nextQuarter = `${year}-0${january}-01`
236
- }
237
-
238
- let result = []
239
- result['next'] = nextQuarter
240
- result['previous'] = prevQuarter
241
- return result
242
- }
243
-
244
211
  /**
245
212
  * Fetch all artists with lessons available for a specific brand.
246
213
  *
@@ -397,8 +364,8 @@ export async function fetchNewReleases(
397
364
  const start = (page - 1) * limit
398
365
  const end = start + limit
399
366
  const sortOrder = getSortOrder(sort, brand)
400
- const nextQuarter = getNextAndPreviousQuarterDates()['next']
401
- const filter = `_type in ${typesString} &amp;&amp; brand == '${brand}' &amp;&amp; status == 'published' &amp;&amp; show_in_new_feed == true &amp;&amp; (!defined(quarter_published) || quarter_published != '${nextQuarter}')`
367
+ const now = getDateOnly()
368
+ const filter = `_type in ${typesString} &amp;&amp; brand == '${brand}' &amp;&amp; (status == 'published' &amp;&amp; show_in_new_feed == true &amp;&amp; published_on &lt;= '${now}')`
402
369
  const fields = `
403
370
  "id": railcontent_id,
404
371
  title,
@@ -414,12 +381,7 @@ export async function fetchNewReleases(
414
381
  web_url_path,
415
382
  "permission_id": permission[]->railcontent_id,
416
383
  `
417
- const filterParams = { allowsPullSongsContent: false }
418
- const query = await buildQuery(filter, filterParams, fields, {
419
- sortOrder: sortOrder,
420
- start,
421
- end: end,
422
- })
384
+ const query = buildRawQuery(filter, fields, {sortOrder: sortOrder, start, end: end})
423
385
  return fetchSanity(query, true)
424
386
  }
425
387
 
@@ -524,12 +486,12 @@ export async function fetchScheduledReleases(brand, { page = 1, limit = 10 }) {
524
486
  * .catch(error => console.error(error));
525
487
  */
526
488
  export async function fetchByRailContentId(id, contentType) {
527
- const fields = getFieldsForContentType(contentType)
528
- const childFields = getChildFieldsForContentType(contentType)
489
+ const fields = await getFieldsForContentTypeWithFilteredChildren(contentType)
490
+ const lessonFields = getChildFieldsForContentType(contentType)
529
491
  const childrenFilter = await new FilterBuilder(``, { isChildrenFilter: true }).buildFilter()
530
492
  const entityFieldsString = ` ${fields}
531
493
  'child_count': coalesce(count(child[${childrenFilter}]->), 0) ,
532
- "lessons": child[${childrenFilter}]->{${childFields}},
494
+ "lessons": child[${childrenFilter}]->{${lessonFields}},
533
495
  'length_in_seconds': coalesce(
534
496
  math::sum(
535
497
  select(
@@ -562,21 +524,25 @@ export async function fetchByRailContentId(id, contentType) {
562
524
  * .then(contents => console.log(contents))
563
525
  * .catch(error => console.error(error));
564
526
  */
565
- export async function fetchByRailContentIds(ids, contentType = undefined, brand = undefined) {
527
+ export async function fetchByRailContentIds(ids, contentType = undefined, brand = undefined, includePermissionsAndStatusFilter = false) {
566
528
  if (!ids?.length) {
567
529
  return []
568
530
  }
531
+ ids = [...new Set(ids.filter(item => item !== null &amp;&amp; item !== undefined))];
569
532
  const idsString = ids.join(',')
570
533
  const brandFilter = brand ? ` &amp;&amp; brand == "${brand}"` : ''
571
- const now = getSanityDate(new Date())
534
+ const lessonCountFilter = await new FilterBuilder(`_id in ^.child[]._ref`, {pullFutureContent: true}).buildFilter()
535
+ const fields = await getFieldsForContentTypeWithFilteredChildren(contentType, true)
536
+ const baseFilter = `railcontent_id in [${idsString}]${brandFilter}`
537
+ const finalFilter = includePermissionsAndStatusFilter ? await new FilterBuilder(baseFilter).buildFilter() : baseFilter
572
538
  const query = `*[
573
- railcontent_id in [${idsString}]${brandFilter}
539
+ ${finalFilter}
574
540
  ]{
575
- ${getFieldsForContentType(contentType)}
541
+ ${fields}
542
+ 'lesson_count': coalesce(count(*[${lessonCountFilter}]), 0),
576
543
  live_event_start_time,
577
544
  live_event_end_time,
578
545
  }`
579
-
580
546
  const customPostProcess = (results) => {
581
547
  const now = getSanityDate(new Date(), false);
582
548
  const liveProcess = (result) => {
@@ -602,7 +568,7 @@ export async function fetchByRailContentIds(ids, contentType = undefined, brand
602
568
  }
603
569
 
604
570
  // Sort results to match the order of the input IDs
605
- const sortedResults = results.sort(sortFuction)
571
+ const sortedResults = results?.sort(sortFuction) ?? null
606
572
 
607
573
  return sortedResults
608
574
  }
@@ -612,15 +578,21 @@ export async function fetchContentRows(brand, pageName, contentRowSlug)
612
578
  if (pageName === 'lessons') pageName = 'lesson'
613
579
  if (pageName === 'songs') pageName = 'song'
614
580
  const rowString = contentRowSlug ? ` &amp;&amp; slug.current == "${contentRowSlug.toLowerCase()}"` : ''
615
- return fetchSanity(`*[_type == 'recommended-content-row' &amp;&amp; brand == '${brand}' &amp;&amp; type == '${pageName}'${rowString}]{
581
+ const lessonCountFilter = await new FilterBuilder(`_id in ^.child[]._ref`, {pullFutureContent: true}).buildFilter()
582
+ const childFilter = await new FilterBuilder('', {isChildrenFilter: true}).buildFilter()
583
+ const query = `*[_type == 'recommended-content-row' &amp;&amp; brand == '${brand}' &amp;&amp; type == '${pageName}'${rowString}]{
616
584
  brand,
617
585
  name,
618
586
  'slug': slug.current,
619
- 'content': content[]->{
620
- 'children': child[]->{ 'id': railcontent_id, 'children': child[]->{'id': railcontent_id}, },
587
+ 'content': content[${childFilter}]->{
588
+ 'children': child[${childFilter}]->{ 'id': railcontent_id,
589
+ 'type': _type, brand, 'thumbnail': thumbnail.asset->url,
590
+ 'children': child[${childFilter}]->{'id': railcontent_id}, },
621
591
  ${getFieldsForContentType('tab-data')}
592
+ 'lesson_count': coalesce(count(*[${lessonCountFilter}]), 0),
622
593
  },
623
- }`, true)
594
+ }`
595
+ return fetchSanity(query, true)
624
596
  }
625
597
 
626
598
 
@@ -829,7 +801,7 @@ export function getSortOrder(sort = '-published_on', brand, groupBy) {
829
801
  sort = isDesc ? sort.substring(1) : sort
830
802
  switch (sort) {
831
803
  case 'slug':
832
- sortOrder = groupBy ? 'name' : 'title'
804
+ sortOrder = groupBy ? 'name' : '!defined(title), lower(title)'
833
805
  break
834
806
  case 'name':
835
807
  sortOrder = sort
@@ -1169,6 +1141,7 @@ export async function jumpToContinueContent(railcontentId) {
1169
1141
  /**
1170
1142
  * Fetch the page data for a specific lesson by Railcontent ID.
1171
1143
  * @param {string} railContentId - The Railcontent ID of the current lesson.
1144
+ * @parent {boolean} addParent - Whether to include parent content data in the response.
1172
1145
  * @returns {Promise&lt;Object|null>} - The fetched page data or null if found.
1173
1146
  *
1174
1147
  * @example
@@ -1176,60 +1149,65 @@ export async function jumpToContinueContent(railcontentId) {
1176
1149
  * .then(data => console.log(data))
1177
1150
  * .catch(error => console.error(error));
1178
1151
  */
1179
- export async function fetchLessonContent(railContentId) {
1152
+ export async function fetchLessonContent(railContentId, { addParent = false } = {}) {
1180
1153
  const filterParams = { isSingle: true, pullFutureContent: true }
1181
1154
 
1155
+ const parentQuery = addParent
1156
+ ? `"parent_content_data": *[railcontent_id in [...(^.parent_content_data[].id)]]{
1157
+ "id": railcontent_id,
1158
+ title,
1159
+ slug,
1160
+ "type": _type,
1161
+ "logo" : logo_image_url.asset->url,
1162
+ "dark_mode_logo": dark_mode_logo_url.asset->url,
1163
+ "light_mode_logo": light_mode_logo_url.asset->url,
1164
+ "badge": badge[0]->badge.asset->url,
1165
+ },`
1166
+ : ''
1167
+
1182
1168
  const fields = `${getFieldsForContentType()}
1183
- "resources": ${resourcesField},
1184
- soundslice,
1185
- instrumentless,
1186
- soundslice_slug,
1187
- "description": ${descriptionField},
1188
- "chapters": ${chapterField},
1189
- "instructors":instructor[]->name,
1190
- "instructor": ${instructorField},
1191
- ${assignmentsField}
1192
- video,
1193
- length_in_seconds,
1194
- mp3_no_drums_no_click_url,
1195
- mp3_no_drums_yes_click_url,
1196
- mp3_yes_drums_no_click_url,
1197
- mp3_yes_drums_yes_click_url,
1198
- "permission_id": permission[]->railcontent_id,
1199
- "parent_content_data": parent_content_data[]{
1200
- "id": id,
1201
- "title": *[railcontent_id == ^.id][0].title,
1202
- "slug":*[railcontent_id == ^.id][0].slug,
1203
- "type": *[railcontent_id == ^.id][0]._type,
1204
- "logo" : *[railcontent_id == ^.id][0].logo_image_url.asset->url,
1205
- "dark_mode_logo": *[railcontent_id == ^.id][0].dark_mode_logo_url.asset->url,
1206
- "light_mode_logo": *[railcontent_id == ^.id][0].light_mode_logo_url.asset->url,
1207
- },
1208
- ...select(
1209
- defined(live_event_start_time) => {
1210
- "live_event_start_time": live_event_start_time,
1211
- "live_event_end_time": live_event_end_time,
1212
- "live_event_youtube_id": live_event_youtube_id,
1213
- "videoId": coalesce(live_event_youtube_id, video.external_id),
1214
- "live_event_is_global": live_global_event == true
1215
- }
1216
- )`
1169
+ "resources": ${resourcesField},
1170
+ soundslice,
1171
+ instrumentless,
1172
+ soundslice_slug,
1173
+ "description": ${descriptionField},
1174
+ "chapters": ${chapterField},
1175
+ "instructors":instructor[]->name,
1176
+ "instructor": ${instructorField},
1177
+ ${assignmentsField}
1178
+ video,
1179
+ length_in_seconds,
1180
+ mp3_no_drums_no_click_url,
1181
+ mp3_no_drums_yes_click_url,
1182
+ mp3_yes_drums_no_click_url,
1183
+ mp3_yes_drums_yes_click_url,
1184
+ "permission_id": permission[]->railcontent_id,
1185
+ ${parentQuery}
1186
+ ...select(
1187
+ defined(live_event_start_time) => {
1188
+ "live_event_start_time": live_event_start_time,
1189
+ "live_event_end_time": live_event_end_time,
1190
+ "live_event_youtube_id": live_event_youtube_id,
1191
+ "videoId": coalesce(live_event_youtube_id, video.external_id),
1192
+ "live_event_is_global": live_global_event == true
1193
+ }
1194
+ )
1195
+ `
1196
+
1217
1197
  const query = await buildQuery(`railcontent_id == ${railContentId}`, filterParams, fields, {
1218
1198
  isSingle: true,
1219
1199
  })
1220
- console.log('query', query)
1221
1200
  const chapterProcess = (result) => {
1222
1201
  const now = getSanityDate(new Date(), false)
1223
1202
  if (result.live_event_start_time &amp;&amp; result.live_event_end_time) {
1224
1203
  result.isLive = result.live_event_start_time &lt;= now &amp;&amp; result.live_event_end_time >= now
1225
1204
  }
1226
1205
  const chapters = result.chapters ?? []
1227
- if (chapters.length == 0) return result
1206
+ if (chapters.length === 0) return result
1228
1207
  result.chapters = chapters.map((chapter, index) => ({
1229
1208
  ...chapter,
1230
1209
  chapter_thumbnail_url: `https://musora-web-platform.s3.amazonaws.com/chapters/${result.brand}/Chapter${index + 1}.jpg`,
1231
1210
  }))
1232
- console.log('result', result)
1233
1211
  return result
1234
1212
  }
1235
1213
 
@@ -1248,7 +1226,7 @@ export async function fetchLessonContent(railContentId) {
1248
1226
  export async function fetchRelatedRecommendedContent(railContentId, brand, count = 10) {
1249
1227
  const recommendedItems = await fetchSimilarItems(railContentId, brand, count)
1250
1228
  if (recommendedItems &amp;&amp; recommendedItems.length > 0) {
1251
- return fetchByRailContentIds(recommendedItems)
1229
+ return fetchByRailContentIds(recommendedItems, 'tab-data', brand, true)
1252
1230
  }
1253
1231
 
1254
1232
  return await fetchRelatedLessons(railContentId, brand).then((result) =>
@@ -1312,7 +1290,7 @@ async function fetchRelatedByLicense(railcontentId, brand, onlyUseSongTypes, cou
1312
1290
  *[${filterSongTypesWithSameLicense}]->{${queryFields}}|order(published_on desc, title asc)[0...${count}],
1313
1291
  }[0...1]`
1314
1292
  const results = await fetchSanity(query, false)
1315
- return results['related_by_license'] ?? []
1293
+ return results ? results['related_by_license'] ?? [] : []
1316
1294
  }
1317
1295
 
1318
1296
  /**
@@ -1321,20 +1299,26 @@ async function fetchRelatedByLicense(railcontentId, brand, onlyUseSongTypes, cou
1321
1299
  * @param {string} brand - The current brand.
1322
1300
  * @returns {Promise&lt;Array&lt;Object>|null>} - The fetched related lessons data or null if not found.
1323
1301
  */
1324
- export async function fetchSiblingContent(railContentId, brand)
1302
+ export async function fetchSiblingContent(railContentId, brand= null)
1325
1303
  {
1326
1304
  const filterGetParent = await new FilterBuilder(`references(^._id) &amp;&amp; _type == ^.parent_type`, {
1305
+ pullFutureContent: true
1306
+ }).buildFilter()
1307
+ const filterForParentList = await new FilterBuilder(`references(^._id) &amp;&amp; _type == ^.parent_type`, {
1327
1308
  pullFutureContent: true,
1309
+ isParentFilter: true,
1328
1310
  }).buildFilter()
1311
+
1329
1312
  const childrenFilter = await new FilterBuilder(``, { isChildrenFilter: true }).buildFilter()
1330
1313
 
1314
+ const brandString = brand ? ` &amp;&amp; brand == "${brand}"` : ''
1331
1315
  const queryFields = `_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail":thumbnail.asset->url, length_in_seconds, status, "type": _type, difficulty, difficulty_string, artist->, "permission_id": permission[]->railcontent_id, "genre": genre[]->name, "parent_id": parent_content_data[0].id`
1332
1316
 
1333
- const query = `*[railcontent_id == ${railContentId} &amp;&amp; brand == "${brand}"]{
1317
+ const query = `*[railcontent_id == ${railContentId}${brandString}]{
1334
1318
  _type, parent_type, 'parent_id': parent_content_data[0].id, railcontent_id,
1335
1319
  'for-calculations': *[${filterGetParent}][0]{
1336
1320
  'siblings-list': child[]->railcontent_id,
1337
- 'parents-list': *[${filterGetParent}][0].child[]->railcontent_id
1321
+ 'parents-list': *[${filterForParentList}][0].child[]->railcontent_id
1338
1322
  },
1339
1323
  "related_lessons" : *[${filterGetParent}][0].child[${childrenFilter}]->{${queryFields}}
1340
1324
  }`
@@ -1361,33 +1345,28 @@ export async function fetchSiblingContent(railContentId, brand)
1361
1345
  /**
1362
1346
  * Fetch lessons related to a specific lesson by RailContent ID and type.
1363
1347
  * @param {string} railContentId - The RailContent ID of the current lesson.
1364
- * @param {string} brand - The current brand.
1365
1348
  * @returns {Promise&lt;Array&lt;Object>|null>} - The fetched related lessons data or null if not found.
1366
1349
  */
1367
- export async function fetchRelatedLessons(railContentId, brand) {
1368
- const filterSameTypeAndSortOrder = await new FilterBuilder(
1369
- `_type==^._type &amp;&amp; _type in ${JSON.stringify(typeWithSortOrder)} &amp;&amp; brand == "${brand}" &amp;&amp; railcontent_id !=${railContentId}`
1370
- ).buildFilter()
1371
- const filterSameType = await new FilterBuilder(
1372
- `_type==^._type &amp;&amp; !(_type in ${JSON.stringify(typeWithSortOrder)}) &amp;&amp; !(defined(parent_type)) &amp;&amp; brand == "${brand}" &amp;&amp; railcontent_id !=${railContentId}`
1373
- ).buildFilter()
1374
- const filterSongSameArtist = await new FilterBuilder(
1375
- `_type=="song" &amp;&amp; _type==^._type &amp;&amp; brand == "${brand}" &amp;&amp; references(^.artist->_id) &amp;&amp; railcontent_id !=${railContentId}`
1350
+ export async function fetchRelatedLessons(railContentId)
1351
+ {
1352
+ const defaultFilterFields = `_type==^._type &amp;&amp; brand == ^.brand &amp;&amp; railcontent_id != ${railContentId}`
1353
+
1354
+ const filterSameArtist = await new FilterBuilder(
1355
+ `${defaultFilterFields} &amp;&amp; references(^.artist->_id)`
1376
1356
  ).buildFilter()
1377
- const filterSongSameGenre = await new FilterBuilder(
1378
- `_type=="song" &amp;&amp; _type==^._type &amp;&amp; brand == "${brand}" &amp;&amp; references(^.genre[]->_id) &amp;&amp; railcontent_id !=${railContentId}`
1357
+ const filterSameGenre = await new FilterBuilder(
1358
+ `${defaultFilterFields} &amp;&amp; references(^.genre[]->_id)`
1379
1359
  ).buildFilter()
1360
+
1380
1361
  const queryFields = `_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail":thumbnail.asset->url, length_in_seconds, status, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type, "genre": genre[]->name`
1381
- const queryFieldsWithSort = queryFields + ', sort'
1382
- const query = `*[railcontent_id == ${railContentId} &amp;&amp; brand == "${brand}" &amp;&amp; (!defined(permission) || references(*[_type=='permission']._id))]{
1362
+
1363
+ const query = `*[railcontent_id == ${railContentId} &amp;&amp; (!defined(permission) || references(*[_type=='permission']._id))]{
1383
1364
  _type, parent_type, railcontent_id,
1384
1365
  "related_lessons" : array::unique([
1385
- ...(*[${filterSongSameArtist}]{${queryFields}}|order(published_on desc, title asc)[0...10]),
1386
- ...(*[${filterSongSameGenre}]{${queryFields}}|order(published_on desc, title asc)[0...10]),
1387
- ...(*[${filterSameTypeAndSortOrder}]{${queryFieldsWithSort}}|order(sort asc, title asc)[0...10]),
1388
- ...(*[${filterSameType}]{${queryFields}}|order(published_on desc, title asc)[0...10])
1389
- ,
1366
+ ...(*[${filterSameArtist}]{${queryFields}}|order(published_on desc, title asc)[0...10]),
1367
+ ...(*[${filterSameGenre}]{${queryFields}}|order(published_on desc, title asc)[0...10]),
1390
1368
  ])[0...10]}`
1369
+
1391
1370
  return await fetchSanity(query, false)
1392
1371
  }
1393
1372
 
@@ -1519,7 +1498,7 @@ export async function fetchLiveEvent(brand, forcedContentId = null) {
1519
1498
  */
1520
1499
  export async function fetchPackData(id) {
1521
1500
  const query = `*[railcontent_id == ${id}]{
1522
- ${getFieldsForContentType('pack')}
1501
+ ${await getFieldsForContentTypeWithFilteredChildren('pack')}
1523
1502
  } [0...1]`
1524
1503
  return fetchSanity(query, false)
1525
1504
  }
@@ -1909,6 +1888,9 @@ export async function fetchSanity(
1909
1888
  console.log('fetchSanity Results:', result)
1910
1889
  }
1911
1890
  let results = isList ? result.result : result.result[0]
1891
+ if (!results) {
1892
+ throw new Error('No results found')
1893
+ }
1912
1894
  results = processNeedAccess
1913
1895
  ? await needsAccessDecorator(results, userPermissions, isAdmin)
1914
1896
  : results
@@ -2055,6 +2037,10 @@ function getSanityDate(date, roundToHourForCaching = true) {
2055
2037
  return date.toISOString()
2056
2038
  }
2057
2039
 
2040
+ function getDateOnly(date = new Date()) {
2041
+ return date.toISOString().split('T')[0]
2042
+ }
2043
+
2058
2044
  const merge = (a, b, predicate = (a, b) => a === b) => {
2059
2045
  const c = [...a] // copy to avoid side effects
2060
2046
  // add all items from B to copy C if they're not already present
@@ -2108,10 +2094,10 @@ async function buildQuery(
2108
2094
  function buildEntityAndTotalQuery(
2109
2095
  filter = '',
2110
2096
  fields = '...',
2111
- { sortOrder = 'published_on desc', start = 0, end = 10, isSingle = false, withoutPagination = false }
2097
+ { sortOrder = 'published_on desc', start = 0, end = 10, isSingle = false }
2112
2098
  ) {
2113
2099
  const sortString = sortOrder ? ` | order(${sortOrder})` : ''
2114
- const countString = isSingle ? '[0...1]' : (withoutPagination ? ``: `[${start}...${end}]`)
2100
+ const countString = isSingle ? '[0...1]' : `[${start}...${end}]`
2115
2101
  const query = `{
2116
2102
  "entity": *[${filter}] ${sortString}${countString}
2117
2103
  {
@@ -2225,43 +2211,17 @@ export async function fetchTabData(
2225
2211
  page = 1,
2226
2212
  limit = 10,
2227
2213
  sort = '-published_on',
2228
- includedFields = [],
2229
- progressIds = undefined,
2230
- progress = 'all',
2214
+ includedFields = []
2231
2215
  } = {}
2232
2216
  ) {
2233
2217
  const start = (page - 1) * limit
2234
2218
  const end = start + limit
2235
- let withoutPagination = false
2236
2219
  // Construct the included fields filter, replacing 'difficulty' with 'difficulty_string'
2237
2220
  const includedFieldsFilter =
2238
2221
  includedFields.length > 0 ? filtersToGroq(includedFields, [], pageName) : ''
2239
2222
 
2240
2223
  let sortOrder = getSortOrder(sort, brand, '')
2241
2224
 
2242
- switch (progress) {
2243
- case 'recent':
2244
- progressIds = await getAllStartedOrCompleted({ brand, onlyIds: true });
2245
- sortOrder = null;
2246
- withoutPagination = true;
2247
- break;
2248
- case 'incomplete':
2249
- progressIds = await getAllStarted();
2250
- sortOrder = null;
2251
- break;
2252
- case 'completed':
2253
- progressIds = await getAllCompleted();
2254
- sortOrder = null;
2255
- break;
2256
- }
2257
-
2258
- // limits the results to supplied progressIds for started &amp; completed filters
2259
- const progressFilter = await getProgressFilter(progress, progressIds)
2260
- if (sort === "recommended"){
2261
- progressIds = await recommendations(brand);
2262
- withoutPagination = true;
2263
- }
2264
-
2265
2225
  const fieldsString = getFieldsForContentType('tab-data');
2266
2226
  const now = getSanityDate(new Date())
2267
2227
 
@@ -2270,13 +2230,14 @@ export async function fetchTabData(
2270
2230
  let entityFieldsString = ''
2271
2231
  let filter = ''
2272
2232
 
2273
- filter = `brand == "${brand}" ${includedFieldsFilter} ${progressFilter}`
2233
+ filter = `brand == "${brand}" ${includedFieldsFilter}`
2274
2234
  const childrenFilter = await new FilterBuilder(``, { isChildrenFilter: true }).buildFilter()
2235
+ const lessonCountFilter = await new FilterBuilder(`_id in ^.child[]._ref`).buildFilter()
2275
2236
  entityFieldsString =
2276
2237
  ` ${fieldsString}
2277
- 'children': child[${childrenFilter}]->{'id': railcontent_id},
2238
+ 'children': child[${childrenFilter}]->{'id': railcontent_id, 'type': _type, brand, 'thumbnail': thumbnail.asset->url},
2278
2239
  'isLive': live_event_start_time &lt;= "${now}" &amp;&amp; live_event_end_time >= "${now}",
2279
- 'lesson_count': coalesce(count(child[${childrenFilter}]->), 0),
2240
+ 'lesson_count': coalesce(count(*[${lessonCountFilter}]), 0),
2280
2241
  'length_in_seconds': coalesce(
2281
2242
  math::sum(
2282
2243
  select(
@@ -2289,42 +2250,14 @@ export async function fetchTabData(
2289
2250
  query = buildEntityAndTotalQuery(filterWithRestrictions, entityFieldsString, {
2290
2251
  sortOrder: sortOrder,
2291
2252
  start: start,
2292
- end: end,
2293
- withoutPagination: withoutPagination,
2253
+ end: end
2294
2254
  })
2295
2255
 
2296
2256
  let results = await fetchSanity(query, true);
2297
2257
 
2298
- if ((['recent', 'incomplete', 'completed'].includes(progress) || sort == "recommended" )&amp;&amp; results.entity.length > 1) {
2299
- const orderMap = new Map(progressIds.map((id, index) => [id, index]))
2300
- results.entity = results.entity
2301
- .sort((a, b) => {
2302
- const aIdx = orderMap.get(a.id) ?? Number.MAX_SAFE_INTEGER;
2303
- const bIdx = orderMap.get(b.id) ?? Number.MAX_SAFE_INTEGER;
2304
- return aIdx - bIdx || new Date(b.published_on) - new Date(a.published_on);
2305
- })
2306
- .slice(start, end);
2307
- }
2308
-
2309
2258
  return results;
2310
2259
  }
2311
2260
 
2312
- export async function fetchRecent(
2313
- brand,
2314
- pageName,
2315
- { page = 1, limit = 10, sort = '-published_on', includedFields = [], progress = 'recent' } = {}
2316
- ) {
2317
- const mergedIncludedFields = [...includedFields, `tab,all`]
2318
- const results = await fetchTabData(brand, pageName, {
2319
- page,
2320
- limit,
2321
- sort,
2322
- includedFields: mergedIncludedFields,
2323
- progress: progress.toLowerCase(),
2324
- })
2325
- return results.entity
2326
- }
2327
-
2328
2261
  export async function fetchScheduledAndNewReleases(
2329
2262
  brand,
2330
2263
  { page = 1, limit = 20, sort = '-published_on' } = {}
@@ -2347,6 +2280,7 @@ export async function fetchScheduledAndNewReleases(
2347
2280
  "id": railcontent_id,
2348
2281
  title,
2349
2282
  "image": thumbnail.asset->url,
2283
+ "thumbnail": thumbnail.asset->url,
2350
2284
  ${artistOrInstructorName()},
2351
2285
  "artists": instructor[]->name,
2352
2286
  difficulty,
@@ -2369,6 +2303,7 @@ export async function fetchShows(brand, type, sort = 'sort') {
2369
2303
 
2370
2304
  const query = await buildQuery(filter, filterParams, getFieldsForContentType(type), {
2371
2305
  sortOrder: sortOrder,
2306
+ end: 100, // Adrian: added for homepage progress rows, this should be handled gracefully
2372
2307
  })
2373
2308
  return fetchSanity(query, true)
2374
2309
  }
@@ -2386,7 +2321,7 @@ export async function fetchShows(brand, type, sort = 'sort') {
2386
2321
  <br class="clear">
2387
2322
 
2388
2323
  <footer>
2389
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Jul 25 2025 21:19:12 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2324
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Aug 19 2025 17:54:03 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2390
2325
  </footer>
2391
2326
 
2392
2327
  <script>prettyPrint();</script>