musora-content-services 1.0.102 → 1.0.105

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.
@@ -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#.fetchAllCompletedStates">fetchAllCompletedStates</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#.fetchSongsInProgress">fetchSongsInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchVimeoData">fetchVimeoData</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#.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#.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#.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#.fetchParentByRailContentId">fetchParentByRailContentId</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#.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#.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>
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#.fetchAllCompletedStates">fetchAllCompletedStates</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#.fetchSongsInProgress">fetchSongsInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchVimeoData">fetchVimeoData</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#.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#.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#.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#.fetchParentByRailContentId">fetchParentByRailContentId</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#.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
 
@@ -197,15 +197,15 @@ export async function fetchSongsInProgress(brand) {
197
197
  * .then(songs => console.log(songs))
198
198
  * .catch(error => console.error(error));
199
199
  */
200
- export async function fetchContentInProgress(type="all", brand, {
201
- page = 1,
202
- limit = 10,
203
- } = {}) {
200
+ export async function fetchContentInProgress(type="all", brand, { page, limit } = {}) {
204
201
  let url;
202
+ const limitString = limit ? `&amp;limit=${limit}` : '';
203
+ const pageString = page ? `&amp;page=${page}` : '';
204
+
205
205
  if(type === "all") {
206
- url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?brand=${brand}&amp;limit=${limit}&amp;page=${page}`;
206
+ url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?brand=${brand}${limitString}${pageString}`;
207
207
  } else {
208
- url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?content_type=${type}&amp;brand=${brand}&amp;limit=${limit}&amp;page=${page}`;
208
+ url = `/content/in_progress/${globalConfig.railcontentConfig.userId}?content_type=${type}&amp;brand=${brand}${limitString}${pageString}`;
209
209
  }
210
210
  const headers = {
211
211
  'Content-Type': 'application/json',
@@ -239,15 +239,15 @@ export async function fetchContentInProgress(type="all", brand, {
239
239
  * .then(songs => console.log(songs))
240
240
  * .catch(error => console.error(error));
241
241
  */
242
- export async function fetchCompletedContent(type="all", brand, {
243
- page = 1,
244
- limit = 10,
245
- } = {}) {
242
+ export async function fetchCompletedContent(type="all", brand, { page, limit } = {}) {
246
243
  let url;
244
+ const limitString = limit ? `&amp;limit=${limit}` : '';
245
+ const pageString = page ? `&amp;page=${page}` : '';
246
+
247
247
  if(type === "all") {
248
- url = `/content/completed/${globalConfig.railcontentConfig.userId}?brand=${brand}&amp;limit=${limit}&amp;page=${page}`;
248
+ url = `/content/completed/${globalConfig.railcontentConfig.userId}?brand=${brand}${limitString}${pageString}`;
249
249
  } else {
250
- url = `/content/completed/${globalConfig.railcontentConfig.userId}?content_type=${type}&amp;brand=${brand}&amp;limit=${limit}&amp;page=${page}`;
250
+ url = `/content/completed/${globalConfig.railcontentConfig.userId}?content_type=${type}&amp;brand=${brand}${limitString}${pageString}`;
251
251
  }
252
252
  const headers = {
253
253
  'Content-Type': 'application/json',
@@ -308,6 +308,56 @@ function fetchAbsolute(url, params) {
308
308
  }
309
309
  }
310
310
  return fetch(url, params);
311
+ }
312
+
313
+ export async function fetchUserContext() {
314
+ let url = `/content/user_data_all`;
315
+ const headers = {
316
+ 'Content-Type': 'application/json',
317
+ 'X-CSRF-TOKEN': globalConfig.railcontentConfig.token
318
+ };
319
+ try {
320
+ const response = await fetch(url, {headers});
321
+ const result = await response.json();
322
+ if (result) {
323
+ console.log('fetchUserContext', result);
324
+ return result;
325
+ } else {
326
+ console.log('result not json');
327
+ }
328
+ } catch (error) {
329
+ console.error('Fetch error:', error);
330
+ return null;
331
+ }
332
+ }
333
+
334
+ export async function fetchHandler(url, method = "get") {
335
+ const headers = {
336
+ 'Content-Type': 'application/json',
337
+ 'X-CSRF-TOKEN': globalConfig.railcontentConfig.token
338
+ };
339
+ try {
340
+ const response = await fetch(url, {method, headers});
341
+ const result = await response.json();
342
+ if (result) {
343
+ return result;
344
+ } else {
345
+ console.log('result not json');
346
+ }
347
+ } catch (error) {
348
+ console.error('Fetch error:', error);
349
+ return null;
350
+ }
351
+ }
352
+
353
+ export async function fetchLikeContent(contentId) {
354
+ let url = `/content/${contentId}/like`;
355
+ return await fetchHandler(url, "post");
356
+ }
357
+
358
+ export async function fetchUnlikeContent(contentId) {
359
+ let url = `/content/${contentId}/unlike`;
360
+ return await fetchHandler(url, "post");
311
361
  }</code></pre>
312
362
  </article>
313
363
  </section>
@@ -322,7 +372,7 @@ function fetchAbsolute(url, params) {
322
372
  <br class="clear">
323
373
 
324
374
  <footer>
325
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Sep 12 2024 18:08:47 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
375
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Sep 19 2024 14:19:19 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
326
376
  </footer>
327
377
 
328
378
  <script>prettyPrint();</script>
@@ -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#.fetchAllCompletedStates">fetchAllCompletedStates</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#.fetchSongsInProgress">fetchSongsInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchVimeoData">fetchVimeoData</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#.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#.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#.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#.fetchParentByRailContentId">fetchParentByRailContentId</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#.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#.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>
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#.fetchAllCompletedStates">fetchAllCompletedStates</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#.fetchSongsInProgress">fetchSongsInProgress</a></li><li data-type='method'><a href="module-Railcontent-Services.html#.fetchVimeoData">fetchVimeoData</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#.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#.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#.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#.fetchParentByRailContentId">fetchParentByRailContentId</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#.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
 
@@ -56,7 +56,9 @@ import {
56
56
  contentTypeConfig,
57
57
  DEFAULT_FIELDS,
58
58
  getFieldsForContentType,
59
- filtersToGroq
59
+ filtersToGroq,
60
+ getUpcomingEventsTypes,
61
+ getNewReleasesTypes,
60
62
  } from "../contentTypeConfig";
61
63
  import {globalConfig} from "./config";
62
64
 
@@ -135,6 +137,7 @@ export async function fetchRelatedSongs(brand, songId) {
135
137
  "url": web_url_path,
136
138
  "published_on": published_on,
137
139
  status,
140
+ "image": thumbnail.asset->url,
138
141
  "fields": [
139
142
  {
140
143
  "key": "title",
@@ -153,10 +156,6 @@ export async function fetchRelatedSongs(brand, songId) {
153
156
  "value": soundslice[0].soundslice_length_in_second
154
157
  }
155
158
  ],
156
- "data": [{
157
- "key": "thumbnail_url",
158
- "value": thumbnail.asset->url
159
- }]
160
159
  }[0...10]),
161
160
  ...(*[_type == "song" &amp;&amp; brand == "${brand}" &amp;&amp; railcontent_id != ${songId} &amp;&amp; references(^.genre[]->_id)]{
162
161
  "type": _type,
@@ -285,7 +284,7 @@ export async function fetchSongCount(brand) {
285
284
  * @example
286
285
  * fetchWorkouts('drumeo')
287
286
  * .then(workouts => console.log(workouts))
288
- * .catch(error => console.error(error));
287
+ * .catch(error => console.error(error));
289
288
  */
290
289
  export async function fetchWorkouts(brand) {
291
290
  const fields = getFieldsForContentType('workout');
@@ -301,14 +300,8 @@ export async function fetchWorkouts(brand) {
301
300
  * @returns {Promise&lt;Object|null>} - The fetched new releases data or null if not found.
302
301
  */
303
302
  export async function fetchNewReleases(brand, { page = 1, limit = 10, sort="-published_on" } = {}) {
304
- const newTypes = {
305
- 'drumeo': ["drum-fest-international-2022", "spotlight", "the-history-of-electronic-drums", "backstage-secrets", "quick-tips", "question-and-answer", "student-collaborations", "live-streams", "live", "podcasts", "solos", "boot-camps", "gear-guides", "performances", "in-rhythm", "challenges", "on-the-road", "diy-drum-experiments", "rhythmic-adventures-of-captain-carson", "study-the-greats", "rhythms-from-another-planet", "tama-drums", "paiste-cymbals", "behind-the-scenes", "exploring-beats", "sonor-drums", "course", "play-along", "student-focus", "coach-stream", "learning-path-level", "unit", "quick-tips", "live", "question-and-answer", "student-review", "boot-camps", "song", "chords-and-scales", "pack", "podcasts", "workout", "challenge", "challenge-part"],
306
- 'pianote': ["student-review", "student-reviews", "question-and-answer", "course", "play-along", "student-focus", "coach-stream", "learning-path-level", "unit", "quick-tips", "live", "question-and-answer", "student-review", "boot-camps", "song", "chords-and-scales", "pack", "podcasts", "workout", "challenge", "challenge-part"],
307
- 'guitareo': ["student-review", "student-reviews", "question-and-answer", "archives", "recording", "course", "play-along", "student-focus", "coach-stream", "learning-path-level", "unit", "quick-tips", "live", "question-and-answer", "student-review", "boot-camps", "song", "chords-and-scales", "pack", "podcasts", "workout", "challenge", "challenge-part"],
308
- 'singeo': ["student-review", "student-reviews", "question-and-answer", "course", "play-along", "student-focus", "coach-stream", "learning-path-level", "unit", "quick-tips", "live", "question-and-answer", "student-review", "boot-camps", "song", "chords-and-scales", "pack", "podcasts", "workout", "challenge", "challenge-part"],
309
- 'default': ["student-review", "student-reviews", "question-and-answer", "course", "play-along", "student-focus", "coach-stream", "learning-path-level", "unit", "quick-tips", "live", "question-and-answer", "student-review", "boot-camps", "song", "chords-and-scales", "pack", "podcasts", "workout", "challenge", "challenge-part"]
310
- };
311
- const typesString = arrayJoinWithQuotes(newTypes[brand] ?? newTypes['default']);
303
+ const newTypes = getNewReleasesTypes(brand);
304
+ const typesString = arrayJoinWithQuotes(newTypes);
312
305
  const start = (page - 1) * limit;
313
306
  const end = start + limit;
314
307
  const sortOrder = getSortOrder(sort);
@@ -344,15 +337,8 @@ export async function fetchNewReleases(brand, { page = 1, limit = 10, sort="-pub
344
337
  * .catch(error => console.error(error));
345
338
  */
346
339
  export async function fetchUpcomingEvents(brand, { page = 1, limit = 10 } = {}) {
347
- const baseLiveTypes = ["student-review", "student-reviews", "student-focus", "coach-stream", "live", "question-and-answer", "student-review", "boot-camps", "recording", "pack-bundle-lesson"];
348
- const liveTypes = {
349
- 'drumeo': [...baseLiveTypes, "drum-fest-international-2022", "spotlight", "the-history-of-electronic-drums", "backstage-secrets", "quick-tips", "student-collaborations", "live-streams", "podcasts", "solos", "gear-guides", "performances", "in-rhythm", "challenges", "on-the-road", "diy-drum-experiments", "rhythmic-adventures-of-captain-carson", "study-the-greats", "rhythms-from-another-planet", "tama-drums", "paiste-cymbals", "behind-the-scenes", "exploring-beats", "sonor-drums"],
350
- 'pianote': baseLiveTypes,
351
- 'guitareo': [...baseLiveTypes, "archives"],
352
- 'singeo': baseLiveTypes,
353
- 'default': baseLiveTypes
354
- };
355
- const typesString = arrayJoinWithQuotes(liveTypes[brand] ?? liveTypes['default']);
340
+ const liveTypes = getUpcomingEventsTypes(brand);
341
+ const typesString = arrayJoinWithQuotes(liveTypes);
356
342
  const now = getSanityDate(new Date());
357
343
  const start = (page - 1) * limit;
358
344
  const end = start + limit;
@@ -372,6 +358,45 @@ export async function fetchUpcomingEvents(brand, { page = 1, limit = 10 } = {})
372
358
  return fetchSanity(query, true);
373
359
  }
374
360
 
361
+ /**
362
+ * Fetch scheduled releases for a specific brand.
363
+ *
364
+ * @param {string} brand - The brand for which to fetch scheduled releasess.
365
+ * @returns {Promise&lt;Object|null>} - A promise that resolves to an array of scheduled release objects or null if not found.
366
+ *
367
+ * @example
368
+ * fetchScheduledReleases('drumeo', {
369
+ * page: 2,
370
+ * limit: 20,
371
+ * })
372
+ * .then(content => console.log(content))
373
+ * .catch(error => console.error(error));
374
+ */
375
+ export async function fetchScheduledReleases(brand, { page = 1, limit = 10 }) {
376
+ const upcomingTypes = getUpcomingEventsTypes(brand);
377
+ const newTypes = getNewReleasesTypes(brand);
378
+
379
+ const scheduledTypes = merge(upcomingTypes, newTypes)
380
+ const typesString = arrayJoinWithQuotes(scheduledTypes);
381
+ const now = getSanityDate(new Date());
382
+ const start = (page - 1) * limit;
383
+ const end = start + limit;
384
+ const query = `*[_type in [${typesString}] &amp;&amp; brand == '${brand}' &amp;&amp; status in ['published','scheduled'] &amp;&amp; published_on > '${now}']{
385
+ "id": railcontent_id,
386
+ title,
387
+ "image": thumbnail.asset->url,
388
+ "artist_name": instructor[0]->name,
389
+ "artists": instructor[]->name,
390
+ difficulty,
391
+ difficulty_string,
392
+ length_in_seconds,
393
+ published_on,
394
+ "type": _type,
395
+ web_url_path,
396
+ } | order(published_on asc)[${start}...${end}]`;
397
+ return fetchSanity(query, true);
398
+ }
399
+
375
400
  /**
376
401
  * Fetch content by a specific Railcontent ID.
377
402
  *
@@ -455,6 +480,7 @@ export async function fetchAll(brand, type, {
455
480
  let config = contentTypeConfig[type] ?? {};
456
481
  let additionalFields = config?.fields ?? [];
457
482
  let isGroupByOneToOne = (groupBy ? config?.relationships?.[groupBy]?.isOneToOne : false) ?? false;
483
+ let webUrlPathType = config?.slug ?? type;
458
484
  const start = (page - 1) * limit;
459
485
  const end = start + limit;
460
486
 
@@ -462,7 +488,7 @@ export async function fetchAll(brand, type, {
462
488
  const searchFilter = searchTerm
463
489
  ? groupBy !== "" ?
464
490
  `&amp;&amp; (^.name match "${searchTerm}*" || title match "${searchTerm}*")`
465
- : `&amp;&amp; (artist->name match "${searchTerm}*" || instructor[]->name match "${searchTerm}*" || title match "${searchTerm}*")`
491
+ : `&amp;&amp; (artist->name match "${searchTerm}*" || instructor[]->name match "${searchTerm}*" || title match "${searchTerm}*" || name match "${searchTerm}*")`
466
492
  : "";
467
493
 
468
494
  // Construct the included fields filter, replacing 'difficulty' with 'difficulty_string'
@@ -483,6 +509,7 @@ export async function fetchAll(brand, type, {
483
509
  // Determine the group by clause
484
510
  let query = "";
485
511
  if (groupBy !== "" &amp;&amp; isGroupByOneToOne) {
512
+ let webUrlPath = 'artists';
486
513
  query = `
487
514
  {
488
515
  "total": count(*[_type == '${groupBy}' &amp;&amp; count(*[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id == ${groupBy}._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]._id) > 0]),
@@ -492,7 +519,7 @@ export async function fetchAll(brand, type, {
492
519
  'type': _type,
493
520
  name,
494
521
  'head_shot_picture_url': thumbnail_url.asset->url,
495
- web_url_path,
522
+ 'web_url_path': '/${brand}/${webUrlPath}/'+name+'?included_fieds[]=type,${type}',
496
523
  'all_lessons_count': count(*[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id == ${groupBy}._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]._id),
497
524
  'lessons': *[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id == ${groupBy}._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{
498
525
  ${fieldsString},
@@ -503,6 +530,7 @@ export async function fetchAll(brand, type, {
503
530
  [${start}...${end}]
504
531
  }`;
505
532
  } else if (groupBy !== "") {
533
+ let webUrlPath = (groupBy == 'genre')?'/genres':'';
506
534
  query = `
507
535
  {
508
536
  "total": count(*[_type == '${groupBy}' &amp;&amp; count(*[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id in ${groupBy}[]._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]._id) > 0]),
@@ -512,7 +540,7 @@ export async function fetchAll(brand, type, {
512
540
  'type': _type,
513
541
  name,
514
542
  'head_shot_picture_url': thumbnail_url.asset->url,
515
- web_url_path,
543
+ 'web_url_path': select(defined(web_url_path)=> web_url_path +'?included_fieds[]=type,${type}',!defined(web_url_path)=> '/${brand}${webUrlPath}/'+name+'/${webUrlPathType}'),
516
544
  'all_lessons_count': count(*[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id in ${groupBy}[]._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]._id),
517
545
  'lessons': *[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id in ${groupBy}[]._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{
518
546
  ${fieldsString},
@@ -546,8 +574,9 @@ export function getSortOrder(sort= '-published_on', groupBy)
546
574
  case "slug":
547
575
  sortOrder = groupBy ? 'name' : "title";
548
576
  break;
577
+ case "name":
549
578
  case "popularity":
550
- sortOrder = "popularity";
579
+ sortOrder = sort;
551
580
  break;
552
581
  case "published_on":
553
582
  default:
@@ -697,6 +726,7 @@ export async function fetchMethod(brand, slug) {
697
726
  status,
698
727
  title,
699
728
  video,
729
+ length_in_seconds,
700
730
  "type": _type,
701
731
  "levels": child[]->
702
732
  {
@@ -711,6 +741,7 @@ export async function fetchMethod(brand, slug) {
711
741
  "type": _type,
712
742
  "description": ${descriptionField},
713
743
  "url": web_url_path,
744
+ web_url_path,
714
745
  xp,
715
746
  }
716
747
  } | order(published_on asc)`
@@ -750,7 +781,6 @@ export async function fetchMethodNextLesson(railcontentId, methodId) {
750
781
  return childIndex ? await fetchByRailContentId(childIndex) : null;
751
782
  }
752
783
 
753
-
754
784
  /**
755
785
  * Fetch the next lesson for a specific method by Railcontent ID.
756
786
  * @param {string} railcontentId - The Railcontent ID of the current lesson.
@@ -868,7 +898,13 @@ export async function fetchLessonContent(railContentId) {
868
898
  "coach_profile_image":thumbnail_url.asset->url
869
899
  },
870
900
  "instructors":instructor[]->name,
871
- instructor[]->,
901
+ "instructor": instructor[]->{
902
+ "id":_id,
903
+ name,
904
+ short_bio,
905
+ web_url_path,
906
+ "coach_card_image": coach_card_image.asset->url,
907
+ },
872
908
  ${assignmentsField}
873
909
  video,
874
910
  length_in_seconds
@@ -898,6 +934,30 @@ export async function fetchRelatedLessons(railContentId, brand) {
898
934
  return fetchSanity(query, false);
899
935
  }
900
936
 
937
+ /**
938
+ * Fetch related method lessons for a specific lesson by RailContent ID and type.
939
+ * @param {string} railContentId - The RailContent ID of the current lesson.
940
+ * @param {string} brand - The current brand.
941
+ * @returns {Promise&lt;Object>|null>} - The fetched related lessons
942
+ */
943
+ export async function fetchRelatedMethodLessons(railContentId, brand) {
944
+ const query = `*[railcontent_id == ${railContentId} &amp;&amp; brand == "${brand}"]{
945
+ "id":_id,
946
+ "related_lessons": *[references(^._id)][0].child[]->{
947
+ "id": railcontent_id,
948
+ "type": _type,
949
+ title,
950
+ "description": description[0].children[0].text, // Extraer texto plano
951
+ "thumbnail_url": thumbnail.asset->url,
952
+ "url": web_url_path,
953
+ difficulty,
954
+ difficulty_string,
955
+ }
956
+ }
957
+ }`
958
+ return fetchSanity(query, false);
959
+ }
960
+
901
961
  /**
902
962
  * Fetch all packs.
903
963
  * @param {string} brand - The brand for which to fetch packs.
@@ -1271,6 +1331,13 @@ function getSanityDate(date) {
1271
1331
  return date.toISOString();
1272
1332
  }
1273
1333
 
1334
+ const merge = (a, b, predicate = (a, b) => a === b) => {
1335
+ const c = [...a]; // copy to avoid side effects
1336
+ // add all items from B to copy C if they're not already present
1337
+ b.forEach((bItem) => (c.some((cItem) => predicate(bItem, cItem)) ? null : c.push(bItem)))
1338
+ return c;
1339
+ }
1340
+
1274
1341
  function checkSanityConfig(config) {
1275
1342
  if (!config.sanityConfig.token) {
1276
1343
  console.warn('fetchSanity: The "token" property is missing in the config object.');
@@ -1306,7 +1373,7 @@ function checkSanityConfig(config) {
1306
1373
  <br class="clear">
1307
1374
 
1308
1375
  <footer>
1309
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Sep 12 2024 18:08:47 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1376
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Sep 19 2024 14:19:19 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1310
1377
  </footer>
1311
1378
 
1312
1379
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.102",
3
+ "version": "1.0.105",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -54,7 +54,14 @@ let contentTypeConfig = {
54
54
  'artist': {
55
55
  isOneToOne: true
56
56
  }
57
- }
57
+ },
58
+ 'slug':'songs',
59
+ },
60
+ 'song-tutorial': {
61
+ 'fields': [
62
+ '"lesson_count": child_count',
63
+ ],
64
+ 'slug':'song-tutorials',
58
65
  },
59
66
  'challenge':{
60
67
  'fields': [
@@ -88,7 +95,8 @@ let contentTypeConfig = {
88
95
  "instructors": instructor[]->name,
89
96
  length_in_seconds,
90
97
  }`,
91
- ]
98
+ ],
99
+ 'slug':'courses',
92
100
  },
93
101
  'method': {
94
102
  'fields': [
@@ -113,7 +121,8 @@ let contentTypeConfig = {
113
121
  'workout': {
114
122
  'fields': [
115
123
  artistOrInstructorNameAsArray(),
116
- ]
124
+ ],
125
+ 'slug':'workouts',
117
126
  },
118
127
  'play-along': {
119
128
  'fields': [
@@ -123,7 +132,8 @@ let contentTypeConfig = {
123
132
  'mp3_no_drums_yes_click_url',
124
133
  'mp3_yes_drums_no_click_url',
125
134
  'bpm',
126
- ]
135
+ ],
136
+ 'slug':'play-alongs',
127
137
  },
128
138
  'pack': {
129
139
  'fields': [
@@ -138,14 +148,16 @@ let contentTypeConfig = {
138
148
  'rudiment': {
139
149
  'fields': [
140
150
  'sheet_music_thumbnail_url',
141
- ]
151
+ ],
152
+ 'slug':'rudiments',
142
153
  },
143
154
  'routine':{
144
155
  'fields': [
145
156
  `"description": ${descriptionField}`,
146
157
  'high_soundslice_slug',
147
158
  'low_soundslice_slug'
148
- ]
159
+ ],
160
+ 'slug':'routines',
149
161
  },
150
162
  'pack-children': {
151
163
  'fields': [
@@ -203,29 +215,30 @@ let contentTypeConfig = {
203
215
  // content with just the added 'instructors' Field
204
216
  'student-focus': contentWithInstructorsField,
205
217
  'quick-tips': contentWithInstructorsField,
206
- 'drum-fest-international-aa2022': contentWithInstructorsField,
218
+ 'drum-fest-international-2022': contentWithInstructorsField,
207
219
  'spotlight': contentWithInstructorsField,
208
220
  'the-history-of-electronic-drums': contentWithInstructorsField,
209
221
  'backstage-secrets': contentWithInstructorsField,
210
222
  'question-and-answer': contentWithInstructorsField,
211
223
  'student-collaborations': contentWithInstructorsField,
212
- 'live': contentWithInstructorsField,
213
- 'solos': contentWithInstructorsField,
224
+ 'live': { ...contentWithInstructorsField, 'slug': 'live-streams' },
225
+ 'solo': { ...contentWithInstructorsField, 'slug': 'solos' },
214
226
  'boot-camps': contentWithInstructorsField,
215
227
  'gear-guids': contentWithInstructorsField,
216
228
  'performances': contentWithInstructorsField,
217
229
  'challenges': contentWithInstructorsField,
218
230
  'on-the-road': contentWithInstructorsField,
219
231
  // content with just the added 'sort' field
220
- 'podcasts': contentWithSortField,
232
+ 'podcast': contentWithSortField,
221
233
  'in-rhythm': contentWithSortField,
222
- 'diy-drum-experiments': contentWithSortField,
234
+ 'diy-drum-experiment': contentWithSortField,
223
235
  'rhythmic-adventures-of-captain-carson': contentWithSortField,
224
236
  'study-the-greats': contentWithSortField,
225
237
  'rhythms-from-another-planet': contentWithSortField,
226
238
  'paiste-cymbals': contentWithInstructorsField,
227
239
  'behind-the-scenes': contentWithSortField,
228
240
  'exploring-beats': contentWithSortField,
241
+ 'sonor': contentWithSortField,
229
242
  }
230
243
 
231
244
  function getNewReleasesTypes(brand) {
@@ -286,6 +299,14 @@ function filtersToGroq(filters) {
286
299
  return `&& topic[]->name match "${value}"`;
287
300
  case 'instrumentless':
288
301
  return `&& instrumentless == ${value}`;
302
+ case 'creativity':
303
+ return `&& creativity[]->name match "${value}"`;
304
+ case 'theory':
305
+ return `&& theory[]->name match "${value}"`;
306
+ case 'essentials':
307
+ return `&& essential[]->name match "${value}"`;
308
+ case 'lifestyle':
309
+ return `&& lifestyle[]->name match "${value}"`;
289
310
  default:
290
311
  return `&& ${key} == ${/^\d+$/.test(value) ? value : `"$${value}"`}`;
291
312
  }
package/src/index.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  fetchAllSongs,
9
9
  fetchSongFilterOptions,
10
10
  fetchSongCount,
11
+ fetchWorkouts,
11
12
  fetchNewReleases,
12
13
  fetchUpcomingEvents,
13
14
  fetchByRailContentId,
@@ -37,6 +38,7 @@ import {
37
38
  fetchScheduledReleases,
38
39
  fetchArtistLessons,
39
40
  fetchGenreLessons,
41
+ fetchRelatedMethodLessons,
40
42
  } from './services/sanity.js';
41
43
 
42
44
  import {
@@ -58,6 +60,7 @@ export {
58
60
  fetchAllSongs,
59
61
  fetchSongFilterOptions,
60
62
  fetchSongCount,
63
+ fetchWorkouts,
61
64
  fetchNewReleases,
62
65
  fetchUpcomingEvents,
63
66
  fetchByRailContentId,
@@ -93,4 +96,5 @@ export {
93
96
  fetchScheduledReleases,
94
97
  fetchArtistLessons,
95
98
  fetchGenreLessons,
99
+ fetchRelatedMethodLessons,
96
100
  }