musora-content-services 1.3.18 → 1.3.20

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,10 @@
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.3.20](https://github.com/railroadmedia/musora-content-services/compare/v1.3.19...v1.3.20) (2025-03-21)
6
+
7
+ ### [1.3.19](https://github.com/railroadmedia/musora-content-services/compare/v1.3.18...v1.3.19) (2025-03-18)
8
+
5
9
  ### [1.3.18](https://github.com/railroadmedia/musora-content-services/compare/v1.3.17...v1.3.18) (2025-03-18)
6
10
 
7
11
  ### [1.3.17](https://github.com/railroadmedia/musora-content-services/compare/v1.3.16...v1.3.17) (2025-03-17)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.3.18",
3
+ "version": "1.3.20",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.d.ts CHANGED
@@ -38,17 +38,12 @@ import {
38
38
 
39
39
  import {
40
40
  addItemToPlaylist,
41
- assignModeratorToComment,
42
- closeComment,
43
41
  countAssignmentsAndLessons,
44
- createComment,
45
42
  createPlaylist,
46
- deleteComment,
47
43
  deletePlaylist,
48
44
  deletePlaylistItem,
49
45
  deletePlaylistLike,
50
46
  duplicatePlaylist,
51
- editComment,
52
47
  fetchAllCompletedStates,
53
48
  fetchCarouselCardData,
54
49
  fetchChallengeIndexMetadata,
@@ -78,9 +73,7 @@ import {
78
73
  fetchUserLikes,
79
74
  fetchUserPermissionsData,
80
75
  fetchUserPlaylists,
81
- likeComment,
82
76
  likePlaylist,
83
- openComment,
84
77
  pinPlaylist,
85
78
  playback,
86
79
  postChallengesCommunityNotification,
@@ -97,11 +90,8 @@ import {
97
90
  postContentReset,
98
91
  postContentUnliked,
99
92
  postRecordWatchSession,
100
- replyToComment,
101
93
  reportPlaylist,
102
94
  setStudentViewForUser,
103
- unassignModeratorToComment,
104
- unlikeComment,
105
95
  unpinPlaylist,
106
96
  updatePlaylist,
107
97
  updatePlaylistItem
@@ -165,21 +155,16 @@ import {
165
155
  declare module 'musora-content-services' {
166
156
  export {
167
157
  addItemToPlaylist,
168
- assignModeratorToComment,
169
158
  assignmentStatusCompleted,
170
159
  assignmentStatusReset,
171
- closeComment,
172
160
  contentStatusCompleted,
173
161
  contentStatusReset,
174
162
  countAssignmentsAndLessons,
175
- createComment,
176
163
  createPlaylist,
177
- deleteComment,
178
164
  deletePlaylist,
179
165
  deletePlaylistItem,
180
166
  deletePlaylistLike,
181
167
  duplicatePlaylist,
182
- editComment,
183
168
  fetchAll,
184
169
  fetchAllCompletedStates,
185
170
  fetchAllFilterOptions,
@@ -262,10 +247,8 @@ declare module 'musora-content-services' {
262
247
  initializeService,
263
248
  isContentLiked,
264
249
  jumpToContinueContent,
265
- likeComment,
266
250
  likeContent,
267
251
  likePlaylist,
268
- openComment,
269
252
  pinPlaylist,
270
253
  playback,
271
254
  postChallengesCommunityNotification,
@@ -285,14 +268,11 @@ declare module 'musora-content-services' {
285
268
  rankCategories,
286
269
  rankItems,
287
270
  recordWatchSession,
288
- replyToComment,
289
271
  reportPlaylist,
290
272
  reset,
291
273
  setLastUpdatedTime,
292
274
  setStudentViewForUser,
293
275
  similarItems,
294
- unassignModeratorToComment,
295
- unlikeComment,
296
276
  unlikeContent,
297
277
  unpinPlaylist,
298
278
  updatePlaylist,
package/src/index.js CHANGED
@@ -38,17 +38,12 @@ import {
38
38
 
39
39
  import {
40
40
  addItemToPlaylist,
41
- assignModeratorToComment,
42
- closeComment,
43
41
  countAssignmentsAndLessons,
44
- createComment,
45
42
  createPlaylist,
46
- deleteComment,
47
43
  deletePlaylist,
48
44
  deletePlaylistItem,
49
45
  deletePlaylistLike,
50
46
  duplicatePlaylist,
51
- editComment,
52
47
  fetchAllCompletedStates,
53
48
  fetchCarouselCardData,
54
49
  fetchChallengeIndexMetadata,
@@ -78,9 +73,7 @@ import {
78
73
  fetchUserLikes,
79
74
  fetchUserPermissionsData,
80
75
  fetchUserPlaylists,
81
- likeComment,
82
76
  likePlaylist,
83
- openComment,
84
77
  pinPlaylist,
85
78
  playback,
86
79
  postChallengesCommunityNotification,
@@ -97,11 +90,8 @@ import {
97
90
  postContentReset,
98
91
  postContentUnliked,
99
92
  postRecordWatchSession,
100
- replyToComment,
101
93
  reportPlaylist,
102
94
  setStudentViewForUser,
103
- unassignModeratorToComment,
104
- unlikeComment,
105
95
  unpinPlaylist,
106
96
  updatePlaylist,
107
97
  updatePlaylistItem
@@ -164,21 +154,16 @@ import {
164
154
 
165
155
  export {
166
156
  addItemToPlaylist,
167
- assignModeratorToComment,
168
157
  assignmentStatusCompleted,
169
158
  assignmentStatusReset,
170
- closeComment,
171
159
  contentStatusCompleted,
172
160
  contentStatusReset,
173
161
  countAssignmentsAndLessons,
174
- createComment,
175
162
  createPlaylist,
176
- deleteComment,
177
163
  deletePlaylist,
178
164
  deletePlaylistItem,
179
165
  deletePlaylistLike,
180
166
  duplicatePlaylist,
181
- editComment,
182
167
  fetchAll,
183
168
  fetchAllCompletedStates,
184
169
  fetchAllFilterOptions,
@@ -261,10 +246,8 @@ export {
261
246
  initializeService,
262
247
  isContentLiked,
263
248
  jumpToContinueContent,
264
- likeComment,
265
249
  likeContent,
266
250
  likePlaylist,
267
- openComment,
268
251
  pinPlaylist,
269
252
  playback,
270
253
  postChallengesCommunityNotification,
@@ -284,14 +267,11 @@ export {
284
267
  rankCategories,
285
268
  rankItems,
286
269
  recordWatchSession,
287
- replyToComment,
288
270
  reportPlaylist,
289
271
  reset,
290
272
  setLastUpdatedTime,
291
273
  setStudentViewForUser,
292
274
  similarItems,
293
- unassignModeratorToComment,
294
- unlikeComment,
295
275
  unlikeContent,
296
276
  unpinPlaylist,
297
277
  updatePlaylist,
@@ -290,10 +290,6 @@ async function patchDataHandler(url, data) {
290
290
  return fetchHandler(url, 'patch', null, data)
291
291
  }
292
292
 
293
- async function deleteDataHandler(url, data) {
294
- return fetchHandler(url, 'delete')
295
- }
296
-
297
293
  export async function fetchHandler(url, method = 'get', dataVersion = null, body = null) {
298
294
  let headers = {
299
295
  'Content-Type': 'application/json',
@@ -496,8 +492,10 @@ export async function fetchChallengeUserActiveChallenges(brand = null) {
496
492
  * @returns {Promise<any|null>}
497
493
  */
498
494
  export async function fetchCarouselCardData(brand = null) {
499
- const brandParam = brand ? `?brand=${brand}` : ''
500
- let url = `/api/v2/content/carousel${brandParam}`
495
+ const urlParams = []
496
+ if (brand) urlParams.push(`brand=${brand}`)
497
+ if (globalConfig.sanityConfig.perspective === 'previewDrafts') urlParams.push(`previewSanity`)
498
+ const url = `/api/v2/content/carousel${urlParams.length ? `?${urlParams.join('&')}` : ''}`
501
499
  return await fetchHandler(url, 'get')
502
500
  }
503
501
 
@@ -1202,7 +1200,6 @@ export async function setStudentViewForUser(userId, enable) {
1202
1200
  return await patchDataHandler(url, data)
1203
1201
  }
1204
1202
 
1205
-
1206
1203
  /**
1207
1204
  * Fetch the top comment for a given content
1208
1205
  *
@@ -1210,28 +1207,27 @@ export async function setStudentViewForUser(userId, enable) {
1210
1207
  * @returns {Promise<Object|null>} - A promise that resolves to an comment object
1211
1208
  */
1212
1209
  export async function fetchTopComment(railcontentId) {
1213
- const url = `/api/content/v1/comments/content/${railcontentId}/top`
1210
+ const url = `/api/content/v1/comments/${railcontentId}/top`
1214
1211
  return await fetchHandler(url)
1215
1212
  }
1216
1213
 
1217
-
1218
1214
  /**
1219
1215
  *
1220
- * @param {int} railcontentId
1221
- * @param {int} page
1222
- * @param {int} limit
1216
+ * @param railcontentId
1217
+ * @param page
1218
+ * @param limit
1223
1219
  * @returns {Promise<*|null>}
1224
1220
  */
1225
1221
  export async function fetchComments(railcontentId, page = 1, limit = 20) {
1226
- const url = `/api/content/v1/comments/content/${railcontentId}/all?page=${page}&limit=${limit}`
1222
+ const url = `/api/content/v1/comments/${railcontentId}/all?page=${page}&limit=${limit}`
1227
1223
  return await fetchHandler(url)
1228
1224
  }
1229
1225
 
1230
1226
  /**
1231
1227
  *
1232
- * @param {int} commentId
1233
- * @param {int} page
1234
- * @param {int} limit
1228
+ * @param commentId
1229
+ * @param page
1230
+ * @param limit
1235
1231
  * @returns {Promise<*|null>}
1236
1232
  */
1237
1233
  export async function fetchCommentRelies(commentId, page = 1, limit = 20) {
@@ -1239,115 +1235,6 @@ export async function fetchCommentRelies(commentId, page = 1, limit = 20) {
1239
1235
  return await fetchHandler(url)
1240
1236
  }
1241
1237
 
1242
- /**
1243
- * @param {int} commentId
1244
- * @returns {Promise<*|null>}
1245
- */
1246
- export async function deleteComment(commentId) {
1247
- const url = `/api/content/v1/comments/${commentId}`
1248
- return await fetchHandler(url, "DELETE")
1249
- }
1250
-
1251
- /**
1252
- * @param {int} commentId
1253
- * @param {string} comment
1254
- * @returns {Promise<*|null>}
1255
- */
1256
- export async function replyToComment(commentId, comment) {
1257
- const data = {'comment' : comment}
1258
- const url = `/api/content/v1/comments/${commentId}/reply`
1259
- return await postDataHandler(url, data)
1260
- }
1261
-
1262
- /**
1263
- * @param {int} railcontentId
1264
- * @param {string} comment
1265
- * @returns {Promise<*|null>}
1266
- */
1267
- export async function createComment(railcontentId, comment) {
1268
- const data = {
1269
- 'comment' : comment,
1270
- 'content_id' : railcontentId
1271
- }
1272
- const url = `/api/content/v1/comments/store`
1273
- return await postDataHandler(url, data)
1274
- }
1275
-
1276
- /**
1277
- * @param {int} commentId
1278
- * @returns {Promise<*|null>}
1279
- */
1280
- export async function assignModeratorToComment(commentId) {
1281
- const url = `/api/content/v1/comments/${commentId}/assign_moderator`
1282
- return await postDataHandler(url)
1283
- }
1284
-
1285
- /**
1286
- * @param {int} commentId
1287
- * @returns {Promise<*|null>}
1288
- */
1289
- export async function unassignModeratorToComment(commentId) {
1290
- const url = `/api/content/v1/comments/${commentId}/unassign_moderator`
1291
- return await postDataHandler(url)
1292
- }
1293
-
1294
- /**
1295
- * @param {int} commentId
1296
- * @returns {Promise<*|null>}
1297
- */
1298
- export async function likeComment(commentId) {
1299
- const url = `/api/content/v1/comments/${commentId}/like`
1300
- return await postDataHandler(url)
1301
- }
1302
-
1303
- /**
1304
- * @param {int} commentId
1305
- * @returns {Promise<*|null>}
1306
- */
1307
- export async function unlikeComment(commentId) {
1308
- const url = `/api/content/v1/comments/${commentId}/like`
1309
- return await deleteDataHandler(url)
1310
- }
1311
-
1312
- /**
1313
- * @param {int} commentId
1314
- * @returns {Promise<*|null>}
1315
- */
1316
- export async function closeComment(commentId) {
1317
- const url = `/api/content/v1/comments/${commentId}`
1318
- const data = {
1319
- 'conversation_status' : 'closed'
1320
- }
1321
- return await patchDataHandler(url, data)
1322
- }
1323
-
1324
- /**
1325
- * @param {int} commentId
1326
- * @returns {Promise<*|null>}
1327
- */
1328
- export async function openComment(commentId) {
1329
- const url = `/api/content/v1/comments/${commentId}`
1330
- const data = {
1331
- 'conversation_status' : 'open'
1332
- }
1333
- return await patchDataHandler(url, data)
1334
- }
1335
-
1336
- /**
1337
- * @param {int} commentId
1338
- * @param {string} comment
1339
- * @returns {Promise<*|null>}
1340
- */
1341
- export async function editComment(commentId, comment) {
1342
- const url = `/api/content/v1/comments/${commentId}`
1343
- const data = {
1344
- 'comment' : comment
1345
- }
1346
- return await patchDataHandler(url, data)
1347
- }
1348
-
1349
-
1350
-
1351
1238
  function fetchAbsolute(url, params) {
1352
1239
  if (globalConfig.railcontentConfig.authToken) {
1353
1240
  params.headers['Authorization'] = `Bearer ${globalConfig.railcontentConfig.authToken}`