musora-content-services 1.6.5 → 1.6.6

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 (84) hide show
  1. package/.github/workflows/conventional-commits.yaml +16 -0
  2. package/.github/workflows/docs.js.yml +58 -0
  3. package/CHANGELOG.md +2 -0
  4. package/README.md +1 -2
  5. package/docs/v2/Content-Organization.html +245 -0
  6. package/docs/v2/ContentOrganization.html +245 -0
  7. package/docs/v2/Gamification.html +245 -0
  8. package/docs/v2/UserManagement.html +269 -0
  9. package/docs/v2/UserManagementSystem.html +317 -0
  10. package/docs/v2/api_types.js.html +97 -0
  11. package/docs/v2/config.js.html +143 -0
  12. package/docs/v2/content-org_content-org.js.html +76 -0
  13. package/docs/v2/content-org_playlists-types.js.html +116 -0
  14. package/docs/v2/content-org_playlists.js.html +418 -0
  15. package/docs/v2/content.js.html +466 -0
  16. package/docs/v2/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  17. package/docs/v2/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  18. package/docs/v2/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  19. package/docs/v2/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  20. package/docs/v2/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  21. package/docs/v2/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  22. package/docs/v2/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  23. package/docs/v2/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  24. package/docs/v2/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  25. package/docs/v2/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  26. package/docs/v2/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  27. package/docs/v2/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  28. package/docs/v2/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  29. package/docs/v2/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  30. package/docs/v2/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  31. package/docs/v2/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  32. package/docs/v2/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  33. package/docs/v2/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  34. package/docs/v2/gamification_awards.js.html +664 -0
  35. package/docs/v2/gamification_gamification.js.html +76 -0
  36. package/docs/v2/gamification_types.js.html +98 -0
  37. package/docs/v2/global.html +5812 -0
  38. package/docs/v2/global.html#User +293 -0
  39. package/docs/v2/index.html +168 -0
  40. package/docs/v2/module-Awards.html +354 -0
  41. package/docs/v2/module-Config.html +434 -0
  42. package/docs/v2/module-Content-Services-V2.html +2434 -0
  43. package/docs/v2/module-Interests.html +1066 -0
  44. package/docs/v2/module-Notifications.html +1183 -0
  45. package/docs/v2/module-Permissions.html +406 -0
  46. package/docs/v2/module-Playlists.html +2862 -0
  47. package/docs/v2/module-Railcontent-Services.html +7954 -0
  48. package/docs/v2/module-Sanity-Services.html +9608 -0
  49. package/docs/v2/module-Session-Management.html +575 -0
  50. package/docs/v2/module-Sessions.html +575 -0
  51. package/docs/v2/module-User-Activity.html +4410 -0
  52. package/docs/v2/module-User-Management.html +490 -0
  53. package/docs/v2/module-User-Permissions.html +406 -0
  54. package/docs/v2/module-UserActivity.html +4410 -0
  55. package/docs/v2/module-UserManagement.html +915 -0
  56. package/docs/v2/module-UserNotifications.html +1223 -0
  57. package/docs/v2/module-UserProfile.html +266 -0
  58. package/docs/v2/railcontent.js.html +984 -0
  59. package/docs/v2/sanity.js.html +2459 -0
  60. package/docs/v2/scripts/collapse.js +39 -0
  61. package/docs/v2/scripts/commonNav.js +28 -0
  62. package/docs/v2/scripts/linenumber.js +25 -0
  63. package/docs/v2/scripts/nav.js +12 -0
  64. package/docs/v2/scripts/polyfill.js +4 -0
  65. package/docs/v2/scripts/prettify/Apache-License-2.0.txt +202 -0
  66. package/docs/v2/scripts/prettify/lang-css.js +2 -0
  67. package/docs/v2/scripts/prettify/prettify.js +28 -0
  68. package/docs/v2/scripts/search.js +99 -0
  69. package/docs/v2/styles/jsdoc.css +776 -0
  70. package/docs/v2/styles/prettify.css +80 -0
  71. package/docs/v2/types.js.html +122 -0
  72. package/docs/v2/userActivity.js.html +1451 -0
  73. package/docs/v2/user_interests.js.html +150 -0
  74. package/docs/v2/user_management.js.html +178 -0
  75. package/docs/v2/user_notifications.js.html +192 -0
  76. package/docs/v2/user_permissions.js.html +110 -0
  77. package/docs/v2/user_profile.js.html +105 -0
  78. package/docs/v2/user_sessions.js.html +139 -0
  79. package/docs/v2/user_types.js.html +208 -0
  80. package/docs/v2/user_user-management-system.js.html +79 -0
  81. package/docs/v2/user_user-management.js.html +78 -0
  82. package/package.json +1 -1
  83. package/src/contentTypeConfig.js +27 -12
  84. package/src/services/sanity.js +120 -81
