musora-content-services 2.33.7 → 2.35.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 (57) hide show
  1. package/CHANGELOG.md +30 -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 -2
  7. package/docs/content-org_content-org.js.html +2 -2
  8. package/docs/content-org_guided-courses.ts.html +2 -2
  9. package/docs/content-org_playlists-types.js.html +2 -2
  10. package/docs/content-org_playlists.js.html +2 -2
  11. package/docs/content.js.html +2 -2
  12. package/docs/gamification_awards.ts.html +2 -2
  13. package/docs/gamification_gamification.js.html +2 -2
  14. package/docs/global.html +2 -2
  15. package/docs/index.html +2 -2
  16. package/docs/module-Accounts.html +2 -2
  17. package/docs/module-Awards.html +2 -2
  18. package/docs/module-Config.html +2 -2
  19. package/docs/module-Content-Services-V2.html +2 -2
  20. package/docs/module-GuidedCourses.html +2 -2
  21. package/docs/module-Interests.html +2 -2
  22. package/docs/module-Permissions.html +2 -2
  23. package/docs/module-Playlists.html +2 -2
  24. package/docs/module-Railcontent-Services.html +2 -2
  25. package/docs/module-Sanity-Services.html +2 -2
  26. package/docs/module-Sessions.html +2 -2
  27. package/docs/module-UserActivity.html +4 -4
  28. package/docs/module-UserChat.html +2 -2
  29. package/docs/module-UserManagement.html +2 -2
  30. package/docs/module-UserMemberships.html +406 -0
  31. package/docs/module-UserNotifications.html +14 -14
  32. package/docs/module-UserProfile.html +2 -2
  33. package/docs/railcontent.js.html +2 -2
  34. package/docs/sanity.js.html +5 -4
  35. package/docs/userActivity.js.html +15 -6
  36. package/docs/user_account.ts.html +2 -2
  37. package/docs/user_chat.js.html +2 -2
  38. package/docs/user_interests.js.html +2 -2
  39. package/docs/user_management.js.html +2 -2
  40. package/docs/user_memberships.js.html +122 -0
  41. package/docs/user_notifications.js.html +7 -5
  42. package/docs/user_permissions.js.html +2 -2
  43. package/docs/user_profile.js.html +2 -2
  44. package/docs/user_sessions.js.html +2 -2
  45. package/docs/user_types.js.html +2 -2
  46. package/docs/user_user-management-system.js.html +2 -2
  47. package/package.json +1 -1
  48. package/src/contentTypeConfig.js +1 -1
  49. package/src/index.d.ts +13 -0
  50. package/src/index.js +13 -0
  51. package/src/services/dataContext.js +1 -0
  52. package/src/services/eventsAPI.js +154 -0
  53. package/src/services/sanity.js +2 -5
  54. package/src/services/user/memberships.js +50 -0
  55. package/src/services/user/notifications.js +5 -3
  56. package/src/services/userActivity.js +1 -1
  57. package/tools/generate-index.cjs +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-Accounts.html">Accounts</a><ul class='methods'><li data-type='method'><a href="module-Accounts.html#~confirmEmailChange">confirmEmailChange</a></li><li data-type='method'><a href="module-Accounts.html#~requestEmailChange">requestEmailChange</a></li><li data-type='method'><a href="module-Accounts.html#~resetPassword">resetPassword</a></li><li data-type='method'><a href="module-Accounts.html#~sendAccountSetupEmail">sendAccountSetupEmail</a></li><li data-type='method'><a href="module-Accounts.html#~sendPasswordResetEmail">sendPasswordResetEmail</a></li><li data-type='method'><a href="module-Accounts.html#~setupAccount">setupAccount</a></li><li data-type='method'><a href="module-Accounts.html#~status">status</a></li></ul></li><li><a href="module-Awards.html">Awards</a><ul class='methods'><li data-type='method'><a href="module-Awards.html#~fetchAwardsForUser">fetchAwardsForUser</a></li><li data-type='method'><a href="module-Awards.html#~fetchCertificate">fetchCertificate</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-GuidedCourses.html">GuidedCourses</a></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>
