musora-content-services 1.0.173 → 1.0.174
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/.github/workflows/node.js.yml +0 -0
- package/CHANGELOG.md +2 -0
- package/README.md +0 -0
- package/babel.config.js +0 -0
- package/docs/config.js.html +4 -3
- 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/index.html +2 -2
- package/docs/module-Config.html +28 -4
- package/docs/module-Railcontent-Services.html +340 -79
- package/docs/module-Sanity-Services.html +403 -47
- package/docs/railcontent.js.html +58 -48
- package/docs/sanity.js.html +650 -560
- 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/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 -0
- package/src/index.js +2 -0
- package/src/services/config.js +0 -0
- package/src/services/contentLikes.js +0 -0
- package/src/services/contentProgress.js +19 -0
- package/src/services/dataContext.js +0 -0
- package/src/services/lastUpdated.js +0 -0
- package/src/services/sanity.js +26 -2
- package/src/services/userPermissions.js +0 -0
- package/test/contentLikes.test.js +0 -0
- package/test/contentProgress.test.js +11 -1
- package/test/initializeTests.js +0 -0
- package/test/lastUpdated.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/test/sanityQueryService.test.js +30 -0
- package/test/userPermissions.test.js +0 -0
- package/tools/generate-index.js +0 -0
package/docs/railcontent.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-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-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.addItemToPlaylist">addItemToPlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.countAssignmentsAndLessons">countAssignmentsAndLessons</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.createPlaylist">createPlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.deletePlaylist">deletePlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.deletePlaylistItem">deletePlaylistItem</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.deletePlaylistLike">deletePlaylistLike</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.duplicatePlaylist">duplicatePlaylist</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#.fetchChallengeIndexMetadata">fetchChallengeIndexMetadata</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeLessonData">fetchChallengeLessonData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeMetadata">fetchChallengeMetadata</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.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#.fetchPlaylist">fetchPlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchPlaylistItem">fetchPlaylistItem</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchPlaylistItems">fetchPlaylistItems</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#.fetchUserAward">fetchUserAward</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserChallengeProgress">fetchUserChallengeProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserPlaylists">fetchUserPlaylists</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.likePlaylist">likePlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesCommunityNotification">postChallengesCommunityNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><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-Railcontent-Services.html">Railcontent-Services</a><ul class='methods'><li data-type='method'><a href="module-Railcontent-Services.html#.addItemToPlaylist">addItemToPlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.countAssignmentsAndLessons">countAssignmentsAndLessons</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.createPlaylist">createPlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.deletePlaylist">deletePlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.deletePlaylistItem">deletePlaylistItem</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.deletePlaylistLike">deletePlaylistLike</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.duplicatePlaylist">duplicatePlaylist</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#.fetchChallengeIndexMetadata">fetchChallengeIndexMetadata</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeLessonData">fetchChallengeLessonData</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeMetadata">fetchChallengeMetadata</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchChallengeUserActiveChallenges">fetchChallengeUserActiveChallenges</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.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#.fetchPlaylist">fetchPlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchPlaylistItem">fetchPlaylistItem</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchPlaylistItems">fetchPlaylistItems</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#.fetchUserAward">fetchUserAward</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserBadges">fetchUserBadges</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserChallengeProgress">fetchUserChallengeProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchUserPlaylists">fetchUserPlaylists</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.likePlaylist">likePlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesCommunityNotification">postChallengesCommunityNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesCompleteLesson">postChallengesCompleteLesson</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesEnroll">postChallengesEnroll</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesEnrollmentNotification">postChallengesEnrollmentNotification</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesLeave">postChallengesLeave</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesSetStartDate">postChallengesSetStartDate</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.postChallengesUnlock">postChallengesUnlock</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.updatePlaylist">updatePlaylist</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.updatePlaylistItem">updatePlaylistItem</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#.fetchAllSongs">fetchAllSongs</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#.fetchAssignments">fetchAssignments</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#.fetchCatalogMetadata">fetchCatalogMetadata</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChallengeOverview">fetchChallengeOverview</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchChildren">fetchChildren</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#.fetchCommentModContentData">fetchCommentModContentData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchCourseOverview">fetchCourseOverview</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#.fetchLessonContent">fetchLessonContent</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#.fetchMethodNextLesson">fetchMethodNextLesson</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#.fetchMethods">fetchMethods</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#.fetchPackAll">fetchPackAll</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchPackChildren">fetchPackChildren</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#.fetchParentByRailContentId">fetchParentByRailContentId</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchParentForDownload">fetchParentForDownload</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedLessons">fetchRelatedLessons</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchRelatedMethodLessons">fetchRelatedMethodLessons</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#.fetchSanity">fetchSanity</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchScheduledReleases">fetchScheduledReleases</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchShowsData">fetchShowsData</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongArtistCount">fetchSongArtistCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongById">fetchSongById</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongCount">fetchSongCount</a></li><li data-type='method'><a href="module-Sanity-Services.html#.fetchSongFilterOptions">fetchSongFilterOptions</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#.fetchWorkouts">fetchWorkouts</a></li></ul></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -63,7 +63,8 @@ const excludeFromGeneratedIndex = [
|
|
|
63
63
|
'postRecordWatchSession',
|
|
64
64
|
'postContentStarted',
|
|
65
65
|
'postContentCompleted',
|
|
66
|
-
'postContentReset'
|
|
66
|
+
'postContentReset',
|
|
67
|
+
'fetchUserPermissionsData'
|
|
67
68
|
];
|
|
68
69
|
|
|
69
70
|
|
|
@@ -283,10 +284,10 @@ export async function fetchContentPageUserData(contentId) {
|
|
|
283
284
|
}
|
|
284
285
|
}
|
|
285
286
|
|
|
286
|
-
export async function
|
|
287
|
-
let url = `/content/
|
|
287
|
+
export async function fetchUserPermissionsData() {
|
|
288
|
+
let url = `/content/user/permissions`;
|
|
288
289
|
// in the case of an unauthorized user, we return empty permissions
|
|
289
|
-
return fetchHandler(url, 'get') ?? [];
|
|
290
|
+
return await fetchHandler(url, 'get') ?? [];
|
|
290
291
|
}
|
|
291
292
|
|
|
292
293
|
async function fetchDataHandler(url, dataVersion, method = "get") {
|
|
@@ -294,7 +295,7 @@ async function fetchDataHandler(url, dataVersion, method = "get") {
|
|
|
294
295
|
}
|
|
295
296
|
|
|
296
297
|
async function postDataHandler(url, data) {
|
|
297
|
-
return fetchHandler(url, 'post', data);
|
|
298
|
+
return fetchHandler(url, 'post', null, data);
|
|
298
299
|
}
|
|
299
300
|
|
|
300
301
|
export async function fetchHandler(url, method = "get", dataVersion = null, body = null) {
|
|
@@ -302,6 +303,9 @@ export async function fetchHandler(url, method = "get", dataVersion = null, body
|
|
|
302
303
|
'Content-Type': 'application/json',
|
|
303
304
|
'X-CSRF-TOKEN': globalConfig.railcontentConfig.token,
|
|
304
305
|
};
|
|
306
|
+
if (globalConfig.railcontentConfig.authToken) {
|
|
307
|
+
headers['Authorization'] = `Bearer ${globalConfig.railcontentConfig.authToken}`;
|
|
308
|
+
}
|
|
305
309
|
if (dataVersion) headers['Data-Version'] = dataVersion;
|
|
306
310
|
const options = {
|
|
307
311
|
method,
|
|
@@ -312,11 +316,11 @@ export async function fetchHandler(url, method = "get", dataVersion = null, body
|
|
|
312
316
|
}
|
|
313
317
|
try {
|
|
314
318
|
const response = await fetchAbsolute(url, options);
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
return result;
|
|
319
|
+
if (response.ok) {
|
|
320
|
+
return await response.json();
|
|
318
321
|
} else {
|
|
319
|
-
console.
|
|
322
|
+
console.error(`Fetch error: ${method} ${url} ${response.status} ${response.statusText}`);
|
|
323
|
+
console.log(response);
|
|
320
324
|
}
|
|
321
325
|
} catch (error) {
|
|
322
326
|
console.error('Fetch error:', error);
|
|
@@ -344,26 +348,15 @@ export async function fetchContentProgress(currentVersion) {
|
|
|
344
348
|
return fetchDataHandler(url, currentVersion);
|
|
345
349
|
}
|
|
346
350
|
|
|
347
|
-
export async function postRecordWatchSession({
|
|
348
|
-
|
|
349
|
-
mediaType,
|
|
350
|
-
mediaCategory,
|
|
351
|
-
watchPosition,
|
|
352
|
-
totalDuration,
|
|
353
|
-
sessionToken,
|
|
354
|
-
brand,
|
|
355
|
-
contentId = null
|
|
356
|
-
}) {
|
|
357
|
-
let url = `/railtracker/media-playback-session`;
|
|
351
|
+
export async function postRecordWatchSession(contentId, mediaTypeId, mediaLengthSeconds, currentSeconds, secondsPlayed, sessionId) {
|
|
352
|
+
let url = `/railtracker/v2/media-playback-session`;
|
|
358
353
|
return postDataHandler(url, {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
brand,
|
|
366
|
-
contentId
|
|
354
|
+
"content_id": contentId,
|
|
355
|
+
"media_type_id": mediaTypeId,
|
|
356
|
+
"media_length_seconds": mediaLengthSeconds,
|
|
357
|
+
"current_second": currentSeconds,
|
|
358
|
+
"seconds_played": secondsPlayed,
|
|
359
|
+
"session_id": sessionId
|
|
367
360
|
});
|
|
368
361
|
}
|
|
369
362
|
|
|
@@ -412,7 +405,7 @@ export async function fetchUserAward(contentId) {
|
|
|
412
405
|
}
|
|
413
406
|
|
|
414
407
|
/**
|
|
415
|
-
* Get
|
|
408
|
+
* Get challenge duration, user progress, and status for the list of challenges
|
|
416
409
|
* Intended to be used on the index page for challenges
|
|
417
410
|
*
|
|
418
411
|
* @param {array} contentIds - arary of railcontent ids of the challenges
|
|
@@ -424,6 +417,29 @@ export async function fetchChallengeIndexMetadata(contentIds) {
|
|
|
424
417
|
return await fetchHandler(url, 'get');
|
|
425
418
|
}
|
|
426
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Get active brand challenges for the authorized user
|
|
422
|
+
*
|
|
423
|
+
* @returns {Promise<any|null>}
|
|
424
|
+
*/
|
|
425
|
+
export async function fetchChallengeUserActiveChallenges(brand = null) {
|
|
426
|
+
let brandParam = brand ? `?brand=${brand}` : '';
|
|
427
|
+
let url = `/challenges/user_active_challenges/get${brandParam}`;
|
|
428
|
+
return await fetchHandler(url, 'get');
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Fetch all completed badges for the user ordered by completion date descending
|
|
433
|
+
*
|
|
434
|
+
* @param {string|null} brand -
|
|
435
|
+
* @returns {Promise<any|null>}
|
|
436
|
+
*/
|
|
437
|
+
export async function fetchUserBadges(brand = null) {
|
|
438
|
+
let brandParam = brand ? `?brand=${brand}` : '';
|
|
439
|
+
let url = `/challenges/user_badges/get${brandParam}`;
|
|
440
|
+
return await fetchHandler(url, 'get');
|
|
441
|
+
}
|
|
442
|
+
|
|
427
443
|
/**
|
|
428
444
|
* Enroll a user in a challenge and set the start date of the challenge to the provided day.
|
|
429
445
|
* Clears any existing progress data for this challenge
|
|
@@ -501,7 +517,7 @@ export async function postChallengesCommunityNotification(contentId) {
|
|
|
501
517
|
* @param {int|string} contentId - railcontent id of the challenge
|
|
502
518
|
* @returns {Promise<any|null>} - Modal data to display
|
|
503
519
|
*/
|
|
504
|
-
export async function
|
|
520
|
+
export async function postChallengesCompleteLesson(contentId) {
|
|
505
521
|
let url = `/challenges/complete_lesson/${contentId}`;
|
|
506
522
|
return await fetchHandler(url, 'post');
|
|
507
523
|
}
|
|
@@ -528,8 +544,8 @@ export async function fetchUserPlaylists(brand, {page, limit, sort, searchTerm}
|
|
|
528
544
|
let url;
|
|
529
545
|
const limitString = limit ? `&limit=${limit}` : '';
|
|
530
546
|
const pageString = page ? `&page=${page}` : '';
|
|
531
|
-
const sortString = sort ? `&sort=${sort}
|
|
532
|
-
const searchFilter = searchTerm ? `&term=${searchTerm}
|
|
547
|
+
const sortString = sort ? `&sort=${sort}` : '';
|
|
548
|
+
const searchFilter = searchTerm ? `&term=${searchTerm}` : '';
|
|
533
549
|
url = `/playlists/all?brand=${brand}${limitString}${pageString}${sortString}${searchFilter}`;
|
|
534
550
|
return await fetchHandler(url);
|
|
535
551
|
}
|
|
@@ -564,7 +580,7 @@ export async function fetchUserPlaylists(brand, {page, limit, sort, searchTerm}
|
|
|
564
580
|
*/
|
|
565
581
|
export async function duplicatePlaylist(playlistId, playlistData) {
|
|
566
582
|
let url = `/playlists/duplicate/${playlistId}`;
|
|
567
|
-
return await fetchHandler(url, "post",null, playlistData);
|
|
583
|
+
return await fetchHandler(url, "post", null, playlistData);
|
|
568
584
|
}
|
|
569
585
|
|
|
570
586
|
/**
|
|
@@ -690,7 +706,7 @@ export async function createPlaylist(playlistData) {
|
|
|
690
706
|
*/
|
|
691
707
|
export async function likePlaylist(playlistId) {
|
|
692
708
|
const url = `/playlists/like`;
|
|
693
|
-
const payload = {
|
|
709
|
+
const payload = {playlist_id: playlistId};
|
|
694
710
|
return await fetchHandler(url, "PUT", null, payload);
|
|
695
711
|
}
|
|
696
712
|
|
|
@@ -717,7 +733,7 @@ export async function likePlaylist(playlistId) {
|
|
|
717
733
|
*/
|
|
718
734
|
export async function deletePlaylistLike(playlistId) {
|
|
719
735
|
const url = `/playlists/like`;
|
|
720
|
-
const payload = {
|
|
736
|
+
const payload = {playlist_id: playlistId};
|
|
721
737
|
return await fetchHandler(url, "DELETE", null, payload);
|
|
722
738
|
}
|
|
723
739
|
|
|
@@ -870,19 +886,14 @@ export async function fetchPlaylistItem(payload) {
|
|
|
870
886
|
return await fetchHandler(url);
|
|
871
887
|
}
|
|
872
888
|
|
|
873
|
-
export async function postContentStarted(contentId) {
|
|
874
|
-
let url = `/content/${contentId}/started`;
|
|
875
|
-
return postDataHandler(url);
|
|
876
|
-
}
|
|
877
|
-
|
|
878
889
|
export async function postContentCompleted(contentId) {
|
|
879
|
-
let url = `/content
|
|
880
|
-
return postDataHandler(url);
|
|
890
|
+
let url = `/content/user/progress/complete`;
|
|
891
|
+
return postDataHandler(url, {"contentId": contentId});
|
|
881
892
|
}
|
|
882
893
|
|
|
883
894
|
export async function postContentReset(contentId) {
|
|
884
|
-
let url = `/content
|
|
885
|
-
return postDataHandler(url);
|
|
895
|
+
let url = `/content/user/progress/reset`;
|
|
896
|
+
return postDataHandler(url, {"contentId": contentId});
|
|
886
897
|
}
|
|
887
898
|
|
|
888
899
|
/**
|
|
@@ -968,8 +979,7 @@ function fetchAbsolute(url, params) {
|
|
|
968
979
|
}
|
|
969
980
|
}
|
|
970
981
|
return fetch(url, params);
|
|
971
|
-
}
|
|
972
|
-
</code></pre>
|
|
982
|
+
}</code></pre>
|
|
973
983
|
</article>
|
|
974
984
|
</section>
|
|
975
985
|
|
|
@@ -983,7 +993,7 @@ function fetchAbsolute(url, params) {
|
|
|
983
993
|
<br class="clear">
|
|
984
994
|
|
|
985
995
|
<footer>
|
|
986
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
996
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Nov 14 2024 23:44:16 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
987
997
|
</footer>
|
|
988
998
|
|
|
989
999
|
<script>prettyPrint();</script>
|