musora-content-services 2.84.0 → 2.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +14 -0
- package/.coderabbit.yaml +0 -0
- package/.editorconfig +0 -0
- package/.github/pull_request_template.md +0 -0
- package/.github/workflows/conventional-commits.yaml +0 -0
- package/.github/workflows/docs.js.yml +0 -0
- package/.github/workflows/node.js.yml +0 -0
- package/.prettierignore +0 -0
- package/.prettierrc +0 -0
- package/.yarnrc.yml +1 -0
- package/CHANGELOG.md +15 -0
- package/README.md +0 -0
- package/babel.config.cjs +0 -0
- package/docs/Content.html +0 -0
- package/docs/ContentOrganization.html +2 -2
- package/docs/Forums.html +2 -2
- package/docs/Gamification.html +2 -2
- package/docs/TestUser.html +2 -2
- package/docs/UserManagementSystem.html +2 -2
- package/docs/api_types.js.html +2 -2
- package/docs/config.js.html +2 -5
- package/docs/content-org_content-org.js.html +2 -2
- package/docs/content-org_guided-courses.ts.html +2 -2
- package/docs/content-org_learning-paths.ts.html +24 -126
- package/docs/content-org_playlists-types.js.html +2 -2
- package/docs/content-org_playlists.js.html +2 -2
- package/docs/content.js.html +10 -88
- package/docs/content_artist.ts.html +0 -0
- package/docs/content_content.ts.html +0 -0
- package/docs/content_genre.ts.html +0 -0
- package/docs/content_instructor.ts.html +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/forums_categories.ts.html +3 -22
- package/docs/forums_discussions.js.html +0 -0
- package/docs/forums_forum.js.html +0 -0
- package/docs/forums_forums.ts.html +2 -2
- package/docs/forums_posts.ts.html +2 -2
- package/docs/forums_threads.ts.html +2 -2
- package/docs/gamification_awards.js.html +0 -0
- package/docs/gamification_awards.ts.html +12 -26
- package/docs/gamification_gamification.js.html +2 -2
- package/docs/gamification_types.js.html +0 -0
- package/docs/global.html +2 -2
- package/docs/index.html +2 -2
- package/docs/liveTesting.ts.html +2 -2
- package/docs/module-Accounts.html +14 -14
- package/docs/module-Artist.html +0 -0
- package/docs/module-Awards.html +6 -106
- package/docs/module-Categories.html +0 -0
- package/docs/module-Config.html +4 -5
- package/docs/module-Content-Services-V2.html +9 -440
- package/docs/module-ForumCategories.html +0 -0
- package/docs/module-ForumDiscussions.html +0 -0
- package/docs/module-Forums.html +43 -607
- package/docs/module-Genre.html +0 -0
- package/docs/module-GuidedCourses.html +2 -2
- package/docs/module-Instructor.html +0 -0
- package/docs/module-Interests.html +2 -2
- package/docs/module-LearningPaths.html +12 -640
- package/docs/module-Onboarding.html +2 -2
- package/docs/module-Payments.html +2 -2
- package/docs/module-Permissions.html +2 -2
- package/docs/module-Playlists.html +2 -2
- package/docs/module-ProgressRow.html +2 -2
- package/docs/module-Railcontent-Services.html +298 -31
- package/docs/module-Sanity-Services.html +1901 -530
- package/docs/module-Sessions.html +2 -2
- package/docs/module-Threads.html +0 -0
- package/docs/module-UserActivity.html +5 -5
- package/docs/module-UserChat.html +2 -2
- package/docs/module-UserManagement.html +2 -2
- package/docs/module-UserMemberships.html +2 -2
- package/docs/module-UserNotifications.html +2 -2
- package/docs/module-UserProfile.html +2 -2
- package/docs/progress-row_method-card.js.html +3 -3
- package/docs/railcontent.js.html +20 -8
- package/docs/sanity.js.html +313 -199
- package/docs/scripts/collapse.js +0 -0
- package/docs/scripts/commonNav.js +0 -0
- package/docs/scripts/linenumber.js +0 -0
- package/docs/scripts/nav.js +0 -0
- package/docs/scripts/polyfill.js +0 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -0
- package/docs/scripts/prettify/lang-css.js +0 -0
- package/docs/scripts/prettify/prettify.js +0 -0
- package/docs/scripts/search.js +0 -0
- package/docs/styles/jsdoc.css +0 -0
- package/docs/styles/prettify.css +0 -0
- package/docs/userActivity.js.html +5 -17
- package/docs/user_account.ts.html +13 -14
- package/docs/user_chat.js.html +2 -2
- package/docs/user_interests.js.html +2 -2
- package/docs/user_management.js.html +2 -2
- package/docs/user_memberships.js.html +0 -0
- package/docs/user_memberships.ts.html +2 -2
- package/docs/user_notifications.js.html +2 -2
- package/docs/user_onboarding.ts.html +2 -2
- package/docs/user_payments.ts.html +2 -2
- package/docs/user_permissions.js.html +3 -3
- package/docs/user_profile.js.html +2 -2
- package/docs/user_sessions.js.html +2 -2
- package/docs/user_types.js.html +2 -2
- package/docs/user_user-management-system.js.html +2 -2
- package/jest.config.js +0 -0
- package/jsdoc.json +0 -0
- package/package.json +1 -1
- package/src/contentMetaData.js +0 -0
- package/src/filterBuilder.js +0 -0
- package/src/index.d.ts +2 -2
- package/src/index.js +2 -2
- package/src/infrastructure/http/HttpClient.ts +0 -0
- package/src/infrastructure/http/executors/FetchRequestExecutor.ts +0 -0
- package/src/infrastructure/http/index.ts +0 -0
- package/src/infrastructure/http/interfaces/HeaderProvider.ts +0 -0
- package/src/infrastructure/http/interfaces/HttpError.ts +0 -0
- package/src/infrastructure/http/interfaces/NetworkError.ts +0 -0
- package/src/infrastructure/http/interfaces/RequestExecutor.ts +0 -0
- package/src/infrastructure/http/interfaces/RequestOptions.ts +0 -0
- package/src/infrastructure/http/providers/DefaultHeaderProvider.ts +0 -0
- package/src/lib/httpHelper.js +0 -0
- package/src/lib/lastUpdated.js +0 -0
- package/src/services/api/types.js +0 -0
- package/src/services/api/types.ts +0 -0
- package/src/services/config.js +0 -0
- package/src/services/content/artist.ts +0 -0
- package/src/services/content/content.ts +0 -0
- package/src/services/content/genre.ts +0 -0
- package/src/services/content/instructor.ts +0 -0
- package/src/services/content-org/content-org.js +0 -0
- package/src/services/content-org/guided-courses.ts +0 -0
- package/src/services/content-org/learning-paths.ts +0 -0
- package/src/services/content-org/playlists-types.js +0 -0
- package/src/services/content-org/playlists.js +0 -0
- package/src/services/content.js +0 -0
- package/src/services/contentAggregator.js +10 -23
- package/src/services/contentLikes.js +0 -0
- package/src/services/contentProgress.js +250 -147
- package/src/services/dataContext.js +0 -0
- package/src/services/dateUtils.js +0 -0
- package/src/services/eventsAPI.js +0 -0
- package/src/services/forums/categories.ts +0 -0
- package/src/services/forums/forums.ts +0 -0
- package/src/services/forums/posts.ts +0 -0
- package/src/services/forums/threads.ts +7 -7
- package/src/services/forums/types.ts +1 -0
- package/src/services/gamification/awards.ts +0 -0
- package/src/services/gamification/gamification.js +0 -0
- package/src/services/imageSRCBuilder.js +0 -0
- package/src/services/imageSRCVerify.js +0 -0
- package/src/services/liveTesting.ts +0 -0
- package/src/services/permissions/PermissionsAdapter.ts +0 -0
- package/src/services/permissions/PermissionsAdapterFactory.ts +0 -0
- package/src/services/permissions/PermissionsV1Adapter.ts +0 -0
- package/src/services/permissions/PermissionsV2Adapter.ts +0 -0
- package/src/services/permissions/README.md +0 -0
- package/src/services/permissions/index.ts +0 -0
- package/src/services/progress-row/method-card.js +0 -0
- package/src/services/railcontent.js +18 -6
- package/src/services/recommendations.js +0 -0
- package/src/services/sanity.js +18 -2
- package/src/services/types.js +0 -0
- package/src/services/user/account.ts +0 -0
- package/src/services/user/chat.js +0 -0
- package/src/services/user/interests.js +0 -0
- package/src/services/user/management.js +0 -0
- package/src/services/user/memberships.ts +0 -0
- package/src/services/user/notifications.js +0 -0
- package/src/services/user/onboarding.ts +0 -0
- package/src/services/user/payments.ts +0 -0
- package/src/services/user/permissions.js +0 -0
- package/src/services/user/profile.js +0 -0
- package/src/services/user/sessions.js +0 -0
- package/src/services/user/types.d.ts +0 -0
- package/src/services/user/types.js +0 -0
- package/src/services/user/user-management-system.js +0 -0
- package/src/services/userActivity.js +3 -14
- package/test/HttpClient.test.js +0 -0
- package/test/content.test.js +0 -0
- package/test/contentLikes.test.js +0 -0
- package/test/contentProgress.test.js +0 -0
- package/test/dataContext.test.js +0 -0
- package/test/forum.test.js +0 -0
- package/test/imageSRCBuilder.test.js +0 -0
- package/test/imageSRCVerify.test.js +0 -0
- package/test/initializeTests.js +0 -0
- package/test/learningPaths.test.js +0 -0
- package/test/lib/lastUpdated.test.js +0 -0
- package/test/live/contentProgressLive.test.js +0 -0
- package/test/live/railcontentLive.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/test/mockData/mockData_fetchByRailContentIds_one_content.json +0 -0
- package/test/mockData/mockData_progress_content.json +0 -0
- package/test/mockData/mockData_sanity_progress_content.json +0 -0
- package/test/mockData/mockData_user_practices.json +0 -0
- package/test/notifications.test.js +0 -0
- package/test/progressRows.test.js +0 -0
- package/test/sanityQueryService.test.js +0 -0
- package/test/streakMessage.test.js +0 -0
- package/test/user/permissions.test.js +0 -0
- package/test/userActivity.test.js +0 -0
- package/tools/generate-index.cjs +0 -0
package/docs/sanity.js.html
CHANGED
|
@@ -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#~deleteAccount">deleteAccount</a></li><li data-type='method'><a href="module-Accounts.html#~numberOfActiveUsers">numberOfActiveUsers</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><li data-type='method'><a href="module-Accounts.html#~toggleStudentView">toggleStudentView</a></li></ul></li><li><a href="module-Artist.html">Artist</a><ul class='methods'><li data-type='method'><a href="module-Artist.html#~fetchArtistBySlug">fetchArtistBySlug</a></li><li data-type='method'><a href="module-Artist.html#~fetchArtistLessons">fetchArtistLessons</a></li><li data-type='method'><a href="module-Artist.html#~fetchArtists">fetchArtists</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><li data-type='method'><a href="module-Awards.html#~getAwardDataForGuidedContent">getAwardDataForGuidedContent</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#.getLegacyMethods">getLegacyMethods</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#.getOwnedContent">getOwnedContent</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-Forums.html">Forums</a><ul class='methods'><li data-type='method'><a href="module-Forums.html#~createForumCategory">createForumCategory</a></li><li data-type='method'><a href="module-Forums.html#~createPost">createPost</a></li><li data-type='method'><a href="module-Forums.html#~createThread">createThread</a></li><li data-type='method'><a href="module-Forums.html#~deleteForumCategory">deleteForumCategory</a></li><li data-type='method'><a href="module-Forums.html#~deletePost">deletePost</a></li><li data-type='method'><a href="module-Forums.html#~deleteThread">deleteThread</a></li><li data-type='method'><a href="module-Forums.html#~fetchCommunityGuidelines">fetchCommunityGuidelines</a></li><li data-type='method'><a href="module-Forums.html#~fetchFollowedThreads">fetchFollowedThreads</a></li><li data-type='method'><a href="module-Forums.html#~fetchForumCategories">fetchForumCategories</a></li><li data-type='method'><a href="module-Forums.html#~fetchLatestThreads">fetchLatestThreads</a></li><li data-type='method'><a href="module-Forums.html#~fetchPosts">fetchPosts</a></li><li data-type='method'><a href="module-Forums.html#~fetchThreads">fetchThreads</a></li><li data-type='method'><a href="module-Forums.html#~followThread">followThread</a></li><li data-type='method'><a href="module-Forums.html#~jumpToPost">jumpToPost</a></li><li data-type='method'><a href="module-Forums.html#~likePost">likePost</a></li><li data-type='method'><a href="module-Forums.html#~lockThread">lockThread</a></li><li data-type='method'><a href="module-Forums.html#~markThreadAsRead">markThreadAsRead</a></li><li data-type='method'><a href="module-Forums.html#~pinThread">pinThread</a></li><li data-type='method'><a href="module-Forums.html#~search">search</a></li><li data-type='method'><a href="module-Forums.html#~unfollowThread">unfollowThread</a></li><li data-type='method'><a href="module-Forums.html#~unlikePost">unlikePost</a></li><li data-type='method'><a href="module-Forums.html#~unlockThread">unlockThread</a></li><li data-type='method'><a href="module-Forums.html#~unpinThread">unpinThread</a></li><li data-type='method'><a href="module-Forums.html#~updateForumCategory">updateForumCategory</a></li><li data-type='method'><a href="module-Forums.html#~updatePost">updatePost</a></li><li data-type='method'><a href="module-Forums.html#~updateThread">updateThread</a></li></ul></li><li></li><li></li><li><a href="module-Genre.html">Genre</a><ul class='methods'><li data-type='method'><a href="module-Genre.html#~fetchGenreBySlug">fetchGenreBySlug</a></li><li data-type='method'><a href="module-Genre.html#~fetchGenreLessons">fetchGenreLessons</a></li><li data-type='method'><a href="module-Genre.html#~fetchGenres">fetchGenres</a></li></ul></li><li><a href="module-GuidedCourses.html">GuidedCourses</a></li><li><a href="module-Instructor.html">Instructor</a><ul class='methods'><li data-type='method'><a href="module-Instructor.html#~fetchInstructorBySlug">fetchInstructorBySlug</a></li><li data-type='method'><a href="module-Instructor.html#~fetchInstructorLessons">fetchInstructorLessons</a></li><li data-type='method'><a href="module-Instructor.html#~fetchInstructors">fetchInstructors</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-LearningPaths.html">LearningPaths</a><ul class='methods'><li data-type='method'><a href="module-LearningPaths.html#~completeLearningPathIntroVideo">completeLearningPathIntroVideo</a></li><li data-type='method'><a href="module-LearningPaths.html#~completeMethodIntroVideo">completeMethodIntroVideo</a></li><li data-type='method'><a href="module-LearningPaths.html#~fetchLearningPathLessons">fetchLearningPathLessons</a></li><li data-type='method'><a href="module-LearningPaths.html#~getActivePath">getActivePath</a></li><li data-type='method'><a href="module-LearningPaths.html#~getDailySession">getDailySession</a></li><li data-type='method'><a href="module-LearningPaths.html#~getEnrichedLearningPath">getEnrichedLearningPath</a></li><li data-type='method'><a href="module-LearningPaths.html#~getLearningPathLessonsByIds">getLearningPathLessonsByIds</a></li><li data-type='method'><a href="module-LearningPaths.html#~mapContentToParent">mapContentToParent</a></li><li data-type='method'><a href="module-LearningPaths.html#~resetAllLearningPaths">resetAllLearningPaths</a></li><li data-type='method'><a href="module-LearningPaths.html#~startLearningPath">startLearningPath</a></li><li data-type='method'><a href="module-LearningPaths.html#~updateActivePath">updateActivePath</a></li><li data-type='method'><a href="module-LearningPaths.html#~updateDailySession">updateDailySession</a></li></ul></li><li><a href="module-Onboarding.html">Onboarding</a><ul class='methods'><li data-type='method'><a href="module-Onboarding.html#~getOnboardingRecommendedContent">getOnboardingRecommendedContent</a></li><li data-type='method'><a href="module-Onboarding.html#~startOnboarding">startOnboarding</a></li><li data-type='method'><a href="module-Onboarding.html#~updateOnboarding">updateOnboarding</a></li><li data-type='method'><a href="module-Onboarding.html#~userOnboardingForBrand">userOnboardingForBrand</a></li></ul></li><li><a href="module-Payments.html">Payments</a><ul class='methods'><li data-type='method'><a href="module-Payments.html#~fetchCustomerPayments">fetchCustomerPayments</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-ProgressRow.html">ProgressRow</a></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#.postContentStart">postContentStart</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#.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#.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#.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#.fetchMethodV2IntroVideo">fetchMethodV2IntroVideo</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodV2Structure">fetchMethodV2Structure</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#.fetchOwnedContent">fetchOwnedContent</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#.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#.getUserSignature">getUserSignature</a></li><li data-type='method'><a href="module-UserManagement.html#.isUsernameAvailable">isUsernameAvailable</a></li><li data-type='method'><a href="module-UserManagement.html#.setUserSignature">setUserSignature</a></li><li data-type='method'><a href="module-UserManagement.html#.toggleSignaturePrivate">toggleSignaturePrivate</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><li data-type='method'><a href="module-UserMemberships.html#~restorePurchases">restorePurchases</a></li><li data-type='method'><a href="module-UserMemberships.html#~upgradeSubscription">upgradeSubscription</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="Forums.html">Forums</a></li><li><a href="Gamification.html">Gamification</a></li><li><a href="UserManagementSystem.html">UserManagementSystem</a></li></ul><h3>Interfaces</h3><ul><li><a href="TestUser.html">TestUser</a></li></ul><h3>Global</h3><ul><li><a href="global.html#createTestUser">createTestUser</a></li></ul>
|
|
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#~deleteAccount">deleteAccount</a></li><li data-type='method'><a href="module-Accounts.html#~numberOfActiveUsers">numberOfActiveUsers</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><li data-type='method'><a href="module-Accounts.html#~toggleStudentView">toggleStudentView</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><li data-type='method'><a href="module-Awards.html#~getAwardDataForGuidedContent">getAwardDataForGuidedContent</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#.getLegacyMethods">getLegacyMethods</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-Forums.html">Forums</a><ul class='methods'><li data-type='method'><a href="module-Forums.html#~createForumCategory">createForumCategory</a></li><li data-type='method'><a href="module-Forums.html#~createPost">createPost</a></li><li data-type='method'><a href="module-Forums.html#~createThread">createThread</a></li><li data-type='method'><a href="module-Forums.html#~deletePost">deletePost</a></li><li data-type='method'><a href="module-Forums.html#~deleteThread">deleteThread</a></li><li data-type='method'><a href="module-Forums.html#~fetchCommunityGuidelines">fetchCommunityGuidelines</a></li><li data-type='method'><a href="module-Forums.html#~fetchFollowedThreads">fetchFollowedThreads</a></li><li data-type='method'><a href="module-Forums.html#~fetchForumCategories">fetchForumCategories</a></li><li data-type='method'><a href="module-Forums.html#~fetchLatestThreads">fetchLatestThreads</a></li><li data-type='method'><a href="module-Forums.html#~fetchPosts">fetchPosts</a></li><li data-type='method'><a href="module-Forums.html#~fetchThreads">fetchThreads</a></li><li data-type='method'><a href="module-Forums.html#~followThread">followThread</a></li><li data-type='method'><a href="module-Forums.html#~jumpToPost">jumpToPost</a></li><li data-type='method'><a href="module-Forums.html#~likePost">likePost</a></li><li data-type='method'><a href="module-Forums.html#~lockThread">lockThread</a></li><li data-type='method'><a href="module-Forums.html#~markThreadAsRead">markThreadAsRead</a></li><li data-type='method'><a href="module-Forums.html#~pinThread">pinThread</a></li><li data-type='method'><a href="module-Forums.html#~search">search</a></li><li data-type='method'><a href="module-Forums.html#~unfollowThread">unfollowThread</a></li><li data-type='method'><a href="module-Forums.html#~unlikePost">unlikePost</a></li><li data-type='method'><a href="module-Forums.html#~unlockThread">unlockThread</a></li><li data-type='method'><a href="module-Forums.html#~unpinThread">unpinThread</a></li><li data-type='method'><a href="module-Forums.html#~updateForumCategory">updateForumCategory</a></li><li data-type='method'><a href="module-Forums.html#~updatePost">updatePost</a></li><li data-type='method'><a href="module-Forums.html#~updateThread">updateThread</a></li></ul></li><li></li><li></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-LearningPaths.html">LearningPaths</a><ul class='methods'><li data-type='method'><a href="module-LearningPaths.html#~fetchLearningPathLessons">fetchLearningPathLessons</a></li><li data-type='method'><a href="module-LearningPaths.html#~getActivePath">getActivePath</a></li><li data-type='method'><a href="module-LearningPaths.html#~getDailySession">getDailySession</a></li><li data-type='method'><a href="module-LearningPaths.html#~getLearningPath">getLearningPath</a></li><li data-type='method'><a href="module-LearningPaths.html#~getLearningPathLessonsByIds">getLearningPathLessonsByIds</a></li><li data-type='method'><a href="module-LearningPaths.html#~resetAllLearningPaths">resetAllLearningPaths</a></li><li data-type='method'><a href="module-LearningPaths.html#~startLearningPath">startLearningPath</a></li><li data-type='method'><a href="module-LearningPaths.html#~updateActivePath">updateActivePath</a></li><li data-type='method'><a href="module-LearningPaths.html#~updateDailySession">updateDailySession</a></li></ul></li><li><a href="module-Onboarding.html">Onboarding</a><ul class='methods'><li data-type='method'><a href="module-Onboarding.html#~getOnboardingRecommendedContent">getOnboardingRecommendedContent</a></li><li data-type='method'><a href="module-Onboarding.html#~startOnboarding">startOnboarding</a></li><li data-type='method'><a href="module-Onboarding.html#~updateOnboarding">updateOnboarding</a></li><li data-type='method'><a href="module-Onboarding.html#~userOnboardingForBrand">userOnboardingForBrand</a></li></ul></li><li><a href="module-Payments.html">Payments</a><ul class='methods'><li data-type='method'><a href="module-Payments.html#~fetchCustomerPayments">fetchCustomerPayments</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-ProgressRow.html">ProgressRow</a></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#.postContentStart">postContentStart</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#.fetchMethodV2IntroVideo">fetchMethodV2IntroVideo</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodV2Structure">fetchMethodV2Structure</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchMethodV2StructureFromId">fetchMethodV2StructureFromId</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#.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#.getUserSignature">getUserSignature</a></li><li data-type='method'><a href="module-UserManagement.html#.isUsernameAvailable">isUsernameAvailable</a></li><li data-type='method'><a href="module-UserManagement.html#.setUserSignature">setUserSignature</a></li><li data-type='method'><a href="module-UserManagement.html#.toggleSignaturePrivate">toggleSignaturePrivate</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><li data-type='method'><a href="module-UserMemberships.html#~restorePurchases">restorePurchases</a></li><li data-type='method'><a href="module-UserMemberships.html#~upgradeSubscription">upgradeSubscription</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="Forums.html">Forums</a></li><li><a href="Gamification.html">Gamification</a></li><li><a href="UserManagementSystem.html">UserManagementSystem</a></li></ul><h3>Interfaces</h3><ul><li><a href="TestUser.html">TestUser</a></li></ul><h3>Global</h3><ul><li><a href="global.html#createTestUser">createTestUser</a></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -69,16 +69,19 @@ import {
|
|
|
69
69
|
SONG_TYPES,
|
|
70
70
|
SONG_TYPES_WITH_CHILDREN,
|
|
71
71
|
} from '../contentTypeConfig.js'
|
|
72
|
-
import {
|
|
72
|
+
import {fetchSimilarItems, recommendations} from './recommendations.js'
|
|
73
73
|
import { processMetadata, typeWithSortOrder } from '../contentMetaData.js'
|
|
74
74
|
|
|
75
75
|
import { globalConfig } from './config.js'
|
|
76
76
|
|
|
77
|
-
import {
|
|
77
|
+
import {
|
|
78
|
+
fetchNextContentDataForParent,
|
|
79
|
+
fetchHandler,
|
|
80
|
+
} from './railcontent.js'
|
|
78
81
|
import { arrayToStringRepresentation, FilterBuilder } from '../filterBuilder.js'
|
|
79
|
-
import {
|
|
82
|
+
import { fetchUserPermissions } from './user/permissions.js'
|
|
80
83
|
import { getAllCompleted, getAllStarted, getAllStartedOrCompleted } from './contentProgress.js'
|
|
81
|
-
import {
|
|
84
|
+
import {fetchRecentActivitiesActiveTabs} from "./userActivity.js";
|
|
82
85
|
|
|
83
86
|
/**
|
|
84
87
|
* Exported functions that are excluded from index generation.
|
|
@@ -206,6 +209,30 @@ function getQueryFromPage(pageNumber, contentPerPage) {
|
|
|
206
209
|
return result
|
|
207
210
|
}
|
|
208
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Fetch all artists with lessons available for a specific brand.
|
|
214
|
+
*
|
|
215
|
+
* @param {string} brand - The brand for which to fetch artists.
|
|
216
|
+
* @returns {Promise<Object|null>} - A promise that resolves to an array of artist objects or null if not found.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* fetchArtists('drumeo')
|
|
220
|
+
* .then(artists => console.log(artists))
|
|
221
|
+
* .catch(error => console.error(error));
|
|
222
|
+
*/
|
|
223
|
+
export async function fetchArtists(brand) {
|
|
224
|
+
const filter = await new FilterBuilder(
|
|
225
|
+
`_type == "song" && brand == "${brand}" && references(^._id)`,
|
|
226
|
+
{ bypassPermissions: true }
|
|
227
|
+
).buildFilter()
|
|
228
|
+
const query = `
|
|
229
|
+
*[_type == "artist"]{
|
|
230
|
+
name,
|
|
231
|
+
"lessonsCount": count(*[${filter}])
|
|
232
|
+
}[lessonsCount > 0] |order(lower(name)) `
|
|
233
|
+
return fetchSanity(query, true, { processNeedAccess: false })
|
|
234
|
+
}
|
|
235
|
+
|
|
209
236
|
/**
|
|
210
237
|
* Fetch current number of artists for songs within a brand.
|
|
211
238
|
* @param {string} brand - The current brand.
|
|
@@ -355,7 +382,7 @@ export async function fetchNewReleases(
|
|
|
355
382
|
web_url_path,
|
|
356
383
|
"permission_id": permission[]->railcontent_id,
|
|
357
384
|
`
|
|
358
|
-
const query = buildRawQuery(filter, fields, {
|
|
385
|
+
const query = buildRawQuery(filter, fields, {sortOrder: sortOrder, start, end: end})
|
|
359
386
|
return fetchSanity(query, true)
|
|
360
387
|
}
|
|
361
388
|
|
|
@@ -496,26 +523,17 @@ export async function fetchByRailContentId(id, contentType) {
|
|
|
496
523
|
* .then(contents => console.log(contents))
|
|
497
524
|
* .catch(error => console.error(error));
|
|
498
525
|
*/
|
|
499
|
-
export async function fetchByRailContentIds(
|
|
500
|
-
ids,
|
|
501
|
-
contentType = undefined,
|
|
502
|
-
brand = undefined,
|
|
503
|
-
includePermissionsAndStatusFilter = false
|
|
504
|
-
) {
|
|
526
|
+
export async function fetchByRailContentIds(ids, contentType = undefined, brand = undefined, includePermissionsAndStatusFilter = false) {
|
|
505
527
|
if (!ids?.length) {
|
|
506
528
|
return []
|
|
507
529
|
}
|
|
508
|
-
ids = [...new Set(ids.filter(
|
|
530
|
+
ids = [...new Set(ids.filter(item => item !== null && item !== undefined))];
|
|
509
531
|
const idsString = ids.join(',')
|
|
510
532
|
const brandFilter = brand ? ` && brand == "${brand}"` : ''
|
|
511
|
-
const lessonCountFilter = await new FilterBuilder(`_id in ^.child[]._ref`, {
|
|
512
|
-
pullFutureContent: true,
|
|
513
|
-
}).buildFilter()
|
|
533
|
+
const lessonCountFilter = await new FilterBuilder(`_id in ^.child[]._ref`, {pullFutureContent: true}).buildFilter()
|
|
514
534
|
const fields = await getFieldsForContentTypeWithFilteredChildren(contentType, true)
|
|
515
535
|
const baseFilter = `railcontent_id in [${idsString}]${brandFilter}`
|
|
516
|
-
const finalFilter = includePermissionsAndStatusFilter
|
|
517
|
-
? await new FilterBuilder(baseFilter).buildFilter()
|
|
518
|
-
: baseFilter
|
|
536
|
+
const finalFilter = includePermissionsAndStatusFilter ? await new FilterBuilder(baseFilter).buildFilter() : baseFilter
|
|
519
537
|
const query = `*[
|
|
520
538
|
${finalFilter}
|
|
521
539
|
]{
|
|
@@ -527,18 +545,20 @@ export async function fetchByRailContentIds(
|
|
|
527
545
|
|
|
528
546
|
console.log('ids query', query)
|
|
529
547
|
const customPostProcess = (results) => {
|
|
530
|
-
const now = getSanityDate(new Date(), false)
|
|
548
|
+
const now = getSanityDate(new Date(), false);
|
|
531
549
|
const liveProcess = (result) => {
|
|
532
550
|
if (result.live_event_start_time && result.live_event_end_time) {
|
|
533
|
-
result.isLive =
|
|
551
|
+
result.isLive =
|
|
552
|
+
result.live_event_start_time <= now &&
|
|
553
|
+
result.live_event_end_time >= now;
|
|
534
554
|
} else {
|
|
535
|
-
result.isLive = false
|
|
555
|
+
result.isLive = false;
|
|
536
556
|
}
|
|
537
|
-
return result
|
|
538
|
-
}
|
|
539
|
-
return results.map(liveProcess)
|
|
557
|
+
return result;
|
|
558
|
+
};
|
|
559
|
+
return results.map(liveProcess);
|
|
540
560
|
}
|
|
541
|
-
const results = await fetchSanity(query, true, { customPostProcess: customPostProcess
|
|
561
|
+
const results = await fetchSanity(query, true, { customPostProcess: customPostProcess })
|
|
542
562
|
|
|
543
563
|
const sortFuction = function compare(a, b) {
|
|
544
564
|
const indexA = ids.indexOf(a['id'])
|
|
@@ -554,12 +574,13 @@ export async function fetchByRailContentIds(
|
|
|
554
574
|
return sortedResults
|
|
555
575
|
}
|
|
556
576
|
|
|
557
|
-
export async function fetchContentRows(brand, pageName, contentRowSlug)
|
|
577
|
+
export async function fetchContentRows(brand, pageName, contentRowSlug)
|
|
578
|
+
{
|
|
558
579
|
if (pageName === 'lessons') pageName = 'lesson'
|
|
559
580
|
if (pageName === 'songs') pageName = 'song'
|
|
560
581
|
const rowString = contentRowSlug ? ` && slug.current == "${contentRowSlug.toLowerCase()}"` : ''
|
|
561
|
-
const lessonCountFilter = await new FilterBuilder(`_id in ^.child[]._ref`, {pullFutureContent: true
|
|
562
|
-
const childFilter = await new FilterBuilder('', {isChildrenFilter: true
|
|
582
|
+
const lessonCountFilter = await new FilterBuilder(`_id in ^.child[]._ref`, {pullFutureContent: true}).buildFilter()
|
|
583
|
+
const childFilter = await new FilterBuilder('', {isChildrenFilter: true}).buildFilter()
|
|
563
584
|
const query = `*[_type == 'recommended-content-row' && brand == '${brand}' && type == '${pageName}'${rowString}]{
|
|
564
585
|
brand,
|
|
565
586
|
name,
|
|
@@ -572,9 +593,11 @@ export async function fetchContentRows(brand, pageName, contentRowSlug) {
|
|
|
572
593
|
'lesson_count': coalesce(count(*[${lessonCountFilter}]), 0),
|
|
573
594
|
},
|
|
574
595
|
}`
|
|
575
|
-
return fetchSanity(query, true
|
|
596
|
+
return fetchSanity(query, true)
|
|
576
597
|
}
|
|
577
598
|
|
|
599
|
+
|
|
600
|
+
|
|
578
601
|
/**
|
|
579
602
|
* Fetch all content for a specific brand and type with pagination, search, and grouping options.
|
|
580
603
|
* @param {string} brand - The brand for which to fetch content.
|
|
@@ -643,7 +666,9 @@ export async function fetchAll(
|
|
|
643
666
|
} else if (type === 'pack') {
|
|
644
667
|
typeFilter = `&& (_type == 'pack' || _type == 'semester-pack')`
|
|
645
668
|
} else {
|
|
646
|
-
typeFilter = type
|
|
669
|
+
typeFilter = type
|
|
670
|
+
? `&& _type == '${type}'`
|
|
671
|
+
: ''
|
|
647
672
|
}
|
|
648
673
|
|
|
649
674
|
// Construct the search filter
|
|
@@ -762,7 +787,7 @@ async function getProgressFilter(progress, progressIds) {
|
|
|
762
787
|
return `&& (railcontent_id in [${ids.join(',')}])`
|
|
763
788
|
}
|
|
764
789
|
case 'incomplete': {
|
|
765
|
-
const ids = progressIds !== undefined ? progressIds :
|
|
790
|
+
const ids = progressIds !== undefined ? progressIds :await getAllStarted()
|
|
766
791
|
return `&& railcontent_id in [${ids.join(',')}]`
|
|
767
792
|
}
|
|
768
793
|
default:
|
|
@@ -861,9 +886,7 @@ export async function fetchAllFilterOptions(
|
|
|
861
886
|
|
|
862
887
|
const includedFieldsFilter = filters?.length ? filtersToGroq(filters) : undefined
|
|
863
888
|
const progressFilter = progressIds ? `&& railcontent_id in [${progressIds.join(',')}]` : ''
|
|
864
|
-
const
|
|
865
|
-
const userPermissionsData = await adapter.fetchUserPermissions()
|
|
866
|
-
const isAdmin = adapter.isAdmin(userPermissionsData)
|
|
889
|
+
const isAdmin = (await fetchUserPermissions()).isAdmin
|
|
867
890
|
|
|
868
891
|
const constructCommonFilter = (excludeFilter) => {
|
|
869
892
|
const filterWithoutOption = excludeFilter
|
|
@@ -928,7 +951,6 @@ export async function fetchFoundation(slug) {
|
|
|
928
951
|
* @param {string} slug - The slug of the method.
|
|
929
952
|
* @returns {Promise<Object|null>} - The fetched methods data or null if not found.
|
|
930
953
|
*/
|
|
931
|
-
//todo BEH-1446 depreciated. remove all old method functions
|
|
932
954
|
export async function fetchMethod(brand, slug) {
|
|
933
955
|
const childrenFilter = await new FilterBuilder(``, { isChildrenFilter: true }).buildFilter()
|
|
934
956
|
|
|
@@ -1132,7 +1154,7 @@ export async function jumpToContinueContent(railcontentId) {
|
|
|
1132
1154
|
* .catch(error => console.error(error));
|
|
1133
1155
|
*/
|
|
1134
1156
|
export async function fetchLessonContent(railContentId, { addParent = false } = {}) {
|
|
1135
|
-
const filterParams = { isSingle: true, pullFutureContent: true
|
|
1157
|
+
const filterParams = { isSingle: true, pullFutureContent: true }
|
|
1136
1158
|
|
|
1137
1159
|
const parentQuery = addParent
|
|
1138
1160
|
? `"parent_content_data": *[railcontent_id in [...(^.parent_content_data[].id)]]{
|
|
@@ -1193,7 +1215,7 @@ export async function fetchLessonContent(railContentId, { addParent = false } =
|
|
|
1193
1215
|
return result
|
|
1194
1216
|
}
|
|
1195
1217
|
|
|
1196
|
-
return fetchSanity(query, false, { customPostProcess: chapterProcess
|
|
1218
|
+
return fetchSanity(query, false, { customPostProcess: chapterProcess })
|
|
1197
1219
|
}
|
|
1198
1220
|
|
|
1199
1221
|
/**
|
|
@@ -1272,7 +1294,7 @@ async function fetchRelatedByLicense(railcontentId, brand, onlyUseSongTypes, cou
|
|
|
1272
1294
|
*[${filterSongTypesWithSameLicense}]->{${queryFields}}|order(published_on desc, title asc)[0...${count}],
|
|
1273
1295
|
}[0...1]`
|
|
1274
1296
|
const results = await fetchSanity(query, false)
|
|
1275
|
-
return results ?
|
|
1297
|
+
return results ? results['related_by_license'] ?? [] : []
|
|
1276
1298
|
}
|
|
1277
1299
|
|
|
1278
1300
|
/**
|
|
@@ -1281,24 +1303,17 @@ async function fetchRelatedByLicense(railcontentId, brand, onlyUseSongTypes, cou
|
|
|
1281
1303
|
* @param {string} brand - The current brand.
|
|
1282
1304
|
* @returns {Promise<Array<Object>|null>} - The fetched related lessons data or null if not found.
|
|
1283
1305
|
*/
|
|
1284
|
-
export async function fetchSiblingContent(railContentId, brand
|
|
1306
|
+
export async function fetchSiblingContent(railContentId, brand= null)
|
|
1307
|
+
{
|
|
1285
1308
|
const filterGetParent = await new FilterBuilder(`references(^._id) && _type == ^.parent_type`, {
|
|
1309
|
+
pullFutureContent: true
|
|
1310
|
+
}).buildFilter()
|
|
1311
|
+
const filterForParentList = await new FilterBuilder(`references(^._id) && _type == ^.parent_type`, {
|
|
1286
1312
|
pullFutureContent: true,
|
|
1287
|
-
|
|
1313
|
+
isParentFilter: true,
|
|
1288
1314
|
}).buildFilter()
|
|
1289
|
-
const filterForParentList = await new FilterBuilder(
|
|
1290
|
-
`references(^._id) && _type == ^.parent_type`,
|
|
1291
|
-
{
|
|
1292
|
-
pullFutureContent: true,
|
|
1293
|
-
isParentFilter: true,
|
|
1294
|
-
showMembershipRestrictedContent: true // Show parent even without permissions
|
|
1295
|
-
}
|
|
1296
|
-
).buildFilter()
|
|
1297
1315
|
|
|
1298
|
-
const childrenFilter = await new FilterBuilder(``, {
|
|
1299
|
-
isChildrenFilter: true,
|
|
1300
|
-
showMembershipRestrictedContent: true // Show all lessons in sidebar, need_access applied on individual page
|
|
1301
|
-
}).buildFilter()
|
|
1316
|
+
const childrenFilter = await new FilterBuilder(``, { isChildrenFilter: true }).buildFilter()
|
|
1302
1317
|
|
|
1303
1318
|
const brandString = brand ? ` && brand == "${brand}"` : ''
|
|
1304
1319
|
const queryFields = `_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail":thumbnail.asset->url, length_in_seconds, status, "type": _type, difficulty, difficulty_string, artist->, "permission_id": permission[]->railcontent_id, "genre": genre[]->name, "parent_id": parent_content_data[0].id`
|
|
@@ -1312,7 +1327,7 @@ export async function fetchSiblingContent(railContentId, brand = null) {
|
|
|
1312
1327
|
"related_lessons" : *[${filterGetParent}][0].child[${childrenFilter}]->{${queryFields}}
|
|
1313
1328
|
}`
|
|
1314
1329
|
|
|
1315
|
-
let result = await fetchSanity(query, false
|
|
1330
|
+
let result = await fetchSanity(query, false)
|
|
1316
1331
|
|
|
1317
1332
|
//there's no way in sanity to retrieve the index of an array, so we must calculate after fetch
|
|
1318
1333
|
if (result['for-calculations'] && result['for-calculations']['parents-list']) {
|
|
@@ -1336,16 +1351,15 @@ export async function fetchSiblingContent(railContentId, brand = null) {
|
|
|
1336
1351
|
* @param {string} railContentId - The RailContent ID of the current lesson.
|
|
1337
1352
|
* @returns {Promise<Array<Object>|null>} - The fetched related lessons data or null if not found.
|
|
1338
1353
|
*/
|
|
1339
|
-
export async function fetchRelatedLessons(railContentId)
|
|
1354
|
+
export async function fetchRelatedLessons(railContentId)
|
|
1355
|
+
{
|
|
1340
1356
|
const defaultFilterFields = `_type==^._type && brand == ^.brand && railcontent_id != ${railContentId}`
|
|
1341
1357
|
|
|
1342
1358
|
const filterSameArtist = await new FilterBuilder(
|
|
1343
|
-
`${defaultFilterFields} && references(^.artist->_id)
|
|
1344
|
-
{ showMembershipRestrictedContent: true }
|
|
1359
|
+
`${defaultFilterFields} && references(^.artist->_id)`
|
|
1345
1360
|
).buildFilter()
|
|
1346
1361
|
const filterSameGenre = await new FilterBuilder(
|
|
1347
|
-
`${defaultFilterFields} && references(^.genre[]->_id)
|
|
1348
|
-
{ showMembershipRestrictedContent: true }
|
|
1362
|
+
`${defaultFilterFields} && references(^.genre[]->_id)`
|
|
1349
1363
|
).buildFilter()
|
|
1350
1364
|
|
|
1351
1365
|
const queryFields = `_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail":thumbnail.asset->url, length_in_seconds, status, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type, "genre": genre[]->name`
|
|
@@ -1357,7 +1371,7 @@ export async function fetchRelatedLessons(railContentId) {
|
|
|
1357
1371
|
...(*[${filterSameGenre}]{${queryFields}}|order(published_on desc, title asc)[0...10]),
|
|
1358
1372
|
])[0...10]}`
|
|
1359
1373
|
|
|
1360
|
-
return await fetchSanity(query, false
|
|
1374
|
+
return await fetchSanity(query, false)
|
|
1361
1375
|
}
|
|
1362
1376
|
|
|
1363
1377
|
/**
|
|
@@ -1382,16 +1396,11 @@ export async function fetchAllPacks(
|
|
|
1382
1396
|
const start = (page - 1) * limit
|
|
1383
1397
|
const end = start + limit
|
|
1384
1398
|
|
|
1385
|
-
const query = await buildQuery(
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
sortOrder: sortOrder,
|
|
1391
|
-
start,
|
|
1392
|
-
end,
|
|
1393
|
-
}
|
|
1394
|
-
)
|
|
1399
|
+
const query = await buildQuery(filter, filterParams, await getFieldsForContentTypeWithFilteredChildren('pack'), {
|
|
1400
|
+
sortOrder: sortOrder,
|
|
1401
|
+
start,
|
|
1402
|
+
end,
|
|
1403
|
+
})
|
|
1395
1404
|
return fetchSanity(query, true)
|
|
1396
1405
|
}
|
|
1397
1406
|
|
|
@@ -1497,6 +1506,45 @@ export async function fetchPackData(id) {
|
|
|
1497
1506
|
return fetchSanity(query, false)
|
|
1498
1507
|
}
|
|
1499
1508
|
|
|
1509
|
+
/**
|
|
1510
|
+
* Fetch the data needed for the coach screen.
|
|
1511
|
+
* @param {string} brand - The brand for which to fetch coach lessons
|
|
1512
|
+
* @param {string} id - The Railcontent ID of the coach
|
|
1513
|
+
* @returns {Promise<Object|null>} - The lessons for the instructor or null if not found.
|
|
1514
|
+
* @param {Object} params - Parameters for pagination, filtering and sorting.
|
|
1515
|
+
* @param {string} [params.sortOrder="-published_on"] - The field to sort the lessons by.
|
|
1516
|
+
* @param {string} [params.searchTerm=""] - The search term to filter content by title.
|
|
1517
|
+
* @param {number} [params.page=1] - The page number for pagination.
|
|
1518
|
+
* @param {number} [params.limit=10] - The number of items per page.
|
|
1519
|
+
* @param {Array<string>} [params.includedFields=[]] - Additional filters to apply to the query in the format of a key,value array. eg. ['difficulty,Intermediate', 'genre,rock'].
|
|
1520
|
+
*
|
|
1521
|
+
* @example
|
|
1522
|
+
* fetchCoachLessons('coach123')
|
|
1523
|
+
* .then(lessons => console.log(lessons))
|
|
1524
|
+
* .catch(error => console.error(error));
|
|
1525
|
+
*/
|
|
1526
|
+
export async function fetchCoachLessons(
|
|
1527
|
+
brand,
|
|
1528
|
+
id,
|
|
1529
|
+
{ sortOrder = '-published_on', searchTerm = '', page = 1, limit = 20, includedFields = [] } = {}
|
|
1530
|
+
) {
|
|
1531
|
+
const fieldsString = getFieldsForContentType()
|
|
1532
|
+
const start = (page - 1) * limit
|
|
1533
|
+
const end = start + limit
|
|
1534
|
+
const searchFilter = searchTerm ? `&& title match "${searchTerm}*"` : ''
|
|
1535
|
+
const includedFieldsFilter = includedFields.length > 0 ? filtersToGroq(includedFields) : ''
|
|
1536
|
+
const filter = `brand == '${brand}' ${searchFilter} ${includedFieldsFilter} && references(*[_type=='instructor' && railcontent_id == ${id}]._id)`
|
|
1537
|
+
const filterWithRestrictions = await new FilterBuilder(filter).buildFilter()
|
|
1538
|
+
|
|
1539
|
+
sortOrder = getSortOrder(sortOrder, brand)
|
|
1540
|
+
const query = buildEntityAndTotalQuery(filterWithRestrictions, fieldsString, {
|
|
1541
|
+
sortOrder: sortOrder,
|
|
1542
|
+
start: start,
|
|
1543
|
+
end: end,
|
|
1544
|
+
})
|
|
1545
|
+
return fetchSanity(query, true)
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1500
1548
|
/**
|
|
1501
1549
|
* Fetch the data needed for the coach screen.
|
|
1502
1550
|
* @param {string} id - The Railcontent ID of the coach
|
|
@@ -1528,6 +1576,121 @@ export async function fetchByReference(
|
|
|
1528
1576
|
return fetchSanity(query, true)
|
|
1529
1577
|
}
|
|
1530
1578
|
|
|
1579
|
+
/**
|
|
1580
|
+
* Fetch the artist's lessons.
|
|
1581
|
+
* @param {string} brand - The brand for which to fetch lessons.
|
|
1582
|
+
* @param {string} name - The name of the artist
|
|
1583
|
+
* @param {string} contentType - The type of the lessons we need to get from the artist. If not defined, groq will get lessons from all content types
|
|
1584
|
+
* @param {Object} params - Parameters for sorting, searching, pagination and filtering.
|
|
1585
|
+
* @param {string} [params.sort="-published_on"] - The field to sort the lessons by.
|
|
1586
|
+
* @param {string} [params.searchTerm=""] - The search term to filter the lessons.
|
|
1587
|
+
* @param {number} [params.page=1] - The page number for pagination.
|
|
1588
|
+
* @param {number} [params.limit=10] - The number of items per page.
|
|
1589
|
+
* @param {Array<string>} [params.includedFields=[]] - Additional filters to apply to the query in the format of a key,value array. eg. ['difficulty,Intermediate', 'genre,rock'].
|
|
1590
|
+
* @param {Array<number>} [params.progressIds] - The ids of the lessons that are in progress or completed
|
|
1591
|
+
* @returns {Promise<Object|null>} - The lessons for the artist and some details about the artist (name and thumbnail).
|
|
1592
|
+
*
|
|
1593
|
+
* @example
|
|
1594
|
+
* fetchArtistLessons('drumeo', '10 Years', 'song', {'-published_on', '', 1, 10, ["difficulty,Intermediate"], [232168, 232824, 303375, 232194, 393125]})
|
|
1595
|
+
* .then(lessons => console.log(lessons))
|
|
1596
|
+
* .catch(error => console.error(error));
|
|
1597
|
+
*/
|
|
1598
|
+
export async function fetchArtistLessons(
|
|
1599
|
+
brand,
|
|
1600
|
+
name,
|
|
1601
|
+
contentType,
|
|
1602
|
+
{
|
|
1603
|
+
sort = '-published_on',
|
|
1604
|
+
searchTerm = '',
|
|
1605
|
+
page = 1,
|
|
1606
|
+
limit = 10,
|
|
1607
|
+
includedFields = [],
|
|
1608
|
+
progressIds = undefined,
|
|
1609
|
+
} = {}
|
|
1610
|
+
) {
|
|
1611
|
+
const fieldsString = DEFAULT_FIELDS.join(',')
|
|
1612
|
+
const start = (page - 1) * limit
|
|
1613
|
+
const end = start + limit
|
|
1614
|
+
const searchFilter = searchTerm ? `&& title match "${searchTerm}*"` : ''
|
|
1615
|
+
const sortOrder = getSortOrder(sort, brand)
|
|
1616
|
+
const addType =
|
|
1617
|
+
contentType && Array.isArray(contentType)
|
|
1618
|
+
? `_type in ['${contentType.join("', '")}'] &&`
|
|
1619
|
+
: contentType
|
|
1620
|
+
? `_type == '${contentType}' && `
|
|
1621
|
+
: ''
|
|
1622
|
+
const includedFieldsFilter = includedFields.length > 0 ? filtersToGroq(includedFields) : ''
|
|
1623
|
+
|
|
1624
|
+
// limits the results to supplied progressIds for started & completed filters
|
|
1625
|
+
const progressFilter =
|
|
1626
|
+
progressIds !== undefined ? `&& railcontent_id in [${progressIds.join(',')}]` : ''
|
|
1627
|
+
const now = getSanityDate(new Date())
|
|
1628
|
+
const query = `{
|
|
1629
|
+
"entity":
|
|
1630
|
+
*[_type == 'artist' && name == '${name}']
|
|
1631
|
+
{'type': _type, name, 'thumbnail':thumbnail_url.asset->url,
|
|
1632
|
+
'lessons_count': count(*[${addType} brand == '${brand}' && references(^._id)]),
|
|
1633
|
+
'lessons': *[${addType} brand == '${brand}' && references(^._id) && (status in ['published'] || (status == 'scheduled' && defined(published_on) && published_on >= '${now}')) ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{${fieldsString}}
|
|
1634
|
+
[${start}...${end}]}
|
|
1635
|
+
|order(${sortOrder})f
|
|
1636
|
+
}`
|
|
1637
|
+
return fetchSanity(query, true)
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
/**
|
|
1641
|
+
* Fetch the genre's lessons.
|
|
1642
|
+
* @param {string} brand - The brand for which to fetch lessons.
|
|
1643
|
+
* @param {string} name - The name of the genre
|
|
1644
|
+
* @param {Object} params - Parameters for sorting, searching, pagination and filtering.
|
|
1645
|
+
* @param {string} [params.sort="-published_on"] - The field to sort the lessons by.
|
|
1646
|
+
* @param {string} [params.searchTerm=""] - The search term to filter the lessons.
|
|
1647
|
+
* @param {number} [params.page=1] - The page number for pagination.
|
|
1648
|
+
* @param {number} [params.limit=10] - The number of items per page.
|
|
1649
|
+
* @param {Array<string>} [params.includedFields=[]] - Additional filters to apply to the query in the format of a key,value array. eg. ['difficulty,Intermediate', 'genre,rock'].
|
|
1650
|
+
* @param {Array<number>} [params.progressIds] - The ids of the lessons that are in progress or completed
|
|
1651
|
+
* @returns {Promise<Object|null>} - The lessons for the artist and some details about the artist (name and thumbnail).
|
|
1652
|
+
*
|
|
1653
|
+
* @example
|
|
1654
|
+
* fetchGenreLessons('drumeo', 'Blues', 'song', {'-published_on', '', 1, 10, ["difficulty,Intermediate"], [232168, 232824, 303375, 232194, 393125]})
|
|
1655
|
+
* .then(lessons => console.log(lessons))
|
|
1656
|
+
* .catch(error => console.error(error));
|
|
1657
|
+
*/
|
|
1658
|
+
export async function fetchGenreLessons(
|
|
1659
|
+
brand,
|
|
1660
|
+
name,
|
|
1661
|
+
contentType,
|
|
1662
|
+
{
|
|
1663
|
+
sort = '-published_on',
|
|
1664
|
+
searchTerm = '',
|
|
1665
|
+
page = 1,
|
|
1666
|
+
limit = 10,
|
|
1667
|
+
includedFields = [],
|
|
1668
|
+
progressIds = undefined,
|
|
1669
|
+
} = {}
|
|
1670
|
+
) {
|
|
1671
|
+
const fieldsString = DEFAULT_FIELDS.join(',')
|
|
1672
|
+
const start = (page - 1) * limit
|
|
1673
|
+
const end = start + limit
|
|
1674
|
+
const searchFilter = searchTerm ? `&& title match "${searchTerm}*"` : ''
|
|
1675
|
+
const sortOrder = getSortOrder(sort, brand)
|
|
1676
|
+
const addType = contentType ? `_type == '${contentType}' && ` : ''
|
|
1677
|
+
const includedFieldsFilter = includedFields.length > 0 ? filtersToGroq(includedFields) : ''
|
|
1678
|
+
// limits the results to supplied progressIds for started & completed filters
|
|
1679
|
+
const progressFilter =
|
|
1680
|
+
progressIds !== undefined ? `&& railcontent_id in [${progressIds.join(',')}]` : ''
|
|
1681
|
+
const now = getSanityDate(new Date())
|
|
1682
|
+
const query = `{
|
|
1683
|
+
"entity":
|
|
1684
|
+
*[_type == 'genre' && name == '${name}']
|
|
1685
|
+
{'type': _type, name, 'thumbnail':thumbnail_url.asset->url,
|
|
1686
|
+
'lessons_count': count(*[${addType} brand == '${brand}' && references(^._id)]),
|
|
1687
|
+
'lessons': *[${addType} brand == '${brand}' && references(^._id) && (status in ['published'] || (status == 'scheduled' && defined(published_on) && published_on >= '${now}')) ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{${fieldsString}}
|
|
1688
|
+
[${start}...${end}]}
|
|
1689
|
+
|order(${sortOrder})
|
|
1690
|
+
}`
|
|
1691
|
+
return fetchSanity(query, true)
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1531
1694
|
export async function fetchTopLevelParentId(railcontentId) {
|
|
1532
1695
|
const statusFilter = "&& status in ['scheduled', 'published', 'archived', 'unlisted']"
|
|
1533
1696
|
|
|
@@ -1649,10 +1812,8 @@ export async function fetchCommentModContentData(ids) {
|
|
|
1649
1812
|
*
|
|
1650
1813
|
* @param {string} query - The GROQ query to execute against the Sanity API.
|
|
1651
1814
|
* @param {boolean} isList - Whether to return an array or a single result.
|
|
1652
|
-
* @param {
|
|
1653
|
-
* @param {
|
|
1654
|
-
* @param {boolean} [options.processNeedAccess=true] - execute the needs_access callback
|
|
1655
|
-
* @param {boolean} [options.processPageType=true] - execute the page_type callback
|
|
1815
|
+
* @param {Function} [customPostProcess=null] - custom post process callback
|
|
1816
|
+
* @param {boolean} [processNeedAccess=true] - execute the needs_access callback
|
|
1656
1817
|
* @returns {Promise<*|null>} - A promise that resolves to the fetched data or null if an error occurs or no results are found.
|
|
1657
1818
|
*
|
|
1658
1819
|
* @example
|
|
@@ -1665,7 +1826,7 @@ export async function fetchCommentModContentData(ids) {
|
|
|
1665
1826
|
export async function fetchSanity(
|
|
1666
1827
|
query,
|
|
1667
1828
|
isList,
|
|
1668
|
-
{ customPostProcess = null, processNeedAccess = true
|
|
1829
|
+
{ customPostProcess = null, processNeedAccess = true } = {}
|
|
1669
1830
|
) {
|
|
1670
1831
|
// Check the config object before proceeding
|
|
1671
1832
|
if (!checkSanityConfig(globalConfig)) {
|
|
@@ -1687,13 +1848,13 @@ export async function fetchSanity(
|
|
|
1687
1848
|
body: JSON.stringify({ query: query }),
|
|
1688
1849
|
}
|
|
1689
1850
|
|
|
1690
|
-
const adapter = getPermissionsAdapter()
|
|
1691
1851
|
let promisesResult = await Promise.all([
|
|
1692
1852
|
fetch(url, options),
|
|
1693
|
-
processNeedAccess ?
|
|
1853
|
+
processNeedAccess ? fetchUserPermissions() : null,
|
|
1694
1854
|
])
|
|
1695
1855
|
const response = promisesResult[0]
|
|
1696
|
-
const userPermissions = promisesResult[1]
|
|
1856
|
+
const userPermissions = promisesResult[1]?.permissions
|
|
1857
|
+
const isAdmin = promisesResult[1]?.isAdmin
|
|
1697
1858
|
|
|
1698
1859
|
if (!response.ok) {
|
|
1699
1860
|
throw new Error(`Sanity API error: ${response.status} - ${response.statusText}`)
|
|
@@ -1705,35 +1866,24 @@ export async function fetchSanity(
|
|
|
1705
1866
|
throw new Error('No results found')
|
|
1706
1867
|
}
|
|
1707
1868
|
results = processNeedAccess
|
|
1708
|
-
? await needsAccessDecorator(results, userPermissions)
|
|
1709
|
-
: results
|
|
1710
|
-
results = processPageType
|
|
1711
|
-
? pageTypeDecorator(results)
|
|
1869
|
+
? await needsAccessDecorator(results, userPermissions, isAdmin)
|
|
1712
1870
|
: results
|
|
1871
|
+
results = pageTypeDecorator(results)
|
|
1713
1872
|
return customPostProcess ? customPostProcess(results) : results
|
|
1714
1873
|
} else {
|
|
1715
1874
|
throw new Error('No results found')
|
|
1716
1875
|
}
|
|
1717
1876
|
} catch (error) {
|
|
1718
|
-
console.error('fetchSanity: Fetch error:', {
|
|
1877
|
+
console.error('fetchSanity: Fetch error:', {error, query})
|
|
1719
1878
|
return null
|
|
1720
1879
|
}
|
|
1721
1880
|
}
|
|
1722
1881
|
|
|
1723
|
-
function contentResultsDecorator(results, fieldName, callback)
|
|
1882
|
+
function contentResultsDecorator(results, fieldName, callback)
|
|
1883
|
+
{
|
|
1724
1884
|
if (Array.isArray(results)) {
|
|
1725
1885
|
results.forEach((result) => {
|
|
1726
|
-
|
|
1727
|
-
if (result.content && Array.isArray(result.content)) {
|
|
1728
|
-
// Content rows structure: array of rows, each with a content array
|
|
1729
|
-
result.content.forEach((contentItem) => {
|
|
1730
|
-
if (contentItem) {
|
|
1731
|
-
contentItem[fieldName] = callback(contentItem)
|
|
1732
|
-
}
|
|
1733
|
-
})
|
|
1734
|
-
} else {
|
|
1735
|
-
result[fieldName] = callback(result)
|
|
1736
|
-
}
|
|
1886
|
+
result[fieldName] = callback(result)
|
|
1737
1887
|
})
|
|
1738
1888
|
} else if (results.entity && Array.isArray(results.entity)) {
|
|
1739
1889
|
// Group By
|
|
@@ -1757,26 +1907,32 @@ function contentResultsDecorator(results, fieldName, callback) {
|
|
|
1757
1907
|
return results
|
|
1758
1908
|
}
|
|
1759
1909
|
|
|
1760
|
-
function pageTypeDecorator(results)
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
})
|
|
1910
|
+
function pageTypeDecorator(results)
|
|
1911
|
+
{
|
|
1912
|
+
return contentResultsDecorator(results, 'page_type', function(content) { return SONG_TYPES_WITH_CHILDREN.includes(content['type']) ? 'song' : 'lesson'})
|
|
1764
1913
|
}
|
|
1765
1914
|
|
|
1766
1915
|
|
|
1767
|
-
function needsAccessDecorator(results, userPermissions) {
|
|
1916
|
+
function needsAccessDecorator(results, userPermissions, isAdmin) {
|
|
1768
1917
|
if (globalConfig.sanityConfig.useDummyRailContentMethods) return results
|
|
1769
|
-
|
|
1770
|
-
return contentResultsDecorator(results, 'need_access', function (content) {
|
|
1771
|
-
return adapter.doesUserNeedAccess(content, userPermissions)
|
|
1772
|
-
})
|
|
1918
|
+
userPermissions = new Set(userPermissions)
|
|
1919
|
+
return contentResultsDecorator(results, 'need_access', function (content) { return doesUserNeedAccessToContent(content, userPermissions, isAdmin) })
|
|
1773
1920
|
}
|
|
1774
1921
|
|
|
1775
|
-
function doesUserNeedAccessToContent(result, userPermissions) {
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1922
|
+
function doesUserNeedAccessToContent(result, userPermissions, isAdmin) {
|
|
1923
|
+
if (isAdmin ?? false) {
|
|
1924
|
+
return false
|
|
1925
|
+
}
|
|
1926
|
+
const permissions = new Set(result?.permission_id ?? [])
|
|
1927
|
+
if (permissions.size === 0) {
|
|
1928
|
+
return false
|
|
1929
|
+
}
|
|
1930
|
+
for (let permission of permissions) {
|
|
1931
|
+
if (userPermissions.has(permission)) {
|
|
1932
|
+
return false
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
return true
|
|
1780
1936
|
}
|
|
1781
1937
|
|
|
1782
1938
|
/**
|
|
@@ -1818,8 +1974,8 @@ export async function fetchShowsData(brand) {
|
|
|
1818
1974
|
* .catch(error => console.error(error));
|
|
1819
1975
|
*/
|
|
1820
1976
|
export async function fetchMetadata(brand, type) {
|
|
1821
|
-
let processedData =
|
|
1822
|
-
if
|
|
1977
|
+
let processedData = processMetadata(brand, type, true)
|
|
1978
|
+
if(processedData?.onlyAvailableTabs === true) {
|
|
1823
1979
|
const activeTabs = await fetchRecentActivitiesActiveTabs()
|
|
1824
1980
|
processedData.tabs = activeTabs
|
|
1825
1981
|
}
|
|
@@ -1845,7 +2001,7 @@ function arrayJoinWithQuotes(array, delimiter = ',') {
|
|
|
1845
2001
|
return wrapped.join(delimiter)
|
|
1846
2002
|
}
|
|
1847
2003
|
|
|
1848
|
-
|
|
2004
|
+
function getSanityDate(date, roundToHourForCaching = true) {
|
|
1849
2005
|
if (roundToHourForCaching) {
|
|
1850
2006
|
// We need to set the published on filter date to be a round time so that it doesn't bypass the query cache
|
|
1851
2007
|
// with every request by changing the filter date every second. I've set it to one minute past the current hour
|
|
@@ -1919,19 +2075,13 @@ async function buildQuery(
|
|
|
1919
2075
|
return buildRawQuery(filter, fields, { sortOrder, start, end, isSingle })
|
|
1920
2076
|
}
|
|
1921
2077
|
|
|
1922
|
-
|
|
2078
|
+
function buildEntityAndTotalQuery(
|
|
1923
2079
|
filter = '',
|
|
1924
2080
|
fields = '...',
|
|
1925
|
-
{
|
|
1926
|
-
sortOrder = 'published_on desc',
|
|
1927
|
-
start = 0,
|
|
1928
|
-
end = 10,
|
|
1929
|
-
isSingle = false,
|
|
1930
|
-
withoutPagination = false,
|
|
1931
|
-
}
|
|
2081
|
+
{ sortOrder = 'published_on desc', start = 0, end = 10, isSingle = false, withoutPagination = false }
|
|
1932
2082
|
) {
|
|
1933
2083
|
const sortString = sortOrder ? ` | order(${sortOrder})` : ''
|
|
1934
|
-
const countString = isSingle ? '[0...1]' : withoutPagination ?
|
|
2084
|
+
const countString = isSingle ? '[0...1]' : (withoutPagination ? ``: `[${start}...${end}]`)
|
|
1935
2085
|
const query = `{
|
|
1936
2086
|
"entity": *[${filter}] ${sortString}${countString}
|
|
1937
2087
|
{
|
|
@@ -2048,7 +2198,6 @@ export async function fetchTabData(
|
|
|
2048
2198
|
includedFields = [],
|
|
2049
2199
|
progressIds = undefined,
|
|
2050
2200
|
progress = 'all',
|
|
2051
|
-
showMembershipRestrictedContent = false,
|
|
2052
2201
|
} = {}
|
|
2053
2202
|
) {
|
|
2054
2203
|
const start = (page - 1) * limit
|
|
@@ -2061,22 +2210,22 @@ export async function fetchTabData(
|
|
|
2061
2210
|
|
|
2062
2211
|
switch (progress) {
|
|
2063
2212
|
case 'recent':
|
|
2064
|
-
progressIds = await getAllStartedOrCompleted({ brand, onlyIds: true })
|
|
2065
|
-
sortOrder = null
|
|
2066
|
-
break
|
|
2213
|
+
progressIds = await getAllStartedOrCompleted({ brand, onlyIds: true });
|
|
2214
|
+
sortOrder = null;
|
|
2215
|
+
break;
|
|
2067
2216
|
case 'incomplete':
|
|
2068
|
-
progressIds = await getAllStarted()
|
|
2069
|
-
sortOrder = null
|
|
2070
|
-
break
|
|
2217
|
+
progressIds = await getAllStarted();
|
|
2218
|
+
sortOrder = null;
|
|
2219
|
+
break;
|
|
2071
2220
|
case 'completed':
|
|
2072
|
-
progressIds = await getAllCompleted()
|
|
2073
|
-
sortOrder = null
|
|
2074
|
-
break
|
|
2221
|
+
progressIds = await getAllCompleted();
|
|
2222
|
+
sortOrder = null;
|
|
2223
|
+
break;
|
|
2075
2224
|
}
|
|
2076
2225
|
|
|
2077
2226
|
// limits the results to supplied progressIds for started & completed filters
|
|
2078
2227
|
const progressFilter = await getProgressFilter(progress, progressIds)
|
|
2079
|
-
const fieldsString = getFieldsForContentType('tab-data')
|
|
2228
|
+
const fieldsString = getFieldsForContentType('tab-data');
|
|
2080
2229
|
const now = getSanityDate(new Date())
|
|
2081
2230
|
|
|
2082
2231
|
// Determine the group by clause
|
|
@@ -2085,10 +2234,11 @@ export async function fetchTabData(
|
|
|
2085
2234
|
let filter = ''
|
|
2086
2235
|
|
|
2087
2236
|
filter = `brand == "${brand}" && (defined(railcontent_id)) ${includedFieldsFilter} ${progressFilter}`
|
|
2088
|
-
const childrenFilter = await new FilterBuilder(``, { isChildrenFilter: true
|
|
2237
|
+
const childrenFilter = await new FilterBuilder(``, { isChildrenFilter: true }).buildFilter()
|
|
2089
2238
|
const childrenFields = await getChildFieldsForContentType('tab-data')
|
|
2090
2239
|
const lessonCountFilter = await new FilterBuilder(`_id in ^.child[]._ref`).buildFilter()
|
|
2091
|
-
entityFieldsString =
|
|
2240
|
+
entityFieldsString =
|
|
2241
|
+
` ${fieldsString}
|
|
2092
2242
|
'children': child[${childrenFilter}]->{ ${childrenFields} 'children': child[${childrenFilter}]->{ ${childrenFields} }, },
|
|
2093
2243
|
'isLive': live_event_start_time <= "${now}" && live_event_end_time >= "${now}",
|
|
2094
2244
|
'lesson_count': coalesce(count(*[${lessonCountFilter}]), 0),
|
|
@@ -2100,27 +2250,27 @@ export async function fetchTabData(
|
|
|
2100
2250
|
),
|
|
2101
2251
|
length_in_seconds
|
|
2102
2252
|
),`
|
|
2103
|
-
const filterWithRestrictions = await new FilterBuilder(filter, {
|
|
2253
|
+
const filterWithRestrictions = await new FilterBuilder(filter, {}).buildFilter()
|
|
2104
2254
|
query = buildEntityAndTotalQuery(filterWithRestrictions, entityFieldsString, {
|
|
2105
2255
|
sortOrder: sortOrder,
|
|
2106
2256
|
start: start,
|
|
2107
|
-
end: end
|
|
2257
|
+
end: end
|
|
2108
2258
|
})
|
|
2109
2259
|
|
|
2110
|
-
let results = await fetchSanity(query, true
|
|
2260
|
+
let results = await fetchSanity(query, true);
|
|
2111
2261
|
|
|
2112
2262
|
if (['recent', 'incomplete', 'completed'].includes(progress) && results.entity.length > 1) {
|
|
2113
2263
|
const orderMap = new Map(progressIds.map((id, index) => [id, index]))
|
|
2114
2264
|
results.entity = results.entity
|
|
2115
2265
|
.sort((a, b) => {
|
|
2116
|
-
const aIdx = orderMap.get(a.id) ?? Number.MAX_SAFE_INTEGER
|
|
2117
|
-
const bIdx = orderMap.get(b.id) ?? Number.MAX_SAFE_INTEGER
|
|
2118
|
-
return aIdx - bIdx || new Date(b.published_on) - new Date(a.published_on)
|
|
2266
|
+
const aIdx = orderMap.get(a.id) ?? Number.MAX_SAFE_INTEGER;
|
|
2267
|
+
const bIdx = orderMap.get(b.id) ?? Number.MAX_SAFE_INTEGER;
|
|
2268
|
+
return aIdx - bIdx || new Date(b.published_on) - new Date(a.published_on);
|
|
2119
2269
|
})
|
|
2120
|
-
.slice(start, end)
|
|
2270
|
+
.slice(start, end);
|
|
2121
2271
|
}
|
|
2122
2272
|
|
|
2123
|
-
return results
|
|
2273
|
+
return results;
|
|
2124
2274
|
}
|
|
2125
2275
|
|
|
2126
2276
|
export async function fetchRecent(
|
|
@@ -2195,12 +2345,12 @@ export async function fetchShows(brand, type, sort = 'sort') {
|
|
|
2195
2345
|
* @returns {Promise<*|null>}
|
|
2196
2346
|
*/
|
|
2197
2347
|
export async function fetchMethodV2IntroVideo(brand) {
|
|
2198
|
-
const type =
|
|
2199
|
-
const filter = `_type == '${type}' && brand == '${brand}'
|
|
2200
|
-
const fields = getIntroVideoFields('method-v2')
|
|
2348
|
+
const type = "method-intro";
|
|
2349
|
+
const filter = `_type == '${type}' && brand == '${brand}'`;
|
|
2350
|
+
const fields = getIntroVideoFields('method-v2');
|
|
2201
2351
|
|
|
2202
|
-
const query = `*[${filter}] { ${fields.join(
|
|
2203
|
-
return fetchSanity(query, false)
|
|
2352
|
+
const query = `*[${filter}] { ${fields.join(", ")} }`;
|
|
2353
|
+
return fetchSanity(query, false);
|
|
2204
2354
|
}
|
|
2205
2355
|
|
|
2206
2356
|
/**
|
|
@@ -2209,7 +2359,7 @@ export async function fetchMethodV2IntroVideo(brand) {
|
|
|
2209
2359
|
* @returns {Promise<*|null>}
|
|
2210
2360
|
*/
|
|
2211
2361
|
export async function fetchMethodV2Structure(brand) {
|
|
2212
|
-
const _type =
|
|
2362
|
+
const _type = "method-v2";
|
|
2213
2363
|
const query = `*[_type == '${_type}' && brand == '${brand}'][0...1]{
|
|
2214
2364
|
'sanity_id': _id,
|
|
2215
2365
|
'learningPaths': child[]->{
|
|
@@ -2217,60 +2367,24 @@ export async function fetchMethodV2Structure(brand) {
|
|
|
2217
2367
|
'children': child[]->railcontent_id
|
|
2218
2368
|
}
|
|
2219
2369
|
}`
|
|
2220
|
-
return await fetchSanity(query, false)
|
|
2370
|
+
return await fetchSanity(query, false);
|
|
2221
2371
|
}
|
|
2222
2372
|
|
|
2223
2373
|
/**
|
|
2224
|
-
* Fetch
|
|
2225
|
-
*
|
|
2226
|
-
*
|
|
2227
|
-
* @param {string} brand - The brand to filter content by
|
|
2228
|
-
* @param {Object} options - Fetch options
|
|
2229
|
-
* @param {Array<string>} options.type - Content type(s) to filter (optional array, default: [])
|
|
2230
|
-
* @param {number} options.page - Page number (default: 1)
|
|
2231
|
-
* @param {number} options.limit - Items per page (default: 10)
|
|
2232
|
-
* @param {string} options.sort - Sort field and direction (default: '-published_on')
|
|
2233
|
-
* @returns {Promise<Object>} Object with 'entity' (content array) and 'total' (count)
|
|
2374
|
+
* Fetch the structure (just ids) of the Method of a given learning path or learning path lesson.
|
|
2375
|
+
* @param contentId
|
|
2376
|
+
* @returns {Promise<*|null>}
|
|
2234
2377
|
*/
|
|
2235
|
-
export async function
|
|
2236
|
-
|
|
2237
|
-
{
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
const end = start + limit
|
|
2246
|
-
|
|
2247
|
-
// Determine the sort order
|
|
2248
|
-
const sortOrder = getSortOrder(sort, brand)
|
|
2249
|
-
|
|
2250
|
-
// Build the type filter
|
|
2251
|
-
let typeFilter = ''
|
|
2252
|
-
if (type.length > 0) {
|
|
2253
|
-
const typesString = type.map(t => `'${t}'`).join(', ')
|
|
2254
|
-
typeFilter = `&& _type in [${typesString}]`
|
|
2255
|
-
}
|
|
2256
|
-
|
|
2257
|
-
// Build the base filter
|
|
2258
|
-
const filter = `brand == "${brand}" ${typeFilter}`
|
|
2259
|
-
|
|
2260
|
-
// Apply owned content filter
|
|
2261
|
-
const filterWithRestrictions = await new FilterBuilder(filter, {
|
|
2262
|
-
showOnlyOwnedContent: true, // Key parameter: exclude membership content
|
|
2263
|
-
}).buildFilter()
|
|
2264
|
-
|
|
2265
|
-
const fieldsString = DEFAULT_FIELDS.join(',')
|
|
2266
|
-
|
|
2267
|
-
const query = buildEntityAndTotalQuery(filterWithRestrictions, fieldsString, {
|
|
2268
|
-
sortOrder: sortOrder,
|
|
2269
|
-
start: start,
|
|
2270
|
-
end: end,
|
|
2271
|
-
})
|
|
2272
|
-
|
|
2273
|
-
return fetchSanity(query, true)
|
|
2378
|
+
export async function fetchMethodV2StructureFromId(contentId) {
|
|
2379
|
+
const _type = "method-v2";
|
|
2380
|
+
const query = `*[_type == '${_type}' && brand == *[railcontent_id == ${contentId}][0].brand][0...1]{
|
|
2381
|
+
'sanity_id': _id,
|
|
2382
|
+
'learningPaths': child[]->{
|
|
2383
|
+
'id': railcontent_id,
|
|
2384
|
+
'children': child[]->railcontent_id
|
|
2385
|
+
}
|
|
2386
|
+
}`
|
|
2387
|
+
return await fetchSanity(query, false);
|
|
2274
2388
|
}
|
|
2275
2389
|
</code></pre>
|
|
2276
2390
|
</article>
|
|
@@ -2286,7 +2400,7 @@ export async function fetchOwnedContent(
|
|
|
2286
2400
|
<br class="clear">
|
|
2287
2401
|
|
|
2288
2402
|
<footer>
|
|
2289
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
2403
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Nov 19 2025 14:55:35 GMT-0800 (Pacific Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
2290
2404
|
</footer>
|
|
2291
2405
|
|
|
2292
2406
|
<script>prettyPrint();</script>
|