musora-content-services 1.2.1 → 1.2.2

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 CHANGED
@@ -2,6 +2,8 @@
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
+ ### [1.2.2](https://github.com/railroadmedia/musora-content-services/compare/v1.2.1...v1.2.2) (2025-01-16)
6
+
5
7
  ### [1.2.1](https://github.com/railroadmedia/musora-content-services/compare/v1.2.0...v1.2.1) (2025-01-16)
6
8
 
7
9
  ## [1.2.0](https://github.com/railroadmedia/musora-content-services/compare/v1.0.233...v1.2.0) (2025-01-14)
package/README.md CHANGED
File without changes
package/babel.config.cjs CHANGED
File without changes
File without changes
package/docs/index.html CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/jest.config.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "build-index": "node tools/generate-index.js",
8
+ "build-index": "node tools/generate-index.cjs",
9
9
  "release": "standard-version",
10
10
  "doc": "jsdoc -c jsdoc.json --verbose",
11
11
  "test": "jest --setupFiles dotenv/config"
File without changes
package/src/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /*** This file was generated automatically. To recreate, please run `npm run build-index`. ***/
2
2
 
3
3
  import {
4
- globalConfig,
5
4
  initializeService
6
5
  } from './services/config.js';
7
6
 
@@ -79,6 +78,7 @@ import {
79
78
  postContentUnliked,
80
79
  postRecordWatchSession,
81
80
  reportPlaylist,
81
+ setStudentViewForUser,
82
82
  unpinPlaylist,
83
83
  updatePlaylist,
84
84
  updatePlaylistItem
@@ -243,7 +243,6 @@ declare module 'musora-content-services' {
243
243
  getProgressStateByIds,
244
244
  getResumeTimeSeconds,
245
245
  getSortOrder,
246
- globalConfig,
247
246
  initializeService,
248
247
  isContentLiked,
249
248
  jumpToContinueContent,
@@ -268,6 +267,7 @@ declare module 'musora-content-services' {
268
267
  recordWatchSession,
269
268
  reportPlaylist,
270
269
  reset,
270
+ setStudentViewForUser,
271
271
  unlikeContent,
272
272
  unpinPlaylist,
273
273
  updatePlaylist,
package/src/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  /*** This file was generated automatically. To recreate, please run `npm run build-index`. ***/
2
2
 
3
3
  import {
4
- globalConfig,
5
4
  initializeService
6
5
  } from './services/config.js';
7
6
 
@@ -79,6 +78,7 @@ import {
79
78
  postContentUnliked,
80
79
  postRecordWatchSession,
81
80
  reportPlaylist,
81
+ setStudentViewForUser,
82
82
  unpinPlaylist,
83
83
  updatePlaylist,
84
84
  updatePlaylistItem
@@ -242,7 +242,6 @@ export {
242
242
  getProgressStateByIds,
243
243
  getResumeTimeSeconds,
244
244
  getSortOrder,
245
- globalConfig,
246
245
  initializeService,
247
246
  isContentLiked,
248
247
  jumpToContinueContent,
@@ -267,6 +266,7 @@ export {
267
266
  recordWatchSession,
268
267
  reportPlaylist,
269
268
  reset,
269
+ setStudentViewForUser,
270
270
  unlikeContent,
271
271
  unpinPlaylist,
272
272
  updatePlaylist,
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -289,6 +289,9 @@ async function postDataHandler(url, data) {
289
289
  return fetchHandler(url, 'post', null, data);
290
290
  }
291
291
 
292
+ async function patchDataHandler(url, data) {
293
+ return fetchHandler(url, 'patch', null, data);}
294
+
292
295
  export async function fetchHandler(url, method = "get", dataVersion = null, body = null) {
293
296
  let headers = {
294
297
  'Content-Type': 'application/json',
@@ -1178,6 +1181,19 @@ export async function playback(playlistId) {
1178
1181
  return await fetchHandler(url, "GET");
1179
1182
  }
1180
1183
 
1184
+ /**
1185
+ * Set a user's StudentView Flag
1186
+ *
1187
+ * @param {int|string} userId - id of the user (must be currently authenticated)
1188
+ * @param {bool} enable - truthsy value to enable student view
1189
+ * @returns {Promise<any|null>}
1190
+ */
1191
+ export async function setStudentViewForUser(userId, enable) {
1192
+ let url = `/user-management-system/user/update/${userId}`;
1193
+ let data = {'use_student_view' : enable ? 1 : 0};
1194
+ return await patchDataHandler(url, data);
1195
+ }
1196
+
1181
1197
  function fetchAbsolute(url, params) {
1182
1198
  if (globalConfig.railcontentConfig.authToken) {
1183
1199
  params.headers['Authorization'] = `Bearer ${globalConfig.railcontentConfig.authToken}`;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/test/log.js CHANGED
File without changes
File without changes
File without changes