musora-content-services 2.92.3 → 2.92.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/src/index.d.ts +2 -0
  4. package/src/index.js +2 -0
  5. package/src/services/content-org/learning-paths.ts +3 -3
  6. package/src/services/progress-row/method-card.js +1 -1
  7. package/src/services/sync/fetch.ts +3 -0
  8. package/docs/Content.html +0 -269
  9. package/docs/ContentOrganization.html +0 -245
  10. package/docs/Forums.html +0 -269
  11. package/docs/Gamification.html +0 -245
  12. package/docs/TestUser.html +0 -260
  13. package/docs/UserManagementSystem.html +0 -317
  14. package/docs/api_types.js.html +0 -97
  15. package/docs/config.js.html +0 -140
  16. package/docs/content-org_content-org.js.html +0 -76
  17. package/docs/content-org_guided-courses.ts.html +0 -110
  18. package/docs/content-org_learning-paths.ts.html +0 -391
  19. package/docs/content-org_playlists-types.js.html +0 -128
  20. package/docs/content-org_playlists.js.html +0 -440
  21. package/docs/content.js.html +0 -603
  22. package/docs/content_artist.ts.html +0 -206
  23. package/docs/content_content.ts.html +0 -77
  24. package/docs/content_genre.ts.html +0 -209
  25. package/docs/content_instructor.ts.html +0 -206
  26. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  27. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  28. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  29. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  30. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  31. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  32. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  33. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  34. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  35. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
  36. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  37. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  38. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  39. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  40. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
  41. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  42. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  43. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  44. package/docs/forums_categories.ts.html +0 -156
  45. package/docs/forums_discussions.js.html +0 -95
  46. package/docs/forums_forum.js.html +0 -95
  47. package/docs/forums_forums.ts.html +0 -160
  48. package/docs/forums_posts.ts.html +0 -284
  49. package/docs/forums_threads.ts.html +0 -284
  50. package/docs/gamification_awards.js.html +0 -165
  51. package/docs/gamification_awards.ts.html +0 -195
  52. package/docs/gamification_gamification.js.html +0 -76
  53. package/docs/gamification_types.js.html +0 -80
  54. package/docs/global.html +0 -6019
  55. package/docs/index.html +0 -167
  56. package/docs/liveTesting.ts.html +0 -103
  57. package/docs/module-Accounts.html +0 -2283
  58. package/docs/module-Artist.html +0 -993
  59. package/docs/module-Awards.html +0 -836
  60. package/docs/module-Categories.html +0 -711
  61. package/docs/module-Config.html +0 -431
  62. package/docs/module-Content-Services-V2.html +0 -2998
  63. package/docs/module-ForumCategories.html +0 -687
  64. package/docs/module-ForumDiscussions.html +0 -370
  65. package/docs/module-Forums.html +0 -16599
  66. package/docs/module-Genre.html +0 -981
  67. package/docs/module-GuidedCourses.html +0 -108
  68. package/docs/module-Instructor.html +0 -929
  69. package/docs/module-Interests.html +0 -1066
  70. package/docs/module-LearningPaths.html +0 -2424
  71. package/docs/module-Onboarding.html +0 -882
  72. package/docs/module-Payments.html +0 -392
  73. package/docs/module-Permissions.html +0 -406
  74. package/docs/module-Playlists.html +0 -3030
  75. package/docs/module-ProgressRow.html +0 -108
  76. package/docs/module-Railcontent-Services.html +0 -5876
  77. package/docs/module-Sanity-Services.html +0 -8244
  78. package/docs/module-Sessions.html +0 -575
  79. package/docs/module-Threads.html +0 -1119
  80. package/docs/module-UserActivity.html +0 -4534
  81. package/docs/module-UserChat.html +0 -410
  82. package/docs/module-UserManagement.html +0 -1932
  83. package/docs/module-UserMemberships.html +0 -829
  84. package/docs/module-UserNotifications.html +0 -2595
  85. package/docs/module-UserProfile.html +0 -370
  86. package/docs/progress-row_method-card.js.html +0 -184
  87. package/docs/railcontent.js.html +0 -724
  88. package/docs/sanity.js.html +0 -2322
  89. package/docs/scripts/collapse.js +0 -39
  90. package/docs/scripts/commonNav.js +0 -28
  91. package/docs/scripts/linenumber.js +0 -25
  92. package/docs/scripts/nav.js +0 -12
  93. package/docs/scripts/polyfill.js +0 -4
  94. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  95. package/docs/scripts/prettify/lang-css.js +0 -2
  96. package/docs/scripts/prettify/prettify.js +0 -28
  97. package/docs/scripts/search.js +0 -99
  98. package/docs/styles/jsdoc.css +0 -776
  99. package/docs/styles/prettify.css +0 -80
  100. package/docs/userActivity.js.html +0 -1512
  101. package/docs/user_account.ts.html +0 -265
  102. package/docs/user_chat.js.html +0 -98
  103. package/docs/user_interests.js.html +0 -150
  104. package/docs/user_management.js.html +0 -258
  105. package/docs/user_memberships.js.html +0 -144
  106. package/docs/user_memberships.ts.html +0 -292
  107. package/docs/user_notifications.js.html +0 -374
  108. package/docs/user_onboarding.ts.html +0 -329
  109. package/docs/user_payments.ts.html +0 -146
  110. package/docs/user_permissions.js.html +0 -110
  111. package/docs/user_profile.js.html +0 -115
  112. package/docs/user_sessions.js.html +0 -170
  113. package/docs/user_types.js.html +0 -224
  114. package/docs/user_user-management-system.js.html +0 -79
