musora-content-services 2.0.6 → 2.0.8
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/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/src/index.d.ts +3 -4
- package/src/index.js +2 -4
- package/src/services/content-org/playlists-types.js +0 -2
- package/src/services/content-org/playlists.js +6 -7
- package/src/services/contentProgress.js +3 -3
- package/src/services/railcontent.js +8 -20
- package/src/services/user/permissions.js +1 -1
- package/src/services/user/sessions.js +2 -2
- package/test/contentProgress.test.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.0.8](https://github.com/railroadmedia/musora-content-services/compare/v2.0.7...v2.0.8) (2025-03-25)
|
|
6
|
+
|
|
7
|
+
### [2.0.7](https://github.com/railroadmedia/musora-content-services/compare/v2.0.6...v2.0.7) (2025-03-21)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **playlists:** config import ([#198](https://github.com/railroadmedia/musora-content-services/issues/198)) ([4965de4](https://github.com/railroadmedia/musora-content-services/commit/4965de4fc2d1cda8de022ff46a3e09caac9d351f))
|
|
13
|
+
|
|
5
14
|
### [2.0.6](https://github.com/railroadmedia/musora-content-services/compare/v2.0.5...v2.0.6) (2025-03-21)
|
|
6
15
|
|
|
7
16
|
### [2.0.5](https://github.com/railroadmedia/musora-content-services/compare/v2.0.4...v2.0.5) (2025-03-21)
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -96,7 +96,6 @@ import {
|
|
|
96
96
|
pinPlaylist,
|
|
97
97
|
playback,
|
|
98
98
|
postChallengesCommunityNotification,
|
|
99
|
-
postChallengesCompleteLesson,
|
|
100
99
|
postChallengesEnroll,
|
|
101
100
|
postChallengesEnrollmentNotification,
|
|
102
101
|
postChallengesHideCompletedBanner,
|
|
@@ -104,7 +103,7 @@ import {
|
|
|
104
103
|
postChallengesSetStartDate,
|
|
105
104
|
postChallengesSoloNotification,
|
|
106
105
|
postChallengesUnlock,
|
|
107
|
-
|
|
106
|
+
postContentComplete,
|
|
108
107
|
postContentLiked,
|
|
109
108
|
postContentReset,
|
|
110
109
|
postContentUnliked,
|
|
@@ -308,7 +307,7 @@ declare module 'musora-content-services' {
|
|
|
308
307
|
pinPlaylist,
|
|
309
308
|
playback,
|
|
310
309
|
postChallengesCommunityNotification,
|
|
311
|
-
|
|
310
|
+
|
|
312
311
|
postChallengesEnroll,
|
|
313
312
|
postChallengesEnrollmentNotification,
|
|
314
313
|
postChallengesHideCompletedBanner,
|
|
@@ -316,7 +315,7 @@ declare module 'musora-content-services' {
|
|
|
316
315
|
postChallengesSetStartDate,
|
|
317
316
|
postChallengesSoloNotification,
|
|
318
317
|
postChallengesUnlock,
|
|
319
|
-
|
|
318
|
+
postContentComplete,
|
|
320
319
|
postContentLiked,
|
|
321
320
|
postContentReset,
|
|
322
321
|
postContentUnliked,
|
package/src/index.js
CHANGED
|
@@ -96,7 +96,6 @@ import {
|
|
|
96
96
|
pinPlaylist,
|
|
97
97
|
playback,
|
|
98
98
|
postChallengesCommunityNotification,
|
|
99
|
-
postChallengesCompleteLesson,
|
|
100
99
|
postChallengesEnroll,
|
|
101
100
|
postChallengesEnrollmentNotification,
|
|
102
101
|
postChallengesHideCompletedBanner,
|
|
@@ -104,7 +103,7 @@ import {
|
|
|
104
103
|
postChallengesSetStartDate,
|
|
105
104
|
postChallengesSoloNotification,
|
|
106
105
|
postChallengesUnlock,
|
|
107
|
-
|
|
106
|
+
postContentComplete,
|
|
108
107
|
postContentLiked,
|
|
109
108
|
postContentReset,
|
|
110
109
|
postContentUnliked,
|
|
@@ -307,7 +306,6 @@ export {
|
|
|
307
306
|
pinPlaylist,
|
|
308
307
|
playback,
|
|
309
308
|
postChallengesCommunityNotification,
|
|
310
|
-
postChallengesCompleteLesson,
|
|
311
309
|
postChallengesEnroll,
|
|
312
310
|
postChallengesEnrollmentNotification,
|
|
313
311
|
postChallengesHideCompletedBanner,
|
|
@@ -315,7 +313,7 @@ export {
|
|
|
315
313
|
postChallengesSetStartDate,
|
|
316
314
|
postChallengesSoloNotification,
|
|
317
315
|
postChallengesUnlock,
|
|
318
|
-
|
|
316
|
+
postContentComplete,
|
|
319
317
|
postContentLiked,
|
|
320
318
|
postContentReset,
|
|
321
319
|
postContentUnliked,
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module Playlists
|
|
7
7
|
*/
|
|
8
|
-
import { fetchHandler } from '../railcontent'
|
|
9
|
-
import
|
|
10
|
-
import './playlists-types'
|
|
8
|
+
import { fetchHandler } from '../railcontent.js'
|
|
9
|
+
import './playlists-types.js'
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Exported functions that are excluded from index generation.
|
|
@@ -16,7 +15,7 @@ import './playlists-types'
|
|
|
16
15
|
*/
|
|
17
16
|
const excludeFromGeneratedIndex = []
|
|
18
17
|
|
|
19
|
-
const
|
|
18
|
+
const BASE_PATH = `/api/content-org`
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* Fetches user playlists for a specific brand.
|
|
@@ -49,7 +48,7 @@ export async function fetchUserPlaylists(
|
|
|
49
48
|
const content = content_id ? `&content_id=${content_id}` : ''
|
|
50
49
|
const categoryString =
|
|
51
50
|
categories && categories.length ? categories.map((cat) => `categories[]=${cat}`).join('&') : ''
|
|
52
|
-
url = `${
|
|
51
|
+
url = `${BASE_PATH}/v1/user/playlists?brand=${brand}${limitString}${pageString}${sortString}${searchFilter}${content}${categoryString ? `&${categoryString}` : ''}`
|
|
53
52
|
return await fetchHandler(url)
|
|
54
53
|
}
|
|
55
54
|
|
|
@@ -79,7 +78,7 @@ export async function fetchUserPlaylists(
|
|
|
79
78
|
* .catch(error => console.error('Error creating playlist:', error));
|
|
80
79
|
*/
|
|
81
80
|
export async function createPlaylist(playlistData) {
|
|
82
|
-
const url = `${
|
|
81
|
+
const url = `${BASE_PATH}/v1/user/playlists`
|
|
83
82
|
return await fetchHandler(url, 'POST', null, playlistData)
|
|
84
83
|
}
|
|
85
84
|
|
|
@@ -117,6 +116,6 @@ export async function createPlaylist(playlistData) {
|
|
|
117
116
|
* });
|
|
118
117
|
*/
|
|
119
118
|
export async function addItemToPlaylist(payload) {
|
|
120
|
-
const url = `${
|
|
119
|
+
const url = `${BASE_PATH}/v1/user/playlists/items`
|
|
121
120
|
return await fetchHandler(url, 'POST', null, payload)
|
|
122
121
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchContentProgress,
|
|
3
|
-
|
|
3
|
+
postContentComplete,
|
|
4
4
|
postContentReset,
|
|
5
5
|
postRecordWatchSession,
|
|
6
6
|
} from './railcontent.js'
|
|
@@ -124,7 +124,7 @@ export async function assignmentStatusCompleted(assignmentId, parentContentId) {
|
|
|
124
124
|
completeStatusInLocalContext(localContext, assignmentId, hierarchy)
|
|
125
125
|
},
|
|
126
126
|
async function () {
|
|
127
|
-
return
|
|
127
|
+
return postContentComplete(assignmentId)
|
|
128
128
|
}
|
|
129
129
|
)
|
|
130
130
|
}
|
|
@@ -136,7 +136,7 @@ export async function contentStatusCompleted(contentId) {
|
|
|
136
136
|
completeStatusInLocalContext(localContext, contentId, hierarchy)
|
|
137
137
|
},
|
|
138
138
|
async function () {
|
|
139
|
-
return
|
|
139
|
+
return postContentComplete(contentId)
|
|
140
140
|
}
|
|
141
141
|
)
|
|
142
142
|
}
|
|
@@ -16,7 +16,7 @@ const excludeFromGeneratedIndex = [
|
|
|
16
16
|
'postContentUnliked',
|
|
17
17
|
'postRecordWatchSession',
|
|
18
18
|
'postContentStarted',
|
|
19
|
-
'
|
|
19
|
+
'postContentComplete',
|
|
20
20
|
'postContentReset',
|
|
21
21
|
'fetchUserPermissionsData',
|
|
22
22
|
]
|
|
@@ -343,18 +343,18 @@ export async function fetchHandler(url, method = 'get', dataVersion = null, body
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
export async function fetchUserLikes(currentVersion) {
|
|
346
|
-
let url = `/content/user/likes
|
|
346
|
+
let url = `/api/content/v1/user/likes`
|
|
347
347
|
return fetchDataHandler(url, currentVersion)
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
export async function postContentLiked(contentId) {
|
|
351
|
-
let url = `/content/user/likes
|
|
351
|
+
let url = `/api/content/v1/user/likes/${contentId}`
|
|
352
352
|
return await postDataHandler(url)
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
export async function postContentUnliked(contentId) {
|
|
356
|
-
let url = `/content/user/likes
|
|
357
|
-
return await
|
|
356
|
+
let url = `/api/content/v1/user/likes/${contentId}`
|
|
357
|
+
return await deleteDataHandler(url)
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
export async function fetchContentProgress(currentVersion) {
|
|
@@ -596,18 +596,6 @@ export async function postChallengesSoloNotification(contentId) {
|
|
|
596
596
|
return await fetchHandler(url, 'post')
|
|
597
597
|
}
|
|
598
598
|
|
|
599
|
-
/**
|
|
600
|
-
* Complete the challenge lesson and update challenge progress
|
|
601
|
-
*
|
|
602
|
-
* @param {int|string} contentId - railcontent id of the challenge
|
|
603
|
-
* @returns {Promise<any|null>} - Modal data to display
|
|
604
|
-
*/
|
|
605
|
-
export async function postChallengesCompleteLesson(contentId) {
|
|
606
|
-
let url = `/challenges/complete_lesson/${contentId}`
|
|
607
|
-
await contentStatusCompleted(contentId)
|
|
608
|
-
return await fetchHandler(url, 'post')
|
|
609
|
-
}
|
|
610
|
-
|
|
611
599
|
/**
|
|
612
600
|
* Hide challenge completed award bannare
|
|
613
601
|
*
|
|
@@ -926,9 +914,9 @@ export async function fetchPlaylistItem(payload) {
|
|
|
926
914
|
return await fetchHandler(url)
|
|
927
915
|
}
|
|
928
916
|
|
|
929
|
-
export async function
|
|
930
|
-
let url = `/content/user/progress/complete`
|
|
931
|
-
return postDataHandler(url
|
|
917
|
+
export async function postContentComplete(contentId) {
|
|
918
|
+
let url = `/api/content/v1/user/progress/complete/${contentId}`
|
|
919
|
+
return postDataHandler(url)
|
|
932
920
|
}
|
|
933
921
|
|
|
934
922
|
export async function postContentReset(contentId) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { setLastUpdatedTime, wasLastUpdateOlderThanXSeconds } from '../../lib/lastUpdated.js'
|
|
5
5
|
import { fetchUserPermissionsData } from '../railcontent.js'
|
|
6
|
-
import './types'
|
|
6
|
+
import './types.js'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Exported functions that are excluded from index generation.
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
getAllStartedOrCompleted,
|
|
15
15
|
} from '../src/services/contentProgress'
|
|
16
16
|
import { initializeTestService } from './initializeTests'
|
|
17
|
-
import {getLessonContentRows,
|
|
17
|
+
import {getLessonContentRows, postContentComplete} from '../src'
|
|
18
18
|
import {fetchRecent} from "../src/services/sanity";
|
|
19
19
|
import {getRecent, getTabResults} from "../src/services/content";
|
|
20
20
|
import {individualLessonsTypes, playAlongLessonTypes, transcriptionsLessonTypes, tutorialsLessonTypes} from "../src/contentTypeConfig";
|
|
@@ -40,7 +40,7 @@ describe('contentProgressDataContext', function () {
|
|
|
40
40
|
let mock2 = jest.spyOn(railContentModule, 'postRecordWatchSession')
|
|
41
41
|
mock2.mockImplementation(() => JSON.parse(`{"version": ${serverVersion}}`))
|
|
42
42
|
|
|
43
|
-
let mock3 = jest.spyOn(railContentModule, '
|
|
43
|
+
let mock3 = jest.spyOn(railContentModule, 'postContentComplete')
|
|
44
44
|
mock3.mockImplementation(() => JSON.parse(`{"version": ${serverVersion}}`))
|
|
45
45
|
|
|
46
46
|
let mock4 = jest.spyOn(railContentModule, 'postContentReset')
|
|
@@ -120,7 +120,7 @@ describe('contentProgressDataContext', function () {
|
|
|
120
120
|
// });
|
|
121
121
|
|
|
122
122
|
// test('getAllCompletedWithUpdate', async () => {
|
|
123
|
-
// let mock2 = jest.spyOn(railContentModule, '
|
|
123
|
+
// let mock2 = jest.spyOn(railContentModule, 'postContentComplete');
|
|
124
124
|
// let serverVersion = 2;
|
|
125
125
|
// mock2.mockImplementation(() => JSON.parse(`{"version": ${serverVersion}}`));
|
|
126
126
|
//
|