musora-content-services 1.0.237 → 1.0.239

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 (66) hide show
  1. package/.github/workflows/node.js.yml +0 -0
  2. package/CHANGELOG.md +4 -0
  3. package/README.md +0 -0
  4. package/babel.config.js +0 -0
  5. package/docs/config.js.html +0 -0
  6. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  7. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  8. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  9. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  10. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  11. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  12. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  13. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  14. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  15. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -0
  16. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  17. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  18. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  19. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  20. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -0
  21. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  22. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  23. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  24. package/docs/index.html +0 -0
  25. package/docs/module-Config.html +0 -0
  26. package/docs/module-Railcontent-Services.html +0 -0
  27. package/docs/module-Sanity-Services.html +0 -0
  28. package/docs/railcontent.js.html +0 -0
  29. package/docs/sanity.js.html +0 -0
  30. package/docs/scripts/collapse.js +0 -0
  31. package/docs/scripts/commonNav.js +0 -0
  32. package/docs/scripts/linenumber.js +0 -0
  33. package/docs/scripts/nav.js +0 -0
  34. package/docs/scripts/polyfill.js +0 -0
  35. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -0
  36. package/docs/scripts/prettify/lang-css.js +0 -0
  37. package/docs/scripts/prettify/prettify.js +0 -0
  38. package/docs/scripts/search.js +0 -0
  39. package/docs/styles/jsdoc.css +0 -0
  40. package/docs/styles/prettify.css +0 -0
  41. package/jest.config.js +0 -0
  42. package/jsdoc.json +0 -0
  43. package/link_mcs.sh +0 -0
  44. package/package.json +1 -1
  45. package/src/contentMetaData.js +0 -0
  46. package/src/filterBuilder.js +0 -0
  47. package/src/index.d.ts +4 -0
  48. package/src/index.js +4 -0
  49. package/src/services/config.js +0 -0
  50. package/src/services/contentLikes.js +0 -0
  51. package/src/services/contentProgress.js +0 -0
  52. package/src/services/dataContext.js +0 -0
  53. package/src/services/lastUpdated.js +0 -0
  54. package/src/services/railcontent.js +11 -3
  55. package/src/services/sanity.js +22 -6
  56. package/src/services/userPermissions.js +0 -0
  57. package/test/contentLikes.test.js +0 -0
  58. package/test/contentProgress.test.js +0 -0
  59. package/test/initializeTests.js +0 -0
  60. package/test/lastUpdated.test.js +0 -0
  61. package/test/live/contentProgressLive.test.js +0 -0
  62. package/test/live/railcontentLive.test.js +0 -0
  63. package/test/localStorageMock.js +0 -0
  64. package/test/log.js +0 -0
  65. package/test/userPermissions.test.js +0 -0
  66. package/tools/generate-index.js +0 -0
