musora-content-services 2.2.0 → 2.3.1
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/.editorconfig +0 -0
- package/.github/workflows/node.js.yml +0 -0
- package/.prettierignore +0 -0
- package/.prettierrc +0 -0
- package/.yarnrc.yml +1 -0
- package/CHANGELOG.md +17 -0
- package/README.md +0 -0
- package/babel.config.cjs +0 -0
- package/docs/Content-Organization.html +0 -0
- package/docs/Gamification.html +0 -0
- package/docs/Playlists.html +0 -0
- package/docs/api_types.js.html +0 -0
- package/docs/config.js.html +0 -0
- package/docs/content-org_playlists-types.js.html +0 -0
- package/docs/content-org_playlists.js.html +0 -0
- package/docs/content-org_types.js.html +0 -0
- package/docs/content.js.html +0 -0
- 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 +0 -0
- package/docs/gamification_gamification.js.html +0 -0
- package/docs/gamification_types.js.html +0 -0
- package/docs/global.html +0 -0
- package/docs/index.html +0 -0
- package/docs/module-Awards.html +0 -0
- package/docs/module-Config.html +0 -0
- package/docs/module-Content-Organization-Playlists.html +0 -0
- package/docs/module-Content-Organization.html +0 -0
- package/docs/module-Content-Services-V2.html +0 -0
- package/docs/module-Content-Services.html +763 -0
- package/docs/module-Playlists.html +0 -0
- package/docs/module-Railcontent-Services.html +0 -0
- package/docs/module-Sanity-Services.html +0 -0
- package/docs/module-Session-Management.html +0 -0
- package/docs/module-User-Permissions.html +0 -0
- package/docs/module-playlists.html +0 -0
- package/docs/module-playlists_.html +0 -0
- package/docs/railcontent.js.html +0 -0
- package/docs/sanity.js.html +0 -0
- 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 +0 -0
- package/docs/user_sessions.js.html +0 -0
- package/docs/user_types.js.html +0 -0
- package/jest.config.js +0 -0
- package/jsdoc.json +0 -0
- package/package.json +1 -1
- package/src/contentMetaData.js +0 -0
- package/src/contentTypeConfig.js +1 -0
- package/src/filterBuilder.js +0 -0
- package/src/index.d.ts +35 -2
- package/src/index.js +35 -2
- package/src/lib/httpHelper.js +0 -0
- package/src/lib/lastUpdated.js +0 -0
- package/src/services/api/types.js +0 -0
- package/src/services/config.js +0 -0
- package/src/services/content-org/playlists-types.js +0 -0
- package/src/services/content-org/playlists.js +0 -0
- package/src/services/content.js +0 -0
- package/src/services/contentLikes.js +0 -0
- package/src/services/contentProgress.js +0 -0
- package/src/services/dataContext.js +15 -2
- package/src/services/forum.js +0 -0
- package/src/services/gamification/awards.js +0 -0
- package/src/services/gamification/gamification.js +0 -0
- package/src/services/gamification/types.js +0 -0
- package/src/services/railcontent.js +60 -0
- package/src/services/recommendations.js +0 -0
- package/src/services/sanity.js +10 -7
- package/src/services/user/management.js +0 -0
- package/src/services/user/permissions.js +0 -0
- package/src/services/user/sessions.js +0 -0
- package/src/services/user/types.js +0 -0
- package/src/services/userActivity.js +378 -23
- package/test/content.test.js +0 -0
- package/test/contentLikes.test.js +2 -0
- package/test/contentProgress.test.js +0 -0
- package/test/dataContext.test.js +0 -0
- package/test/forum.test.js +0 -0
- package/test/initializeTests.js +0 -0
- package/test/lib/lastUpdated.test.js +0 -0
- 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
- package/test/mockData/mockData_fetchByRailContentIds_one_content.json +35 -0
- package/test/sanityQueryService.test.js +0 -0
- package/test/user/permissions.test.js +0 -0
- package/test/userActivity.test.js +118 -0
- package/tools/generate-index.cjs +0 -0
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/railcontent.js.html
CHANGED
|
File without changes
|
package/docs/sanity.js.html
CHANGED
|
File without changes
|
package/docs/scripts/collapse.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/scripts/nav.js
CHANGED
|
File without changes
|
package/docs/scripts/polyfill.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/scripts/search.js
CHANGED
|
File without changes
|
package/docs/styles/jsdoc.css
CHANGED
|
File without changes
|
package/docs/styles/prettify.css
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/user_types.js.html
CHANGED
|
File without changes
|
package/jest.config.js
CHANGED
|
File without changes
|
package/jsdoc.json
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/contentMetaData.js
CHANGED
|
File without changes
|
package/src/contentTypeConfig.js
CHANGED
package/src/filterBuilder.js
CHANGED
|
File without changes
|
package/src/index.d.ts
CHANGED
|
@@ -94,8 +94,11 @@ import {
|
|
|
94
94
|
fetchUserChallengeProgress,
|
|
95
95
|
fetchUserLikes,
|
|
96
96
|
fetchUserPermissionsData,
|
|
97
|
+
fetchUserPracticeMeta,
|
|
98
|
+
fetchUserPractices,
|
|
97
99
|
likeComment,
|
|
98
100
|
likePlaylist,
|
|
101
|
+
logUserPractice,
|
|
99
102
|
openComment,
|
|
100
103
|
pinPlaylist,
|
|
101
104
|
playback,
|
|
@@ -179,6 +182,11 @@ import {
|
|
|
179
182
|
jumpToContinueContent
|
|
180
183
|
} from './services/sanity.js';
|
|
181
184
|
|
|
185
|
+
import {
|
|
186
|
+
blockUser,
|
|
187
|
+
unblockUser
|
|
188
|
+
} from './services/user/management.js';
|
|
189
|
+
|
|
182
190
|
import {
|
|
183
191
|
fetchUserPermissions,
|
|
184
192
|
reset
|
|
@@ -190,7 +198,17 @@ import {
|
|
|
190
198
|
} from './services/user/sessions.js';
|
|
191
199
|
|
|
192
200
|
import {
|
|
193
|
-
|
|
201
|
+
deletePracticeSession,
|
|
202
|
+
getPracticeSessions,
|
|
203
|
+
getRecentActivity,
|
|
204
|
+
getUserMonthlyStats,
|
|
205
|
+
getUserPractices,
|
|
206
|
+
getUserWeeklyStats,
|
|
207
|
+
recordUserPractice,
|
|
208
|
+
removeUserPractice,
|
|
209
|
+
restorePracticeSession,
|
|
210
|
+
restoreUserPractice,
|
|
211
|
+
updateUserPractice
|
|
194
212
|
} from './services/userActivity.js';
|
|
195
213
|
|
|
196
214
|
declare module 'musora-content-services' {
|
|
@@ -199,6 +217,7 @@ declare module 'musora-content-services' {
|
|
|
199
217
|
assignModeratorToComment,
|
|
200
218
|
assignmentStatusCompleted,
|
|
201
219
|
assignmentStatusReset,
|
|
220
|
+
blockUser,
|
|
202
221
|
closeComment,
|
|
203
222
|
contentStatusCompleted,
|
|
204
223
|
contentStatusReset,
|
|
@@ -209,6 +228,7 @@ declare module 'musora-content-services' {
|
|
|
209
228
|
deletePlaylist,
|
|
210
229
|
deletePlaylistItem,
|
|
211
230
|
deletePlaylistLike,
|
|
231
|
+
deletePracticeSession,
|
|
212
232
|
duplicatePlaylist,
|
|
213
233
|
editComment,
|
|
214
234
|
fetchAll,
|
|
@@ -288,6 +308,8 @@ declare module 'musora-content-services' {
|
|
|
288
308
|
fetchUserPermissions,
|
|
289
309
|
fetchUserPermissionsData,
|
|
290
310
|
fetchUserPlaylists,
|
|
311
|
+
fetchUserPracticeMeta,
|
|
312
|
+
fetchUserPractices,
|
|
291
313
|
getActiveDiscussions,
|
|
292
314
|
getAllCompleted,
|
|
293
315
|
getAllStarted,
|
|
@@ -295,17 +317,21 @@ declare module 'musora-content-services' {
|
|
|
295
317
|
getContentRows,
|
|
296
318
|
getLessonContentRows,
|
|
297
319
|
getNewAndUpcoming,
|
|
320
|
+
getPracticeSessions,
|
|
298
321
|
getProgressPercentage,
|
|
299
322
|
getProgressPercentageByIds,
|
|
300
323
|
getProgressState,
|
|
301
324
|
getProgressStateByIds,
|
|
302
325
|
getRecent,
|
|
326
|
+
getRecentActivity,
|
|
303
327
|
getRecommendedForYou,
|
|
304
328
|
getResumeTimeSeconds,
|
|
305
329
|
getScheduleContentRows,
|
|
306
330
|
getSortOrder,
|
|
307
331
|
getTabResults,
|
|
308
|
-
|
|
332
|
+
getUserMonthlyStats,
|
|
333
|
+
getUserPractices,
|
|
334
|
+
getUserWeeklyStats,
|
|
309
335
|
globalConfig,
|
|
310
336
|
initializeService,
|
|
311
337
|
isContentLiked,
|
|
@@ -313,6 +339,7 @@ declare module 'musora-content-services' {
|
|
|
313
339
|
likeComment,
|
|
314
340
|
likeContent,
|
|
315
341
|
likePlaylist,
|
|
342
|
+
logUserPractice,
|
|
316
343
|
login,
|
|
317
344
|
logout,
|
|
318
345
|
openComment,
|
|
@@ -334,17 +361,23 @@ declare module 'musora-content-services' {
|
|
|
334
361
|
rankCategories,
|
|
335
362
|
rankItems,
|
|
336
363
|
recommendations,
|
|
364
|
+
recordUserPractice,
|
|
337
365
|
recordWatchSession,
|
|
366
|
+
removeUserPractice,
|
|
338
367
|
replyToComment,
|
|
339
368
|
reportPlaylist,
|
|
340
369
|
reset,
|
|
370
|
+
restorePracticeSession,
|
|
371
|
+
restoreUserPractice,
|
|
341
372
|
setStudentViewForUser,
|
|
342
373
|
unassignModeratorToComment,
|
|
374
|
+
unblockUser,
|
|
343
375
|
unlikeComment,
|
|
344
376
|
unlikeContent,
|
|
345
377
|
unpinPlaylist,
|
|
346
378
|
updatePlaylist,
|
|
347
379
|
updatePlaylistItem,
|
|
380
|
+
updateUserPractice,
|
|
348
381
|
verifyLocalDataContext,
|
|
349
382
|
}
|
|
350
383
|
}
|
package/src/index.js
CHANGED
|
@@ -94,8 +94,11 @@ import {
|
|
|
94
94
|
fetchUserChallengeProgress,
|
|
95
95
|
fetchUserLikes,
|
|
96
96
|
fetchUserPermissionsData,
|
|
97
|
+
fetchUserPracticeMeta,
|
|
98
|
+
fetchUserPractices,
|
|
97
99
|
likeComment,
|
|
98
100
|
likePlaylist,
|
|
101
|
+
logUserPractice,
|
|
99
102
|
openComment,
|
|
100
103
|
pinPlaylist,
|
|
101
104
|
playback,
|
|
@@ -179,6 +182,11 @@ import {
|
|
|
179
182
|
jumpToContinueContent
|
|
180
183
|
} from './services/sanity.js';
|
|
181
184
|
|
|
185
|
+
import {
|
|
186
|
+
blockUser,
|
|
187
|
+
unblockUser
|
|
188
|
+
} from './services/user/management.js';
|
|
189
|
+
|
|
182
190
|
import {
|
|
183
191
|
fetchUserPermissions,
|
|
184
192
|
reset
|
|
@@ -190,7 +198,17 @@ import {
|
|
|
190
198
|
} from './services/user/sessions.js';
|
|
191
199
|
|
|
192
200
|
import {
|
|
193
|
-
|
|
201
|
+
deletePracticeSession,
|
|
202
|
+
getPracticeSessions,
|
|
203
|
+
getRecentActivity,
|
|
204
|
+
getUserMonthlyStats,
|
|
205
|
+
getUserPractices,
|
|
206
|
+
getUserWeeklyStats,
|
|
207
|
+
recordUserPractice,
|
|
208
|
+
removeUserPractice,
|
|
209
|
+
restorePracticeSession,
|
|
210
|
+
restoreUserPractice,
|
|
211
|
+
updateUserPractice
|
|
194
212
|
} from './services/userActivity.js';
|
|
195
213
|
|
|
196
214
|
export {
|
|
@@ -198,6 +216,7 @@ export {
|
|
|
198
216
|
assignModeratorToComment,
|
|
199
217
|
assignmentStatusCompleted,
|
|
200
218
|
assignmentStatusReset,
|
|
219
|
+
blockUser,
|
|
201
220
|
closeComment,
|
|
202
221
|
contentStatusCompleted,
|
|
203
222
|
contentStatusReset,
|
|
@@ -208,6 +227,7 @@ export {
|
|
|
208
227
|
deletePlaylist,
|
|
209
228
|
deletePlaylistItem,
|
|
210
229
|
deletePlaylistLike,
|
|
230
|
+
deletePracticeSession,
|
|
211
231
|
duplicatePlaylist,
|
|
212
232
|
editComment,
|
|
213
233
|
fetchAll,
|
|
@@ -287,6 +307,8 @@ export {
|
|
|
287
307
|
fetchUserPermissions,
|
|
288
308
|
fetchUserPermissionsData,
|
|
289
309
|
fetchUserPlaylists,
|
|
310
|
+
fetchUserPracticeMeta,
|
|
311
|
+
fetchUserPractices,
|
|
290
312
|
getActiveDiscussions,
|
|
291
313
|
getAllCompleted,
|
|
292
314
|
getAllStarted,
|
|
@@ -294,17 +316,21 @@ export {
|
|
|
294
316
|
getContentRows,
|
|
295
317
|
getLessonContentRows,
|
|
296
318
|
getNewAndUpcoming,
|
|
319
|
+
getPracticeSessions,
|
|
297
320
|
getProgressPercentage,
|
|
298
321
|
getProgressPercentageByIds,
|
|
299
322
|
getProgressState,
|
|
300
323
|
getProgressStateByIds,
|
|
301
324
|
getRecent,
|
|
325
|
+
getRecentActivity,
|
|
302
326
|
getRecommendedForYou,
|
|
303
327
|
getResumeTimeSeconds,
|
|
304
328
|
getScheduleContentRows,
|
|
305
329
|
getSortOrder,
|
|
306
330
|
getTabResults,
|
|
307
|
-
|
|
331
|
+
getUserMonthlyStats,
|
|
332
|
+
getUserPractices,
|
|
333
|
+
getUserWeeklyStats,
|
|
308
334
|
globalConfig,
|
|
309
335
|
initializeService,
|
|
310
336
|
isContentLiked,
|
|
@@ -312,6 +338,7 @@ export {
|
|
|
312
338
|
likeComment,
|
|
313
339
|
likeContent,
|
|
314
340
|
likePlaylist,
|
|
341
|
+
logUserPractice,
|
|
315
342
|
login,
|
|
316
343
|
logout,
|
|
317
344
|
openComment,
|
|
@@ -333,16 +360,22 @@ export {
|
|
|
333
360
|
rankCategories,
|
|
334
361
|
rankItems,
|
|
335
362
|
recommendations,
|
|
363
|
+
recordUserPractice,
|
|
336
364
|
recordWatchSession,
|
|
365
|
+
removeUserPractice,
|
|
337
366
|
replyToComment,
|
|
338
367
|
reportPlaylist,
|
|
339
368
|
reset,
|
|
369
|
+
restorePracticeSession,
|
|
370
|
+
restoreUserPractice,
|
|
340
371
|
setStudentViewForUser,
|
|
341
372
|
unassignModeratorToComment,
|
|
373
|
+
unblockUser,
|
|
342
374
|
unlikeComment,
|
|
343
375
|
unlikeContent,
|
|
344
376
|
unpinPlaylist,
|
|
345
377
|
updatePlaylist,
|
|
346
378
|
updatePlaylistItem,
|
|
379
|
+
updateUserPractice,
|
|
347
380
|
verifyLocalDataContext,
|
|
348
381
|
};
|
package/src/lib/httpHelper.js
CHANGED
|
File without changes
|
package/src/lib/lastUpdated.js
CHANGED
|
File without changes
|
|
File without changes
|
package/src/services/config.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/services/content.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -10,6 +10,7 @@ const excludeFromGeneratedIndex = []
|
|
|
10
10
|
//These constants need to match MWP UserDataVersionKeyEnum enum
|
|
11
11
|
export const ContentLikesVersionKey = 0
|
|
12
12
|
export const ContentProgressVersionKey = 1
|
|
13
|
+
export const UserActivityVersionKey = 2
|
|
13
14
|
|
|
14
15
|
let cache = null
|
|
15
16
|
|
|
@@ -101,8 +102,10 @@ export class DataContext {
|
|
|
101
102
|
|
|
102
103
|
clearCache() {
|
|
103
104
|
this.clearContext()
|
|
104
|
-
cache
|
|
105
|
-
|
|
105
|
+
if (cache) {
|
|
106
|
+
cache.removeItem(this.localStorageKey)
|
|
107
|
+
cache.removeItem(this.localStorageLastUpdatedKey)
|
|
108
|
+
}
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
clearContext() {
|
|
@@ -134,4 +137,14 @@ export class DataContext {
|
|
|
134
137
|
version() {
|
|
135
138
|
return this.context?.version ?? -1
|
|
136
139
|
}
|
|
140
|
+
async updateLocal(localUpdateFunction) {
|
|
141
|
+
await this.ensureLocalContextLoaded()
|
|
142
|
+
if (this.context) {
|
|
143
|
+
const res = await localUpdateFunction(this.context)
|
|
144
|
+
if (this.context) this.context.version++
|
|
145
|
+
let data = JSON.stringify(this.context)
|
|
146
|
+
cache.setItem(this.localStorageKey, data)
|
|
147
|
+
this.setLastUpdatedTime()
|
|
148
|
+
}
|
|
149
|
+
}
|
|
137
150
|
}
|
package/src/services/forum.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1176,6 +1176,66 @@ export async function editComment(commentId, comment) {
|
|
|
1176
1176
|
return await patchDataHandler(url, data)
|
|
1177
1177
|
}
|
|
1178
1178
|
|
|
1179
|
+
export async function fetchUserPractices(currentVersion) {
|
|
1180
|
+
const url = `/api/user/practices/v1/practices`
|
|
1181
|
+
const response = await fetchDataHandler(url, currentVersion)
|
|
1182
|
+
const { data, version } = response;
|
|
1183
|
+
const userPractices = data;
|
|
1184
|
+
|
|
1185
|
+
let formattedPractices = userPractices.reduce((acc, practice) => {
|
|
1186
|
+
// Initialize the array if the day does not exist
|
|
1187
|
+
if (!acc[practice.day]) {
|
|
1188
|
+
acc[practice.day] = [];
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
// Push the practice entry into the array
|
|
1192
|
+
acc[practice.day].push({ id:practice.id, duration_seconds: practice.duration_seconds });
|
|
1193
|
+
|
|
1194
|
+
return acc;
|
|
1195
|
+
}, {});
|
|
1196
|
+
|
|
1197
|
+
let json = {
|
|
1198
|
+
data: {
|
|
1199
|
+
practices: formattedPractices
|
|
1200
|
+
},
|
|
1201
|
+
version: version
|
|
1202
|
+
};
|
|
1203
|
+
|
|
1204
|
+
return json;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
export async function logUserPractice(practiceDetails) {
|
|
1208
|
+
const url = `/api/user/practices/v1/practices`
|
|
1209
|
+
return await fetchHandler(url, 'POST', null, practiceDetails)
|
|
1210
|
+
}
|
|
1211
|
+
export async function fetchUserPracticeMeta(practiceIds) {
|
|
1212
|
+
if(practiceIds.length == 0)
|
|
1213
|
+
{
|
|
1214
|
+
return [];
|
|
1215
|
+
}
|
|
1216
|
+
let idsString = '';
|
|
1217
|
+
if (practiceIds && practiceIds.length > 0) {
|
|
1218
|
+
idsString = '?';
|
|
1219
|
+
practiceIds.forEach((id, index) => {
|
|
1220
|
+
idsString += `practice_ids[]=${id}${index < practiceIds.length - 1 ? '&' : ''}`;
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
const url = `/api/user/practices/v1/practices${idsString}`
|
|
1224
|
+
return await fetchHandler(url, 'GET', null)
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
function fetchAbsolute(url, params) {
|
|
1228
|
+
if (globalConfig.railcontentConfig.authToken) {
|
|
1229
|
+
params.headers['Authorization'] = `Bearer ${globalConfig.railcontentConfig.authToken}`
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
if (globalConfig.railcontentConfig.baseUrl) {
|
|
1233
|
+
if (url.startsWith('/')) {
|
|
1234
|
+
return fetch(globalConfig.railcontentConfig.baseUrl + url, params)
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
return fetch(url, params)
|
|
1238
|
+
}
|
|
1179
1239
|
export async function fetchHandler(url, method = 'get', dataVersion = null, body = null) {
|
|
1180
1240
|
return fetchJSONHandler(
|
|
1181
1241
|
url,
|
|
File without changes
|
package/src/services/sanity.js
CHANGED
|
@@ -353,6 +353,7 @@ export async function fetchNewReleases(
|
|
|
353
353
|
"id": railcontent_id,
|
|
354
354
|
title,
|
|
355
355
|
"image": thumbnail.asset->url,
|
|
356
|
+
"thumbnail": thumbnail.asset->url,
|
|
356
357
|
${artistOrInstructorName()},
|
|
357
358
|
"artists": instructor[]->name,
|
|
358
359
|
difficulty,
|
|
@@ -396,6 +397,7 @@ export async function fetchUpcomingEvents(brand, { page = 1, limit = 10 } = {})
|
|
|
396
397
|
"id": railcontent_id,
|
|
397
398
|
title,
|
|
398
399
|
"image": thumbnail.asset->url,
|
|
400
|
+
"thumbnail": thumbnail.asset->url,
|
|
399
401
|
${artistOrInstructorName()},
|
|
400
402
|
"artists": instructor[]->name,
|
|
401
403
|
difficulty,
|
|
@@ -444,6 +446,7 @@ export async function fetchScheduledReleases(brand, { page = 1, limit = 10 }) {
|
|
|
444
446
|
"id": railcontent_id,
|
|
445
447
|
title,
|
|
446
448
|
"image": thumbnail.asset->url,
|
|
449
|
+
"thumbnail": thumbnail.asset->url,
|
|
447
450
|
${artistOrInstructorName()},
|
|
448
451
|
"artists": instructor[]->name,
|
|
449
452
|
difficulty,
|
|
@@ -1071,7 +1074,7 @@ export async function fetchMethod(brand, slug) {
|
|
|
1071
1074
|
child_count,
|
|
1072
1075
|
difficulty,
|
|
1073
1076
|
difficulty_string,
|
|
1074
|
-
"
|
|
1077
|
+
"thumbnail": thumbnail.asset->url,
|
|
1075
1078
|
"instructor": instructor[]->{name},
|
|
1076
1079
|
title,
|
|
1077
1080
|
"type": _type,
|
|
@@ -1097,7 +1100,7 @@ export async function fetchMethodChildren(railcontentId) {
|
|
|
1097
1100
|
"child_count":coalesce(count(child[${childrenFilter}]->), 0),
|
|
1098
1101
|
"id": railcontent_id,
|
|
1099
1102
|
"description": ${descriptionField},
|
|
1100
|
-
"
|
|
1103
|
+
"thumbnail": thumbnail.asset->url,
|
|
1101
1104
|
title,
|
|
1102
1105
|
xp,
|
|
1103
1106
|
total_xp,
|
|
@@ -1261,7 +1264,7 @@ export async function fetchLessonContent(railContentId) {
|
|
|
1261
1264
|
railcontent_id,
|
|
1262
1265
|
"id":railcontent_id,
|
|
1263
1266
|
slug, artist->,
|
|
1264
|
-
"
|
|
1267
|
+
"thumbnail":thumbnail.asset->url,
|
|
1265
1268
|
"url": web_url_path,
|
|
1266
1269
|
soundslice_slug,
|
|
1267
1270
|
"description": description[0].children[0].text,
|
|
@@ -1406,7 +1409,7 @@ export async function fetchRelatedLessons(railContentId, brand) {
|
|
|
1406
1409
|
).buildFilter()
|
|
1407
1410
|
const filterNeighbouringSiblings = await new FilterBuilder(`references(^._id)`).buildFilter()
|
|
1408
1411
|
const childrenFilter = await new FilterBuilder(``, { isChildrenFilter: true }).buildFilter()
|
|
1409
|
-
const queryFields = `_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "
|
|
1412
|
+
const queryFields = `_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type, "genre": genre[]->name`
|
|
1410
1413
|
const queryFieldsWithSort = queryFields + ', sort'
|
|
1411
1414
|
const query = `*[railcontent_id == ${railContentId} && brand == "${brand}" && (!defined(permission) || references(*[_type=='permission']._id))]{
|
|
1412
1415
|
_type, parent_type, railcontent_id,
|
|
@@ -1697,11 +1700,11 @@ export async function fetchArtistLessons(
|
|
|
1697
1700
|
const query = `{
|
|
1698
1701
|
"entity":
|
|
1699
1702
|
*[_type == 'artist' && name == '${name}']
|
|
1700
|
-
{'type': _type, name, '
|
|
1703
|
+
{'type': _type, name, 'thumbnail':thumbnail_url.asset->url,
|
|
1701
1704
|
'lessons_count': count(*[${addType} brand == '${brand}' && references(^._id)]),
|
|
1702
1705
|
'lessons': *[${addType} brand == '${brand}' && references(^._id) && (status in ['published'] || (status == 'scheduled' && defined(published_on) && published_on >= '${now}')) ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{${fieldsString}}
|
|
1703
1706
|
[${start}...${end}]}
|
|
1704
|
-
|order(${sortOrder})
|
|
1707
|
+
|order(${sortOrder})f
|
|
1705
1708
|
}`
|
|
1706
1709
|
return fetchSanity(query, true)
|
|
1707
1710
|
}
|
|
@@ -1751,7 +1754,7 @@ export async function fetchGenreLessons(
|
|
|
1751
1754
|
const query = `{
|
|
1752
1755
|
"entity":
|
|
1753
1756
|
*[_type == 'genre' && name == '${name}']
|
|
1754
|
-
{'type': _type, name, '
|
|
1757
|
+
{'type': _type, name, 'thumbnail':thumbnail_url.asset->url,
|
|
1755
1758
|
'lessons_count': count(*[${addType} brand == '${brand}' && references(^._id)]),
|
|
1756
1759
|
'lessons': *[${addType} brand == '${brand}' && references(^._id) && (status in ['published'] || (status == 'scheduled' && defined(published_on) && published_on >= '${now}')) ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{${fieldsString}}
|
|
1757
1760
|
[${start}...${end}]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|