32
+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Accounts.html">Accounts</a><ul class='methods'><li data-type='method'><a href="module-Accounts.html#~confirmEmailChange">confirmEmailChange</a></li><li data-type='method'><a href="module-Accounts.html#~requestEmailChange">requestEmailChange</a></li><li data-type='method'><a href="module-Accounts.html#~resetPassword">resetPassword</a></li><li data-type='method'><a href="module-Accounts.html#~sendAccountSetupEmail">sendAccountSetupEmail</a></li><li data-type='method'><a href="module-Accounts.html#~sendPasswordResetEmail">sendPasswordResetEmail</a></li><li data-type='method'><a href="module-Accounts.html#~setupAccount">setupAccount</a></li><li data-type='method'><a href="module-Accounts.html#~status">status</a></li></ul></li><li><a href="module-Awards.html">Awards</a><ul class='methods'><li data-type='method'><a href="module-Awards.html#~fetchAwardsForUser">fetchAwardsForUser</a></li><li data-type='method'><a href="module-Awards.html#~fetchCertificate">fetchCertificate</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-GuidedCourses.html">GuidedCourses</a></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-UserMemberships.html">UserMemberships</a><ul class='methods'><li data-type='method'><a href="module-UserMemberships.html#.fetchMemberships">fetchMemberships</a></li><li data-type='method'><a href="module-UserMemberships.html#.fetchRechargeTokens">fetchRechargeTokens</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
 
@@ -66,7 +66,7 @@
66
66
  <br class="clear">
67
67
 
68
68
  <footer>
69
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Aug 27 2025 17:20:43 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
69
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Sep 05 2025 12:36:37 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
70
70
  </footer>
71
71
 