@@ -1,724 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
-
5
- <meta charset="utf-8">
6
- <title>railcontent.js - Documentation</title>
7
-
8
-
9
- <script src="scripts/prettify/prettify.js"></script>
10
- <script src="scripts/prettify/lang-css.js"></script>
11
- <!--[if lt IE 9]>
12
- <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
- <![endif]-->
14
- <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
- <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
- <script src="scripts/nav.js" defer></script>
17
-
18
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
19
- </head>
20
- <body>
21
-
22
- <input type="checkbox" id="nav-trigger" class="nav-trigger" />
23
- <label for="nav-trigger" class="navicon-button x">
24
- <div class="navicon"></div>
25
- </label>
26
-
27
- <label for="nav-trigger" class="overlay"></label>
28
-
29
- <nav >
30
-
31
-
32
- <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-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#~fetchLearningPathProgressCheckLessons">fetchLearningPathProgressCheckLessons</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#~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#.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#.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#.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#.fetchTopLevelParentId">fetchTopLevelParentId</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
-
34
- </nav>
35
-
36
- <div id="main">
37
-
38
- <h1 class="page-title">railcontent.js</h1>
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
- <section>
47
- <article>
48
- <pre class="prettyprint source linenums"><code>/**
49
- * @module Railcontent-Services
50
- */
51
- import { globalConfig } from './config.js'
52
- import { fetchJSONHandler } from '../lib/httpHelper.js'
53
-
54
- /**
55
- * Exported functions that are excluded from index generation.
56
- *
57
- * @type {string[]}
58
- */
59
- const excludeFromGeneratedIndex = [
60
- 'fetchUserPermissionsData',
61
- ]
62
-
63
- /**
64
- * Fetches the completion status of a specific lesson for the current user.
65
- *
66
- * @param {string} content_id - The ID of the lesson content to check.
67
- * @returns {Promise&lt;Object|null>} - Returns the completion status object if found, otherwise null.
68
- * @example
69
- * fetchCurrentSongComplete('user123', 'lesson456', 'csrf-token')
70
- * .then(status => console.log(status))
71
- * .catch(error => console.error(error));
72
- */
73
- export async function fetchCompletedState(content_id) {
74
- const url = `/content/user_progress/${globalConfig.sessionConfig.userId}?content_ids[]=${content_id}`
75
-
76
- const headers = {
77
- 'Content-Type': 'application/json',
78
- Accept: 'application/json',
79
- 'X-CSRF-TOKEN': globalConfig.sessionConfig.token,
80
- }
81
-
82
- try {
83
- const response = await fetchAbsolute(url, { headers })
84
- const result = await response.json()
85
-
86
- if (result &amp;&amp; result[content_id]) {
87
- return result[content_id] // Return the correct object
88
- } else {
89
- return null // Handle unexpected structure
90
- }
91
- } catch (error) {
92
- console.error('Fetch error:', error)
93
- return null
94
- }
95
- }
96
-
97
- /**
98
- * Fetches the completion status for multiple songs for the current user.
99
- *
100
- * @param {Array&lt;string>} contentIds - An array of content IDs to check.
101
- * @returns {Promise&lt;Object|null>} - Returns an object containing completion statuses keyed by content ID, or null if an error occurs.
102
- * @example
103
- * fetchAllCompletedStates('user123', ['song456', 'song789'], 'csrf-token')
104
- * .then(statuses => console.log(statuses))
105
- * .catch(error => console.error(error));
106
- */
107
- export async function fetchAllCompletedStates(contentIds) {
108
- const url = `/content/user_progress/${globalConfig.sessionConfig.userId}?${contentIds.map((id) => `content_ids[]=${id}`).join('&amp;')}`
109
-
110
- const headers = {
111
- 'Content-Type': 'application/json',
112
- Accept: 'application/json',
113
- 'X-CSRF-TOKEN': globalConfig.sessionConfig.token,
114
- }
115
-
116
- try {
117
- const response = await fetchAbsolute(url, { headers })
118
- const result = await response.json()
119
- if (result) {
120
- return result
121
- } else {
122
- console.log('result not json')
123
- }
124
- } catch (error) {
125
- console.error('Fetch error:', error)
126
- return null
127
- }
128
- }
129
-
130
- /**
131
- * Fetches a list of songs that are currently in progress for the current user.
132
- *
133
- * @param {string} brand - The brand associated with the songs.
134
- * @returns {Promise&lt;Object|null>} - Returns an object containing in-progress songs if found, otherwise null.
135
- * @example
136
- * fetchSongsInProgress('drumeo')
137
- * .then(songs => console.log(songs))
138
- * .catch(error => console.error(error));
139
- */
140
- export async function fetchSongsInProgress(brand) {
141
- const url = `/content/in_progress/${globalConfig.sessionConfig.userId}?content_type=song&amp;brand=${brand}`
142
-
143
- const headers = {
144
- 'Content-Type': 'application/json',
145
- Accept: 'application/json',
146
- 'X-CSRF-TOKEN': globalConfig.sessionConfig.token,
147
- }
148
-
149
- try {
150
- const response = await fetchAbsolute(url, { headers })
151
- const result = await response.json()
152
- if (result) {
153
- //console.log('fetchSongsInProgress', result);
154
- return result
155
- } else {
156
- console.log('result not json')
157
- }
158
- } catch (error) {
159
- console.error('Fetch error:', error)
160
- return null
161
- }
162
- }
163
-
164
- /**
165
- * Fetches a list of content that is currently in progress for the current user.
166
- *
167
- * @param {string} type - The content type associated with the content.
168
- * @param {string} brand - The brand associated with the content.
169
- * @param {number} [params.limit=20] - The limit of results per page.
170
- * @param {number} [params.page=1] - The page number for pagination.
171
- * @returns {Promise&lt;Object|null>} - Returns an object containing in-progress content if found, otherwise null.
172
- * @example
173
- * fetchContentInProgress('song', 'drumeo')
174
- * .then(songs => console.log(songs))
175
- * .catch(error => console.error(error));
176
- */
177
- export async function fetchContentInProgress(type = 'all', brand, { page, limit } = {}) {
178
- let url
179
- const limitString = limit ? `&amp;limit=${limit}` : ''
180
- const pageString = page ? `&amp;page=${page}` : ''
181
-
182
- if (type === 'all') {
183
- url = `/content/in_progress/${globalConfig.sessionConfig.userId}?brand=${brand}${limitString}${pageString}`
184
- } else {
185
- url = `/content/in_progress/${globalConfig.sessionConfig.userId}?content_type=${type}&amp;brand=${brand}${limitString}${pageString}`
186
- }
187
- const headers = {
188
- 'Content-Type': 'application/json',
189
- Accept: 'application/json',
190
- 'X-CSRF-TOKEN': globalConfig.sessionConfig.token,
191
- }
192
- try {
193
- const response = await fetchAbsolute(url, { headers })
194
- const result = await response.json()
195
- if (result) {
196
- //console.log('contentInProgress', result);
197
- return result
198
- } else {
199
- console.log('result not json')
200
- }
201
- } catch (error) {
202
- console.error('Fetch error:', error)
203
- return null
204
- }
205
- }
206
-
207
- /**
208
- * Fetches a list of content that has been completed for the current user.
209
- *
210
- * @param {string} type - The content type associated with the content.
211
- * @param {string} brand - The brand associated with the content.
212
- * @param {number} [params.limit=20] - The limit of results per page.
213
- * @param {number} [params.page=1] - The page number for pagination.
214
- * @returns {Promise&lt;Object|null>} - Returns an object containing in-progress content if found, otherwise null.
215
- * @example
216
- * fetchCompletedContent('song', 'drumeo')
217
- * .then(songs => console.log(songs))
218
- * .catch(error => console.error(error));
219
- */
220
- export async function fetchCompletedContent(type = 'all', brand, { page, limit } = {}) {
221
- let url
222
- const limitString = limit ? `&amp;limit=${limit}` : ''
223
- const pageString = page ? `&amp;page=${page}` : ''
224
-
225
- if (type === 'all') {
226
- url = `/content/completed/${globalConfig.sessionConfig.userId}?brand=${brand}${limitString}${pageString}`
227
- } else {
228
- url = `/content/completed/${globalConfig.sessionConfig.userId}?content_type=${type}&amp;brand=${brand}${limitString}${pageString}`
229
- }
230
- const headers = {
231
- 'Content-Type': 'application/json',
232
- Accept: 'application/json',
233
- 'X-CSRF-TOKEN': globalConfig.sessionConfig.token,
234
- }
235
- try {
236
- const response = await fetchAbsolute(url, { headers })
237
- const result = await response.json()
238
- if (result) {
239
- //console.log('completed content', result);
240
- return result
241
- } else {
242
- console.log('result not json')
243
- }
244
- } catch (error) {
245
- console.error('Fetch error:', error)
246
- return null
247
- }
248
- }
249
-
250
- /**
251
- * Fetches user context data for a specific piece of content.
252
- *
253
- * @param {int} contentId - The content id.
254
- * @returns {Promise&lt;Object|null>} - Returns an object containing user context data if found, otherwise null.
255
- * @example
256
- * fetchContentPageUserData(406548)
257
- * .then(data => console.log(data))
258
- * .catch(error => console.error(error));
259
- */
260
- export async function fetchContentPageUserData(contentId) {
261
- let url = `/api/content/v1/${contentId}/user_data/${globalConfig.sessionConfig.userId}`
262
- const headers = {
263
- 'Content-Type': 'application/json',
264
- Accept: 'application/json',
265
- 'X-CSRF-TOKEN': globalConfig.sessionConfig.token,
266
- }
267
-
268
- try {
269
- const response = await fetchAbsolute(url, { headers })
270
- const result = await response.json()
271
- if (result) {
272
- console.log('fetchContentPageUserData', result)
273
- return result
274
- } else {
275
- console.log('result not json')
276
- }
277
- } catch (error) {
278
- console.error('Fetch error:', error)
279
- return null
280
- }
281
- }
282
-
283
- /**
284
- * Fetches the ID and Type of the piece of content that would be the next one for the user
285
- *
286
- * @param {int} contentId - The id of the parent (method, level, or course) piece of content.
287
- * @returns {Promise&lt;Object|null>} - Returns and Object with the id and type of the next piece of content if found, otherwise null.
288
- */
289
- export async function fetchNextContentDataForParent(contentId) {
290
- let url = `/content/${contentId}/next/${globalConfig.sessionConfig.userId}`
291
- const headers = {
292
- 'Content-Type': 'application/json',
293
- 'X-CSRF-TOKEN': globalConfig.sessionConfig.token,
294
- }
295
-
296
- try {
297
- const response = await fetchAbsolute(url, { headers })
298
- const result = await response.json()
299
- if (result) {
300
- // console.log('fetchNextContentDataForParent', result);
301
- return result.next
302
- } else {
303
- console.log('fetchNextContentDataForParent result not json')
304
- return null
305
- }
306
- } catch (error) {
307
- console.error('Fetch error:', error)
308
- return null
309
- }
310
- }
311
-
312
- export async function fetchUserPermissionsData() {
313
- let url = `/content/user/permissions`
314
- // in the case of an unauthorized user, we return empty permissions
315
- return (await fetchHandler(url, 'get')) ?? []
316
- }
317
-
318
- async function postDataHandler(url, data) {
319
- return fetchHandler(url, 'post', null, data)
320
- }
321
-
322
- async function patchDataHandler_depreciated(url, data) {
323
- throw Error('PATCH verb throws a CORS error on the FEW. Use PATCH instead')
324
- }
325
-
326
- async function putDataHandler(url, data) {
327
- return fetchHandler(url, 'put', null, data)
328
- }
329
-
330
- async function deleteDataHandler(url, data) {
331
- return fetchHandler(url, 'delete')
332
- }
333
-
334
- export async function fetchLikeCount(contendId) {
335
- const url = `/api/content/v1/content/like_count/${contendId}`
336
- return await fetchHandler(url)
337
- }
338
-
339
- export async function postPlaylistContentEngaged(playlistItemId) {
340
- let url = `/railtracker/v1/last-engaged/${playlistItemId}`
341
- return postDataHandler(url)
342
- }
343
-
344
- /**
345
- * Fetch the user's best award for this challenge
346
- *
347
- * @param contentId - railcontent id of the challenge
348
- * @returns {Promise&lt;any|null>} - streamed PDF
349
- */
350
- export async function fetchUserAward(contentId) {
351
- let url = `/challenges/download_award/${contentId}`
352
- return await fetchHandler(url, 'get')
353
- }
354
-
355
- /**
356
- * Fetch All Carousel Card Data
357
- *
358
- * @returns {Promise&lt;any|null>}
359
- */
360
- export async function fetchCarouselCardData(brand = null) {
361
- const brandParam = brand ? `?brand=${brand}` : ''
362
- let url = `/api/v2/content/carousel${brandParam}`
363
- return await fetchHandler(url, 'get')
364
- }
365
-
366
- /**
367
- * Fetch all completed badges for the user ordered by completion date descending
368
- *
369
- * @param {string|null} brand -
370
- * @returns {Promise&lt;any|null>}
371
- */
372
- export async function fetchUserBadges(brand = null) {
373
- let brandParam = brand ? `?brand=${brand}` : ''
374
- let url = `/challenges/user_badges/get${brandParam}`
375
- return await fetchHandler(url, 'get')
376
- }
377
-
378
- /**
379
- * Set a user's StudentView Flag
380
- *
381
- * @param {int|string} userId - id of the user (must be currently authenticated)
382
- * @param {bool} enable - truthy value to enable student view
383
- * @returns {Promise&lt;any|null>}
384
- */
385
- export async function setStudentViewForUser(userId, enable) {
386
- let url = `/user-management-system/user/update/${userId}`
387
- let data = { use_student_view: enable ? 1 : 0 }
388
- return await putDataHandler(url, data)
389
- }
390
-
391
- /**
392
- * Fetch the top comment for a given content
393
- *
394
- * @param {int} railcontentId - The railcontent id to fetch.
395
- * @returns {Promise&lt;Object|null>} - A promise that resolves to an comment object
396
- */
397
- export async function fetchTopComment(railcontentId) {
398
- const url = `/api/content/v1/${railcontentId}/comments?filter=top`
399
- return await fetchHandler(url)
400
- }
401
-
402
- /**
403
- *
404
- * @param {int} railcontentId
405
- * @param {int} page
406
- * @param {int} limit
407
- * @returns {Promise&lt;*|null>}
408
- */
409
- export async function fetchComments(railcontentId, page = 1, limit = 20) {
410
- const url = `/api/content/v1/${railcontentId}/comments?page=${page}&amp;limit=${limit}`
411
- return await fetchHandler(url)
412
- }
413
-
414
- /**
415
- *
416
- * @param {int} commentId
417
- * @param {int} page
418
- * @param {int} limit
419
- * @returns {Promise&lt;*|null>}
420
- */
421
- export async function fetchCommentRelies(commentId, page = 1, limit = 20) {
422
- const url = `/api/content/v1/comments/${commentId}/replies?page=${page}&amp;limit=${limit}`
423
- return await fetchHandler(url)
424
- }
425
-
426
- /**
427
- * @param {int} commentId
428
- * @returns {Promise&lt;*|null>}
429
- */
430
- export async function deleteComment(commentId) {
431
- const url = `/api/content/v1/comments/${commentId}`
432
- return await fetchHandler(url, 'DELETE')
433
- }
434
-
435
- /**
436
- * @param {int} commentId
437
- * @returns {Promise&lt;*|null>}
438
- */
439
- export async function restoreComment(commentId) {
440
- const url = `/api/content/v1/comments/restore/${commentId}`
441
- return await fetchHandler(url, 'POST')
442
- }
443
-
444
- /**
445
- * @param {int} commentId
446
- * @param {string} comment
447
- * @returns {Promise&lt;*|null>}
448
- */
449
- export async function replyToComment(commentId, comment) {
450
- const data = { comment: comment }
451
- const url = `/api/content/v1/comments/${commentId}/reply`
452
- return await postDataHandler(url, data)
453
- }
454
-
455
- /**
456
- * @param {int} railcontentId
457
- * @param {string} comment
458
- * @returns {Promise&lt;*|null>}
459
- */
460
- export async function createComment(railcontentId, comment) {
461
- const data = {
462
- comment: comment,
463
- content_id: railcontentId,
464
- }
465
- const url = `/api/content/v1/comments/store`
466
- return await postDataHandler(url, data)
467
- }
468
-
469
- /**
470
- * @param {int} commentId
471
- * @returns {Promise&lt;*|null>}
472
- */
473
- export async function assignModeratorToComment(commentId) {
474
- const url = `/api/content/v1/comments/${commentId}/assign_moderator`
475
- return await postDataHandler(url)
476
- }
477
-
478
- /**
479
- * @param {int} commentId
480
- * @returns {Promise&lt;*|null>}
481
- */
482
- export async function unassignModeratorToComment(commentId) {
483
- const url = `/api/content/v1/comments/${commentId}/unassign_moderator`
484
- return await postDataHandler(url)
485
- }
486
-
487
- /**
488
- * @param {int} commentId
489
- * @returns {Promise&lt;*|null>}
490
- */
491
- export async function likeComment(commentId) {
492
- const url = `/api/content/v1/comments/${commentId}/like`
493
- return await postDataHandler(url)
494
- }
495
-
496
- /**
497
- * @param {int} commentId
498
- * @returns {Promise&lt;*|null>}
499
- */
500
- export async function unlikeComment(commentId) {
501
- const url = `/api/content/v1/comments/${commentId}/like`
502
- return await deleteDataHandler(url)
503
- }
504
-
505
- /**
506
- * @param {int} commentId
507
- * @returns {Promise&lt;*|null>}
508
- */
509
- export async function closeComment(commentId) {
510
- const url = `/api/content/v1/comments/${commentId}`
511
- const data = {
512
- conversation_status: 'closed',
513
- }
514
- return await putDataHandler(url, data)
515
- }
516
-
517
- /**
518
- * @param {int} commentId
519
- * @returns {Promise&lt;*|null>}
520
- */
521
- export async function openComment(commentId) {
522
- const url = `/api/content/v1/comments/${commentId}`
523
- const data = {
524
- conversation_status: 'open',
525
- }
526
- return await putDataHandler(url, data)
527
- }
528
-
529
- /**
530
- * @param {int} commentId
531
- * @param {string} comment
532
- * @returns {Promise&lt;*|null>}
533
- */
534
- export async function editComment(commentId, comment) {
535
- const url = `/api/content/v1/comments/${commentId}`
536
- const data = {
537
- comment: comment,
538
- }
539
- return await putDataHandler(url, data)
540
- }
541
-
542
- /**
543
- * @param {int} commentId
544
- * @param {string} issue
545
- * @returns {Promise&lt;*|null>}
546
- */
547
- export async function reportComment(commentId, issue) {
548
- const url = `/api/content/v1/comments/${commentId}/report`
549
- const data = {
550
- issue: issue,
551
- }
552
- return await postDataHandler(url, data)
553
- }
554
-
555
- /**
556
- * Fetches a single comment by its ID.
557
- *
558
- * @param {number|string} commentId - The ID of the comment to fetch.
559
- * @returns {Promise&lt;Object|null>} - A promise that resolves to the comment object if found, otherwise null.
560
- *
561
- * @example
562
- * fetchComment(123)
563
- * .then(comment => console.log(comment))
564
- * .catch(error => console.error(error));
565
- */
566
- export async function fetchComment(commentId) {
567
- const url = `/api/content/v1/comments/${commentId}`
568
- const comment = await fetchHandler(url)
569
- return comment.parent ? comment.parent : comment
570
- }
571
-
572
- export async function fetchUserPractices(userId) {
573
- const url = `/api/user/practices/v1/practices?user_id=${userId}`
574
- const response = await fetchHandler(url)
575
- const { data } = response
576
- const userPractices = data
577
- if (!userPractices) {
578
- return {}
579
- }
580
-
581
- const formattedPractices = userPractices.reduce((acc, practice) => {
582
- if (!acc[practice.date]) {
583
- acc[practice.date] = []
584
- }
585
-
586
- acc[practice.date].push({
587
- id: practice.id,
588
- duration_seconds: practice.duration_seconds,
589
- })
590
-
591
- return acc
592
- }, {})
593
-
594
- return formattedPractices
595
- }
596
-
597
- export async function fetchUserPracticeMeta(day, userId) {
598
- const url = `/api/user/practices/v1/practices?user_id=${userId}&amp;date=${date}`
599
- return await fetchHandler(url, 'GET', null)
600
- }
601
-
602
- /**
603
- * Fetches user practice notes for a specific date.
604
- * @param {string} date - The date for which to fetch practice notes (format: YYYY-MM-DD).
605
- * @returns {Promise&lt;Object|null>} - A promise that resolves to an object containing the practice notes if found, otherwise null.
606
- *
607
- * @example
608
- * fetchUserPracticeNotes('2025-04-10')
609
- * .then(notes => console.log(notes))
610
- * .catch(error => console.error(error));
611
- */
612
- export async function fetchUserPracticeNotes(date) {
613
- const url = `/api/user/practices/v1/notes?date=${date}`
614
- return await fetchHandler(url, 'GET', null)
615
- }
616
-
617
- /**
618
- * Get the id and slug of last interacted child. Only valid for certain content types
619
- *
620
- * @async
621
- * @function fetchLastInteractedChild
622
- * @param {array} content_ids - Content ids of to get the last interacted child of
623
- *
624
- *
625
- * @returns {Promise&lt;Object>} - keyed object per valid content ids with the child
626
- *
627
- * @example
628
- * try {
629
- * const response = await fetchLastInteractedChild([191369, 410427]);
630
- * console.log('child id', response[191369].content_id)
631
- * console.log('child slug', response[191369].slug)
632
- * } catch (error) {
633
- * console.error('Failed to get children', error);
634
- * }
635
- */
636
- export async function fetchLastInteractedChild(content_ids) {
637
- const params = new URLSearchParams()
638
- content_ids.forEach((id) => params.append('content_ids[]', id))
639
- const url = `/api/content/v1/user/last_interacted_child?${params.toString()}`
640
- return await fetchHandler(url, 'GET', null)
641
- }
642
-
643
- /**
644
- * @typedef {Object} Activity
645
- * @property {string} id - Unique identifier for the activity.
646
- * @property {string} type - Type of activity (e.g., "lesson_completed").
647
- * @property {string} timestamp - ISO 8601 string of when the activity occurred.
648
- * @property {Object} meta - Additional metadata related to the activity.
649
- */
650
-
651
- /**
652
- * @typedef {Object} PaginatedActivities
653
- * @property {number} currentPage
654
- * @property {number} totalPages
655
- * @property {Activity[]} data
656
- */
657
-
658
- /**
659
- * Fetches a paginated list of recent user activities.
660
- * @param {Object} [params={}] - Optional parameters.
661
- * @param {number} [params.page=1] - The page number for pagination.
662
- * @param {number} [params.limit=10] - The number of results per page.
663
- * @param {string|null} [params.tabName=null] - Optional filter for activity type/tab.
664
- * @returns {Promise&lt;PaginatedActivities>} - A promise that resolves to a paginated object of user activities.
665
- *
666
- * @example
667
- * fetchRecentUserActivities({ page: 2, limit: 5 })
668
- * .then(activities => console.log(activities))
669
- * .catch(error => console.error(error));
670
- */
671
- export async function fetchRecentUserActivities({ page = 1, limit = 5, tabName = null } = {}) {
672
- let pageAndLimit = `?page=${page}&amp;limit=${limit}`
673
- let tabParam = tabName ? `&amp;tabName=${tabName}` : ''
674
- const url = `/api/user-management-system/v1/activities/all${pageAndLimit}${tabParam}`
675
- return await fetchHandler(url, 'GET', null)
676
- }
677
-
678
- function fetchAbsolute(url, params) {
679
- if (globalConfig.sessionConfig.authToken) {
680
- params.headers['Authorization'] = `Bearer ${globalConfig.sessionConfig.authToken}`
681
- }
682
-
683
- if (globalConfig.baseUrl) {
684
- if (url.startsWith('/')) {
685
- return fetch(globalConfig.baseUrl + url, params)
686
- }
687
- }
688
- return fetch(url, params)
689
- }
690
- export async function fetchHandler(url, method = 'get', dataVersion = null, body = null) {
691
- return fetchJSONHandler(
692
- url,
693
- globalConfig.sessionConfig.token,
694
- globalConfig.baseUrl,
695
- method,
696
- dataVersion,
697
- body
698
- )
699
- }
700
- </code></pre>
701
- </article>
702
- </section>
703
-
704
-
705
-
706
-
707
-
708
-
709
- </div>
710
-
711
- <br class="clear">
712
-
713
- <footer>
714
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Nov 28 2025 11:22:56 GMT-0800 (Pacific Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
715
- </footer>
716
-
717
- <script>prettyPrint();</script>
718
- <script src="scripts/polyfill.js"></script>
719
- <script src="scripts/linenumber.js"></script>
720
-
721
-
722
-
723
- </body>
724
- </html>