File without changes
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.0.239](https://github.com/railroadmedia/musora-content-services/compare/v1.0.238...v1.0.239) (2024-12-16)
6
+
7
+ ### [1.0.238](https://github.com/railroadmedia/musora-content-services/compare/v1.0.237...v1.0.238) (2024-12-16)
8
+
5
9
  ### [1.0.237](https://github.com/railroadmedia/musora-content-services/compare/v1.0.236...v1.0.237) (2024-12-14)
6
10
 
7
11
  ### [1.0.236](https://github.com/railroadmedia/musora-content-services/compare/v1.0.235...v1.0.236) (2024-12-13)
package/README.md CHANGED
File without changes
package/babel.config.js CHANGED
File without changes
File without changes
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/docs/index.html CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
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/jest.config.js CHANGED
File without changes
package/jsdoc.json CHANGED
File without changes
package/link_mcs.sh CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.237",
3
+ "version": "1.0.239",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
File without changes
File without changes
package/src/index.d.ts CHANGED
@@ -63,6 +63,7 @@ import {
63
63
  fetchUserPlaylists,
64
64
  likePlaylist,
65
65
  pinPlaylist,
66
+ playback,
66
67
  postChallengesCommunityNotification,
67
68
  postChallengesCompleteLesson,
68
69
  postChallengesEnroll,
@@ -95,6 +96,7 @@ import {
95
96
  fetchByReference,
96
97
  fetchCatalogMetadata,
97
98
  fetchChallengeOverview,
99
+ fetchChatAndLiveEnvent,
98
100
  fetchChildren,
99
101
  fetchCoachLessons,
100
102
  fetchCommentModContentData,
@@ -172,6 +174,7 @@ declare module 'musora-content-services' {
172
174
  fetchChallengeMetadata,
173
175
  fetchChallengeOverview,
174
176
  fetchChallengeUserActiveChallenges,
177
+ fetchChatAndLiveEnvent,
175
178
  fetchChildren,
176
179
  fetchCoachLessons,
177
180
  fetchCommentModContentData,
@@ -246,6 +249,7 @@ declare module 'musora-content-services' {
246
249
  likeContent,
247
250
  likePlaylist,
248
251
  pinPlaylist,
252
+ playback,
249
253
  postChallengesCommunityNotification,
250
254
  postChallengesCompleteLesson,
251
255
  postChallengesEnroll,
package/src/index.js CHANGED
@@ -63,6 +63,7 @@ import {
63
63
  fetchUserPlaylists,
64
64
  likePlaylist,
65
65
  pinPlaylist,
66
+ playback,
66
67
  postChallengesCommunityNotification,
67
68
  postChallengesCompleteLesson,
68
69
  postChallengesEnroll,
@@ -95,6 +96,7 @@ import {
95
96
  fetchByReference,
96
97
  fetchCatalogMetadata,
97
98
  fetchChallengeOverview,
99
+ fetchChatAndLiveEnvent,
98
100
  fetchChildren,
99
101
  fetchCoachLessons,
100
102
  fetchCommentModContentData,
@@ -171,6 +173,7 @@ export {
171
173
  fetchChallengeMetadata,
172
174
  fetchChallengeOverview,
173
175
  fetchChallengeUserActiveChallenges,
176
+ fetchChatAndLiveEnvent,
174
177
  fetchChildren,
175
178
  fetchCoachLessons,
176
179
  fetchCommentModContentData,
@@ -245,6 +248,7 @@ export {
245
248
  likeContent,
246
249
  likePlaylist,
247
250
  pinPlaylist,
251
+ playback,
248
252
  postChallengesCommunityNotification,
249
253
  postChallengesCompleteLesson,
250
254
  postChallengesEnroll,
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -617,14 +617,17 @@ export async function postChallengesHideCompletedBanner(contentId) {
617
617
  * .then(playlists => console.log(playlists))
618
618
  * .catch(error => console.error(error));
619
619
  */
620
- export async function fetchUserPlaylists(brand, {page, limit, sort, searchTerm, content_id} = {}) {
620
+ export async function fetchUserPlaylists(brand, {page, limit, sort, searchTerm, content_id, categories} = {}) {
621
621
  let url;
622
622
  const limitString = limit ? `&limit=${limit}` : '';
623
623
  const pageString = page ? `&page=${page}` : '';
624
624
  const sortString = sort ? `&sort=${sort}` : '';
625
625
  const searchFilter = searchTerm ? `&term=${searchTerm}` : '';
626
626
  const content = content_id ? `&content_id=${content_id}` : '';
627
- url = `/playlists/all?brand=${brand}${limitString}${pageString}${sortString}${searchFilter}${content}`;
627
+ const categoryString = categories && categories.length
628
+ ? categories.map(cat => `categories[]=${cat}`).join('&')
629
+ : '';
630
+ url = `/playlists/all?brand=${brand}${limitString}${pageString}${sortString}${searchFilter}${content}${categoryString ? `&${categoryString}` : ''}`;
628
631
  return await fetchHandler(url);
629
632
  }
630
633
 
@@ -1159,6 +1162,11 @@ export async function reportPlaylist(playlistId, {issue} = {}) {
1159
1162
  return await fetchHandler(url, "PUT");
1160
1163
  }
1161
1164
 
1165
+ export async function playback(playlistId) {
1166
+ const url = `/playlists/play/${playlistId}`;
1167
+ return await fetchHandler(url, "GET");
1168
+ }
1169
+
1162
1170
  function fetchAbsolute(url, params) {
1163
1171
  if (globalConfig.railcontentConfig.baseUrl) {
1164
1172
  if (url.startsWith('/')) {
@@ -1166,4 +1174,4 @@ function fetchAbsolute(url, params) {
1166
1174
  }
1167
1175
  }
1168
1176
  return fetch(url, params);
1169
- }
1177
+ }
@@ -28,7 +28,8 @@ import {
28
28
  fetchCompletedChallenges,
29
29
  fetchCurrentSongComplete,
30
30
  fetchOwnedChallenges,
31
- fetchNextContentDataForParent
31
+ fetchNextContentDataForParent,
32
+ fetchHandler,
32
33
  } from './railcontent.js';
33
34
  import {arrayToStringRepresentation, FilterBuilder} from "../filterBuilder";
34
35
  import {fetchUserPermissions} from "./userPermissions";
@@ -1117,7 +1118,7 @@ export async function fetchNextPreviousLesson(railcontentId) {
1117
1118
  */
1118
1119
  export async function jumpToContinueContent(railcontentId) {
1119
1120
  const nextContent = await fetchNextContentDataForParent(railcontentId);
1120
- if (!nextContent) {
1121
+ if (!nextContent || !nextContent.id) {
1121
1122
  return null;
1122
1123
  }
1123
1124
  let next = await fetchByRailContentId(nextContent.id, nextContent.type);
@@ -1303,17 +1304,20 @@ export async function fetchLiveEvent(brand) {
1303
1304
  default:
1304
1305
  break;
1305
1306
  }
1306
- let dateTemp = new Date();
1307
- dateTemp.setDate(dateTemp.getDate() - 1);
1307
+ let startDateTemp = new Date();
1308
+ let endDateTemp = new Date();
1309
+ startDateTemp= new Date (startDateTemp.setMinutes(startDateTemp.getMinutes() + 15));
1310
+ endDateTemp = new Date(endDateTemp.setMinutes(endDateTemp.getMinutes() - 15));
1308
1311
 
1309
1312
  // See LiveStreamEventService.getCurrentOrNextLiveEvent for some nice complicated logic which I don't think is actually importart
1310
1313
  // this has some +- on times
1311
1314
  // But this query just finds the first scheduled event (sorted by start_time) that ends after now()
1312
- const query = `*[status == 'scheduled' && defined(live_event_start_time) && published_on > '${getSanityDate(dateTemp, false)}' && live_event_end_time >= '${getSanityDate(new Date(), false)}']{
1315
+ const query = `*[status == 'scheduled' && defined(live_event_start_time) && live_event_start_time <= '${getSanityDate(startDateTemp, false)}' && live_event_end_time >= '${getSanityDate(endDateTemp, false)}']{
1313
1316
  'slug': slug.current,
1314
1317
  'id': railcontent_id,
1315
1318
  live_event_start_time,
1316
1319
  live_event_end_time,
1320
+ live_event_youtube_id,
1317
1321
  railcontent_id,
1318
1322
  published_on,
1319
1323
  'event_coach_url' : instructor[0]->web_url_path,
@@ -1326,7 +1330,7 @@ export async function fetchLiveEvent(brand) {
1326
1330
  },
1327
1331
  'videoId': coalesce(live_event_youtube_id, video.external_id),
1328
1332
  } | order(live_event_start_time)[0...1]`;
1329
- return await fetchSanity(query, false);
1333
+ return await fetchSanity(query, false, {processNeedAccess: false});
1330
1334
  }
1331
1335
 
1332
1336
  /**
@@ -1929,6 +1933,17 @@ export async function fetchMetadata(brand, type) {
1929
1933
  return processedData ? processedData : {};
1930
1934
  }
1931
1935
 
1936
+ export async function fetchChatAndLiveEnvent(brand, forcedId = null) {
1937
+ const liveEvent = (forcedId !== null) ? await fetchByRailContentIds([forcedId]): [await fetchLiveEvent(brand)];
1938
+ if (liveEvent.length === 0 || (liveEvent.length === 1 && liveEvent[0] === undefined)) {
1939
+ return null;
1940
+ }
1941
+ let url = `/content/live-chat?brand=${brand}`;
1942
+ const chatData = await fetchHandler(url);
1943
+ const mergedData = { ...chatData, ...liveEvent[0] };
1944
+ return mergedData;
1945
+ }
1946
+
1932
1947
 
1933
1948
  //Helper Functions
1934
1949
  function arrayJoinWithQuotes(array, delimiter = ',') {
@@ -2044,6 +2059,7 @@ function getFilterOptions(option, commonFilter, contentType, brand) {
2044
2059
  case "difficulty":
2045
2060
  filterGroq = `
2046
2061
  "difficulty": [
2062
+ {"type": "All", "count": count(*[${commonFilter} && difficulty_string == "All"])},
2047
2063
  {"type": "Introductory", "count": count(*[${commonFilter} && difficulty_string == "Introductory"])},
2048
2064
  {"type": "Beginner", "count": count(*[${commonFilter} && difficulty_string == "Beginner"])},
2049
2065
  {"type": "Intermediate", "count": count(*[${commonFilter} && difficulty_string == "Intermediate" ])},
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