musora-content-services 2.145.6 → 2.145.9
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 +6 -0
- package/package.json +1 -1
- package/src/contentTypeConfig.js +3 -2
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/services/sanity.js +24 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
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
|
+
### [2.145.9](https://github.com/railroadmedia/musora-content-services/compare/v2.145.8...v2.145.9) (2026-04-01)
|
|
6
|
+
|
|
7
|
+
### [2.145.8](https://github.com/railroadmedia/musora-content-services/compare/v2.145.7...v2.145.8) (2026-04-01)
|
|
8
|
+
|
|
9
|
+
### [2.145.7](https://github.com/railroadmedia/musora-content-services/compare/v2.145.6...v2.145.7) (2026-04-01)
|
|
10
|
+
|
|
5
11
|
### [2.145.6](https://github.com/railroadmedia/musora-content-services/compare/v2.145.5...v2.145.6) (2026-03-31)
|
|
6
12
|
|
|
7
13
|
### [2.145.5](https://github.com/railroadmedia/musora-content-services/compare/v2.145.4...v2.145.5) (2026-03-31)
|
package/package.json
CHANGED
package/src/contentTypeConfig.js
CHANGED
|
@@ -72,6 +72,8 @@ export const DEFAULT_FIELDS = [
|
|
|
72
72
|
'"grandparent_id": parent_content_data[1].id',
|
|
73
73
|
'live_event_start_time',
|
|
74
74
|
'live_event_end_time',
|
|
75
|
+
'enrollment_start_time',
|
|
76
|
+
'enrollment_end_time',
|
|
75
77
|
]
|
|
76
78
|
|
|
77
79
|
// these are identical... why
|
|
@@ -399,7 +401,6 @@ export const ownedContentTypes = {
|
|
|
399
401
|
|
|
400
402
|
export let contentTypeConfig = {
|
|
401
403
|
'tab-data': {
|
|
402
|
-
fields: ['enrollment_start_time', 'enrollment_end_time'],
|
|
403
404
|
includeChildFields: true,
|
|
404
405
|
},
|
|
405
406
|
'progress-tracker': {
|
|
@@ -416,7 +417,7 @@ export let contentTypeConfig = {
|
|
|
416
417
|
'railcontent_id',
|
|
417
418
|
'"assignments": assignment[]{railcontent_id}',
|
|
418
419
|
'"metadata": { brand, "type": _type, "parent_id": coalesce(parent_content_data[0].id, 0) }',
|
|
419
|
-
|
|
420
|
+
],
|
|
420
421
|
childFields: [
|
|
421
422
|
'railcontent_id',
|
|
422
423
|
'"assignments": assignment[]{railcontent_id}',
|
package/src/index.d.ts
CHANGED
|
@@ -323,6 +323,7 @@ import {
|
|
|
323
323
|
getSanityDate,
|
|
324
324
|
getSongTypesFor,
|
|
325
325
|
getSortOrder,
|
|
326
|
+
hasAnyMethodV2IntroCompleted,
|
|
326
327
|
jumpToContinueContent
|
|
327
328
|
} from './services/sanity.js';
|
|
328
329
|
|
|
@@ -680,6 +681,7 @@ declare module 'musora-content-services' {
|
|
|
680
681
|
getWeekNumber,
|
|
681
682
|
globalConfig,
|
|
682
683
|
guidedCourses,
|
|
684
|
+
hasAnyMethodV2IntroCompleted,
|
|
683
685
|
initializeEnvVar,
|
|
684
686
|
initializeService,
|
|
685
687
|
isBucketUrl,
|
package/src/index.js
CHANGED
|
@@ -327,6 +327,7 @@ import {
|
|
|
327
327
|
getSanityDate,
|
|
328
328
|
getSongTypesFor,
|
|
329
329
|
getSortOrder,
|
|
330
|
+
hasAnyMethodV2IntroCompleted,
|
|
330
331
|
jumpToContinueContent
|
|
331
332
|
} from './services/sanity.js';
|
|
332
333
|
|
|
@@ -679,6 +680,7 @@ export {
|
|
|
679
680
|
getWeekNumber,
|
|
680
681
|
globalConfig,
|
|
681
682
|
guidedCourses,
|
|
683
|
+
hasAnyMethodV2IntroCompleted,
|
|
682
684
|
initializeEnvVar,
|
|
683
685
|
initializeService,
|
|
684
686
|
isBucketUrl,
|
package/src/services/sanity.js
CHANGED
|
@@ -44,7 +44,7 @@ import { globalConfig } from './config.js'
|
|
|
44
44
|
|
|
45
45
|
import { arrayToStringRepresentation, FilterBuilder } from '../filterBuilder.js'
|
|
46
46
|
import { getPermissionsAdapter } from './permissions/index.ts'
|
|
47
|
-
import {
|
|
47
|
+
import {getAllCompleted, getAllCompletedByIds, getAllStarted, getAllStartedOrCompleted} from './contentProgress.js'
|
|
48
48
|
import { fetchRecentActivitiesActiveTabs } from './userActivity.js'
|
|
49
49
|
import { query } from '../lib/sanity/query'
|
|
50
50
|
import { Filters as f } from '../lib/sanity/filter'
|
|
@@ -2529,3 +2529,26 @@ export function fetchParentChildRelationshipsFor(childIds, parentType) {
|
|
|
2529
2529
|
}`
|
|
2530
2530
|
return fetchSanity(query, true, { processNeedAccess: false, processPageType: false })
|
|
2531
2531
|
}
|
|
2532
|
+
|
|
2533
|
+
/**
|
|
2534
|
+
* Checks whether the user has completed a Method V2 intro video on **any** brand.
|
|
2535
|
+
*
|
|
2536
|
+
* Fetches all `method-intro` content IDs from Sanity (cross-brand) and checks
|
|
2537
|
+
* the local progress store for any completed record among them. This intentionally
|
|
2538
|
+
* ignores the current brand so that completing the intro on one brand (e.g. PlayBass)
|
|
2539
|
+
* is recognised as completed when the user switches to another brand (e.g. Drumeo).
|
|
2540
|
+
*
|
|
2541
|
+
* @returns {Promise<boolean>} `true` if the user has completed at least one Method V2
|
|
2542
|
+
* intro video across any brand, `false` otherwise.
|
|
2543
|
+
*/
|
|
2544
|
+
export async function hasAnyMethodV2IntroCompleted() {
|
|
2545
|
+
const type = 'method-intro'
|
|
2546
|
+
const filter = `_type == '${type}'`
|
|
2547
|
+
|
|
2548
|
+
const query = `*[${filter}] { railcontent_id }`
|
|
2549
|
+
const videos = await fetchSanity(query, true);
|
|
2550
|
+
const ids = (videos || []).map((v) => v.railcontent_id)
|
|
2551
|
+
|
|
2552
|
+
const completedVideos = await getAllCompletedByIds(ids)
|
|
2553
|
+
return (completedVideos?.data?.length || 0) > 0
|
|
2554
|
+
}
|