72
72
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.33.7",
3
+ "version": "2.35.0",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -262,7 +262,7 @@ export let contentTypeConfig = {
262
262
  'progress-tracker': {
263
263
  fields: [
264
264
  '"parent_content_data": parent_content_data[].id',
265
- '"badge" : badge.asset->url',
265
+ '"badge" : *[references(^._id) && _type == "content-award"][0].badge.asset->url',
266
266
  ],
267
267
  includeChildFields: true,
268
268
  },
package/src/index.d.ts CHANGED
@@ -254,6 +254,11 @@ import {
254
254
  uploadPictureFromS3
255
255
  } from './services/user/management.js';
256
256
 
257
+ import {
258
+ fetchMemberships,
259
+ fetchRechargeTokens
260
+ } from './services/user/memberships.js';
261
+
257
262
  import {
258
263
  deleteNotification,
259
264
  fetchLiveEventPollingState,
@@ -310,6 +315,10 @@ import {
310
315
  updateUserPractice
311
316
  } from './services/userActivity.js';
312
317
 
318
+ import {
319
+ default as EventsAPI
320
+ } from './services/eventsAPI';
321
+
313
322
  declare module 'musora-content-services' {
314
323
  export {
315
324
  addContextToContent,
@@ -380,6 +389,7 @@ declare module 'musora-content-services' {
380
389
  fetchLikeCount,
381
390
  fetchLiveEvent,
382
391
  fetchLiveEventPollingState,
392
+ fetchMemberships,
383
393
  fetchMetadata,
384
394
  fetchMethod,
385
395
  fetchMethodChildren,
@@ -400,6 +410,7 @@ declare module 'musora-content-services' {
400
410
  fetchRecent,
401
411
  fetchRecentActivitiesActiveTabs,
402
412
  fetchRecentUserActivities,
413
+ fetchRechargeTokens,
403
414
  fetchRelatedLessons,
404
415
  fetchRelatedRecommendedContent,
405
416
  fetchRelatedSongs,
@@ -549,3 +560,5 @@ declare module 'musora-content-services' {
549
560
  verifyLocalDataContext,
550
561
  }
551
562
  }
563
+
564
+ export default EventsAPI
package/src/index.js CHANGED
@@ -254,6 +254,11 @@ import {
254
254
  uploadPictureFromS3
255
255
  } from './services/user/management.js';
256
256
 
257
+ import {
258
+ fetchMemberships,
259
+ fetchRechargeTokens
260
+ } from './services/user/memberships.js';
261
+
257
262
  import {
258
263
  deleteNotification,
259
264
  fetchLiveEventPollingState,
@@ -310,6 +315,10 @@ import {
310
315
  updateUserPractice
311
316
  } from './services/userActivity.js';
312
317
 
318
+ import {
319
+ default as EventsAPI
320
+ } from './services/eventsAPI';
321
+
313
322
  export {
314
323
  addContextToContent,
315
324
  addItemToPlaylist,
@@ -379,6 +388,7 @@ export {
379
388
  fetchLikeCount,
380
389
  fetchLiveEvent,
381
390
  fetchLiveEventPollingState,
391
+ fetchMemberships,
382
392
  fetchMetadata,
383
393
  fetchMethod,
384
394
  fetchMethodChildren,
@@ -399,6 +409,7 @@ export {
399
409
  fetchRecent,
400
410
  fetchRecentActivitiesActiveTabs,
401
411
  fetchRecentUserActivities,
412
+ fetchRechargeTokens,
402
413
  fetchRelatedLessons,
403
414
  fetchRelatedRecommendedContent,
404
415
  fetchRelatedSongs,
@@ -547,3 +558,5 @@ export {
547
558
  verifyImageSRC,
548
559
  verifyLocalDataContext,
549
560
  };
561
+
562
+ export default EventsAPI
@@ -11,6 +11,7 @@ const excludeFromGeneratedIndex = []
11
11
  export const ContentLikesVersionKey = 0
12
12
  export const ContentProgressVersionKey = 1
13
13
  export const UserActivityVersionKey = 2
14
+ export const PollingStateVersionKey = 3
14
15
 
15
16
  let cache = null
16
17
 
@@ -0,0 +1,154 @@
1
+ import {fetchLiveEventPollingState, fetchUnreadCount, pauseLiveEventPolling} from "./user/notifications"
2
+ import {fetchLiveEvent} from "./sanity"
3
+ import { DataContext, PollingStateVersionKey } from './dataContext'
4
+
5
+ const pollingStateContext = new DataContext(PollingStateVersionKey, fetchLiveEventPollingState)
6
+
7
+ /**
8
+ * API for managing notifications and live event polling.
9
+ */
10
+ class EventsAPI {
11
+ constructor() {
12
+ this.brand = 'drumeo'
13
+ this.onNotificationStateUpdated = []
14
+ this.pollingInterval = null
15
+ this.isLiveEventPollingActive = true
16
+ this.resumeLiveEventTimeout = null
17
+ }
18
+
19
+ async initPollingControl() {
20
+ return pollingStateContext.getData();
21
+ }
22
+
23
+ /**
24
+ * Initializes the EventsAPI, setting the brand and starting auto events.
25
+ * @param {Object} [options]
26
+ * @param {string} [options.brand='drumeo'] - Brand identifier.
27
+ */
28
+ async initialize({ brand = 'drumeo' } = {}) {
29
+ this.brand = brand;
30
+ await this.setupAutoEvents();
31
+ await this.checkNotifications();
32
+ }
33
+ /**
34
+ * Adds a callback for when the notification state updates.
35
+ * @param {(notifications: { unreadCount: number, liveEvent: any }) => void} callback
36
+ * @returns {() => void} Function to remove the handler.
37
+ */
38
+ addNotificationStateUpdatedHandler(callback) {
39
+ this.onNotificationStateUpdated.push(callback);
40
+ return () => this.removeNotificationStateUpdatedHandler(callback);
41
+ }
42
+
43
+ /**
44
+ * Removes a previously added notification state update callback.
45
+ * @param {Function} callback
46
+ */
47
+ removeNotificationStateUpdatedHandler(callback) {
48
+ const index = this.onNotificationStateUpdated.indexOf(callback);
49
+ if (index > -1) {
50
+ this.onNotificationStateUpdated.splice(index, 1);
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Triggers all notification state update callbacks.
56
+ * @param {Object} notifications
57
+ * @param {number} notifications.unreadCount
58
+ * @param {any} notifications.liveEvent
59
+ */
60
+ triggerNotificationStateUpdated(notifications) {
61
+ this.onNotificationStateUpdated.forEach(callback => {
62
+ try {
63
+ callback(notifications);
64
+ } catch (error) {
65
+ console.error('Error in onNotificationStateUpdated callback:', error);
66
+ }
67
+ });
68
+ }
69
+
70
+ /**
71
+ * Sets up automatic polling for notifications.
72
+ */
73
+ async setupAutoEvents() {
74
+ try {
75
+ const pollingData = await this.initPollingControl();
76
+ const pauseUntil = Date.parse(pollingData?.pause_until); // UTC ms
77
+ const now = Date.now(); // UTC ms
78
+ const isPaused = pauseUntil > now;
79
+ if (isPaused) {
80
+ const ttlMs = pauseUntil - now;
81
+ await this.pauseLiveEventCheck(ttlMs);
82
+ }
83
+ this.pollingInterval = setInterval(() => {
84
+ this.checkNotifications();
85
+ }, 60000);
86
+ } catch (error) {
87
+ console.error('EventsApi: Failed to setup auto events:', error);
88
+ this.checkNotifications();
89
+ }
90
+ }
91
+
92
+
93
+ /**
94
+ * Checks for unread notifications and triggers callbacks.
95
+ */
96
+ async checkNotifications() {
97
+ try {
98
+ const notificationRes = await fetchUnreadCount({brand : this.brand });
99
+ this.triggerNotificationStateUpdated({
100
+ unreadCount: notificationRes.data,
101
+ liveEvent : notificationRes.liveEvent || null,
102
+ });
103
+ } catch (error) {
104
+ console.error('Failed to check notifications:', error);
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Pauses live event polling for a specified TTL or until the live event ends.
110
+ * @param {number} ttlMs - Time to pause in milliseconds.
111
+ */
112
+ async pauseLiveEventCheck(ttlMs) {
113
+ this.isLiveEventPollingActive = false;
114
+ if (this.resumeLiveEventTimeout) {
115
+ clearTimeout(this.resumeLiveEventTimeout);
116
+ }
117
+ if (typeof ttlMs !== 'number') {
118
+ try {
119
+ const liveEvent = await fetchLiveEvent(this.brand);
120
+ if(liveEvent == null || liveEvent.live_event_end_time == null){
121
+ return;
122
+ }
123
+ const now = Date.now();
124
+ const endTime = new Date(liveEvent.live_event_end_time).getTime();
125
+ await pauseLiveEventPolling(this.brand);
126
+ ttlMs = endTime - now;
127
+ } catch (err) {
128
+ console.error('Failed to fetch live event for TTL fallback:', err);
129
+ return;
130
+ }
131
+ }
132
+
133
+ if (ttlMs > 0) {
134
+ this.resumeLiveEventTimeout = setTimeout(() => {
135
+ this.resumeLiveEventCheck();
136
+ }, ttlMs);
137
+ }
138
+ }
139
+
140
+ /**
141
+ * Resumes live event polling immediately.
142
+ */
143
+ resumeLiveEventCheck() {
144
+ this.isLiveEventPollingActive = true;
145
+ if (this.resumeLiveEventTimeout) {
146
+ clearTimeout(this.resumeLiveEventTimeout);
147
+ this.resumeLiveEventTimeout = null;
148
+ }
149
+ }
150
+ }
151
+
152
+ // Export singleton
153
+ const eventsAPI = new EventsAPI();
154
+ export default eventsAPI;
@@ -1114,7 +1114,7 @@ export async function fetchLessonContent(railContentId, { addParent = false } =
1114
1114
  "logo" : logo_image_url.asset->url,
1115
1115
  "dark_mode_logo": dark_mode_logo_url.asset->url,
1116
1116
  "light_mode_logo": light_mode_logo_url.asset->url,
1117
- "badge": badge[0]->badge.asset->url,
1117
+ "badge": *[references(^._id) && _type == 'content-award'][0].badge.asset->url,
1118
1118
  },`
1119
1119
  : ''
1120
1120
 
@@ -1805,9 +1805,6 @@ export async function fetchSanity(
1805
1805
  return null
1806
1806
  }
1807
1807
 
1808
- // if (globalConfig.sanityConfig.debug) {
1809
- // console.log('fetchSanity Query:', query)
1810
- // }
1811
1808
  const perspective = globalConfig.sanityConfig.perspective ?? 'published'
1812
1809
  const api = globalConfig.sanityConfig.useCachedAPI ? 'apicdn' : 'api'
1813
1810
  const url = `https://${globalConfig.sanityConfig.projectId}.${api}.sanity.io/v${globalConfig.sanityConfig.version}/data/query/${globalConfig.sanityConfig.dataset}?perspective=${perspective}`
@@ -1852,7 +1849,7 @@ export async function fetchSanity(
1852
1849
  throw new Error('No results found')
1853
1850
  }
1854
1851
  } catch (error) {
1855
- console.error('fetchSanity: Fetch error:', error)
1852
+ console.error('fetchSanity: Fetch error:', {error, query})
1856
1853
  return null
1857
1854
  }
1858
1855
  }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @module UserMemberships
3
+ */
4
+ import { fetchHandler } from '../railcontent.js'
5
+ import './types.js'
6
+
7
+ const baseUrl = `/api/user-memberships`
8
+
9
+ /**
10
+ * Fetches the authenticated user's memberships from the API.
11
+ *
12
+ * @returns {Promise<Array<Object>>} - A promise that resolves to an array of membership objects.
13
+ *
14
+ * @throws {Error} - Throws an error if the request fails.
15
+ *
16
+ * @example
17
+ * fetchMemberships()
18
+ * .then(memberships => console.log(memberships))
19
+ * .catch(error => console.error(error));
20
+ */
21
+ export async function fetchMemberships() {
22
+ const url = `${baseUrl}/v1`
23
+ return fetchHandler(url, 'get')
24
+ }
25
+
26
+ /**
27
+ * Fetches tokens required for interacting with Shopify and Recharge.
28
+ *
29
+ * @returns {Promise<Object>} - A promise that resolves to an object containing:
30
+ * - {string} shopify_customer_access_token - Shopify customer access token.
31
+ * - {string} store_identifier - The store domain identifier.
32
+ * - {string} recharge_storefront_access_token - Recharge storefront access token.
33
+ * - {string} storefront_access_token - Shopify storefront access token.
34
+ *
35
+ * @throws {Error} - Throws an error if the request fails.
36
+ *
37
+ * @example
38
+ * fetchRechargeTokens()
39
+ * .then(tokens => console.log(tokens))
40
+ * .catch(error => console.error(error));
41
+ */
42
+ export async function fetchRechargeTokens() {
43
+ const url = `${baseUrl}/v1/subscriptions-tokens`
44
+ return fetchHandler(url, 'get')
45
+ }
46
+
47
+
48
+
49
+
50
+
@@ -2,7 +2,9 @@
2
2
  * @module UserNotifications
3
3
  */
4
4
  import { fetchHandler } from '../railcontent.js'
5
+ import eventsAPI from '../eventsAPI.js'
5
6
  import './types.js'
7
+ import {globalConfig} from "../config";
6
8
  import {fetchLiveEvent} from "../sanity";
7
9
 
8
10
  const baseUrl = `/api/notifications`
@@ -67,8 +69,8 @@ export async function markNotificationAsRead(notificationId) {
67
69
  * @param {string} [brand='drumeo'] - The brand context for live event handling before marking notifications.
68
70
  * @returns {Promise<Object>} - A promise resolving to the API response from the notifications read endpoint.
69
71
  */
70
- export async function markAllNotificationsAsRead(brand = 'drumeo') {
71
- await pauseLiveEventPolling(brand)
72
+ export async function markAllNotificationsAsRead() {
73
+ await eventsAPI.pauseLiveEventCheck()
72
74
  const url = `${baseUrl}/v1/read`
73
75
  return fetchHandler(url, 'put')
74
76
  }
@@ -168,7 +170,7 @@ export async function fetchUnreadCount({ brand = 'drumeo'} = {}) {
168
170
  const liveEventPollingState = await fetchLiveEventPollingState()
169
171
  if(liveEventPollingState.data?.read_state === true){
170
172
  const liveEvent = await fetchLiveEvent(brand)
171
- return { data: liveEvent ? 1 : 0}
173
+ return { data: liveEvent ? 1 : 0, liveEvent}
172
174
  }
173
175
  return { data: 0}
174
176
  }
@@ -1216,7 +1216,7 @@ function getDefaultCTATextForContent(content, contentType) {
1216
1216
  )
1217
1217
  ctaText = 'Replay Song'
1218
1218
  if (contentType === 'lesson') ctaText = 'Revisit Lesson'
1219
- if (contentType === 'song tutorial' || collectionLessonTypes.includes(contentType))
1219
+ if (contentType === 'song tutorial' || collectionLessonTypes.includes(content.type))
1220
1220
  ctaText = 'Revisit Lessons'
1221
1221
  if (contentType === 'pack') ctaText = 'View Lessons'
1222
1222
  }
@@ -89,11 +89,15 @@ Object.entries(fileExports).forEach(([file, functionNames]) => {
89
89
  content += `\nimport {\n\t${functionNames.join(',\n\t')}\n} from './services/${file}';\n`
90
90
  })
91
91
 
92
+ content += `\nimport {\n\t default as EventsAPI \n} from './services/eventsAPI';\n`
93
+
92
94
  const allFunctionNames = Object.values(fileExports).flat().sort()
93
95
  content += '\nexport {\n'
94
96
  content += `\t${allFunctionNames.join(',\n\t')},\n`
95
97
  content += '};\n'
96
98
 
99
+ content += '\nexport default EventsAPI\n'
100
+
97
101
  // write the generated content to index.js
98
102
  const outputPath = path.join(__dirname, '../src/index.js')
99
103
  fs.writeFileSync(outputPath, content)
@@ -108,12 +112,16 @@ Object.entries(fileExports).forEach(([file, functionNames]) => {
108
112
  dtsContent += `\nimport {\n\t${functionNames.join(',\n\t')}\n} from './services/${file}';\n`
109
113
  })
110
114
 
115
+ dtsContent += `\nimport {\n\t default as EventsAPI \n} from './services/eventsAPI';\n`
116
+
111
117
  dtsContent += "\ndeclare module 'musora-content-services' {\n"
112
118
  dtsContent += '\texport {\n'
113
119
  dtsContent += `\t\t${allFunctionNames.join(',\n\t\t')},\n`
114
120
  dtsContent += '\t}\n'
115
121
  dtsContent += '}\n'
116
122
 
123
+ dtsContent += '\nexport default EventsAPI\n'
124
+
117
125
  // write the generated content to index.d.ts
118
126
  const outputDtsPath = path.join(__dirname, '../src/index.d.ts')
119
127
  fs.writeFileSync(outputDtsPath, dtsContent)