musora-content-services 2.1.1 → 2.2.0
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/.github/workflows/node.js.yml +0 -0
- package/.prettierignore +0 -0
- package/.prettierrc +0 -0
- package/CHANGELOG.md +7 -0
- package/README.md +0 -0
- package/babel.config.cjs +0 -0
- package/docs/Content-Organization.html +2 -2
- package/docs/Gamification.html +245 -0
- package/docs/api_types.js.html +97 -0
- package/docs/config.js.html +2 -2
- package/docs/content-org_playlists-types.js.html +3 -5
- package/docs/content-org_playlists.js.html +8 -9
- package/docs/content.js.html +2 -2
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/gamification_awards.js.html +664 -0
- package/docs/gamification_gamification.js.html +76 -0
- package/docs/gamification_types.js.html +98 -0
- package/docs/global.html +1441 -153
- package/docs/index.html +2 -2
- package/docs/module-Awards.html +354 -0
- package/docs/module-Config.html +2 -2
- package/docs/module-Content-Services-V2.html +2 -2
- package/docs/module-Playlists.html +6 -6
- package/docs/module-Railcontent-Services.html +33 -194
- package/docs/module-Sanity-Services.html +885 -90
- package/docs/module-Session-Management.html +2 -2
- package/docs/module-User-Permissions.html +2 -2
- package/docs/railcontent.js.html +13 -25
- package/docs/sanity.js.html +76 -5
- package/docs/scripts/collapse.js +0 -0
- package/docs/scripts/commonNav.js +0 -0
- package/docs/scripts/linenumber.js +0 -0
- package/docs/scripts/nav.js +0 -0
- package/docs/scripts/polyfill.js +0 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -0
- package/docs/scripts/prettify/lang-css.js +0 -0
- package/docs/scripts/prettify/prettify.js +0 -0
- package/docs/scripts/search.js +0 -0
- package/docs/styles/jsdoc.css +0 -0
- package/docs/styles/prettify.css +0 -0
- package/docs/user_permissions.js.html +3 -3
- package/docs/user_sessions.js.html +4 -4
- package/docs/user_types.js.html +2 -2
- package/jest.config.js +0 -0
- package/jsdoc.json +4 -2
- package/package.json +1 -1
- package/src/index.d.ts +5 -1
- package/src/index.js +5 -0
- package/src/services/api/types.js +25 -0
- package/src/services/contentLikes.js +0 -0
- package/src/services/gamification/awards.js +592 -0
- package/src/services/gamification/gamification.js +4 -0
- package/src/services/gamification/types.js +26 -0
- package/src/services/sanity.js +12 -14
- package/test/live/contentProgressLive.test.js +0 -0
- package/test/live/railcontentLive.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} Award
|
|
3
|
+
* @property {string} username - The username of the user.
|
|
4
|
+
* @property {number} streak - The name of the award.
|
|
5
|
+
* @property {number} minutes_practiced - The name of the award.
|
|
6
|
+
* @property {Date} date_completed - Date of completion
|
|
7
|
+
* @property {string} challenge_title - The name of the challenge completed.
|
|
8
|
+
* @property {string} award_text - Award description
|
|
9
|
+
* @property {string} tier - Award tier [bronze, silver, gold]
|
|
10
|
+
* @property {string} award - Award image URL
|
|
11
|
+
* @property {string} award_64 - Award image in base64
|
|
12
|
+
* @property {string} instructor_signature - Instructor signature image URL
|
|
13
|
+
* @property {string} instructor_signature_64 - Instructor signature image in base64
|
|
14
|
+
* @property {string} musora_logo - Musora logo image URL
|
|
15
|
+
* @property {string} musora_logo_64 - Musora logo image in base64
|
|
16
|
+
* @property {string} brand_logo - Brand logo image URL
|
|
17
|
+
* @property {string} brand_logo_64 - Brand logo image in base64
|
|
18
|
+
* @property {string} ribbon_image - Ribbon image URL
|
|
19
|
+
* @property {string} ribbon_image_64 - Ribbon image in base64
|
|
20
|
+
* @property {number} id - ID of the challenge completed
|
|
21
|
+
* @property {string} artist_name - Name of the artist featured in the challenge
|
|
22
|
+
* @property {string} dark_mode_logo_url - Dark mode logo image URL
|
|
23
|
+
* @property {string} light_mode_logo_url - Light mode logo image URL
|
|
24
|
+
* @property {string} logo_image_url - Name of the artist featured in the challenge
|
|
25
|
+
* @property {string} web_url_path - URL path for the challenge
|
|
26
|
+
*/
|
package/src/services/sanity.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
getNewReleasesTypes,
|
|
16
16
|
coachLessonsTypes,
|
|
17
17
|
getChildFieldsForContentType,
|
|
18
|
-
SONG_TYPES
|
|
18
|
+
SONG_TYPES,
|
|
19
19
|
} from '../contentTypeConfig.js'
|
|
20
20
|
import { fetchSimilarItems } from './recommendations.js'
|
|
21
21
|
import { processMetadata, typeWithSortOrder } from '../contentMetaData.js'
|
|
@@ -1321,7 +1321,7 @@ export async function fetchLessonContent(railContentId) {
|
|
|
1321
1321
|
* @param count
|
|
1322
1322
|
* @returns {Promise<Array<Object>|null>}
|
|
1323
1323
|
*/
|
|
1324
|
-
export async function fetchRelatedRecommendedContent(railContentId, brand, count=10) {
|
|
1324
|
+
export async function fetchRelatedRecommendedContent(railContentId, brand, count = 10) {
|
|
1325
1325
|
const recommendedItems = await fetchSimilarItems(railContentId, brand, count)
|
|
1326
1326
|
return fetchByRailContentIds(recommendedItems)
|
|
1327
1327
|
}
|
|
@@ -1333,9 +1333,9 @@ export async function fetchRelatedRecommendedContent(railContentId, brand, count
|
|
|
1333
1333
|
* @param railcontentId
|
|
1334
1334
|
* @param brand
|
|
1335
1335
|
* @param count
|
|
1336
|
-
* @returns {Promise
|
|
1336
|
+
* @returns {Promise<Array<Object>>}
|
|
1337
1337
|
*/
|
|
1338
|
-
export async function fetchOtherSongVersions(railcontentId, brand, count=3){
|
|
1338
|
+
export async function fetchOtherSongVersions(railcontentId, brand, count = 3) {
|
|
1339
1339
|
return fetchRelatedByLicense(railcontentId, brand, true, count)
|
|
1340
1340
|
}
|
|
1341
1341
|
|
|
@@ -1346,9 +1346,9 @@ export async function fetchOtherSongVersions(railcontentId, brand, count=3){
|
|
|
1346
1346
|
* @param {integer} railcontentId
|
|
1347
1347
|
* @param {string} brand
|
|
1348
1348
|
* @param {integer:3} count
|
|
1349
|
-
* @returns {Promise
|
|
1349
|
+
* @returns {Promise<Array<Object>>}
|
|
1350
1350
|
*/
|
|
1351
|
-
export async function fetchLessonsFeaturingThisContent(railcontentId, brand, count=3){
|
|
1351
|
+
export async function fetchLessonsFeaturingThisContent(railcontentId, brand, count = 3) {
|
|
1352
1352
|
return fetchRelatedByLicense(railcontentId, brand, false, count)
|
|
1353
1353
|
}
|
|
1354
1354
|
|
|
@@ -1359,16 +1359,15 @@ export async function fetchLessonsFeaturingThisContent(railcontentId, brand, cou
|
|
|
1359
1359
|
* @param {string} brand
|
|
1360
1360
|
* @param {boolean} onlyUseSongTypes - if true, only return the song type documents. If false, return everything except those
|
|
1361
1361
|
* @param {integer:3} count
|
|
1362
|
-
* @returns {Promise
|
|
1362
|
+
* @returns {Promise<Array<Object>>}
|
|
1363
1363
|
*/
|
|
1364
1364
|
async function fetchRelatedByLicense(railcontentId, brand, onlyUseSongTypes, count) {
|
|
1365
1365
|
const typeCheck = `@->_type in [${arrayJoinWithQuotes(SONG_TYPES)}]`
|
|
1366
1366
|
const typeCheckString = onlyUseSongTypes ? `${typeCheck}` : `!(${typeCheck})`
|
|
1367
|
-
const contentFromLicenseFilter
|
|
1368
|
-
let filterSongTypesWithSameLicense = await new FilterBuilder(
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
).buildFilter()
|
|
1367
|
+
const contentFromLicenseFilter = `_type == 'license' && references(^._id)].content[${typeCheckString} && @->railcontent_id != ${railcontentId}`
|
|
1368
|
+
let filterSongTypesWithSameLicense = await new FilterBuilder(contentFromLicenseFilter, {
|
|
1369
|
+
isChildrenFilter: true,
|
|
1370
|
+
}).buildFilter()
|
|
1372
1371
|
let queryFields = getFieldsForContentType()
|
|
1373
1372
|
const baseParentQuery = `railcontent_id == ${railcontentId}`
|
|
1374
1373
|
let parentQuery = await new FilterBuilder(baseParentQuery).buildFilter()
|
|
@@ -1383,7 +1382,7 @@ async function fetchRelatedByLicense(railcontentId, brand, onlyUseSongTypes, cou
|
|
|
1383
1382
|
}[0...1]`
|
|
1384
1383
|
|
|
1385
1384
|
const results = await fetchSanity(query, false)
|
|
1386
|
-
return results['related_by_license'] ?? []
|
|
1385
|
+
return results['related_by_license'] ?? []
|
|
1387
1386
|
}
|
|
1388
1387
|
|
|
1389
1388
|
/**
|
|
@@ -2350,4 +2349,3 @@ export async function fetchScheduledAndNewReleases(
|
|
|
2350
2349
|
|
|
2351
2350
|
return fetchSanity(query, true)
|
|
2352
2351
|
}
|
|
2353
|
-
|
|
File without changes
|
|
File without changes
|
package/test/localStorageMock.js
CHANGED
|
File without changes
|
package/test/log.js
CHANGED
|
File without changes
|