@@ -0,0 +1,466 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+
5
+ <meta charset="utf-8">
6
+ <title>content.js - Documentation</title>
7
+
8
+
9
+ <script src="scripts/prettify/prettify.js"></script>
10
+ <script src="scripts/prettify/lang-css.js"></script>
11
+ <!--[if lt IE 9]>
12
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
+ <![endif]-->
14
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
+ <script src="scripts/nav.js" defer></script>
17
+
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
19
+ </head>
20
+ <body>
21
+
22
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
23
+ <label for="nav-trigger" class="navicon-button x">
24
+ <div class="navicon"></div>
25
+ </label>
26
+
27
+ <label for="nav-trigger" class="overlay"></label>
28
+
29
+ <nav >
30
+
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#~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#~togglePlaylistPrivate">togglePlaylistPrivate</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#.fetchChallengeIndexMetadata">fetchChallengeIndexMetadata</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeLessonData">fetchChallengeLessonData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeMetadata">fetchChallengeMetadata</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeUserActiveChallenges">fetchChallengeUserActiveChallenges</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#.fetchCompletedChallenges">fetchCompletedChallenges</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#.fetchOwnedChallenges">fetchOwnedChallenges</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#.fetchUserChallengeProgress">fetchUserChallengeProgress</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#.postChallengesCommunityNotification">postChallengesCommunityNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesEnroll">postChallengesEnroll</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesEnrollmentNotification">postChallengesEnrollmentNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesHideCompletedBanner">postChallengesHideCompletedBanner</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesLeave">postChallengesLeave</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesSetStartDate">postChallengesSetStartDate</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesSoloNotification">postChallengesSoloNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesUnlock">postChallengesUnlock</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#.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#.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><li data-type='method'><a href="module-Sanity-Services.html#~handleCustomFetchAll">handleCustomFetchAll</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#.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#.fetchNotifications">fetchNotifications</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></ul></li><li><a href="module-UserProfile.html">UserProfile</a><ul class='methods'><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
+
34
+ </nav>
35
+
36
+ <div id="main">
37
+
38
+ <h1 class="page-title">content.js</h1>
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+ <section>
47
+ <article>
48
+ <pre class="prettyprint source linenums"><code>/**
49
+ * @module Content-Services-V2
50
+ */
51
+
52
+ import {
53
+ fetchByRailContentIds,
54
+ fetchMetadata,
55
+ fetchRecent,
56
+ fetchTabData,
57
+ fetchNewReleases,
58
+ fetchUpcomingEvents,
59
+ fetchScheduledReleases,
60
+ fetchReturning,
61
+ fetchLeaving, fetchScheduledAndNewReleases
62
+ } from './sanity.js'
63
+ import {TabResponseType, Tabs, capitalizeFirstLetter} from '../contentMetaData.js'
64
+ import {fetchHandler} from "./railcontent";
65
+ import {recommendations} from "./recommendations";
66
+
67
+
68
+ export async function getLessonContentRows (brand='drumeo', pageName = 'lessons') {
69
+ let recentContentIds = await fetchRecent(brand, pageName, { progress: 'recent' });
70
+
71
+ let contentRows = await getContentRows(brand, pageName);
72
+ contentRows = Array.isArray(contentRows) ? contentRows : [];
73
+ contentRows.unshift({
74
+ id: 'recent',
75
+ title: 'Recent ' + capitalizeFirstLetter(pageName),
76
+ items: recentContentIds || []
77
+ });
78
+
79
+ const results = await Promise.all(
80
+ contentRows.map(async (row) => {
81
+ return { id: row.id, title: row.title, items: row.items }
82
+ })
83
+ )
84
+ return results
85
+ }
86
+
87
+ /**
88
+ * Get data that should be displayed for a specific tab with pagination
89
+ * @param {string} brand - The brand for which to fetch data.
90
+ * @param {string} pageName - The page name (e.g., 'lessons', 'songs','challenges).
91
+ * @param {string} tabName - The name for the selected tab. Should be same name received from fetchMetadata (e.g., 'Individuals', 'Collections','For You').
92
+ * @param {Object} params - Parameters for pagination, sorting, and filter.
93
+ * @param {number} [params.page=1] - The page number for pagination.
94
+ * @param {number} [params.limit=10] - The number of items per page.
95
+ * @param {string} [params.sort="-published_on"] - The field to sort the data by.
96
+ * @param {Array&lt;string>} [params.selectedFilters=[]] - The selected filter.
97
+ * @returns {Promise&lt;Object|null>} - The fetched content data or null if not found.
98
+ *
99
+ * @example
100
+ * getTabResults('drumeo', 'lessons','Singles', {
101
+ * page: 2,
102
+ * limit: 20,
103
+ * sort: '-popularity',
104
+ * includedFields: ['difficulty,Intermediate'],
105
+ * })
106
+ * .then(content => console.log(content))
107
+ * .catch(error => console.error(error));
108
+ */
109
+ export async function getTabResults(brand, pageName, tabName, {
110
+ page = 1,
111
+ limit = 10,
112
+ sort = 'recommended',
113
+ selectedFilters = []
114
+ } = {}) {
115
+
116
+ // Extract and handle 'progress' filter separately
117
+ const progressFilter = selectedFilters.find(f => f.startsWith('progress,')) || 'progress,all';
118
+ const progressValue = progressFilter.split(',')[1].toLowerCase();
119
+ const filteredSelectedFilters = selectedFilters.filter(f => !f.startsWith('progress,'));
120
+
121
+ // Prepare included fields
122
+ const mergedIncludedFields = [...filteredSelectedFilters, `tab,${tabName.toLowerCase()}`];
123
+
124
+ // Fetch data
125
+ const results = tabName === Tabs.ForYou.name
126
+ ? { entity: await getLessonContentRows(brand, pageName) }
127
+ : await fetchTabData(brand, pageName, { page, limit, sort, includedFields: mergedIncludedFields, progress: progressValue });
128
+
129
+ // Fetch metadata
130
+ const metaData = await fetchMetadata(brand, pageName);
131
+
132
+ // Process filters
133
+ const filters = (metaData.filters ?? []).map(filter => ({
134
+ ...filter,
135
+ items: filter.items.map(item => {
136
+ const value = item.value.split(',')[1];
137
+ return {
138
+ ...item,
139
+ selected: selectedFilters.includes(`${filter.key},${value}`) ||
140
+ (filter.key === 'progress' &amp;&amp; value === 'all' &amp;&amp; !selectedFilters.some(f => f.startsWith('progress,')))
141
+ };
142
+ })
143
+ }));
144
+
145
+ // Process sort options
146
+ const sortOptions = {
147
+ title: metaData.sort?.title ?? 'Sort By',
148
+ type: metaData.sort?.type ?? 'radio',
149
+ items: (metaData.sort?.items ?? []).map(option => ({
150
+ ...option,
151
+ selected: option.value === sort
152
+ }))
153
+ };
154
+
155
+ return {
156
+ type: tabName === Tabs.ForYou.name ? TabResponseType.SECTIONS : TabResponseType.CATALOG,
157
+ data: results.entity,
158
+ meta: { filters, sort: sortOptions }
159
+ };
160
+ }
161
+
162
+ /**
163
+ * Fetches recent content for a given brand and page with pagination.
164
+ *
165
+ * @param {string} brand - The brand for which to fetch data.
166
+ * @param {string} pageName - The page name (e.g., 'all', 'incomplete', 'completed').
167
+ * @param {string} [tabName='all'] - The tab name (defaults to 'all' for recent content).
168
+ * @param {Object} params - Parameters for pagination and sorting.
169
+ * @param {number} [params.page=1] - The page number for pagination.
170
+ * @param {number} [params.limit=10] - The number of items per page.
171
+ * @param {string} [params.sort="-published_on"] - The field to sort the data by.
172
+ * @returns {Promise&lt;Object>} - The fetched content data.
173
+ *
174
+ * @example
175
+ * getRecent('drumeo', 'lessons', 'all', {
176
+ * page: 2,
177
+ * limit: 15,
178
+ * sort: '-popularity'
179
+ * })
180
+ * .then(content => console.log(content))
181
+ * .catch(error => console.error(error));
182
+ */
183
+ export async function getRecent(brand, pageName, tabName = 'all', {
184
+ page = 1,
185
+ limit = 10,
186
+ sort = '-published_on',
187
+ } = {}) {
188
+ const progress = tabName.toLowerCase() == 'all' ? 'recent':tabName.toLowerCase();
189
+ const recentContentIds = await fetchRecent(brand, pageName, { page:page, limit:limit, progress: progress });
190
+ const metaData = await fetchMetadata(brand, 'recent');
191
+ return {
192
+ type: TabResponseType.CATALOG,
193
+ data: recentContentIds,
194
+ meta: { tabs: metaData.tabs }
195
+ };
196
+ }
197
+
198
+ /**
199
+ * Fetches content rows for a given brand and page with optional filtering by content row id.
200
+ *
201
+ * @param {string} brand - The brand for which to fetch content rows.
202
+ * @param {string} pageName - The page name (e.g., 'lessons', 'songs', 'challenges').
203
+ * @param {string} [contentRowId] - The specific content row ID to fetch.
204
+ * @param {Object} params - Parameters for pagination.
205
+ * @param {number} [params.page=1] - The page number for pagination.
206
+ * @param {number} [params.limit=10] - The maximum number of content items per row.
207
+ * @returns {Promise&lt;Object>} - The fetched content rows with complete Sanity data instead of just content IDs.
208
+ * When contentRowId is provided, returns an object with type, data, and meta properties.
209
+ *
210
+ * @example
211
+ * getContentRows('drumeo', 'lessons', 'Your-Daily-Warmup', {
212
+ * page: 1,
213
+ * limit: 5
214
+ * })
215
+ * .then(content => console.log(content))
216
+ * .catch(error => console.error(error));
217
+ */
218
+ export async function getContentRows(brand, pageName, contentRowId , {
219
+ page = 1,
220
+ limit = 10,
221
+ } = {}) {
222
+ const contentRow = contentRowId ? `&amp;content_row_id=${contentRowId}` : ''
223
+ const url = `/api/content/v1/rows?brand=${brand}&amp;page_name=${pageName}${contentRow}&amp;page=${page}&amp;limit=${limit}`;
224
+ const contentRows = await fetchHandler(url, 'get', null) || [];
225
+ const results = await Promise.all(
226
+ contentRows.map(async (row) => {
227
+ if (row.content.length === 0){
228
+ return { id: row.id, title: row.title, items: [] }
229
+ }
230
+ const data = await fetchByRailContentIds(row.content)
231
+ return { id: row.id, title: row.title, items: data }
232
+ })
233
+ )
234
+
235
+ if (contentRowId) {
236
+ return {
237
+ type: TabResponseType.CATALOG,
238
+ data: results[0].items,
239
+ meta: {}
240
+ };
241
+ }
242
+
243
+ return results
244
+ }
245
+
246
+ /**
247
+ * Fetches new and upcoming releases for a given brand with pagination options.
248
+ *
249
+ * @param {string} brand - The brand for which to fetch new and upcoming releases.
250
+ * @param {Object} [params={}] - Pagination parameters.
251
+ * @param {number} [params.page=1] - The page number for pagination.
252
+ * @param {number} [params.limit=10] - The maximum number of content items to fetch.
253
+ * @returns {Promise&lt;{ data: Object[] } | null>} - A promise that resolves to the fetched content data or `null` if no data is found.
254
+ *
255
+ * @example
256
+ * // Fetch the first page with 10 results
257
+ * getNewAndUpcoming('drumeo')
258
+ * .then(response => console.log(response))
259
+ * .catch(error => console.error(error));
260
+ *
261
+ * @example
262
+ * // Fetch the second page with 20 results
263
+ * getNewAndUpcoming('drumeo', { page: 2, limit: 20 })
264
+ * .then(response => console.log(response))
265
+ * .catch(error => console.error(error));
266
+ */
267
+ export async function getNewAndUpcoming(brand, {
268
+ page = 1,
269
+ limit = 10,
270
+ } = {}) {
271
+
272
+ const data = await fetchScheduledAndNewReleases(brand, {page: page, limit: limit});
273
+ if (!data) {
274
+ return null;
275
+ }
276
+
277
+ return {
278
+ data: data,
279
+ };
280
+ }
281
+
282
+ /**
283
+ * Fetches scheduled content rows for a given brand with optional filtering by content row ID.
284
+ *
285
+ * @param {string} brand - The brand for which to fetch content rows.
286
+ * @param {string} [contentRowId=null] - The specific content row ID to fetch (optional).
287
+ * @param {Object} [params={}] - Pagination parameters.
288
+ * @param {number} [params.page=1] - The page number for pagination.
289
+ * @param {number} [params.limit=10] - The maximum number of content items per row.
290
+ * @returns {Promise&lt;Object>} - A promise that resolves to the fetched content rows.
291
+ *
292
+ * @example
293
+ * // Fetch all sections with default pagination
294
+ * getScheduleContentRows('drumeo')
295
+ * .then(content => console.log(content))
296
+ * .catch(error => console.error(error));
297
+ *
298
+ * @example
299
+ * // Fetch only the 'New-Releases' section with custom pagination
300
+ * getScheduleContentRows('drumeo', 'New-Releases', { page: 1, limit: 30 })
301
+ * .then(content => console.log(content))
302
+ * .catch(error => console.error(error));
303
+ *
304
+ * @example
305
+ * // Fetch only the 'Live-Streams' section with unlimited results
306
+ * getScheduleContentRows('drumeo', 'Live-Streams')
307
+ * .then(content => console.log(content))
308
+ * .catch(error => console.error(error));
309
+ */
310
+ export async function getScheduleContentRows(brand, contentRowId = null, { page = 1, limit = 10 } = {}) {
311
+ const sections = {
312
+ 'New-Releases': {
313
+ title: 'New Releases',
314
+ fetchMethod: fetchNewReleases
315
+ },
316
+ 'Live-Streams': {
317
+ title: 'Live Streams',
318
+ fetchMethod: fetchUpcomingEvents
319
+ },
320
+ 'Upcoming-Releases': {
321
+ title: 'Upcoming Releases',
322
+ fetchMethod: fetchScheduledReleases
323
+ },
324
+ 'Returning-Soon': {
325
+ title: 'Returning Soon',
326
+ fetchMethod: fetchReturning
327
+ },
328
+ 'Leaving-Soon': {
329
+ title: 'Leaving Soon',
330
+ fetchMethod: fetchLeaving
331
+ }
332
+ };
333
+
334
+ if (contentRowId) {
335
+ if (!sections[contentRowId]) {
336
+ return null; // Return null if the requested section does not exist
337
+ }
338
+
339
+ const items = await sections[contentRowId].fetchMethod(brand, { page, limit });
340
+
341
+ // Fetch only the requested section
342
+ const result = {
343
+ id: contentRowId,
344
+ title: sections[contentRowId].title,
345
+ // TODO: Remove content after FE/MA updates the existing code to use items
346
+ content: items,
347
+ items: items
348
+ };
349
+
350
+ return {
351
+ type: TabResponseType.CATALOG,
352
+ data: result,
353
+ meta: {}
354
+ };
355
+ }
356
+
357
+ // If no specific contentRowId, fetch all sections
358
+ const results = await Promise.all(
359
+ Object.entries(sections).map(async ([id, section]) => {
360
+ // Apply special pagination rules
361
+ const isNewReleases = id === 'New-Releases';
362
+ const pagination = isNewReleases ? { page: 1, limit: 30 } : { page: 1, limit: Number.MAX_SAFE_INTEGER };
363
+ const items = await section.fetchMethod(brand, pagination)
364
+
365
+ return {
366
+ id,
367
+ title: section.title,
368
+ // TODO: Remove content after FE/MA updates the existing code to use items
369
+ content: items,
370
+ items: items
371
+ };
372
+ })
373
+ );
374
+
375
+ return {
376
+ type: TabResponseType.SECTIONS,
377
+ data: results,
378
+ meta: {}
379
+ };
380
+ }
381
+
382
+ /**
383
+ * Fetches recommended content for a given brand with pagination support.
384
+ *
385
+ * @param {string} brand - The brand for which to fetch recommended content.
386
+ * @param {Object} [params={}] - Pagination parameters.
387
+ * @param {number} [params.page=1] - The page number for pagination.
388
+ * @param {number} [params.limit=10] - The maximum number of recommended content items per page.
389
+ * @returns {Promise&lt;Object>} - A promise that resolves to an object containing recommended content.
390
+ *
391
+ * @example
392
+ * // Fetch recommended content for a brand with default pagination
393
+ * getRecommendedForYou('drumeo')
394
+ * .then(content => console.log(content))
395
+ * .catch(error => console.error(error));
396
+ *
397
+ * @example
398
+ * // Fetch recommended content for a brand with custom pagination
399
+ * getRecommendedForYou('drumeo', { page: 2, limit: 5 })
400
+ * .then(content => console.log(content))
401
+ * .catch(error => console.error(error));
402
+ */
403
+ export async function getRecommendedForYou(brand, rowId = null, {
404
+ page = 1,
405
+ limit = 10,
406
+ } = {}) {
407
+ const requiredItems = page * limit;
408
+ const data = await recommendations(brand, {limit: requiredItems});
409
+ if (!data || !data.length) {
410
+ return { id: 'recommended', title: 'Recommended For You', items: [] };
411
+ }
412
+
413
+ // Apply pagination before calling fetchByRailContentIds
414
+ const startIndex = (page - 1) * limit;
415
+ const paginatedData = data.slice(startIndex, startIndex + limit);
416
+
417
+ const contents = await fetchByRailContentIds(paginatedData);
418
+ const result = {
419
+ id: 'recommended',
420
+ title: 'Recommended For You',
421
+ items: contents
422
+ };
423
+
424
+ if (rowId) {
425
+ return {
426
+ type: TabResponseType.CATALOG,
427
+ data: contents,
428
+ meta: {}
429
+ };
430
+ }
431
+
432
+ return { id: 'recommended', title: 'Recommended For You', items: contents }
433
+ }
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+
442
+ </code></pre>
443
+ </article>
444
+ </section>
445
+
446
+
447
+
448
+
449
+
450
+
451
+ </div>
452
+
453
+ <br class="clear">
454
+
455
+ <footer>
456
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Mon Jun 16 2025 14:26:22 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
457
+ </footer>
458
+
459
+ <script>prettyPrint();</script>
460
+ <script src="scripts/polyfill.js"></script>
461
+ <script src="scripts/linenumber.js"></script>
462
+
463
+
464
+
465
+ </body>
466
+ </html>