musora-content-services 2.106.1 → 2.107.2

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 (167) hide show
  1. package/.claude/settings.local.json +19 -0
  2. package/.coderabbit.yaml +0 -0
  3. package/.editorconfig +0 -0
  4. package/.github/pull_request_template.md +0 -0
  5. package/.github/workflows/conventional-commits.yaml +0 -0
  6. package/.github/workflows/docs.js.yml +0 -0
  7. package/.github/workflows/node.js.yml +0 -0
  8. package/.prettierignore +0 -0
  9. package/.prettierrc +0 -0
  10. package/CHANGELOG.md +17 -0
  11. package/CLAUDE.md +0 -0
  12. package/README.md +0 -0
  13. package/babel.config.cjs +0 -0
  14. package/jest.config.js +0 -0
  15. package/jsdoc.json +0 -0
  16. package/package.json +1 -1
  17. package/src/constants/award-assets.js +0 -0
  18. package/src/contentMetaData.js +0 -0
  19. package/src/index.d.ts +2 -4
  20. package/src/index.js +2 -4
  21. package/src/infrastructure/http/HttpClient.ts +4 -3
  22. package/src/infrastructure/http/executors/FetchRequestExecutor.ts +0 -0
  23. package/src/infrastructure/http/index.ts +0 -0
  24. package/src/infrastructure/http/interfaces/HeaderProvider.ts +0 -0
  25. package/src/infrastructure/http/interfaces/HttpError.ts +0 -0
  26. package/src/infrastructure/http/interfaces/NetworkError.ts +0 -0
  27. package/src/infrastructure/http/interfaces/RequestExecutor.ts +0 -0
  28. package/src/infrastructure/http/interfaces/RequestOptions.ts +0 -0
  29. package/src/infrastructure/http/providers/DefaultHeaderProvider.ts +0 -0
  30. package/src/lib/brands.ts +0 -0
  31. package/src/lib/lastUpdated.js +0 -0
  32. package/src/services/api/types.js +0 -0
  33. package/src/services/api/types.ts +0 -0
  34. package/src/services/awards/internal/.indexignore +0 -0
  35. package/src/services/awards/internal/award-events.js +0 -0
  36. package/src/services/awards/internal/completion-data-generator.js +0 -0
  37. package/src/services/awards/internal/content-progress-observer.js +0 -0
  38. package/src/services/awards/internal/image-utils.js +0 -0
  39. package/src/services/awards/internal/message-generator.js +0 -0
  40. package/src/services/awards/internal/types.js +0 -0
  41. package/src/services/config.js +0 -0
  42. package/src/services/content/content.ts +0 -0
  43. package/src/services/content-org/content-org.js +0 -0
  44. package/src/services/content-org/guided-courses.ts +1 -1
  45. package/src/services/content-org/learning-paths.ts +1 -1
  46. package/src/services/content-org/playlists-types.js +0 -0
  47. package/src/services/content-org/playlists.js +1 -1
  48. package/src/services/contentLikes.js +0 -0
  49. package/src/services/dataContext.js +0 -0
  50. package/src/services/dateUtils.js +0 -0
  51. package/src/services/eventsAPI.js +0 -0
  52. package/src/services/forums/categories.ts +0 -0
  53. package/src/services/forums/posts.ts +0 -0
  54. package/src/services/forums/types.ts +0 -0
  55. package/src/services/gamification/awards.ts +0 -0
  56. package/src/services/gamification/gamification.js +0 -0
  57. package/src/services/imageSRCBuilder.js +0 -0
  58. package/src/services/imageSRCVerify.js +0 -0
  59. package/src/services/liveTesting.ts +0 -0
  60. package/src/services/permissions/PermissionsAdapter.ts +0 -0
  61. package/src/services/permissions/PermissionsAdapterFactory.ts +0 -0
  62. package/src/services/permissions/PermissionsV1Adapter.ts +0 -0
  63. package/src/services/permissions/README.md +0 -0
  64. package/src/services/permissions/index.ts +0 -0
  65. package/src/services/recommendations.js +1 -1
  66. package/src/services/reporting/README.md +0 -0
  67. package/src/services/reporting/reporting.ts +0 -0
  68. package/src/services/reporting/types.ts +0 -0
  69. package/src/services/sanity.js +4 -4
  70. package/src/services/sentry/.indexignore +0 -0
  71. package/src/services/sentry/index.ts +0 -0
  72. package/src/services/sync/.indexignore +0 -0
  73. package/src/services/sync/adapters/factory.ts +0 -0
  74. package/src/services/sync/adapters/lokijs.ts +0 -0
  75. package/src/services/sync/adapters/sqlite.ts +0 -0
  76. package/src/services/sync/concurrency-safety.ts +0 -0
  77. package/src/services/sync/context/index.ts +0 -0
  78. package/src/services/sync/context/providers/base.ts +0 -0
  79. package/src/services/sync/context/providers/connectivity.ts +0 -0
  80. package/src/services/sync/context/providers/durability.ts +0 -0
  81. package/src/services/sync/context/providers/index.ts +0 -0
  82. package/src/services/sync/context/providers/session.ts +0 -0
  83. package/src/services/sync/context/providers/tabs.ts +0 -0
  84. package/src/services/sync/context/providers/visibility.ts +0 -0
  85. package/src/services/sync/database/factory.ts +0 -0
  86. package/src/services/sync/errors/boundary.ts +0 -0
  87. package/src/services/sync/index.ts +0 -0
  88. package/src/services/sync/models/Base.ts +0 -0
  89. package/src/services/sync/models/index.ts +0 -0
  90. package/src/services/sync/repositories/base.ts +0 -0
  91. package/src/services/sync/repositories/content-likes.ts +0 -0
  92. package/src/services/sync/repositories/index.ts +0 -0
  93. package/src/services/sync/repositories/practice-day-notes.ts +0 -0
  94. package/src/services/sync/repositories/practices.ts +0 -0
  95. package/src/services/sync/repository-proxy.ts +0 -0
  96. package/src/services/sync/resolver.ts +0 -0
  97. package/src/services/sync/run-scope.ts +0 -0
  98. package/src/services/sync/serializers/index.ts +0 -0
  99. package/src/services/sync/serializers/model.ts +0 -0
  100. package/src/services/sync/serializers/raw.ts +0 -0
  101. package/src/services/sync/store/push-coalescer.ts +0 -0
  102. package/src/services/sync/store-configs.ts +0 -0
  103. package/src/services/sync/strategies/base.ts +0 -0
  104. package/src/services/sync/strategies/index.ts +0 -0
  105. package/src/services/sync/strategies/initial.ts +0 -0
  106. package/src/services/sync/strategies/polling.ts +0 -0
  107. package/src/services/sync/telemetry/index.ts +0 -0
  108. package/src/services/sync/telemetry/sampling.ts +0 -0
  109. package/src/services/sync/utils/event-emitter.ts +0 -0
  110. package/src/services/sync/utils/index.ts +0 -0
  111. package/src/services/sync/utils/throttle.ts +0 -0
  112. package/src/services/sync/utils/timers.ts +0 -0
  113. package/src/services/types.js +0 -0
  114. package/src/services/user/account.ts +0 -0
  115. package/src/services/user/chat.js +1 -1
  116. package/src/services/user/interests.js +1 -1
  117. package/src/services/user/management.js +1 -1
  118. package/src/services/user/notifications.js +1 -1
  119. package/src/services/user/payments.ts +0 -0
  120. package/src/services/user/permissions.js +0 -0
  121. package/src/services/user/profile.js +1 -1
  122. package/src/services/user/sessions.js +25 -33
  123. package/src/services/user/types.js +6 -0
  124. package/src/services/user/user-management-system.js +0 -0
  125. package/src/services/userActivity.js +29 -10
  126. package/test/HttpClient.test.js +0 -0
  127. package/test/awards/award-alacarte-observer.test.js +0 -0
  128. package/test/awards/award-auto-refresh.test.js +0 -0
  129. package/test/awards/award-calculations.test.js +0 -0
  130. package/test/awards/award-certificate-display.test.js +0 -0
  131. package/test/awards/award-collection-edge-cases.test.js +0 -0
  132. package/test/awards/award-collection-filtering.test.js +0 -0
  133. package/test/awards/award-exclusion-handling.test.js +0 -0
  134. package/test/awards/award-multi-lesson.test.js +0 -0
  135. package/test/awards/award-observer-integration.test.js +0 -0
  136. package/test/awards/award-query-messages.test.js +0 -0
  137. package/test/awards/award-user-collection.test.js +0 -0
  138. package/test/awards/duplicate-prevention.test.js +0 -0
  139. package/test/awards/helpers/completion-mock.js +0 -0
  140. package/test/awards/helpers/index.js +0 -0
  141. package/test/awards/helpers/mock-setup.js +0 -0
  142. package/test/awards/helpers/progress-emitter.js +0 -0
  143. package/test/awards/message-generator.test.js +0 -0
  144. package/test/content.test.js +0 -0
  145. package/test/contentLikes.test.js +0 -0
  146. package/test/contentProgress.test.js +0 -0
  147. package/test/dataContext.test.js +0 -0
  148. package/test/forum.test.js +0 -0
  149. package/test/imageSRCBuilder.test.js +0 -0
  150. package/test/imageSRCVerify.test.js +0 -0
  151. package/test/lib/lastUpdated.test.js +0 -0
  152. package/test/live/contentProgressLive.test.js +0 -0
  153. package/test/live/railcontentLive.test.js +0 -0
  154. package/test/localStorageMock.js +0 -0
  155. package/test/log.js +0 -0
  156. package/test/mockData/award-definitions.js +0 -0
  157. package/test/mockData/mockData_fetchByRailContentIds_one_content.json +0 -0
  158. package/test/mockData/mockData_progress_content.json +0 -0
  159. package/test/mockData/mockData_sanity_progress_content.json +0 -0
  160. package/test/mockData/mockData_user_practices.json +0 -0
  161. package/test/notifications.test.js +0 -0
  162. package/test/progressRows.test.js +0 -0
  163. package/test/streakMessage.test.js +0 -0
  164. package/test/sync/models/award-database-integration.test.js +0 -0
  165. package/test/user/permissions.test.js +0 -0
  166. package/test/userActivity.test.js +0 -0
  167. package/tools/generate-index.cjs +0 -0
@@ -0,0 +1,19 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(find:*)",
5
+ "Bash(docker exec:*)",
6
+ "Bash(npm test:*)",
7
+ "WebSearch",
8
+ "WebFetch(domain:watermelondb.dev)",
9
+ "WebFetch(domain:github.com)",
10
+ "Bash(git checkout:*)",
11
+ "Bash(npm run doc:*)",
12
+ "Bash(cat:*)",
13
+ "Bash(tr:*)",
14
+ "Bash(npm run build-index:*)"
15
+ ],
16
+ "deny": [],
17
+ "ask": []
18
+ }
19
+ }
package/.coderabbit.yaml CHANGED
File without changes
package/.editorconfig CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
package/.prettierignore CHANGED
File without changes
package/.prettierrc CHANGED
File without changes
package/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
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.107.2](https://github.com/railroadmedia/musora-content-services/compare/v2.107.1...v2.107.2) (2025-12-19)
6
+
7
+ ### [2.107.1](https://github.com/railroadmedia/musora-content-services/compare/v2.107.0...v2.107.1) (2025-12-19)
8
+
9
+ ## [2.107.0](https://github.com/railroadmedia/musora-content-services/compare/v2.105.0...v2.107.0) (2025-12-19)
10
+
11
+
12
+ ### Features
13
+
14
+ * Add some validators prior to writing to watermelon ([#663](https://github.com/railroadmedia/musora-content-services/issues/663)) ([9eeedac](https://github.com/railroadmedia/musora-content-services/commit/9eeedac5a3cf8b4eedd091fcb8252ffd5bae6c85))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * 401 authentication errors for mobile app by reading token lazily from globalConfig at request time instead of at HttpClient instantiation ([99204b3](https://github.com/railroadmedia/musora-content-services/commit/99204b317c806ef8bec6f0846059c82fc7f3b585))
20
+ * Restricted access in recent activities ([7013794](https://github.com/railroadmedia/musora-content-services/commit/7013794f235f350eb30833bf0680bb7bb851af10))
21
+
5
22
  ### [2.106.1](https://github.com/railroadmedia/musora-content-services/compare/v2.106.0...v2.106.1) (2025-12-18)
6
23
 
7
24
  ## [2.106.0](https://github.com/railroadmedia/musora-content-services/compare/v2.105.0...v2.106.0) (2025-12-18)
package/CLAUDE.md CHANGED
File without changes
package/README.md CHANGED
File without changes
package/babel.config.cjs CHANGED
File without changes
package/jest.config.js CHANGED
File without changes
package/jsdoc.json CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.106.1",
3
+ "version": "2.107.2",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
File without changes
File without changes
package/src/index.d.ts CHANGED
@@ -396,9 +396,8 @@ import {
396
396
  } from './services/user/profile.js';
397
397
 
398
398
  import {
399
- getAuthKey,
399
+ generateAuthSessionUrl,
400
400
  login,
401
- loginWithAuthKey,
402
401
  logout
403
402
  } from './services/user/sessions.js';
404
403
 
@@ -580,13 +579,13 @@ declare module 'musora-content-services' {
580
579
  fetchUserPractices,
581
580
  findIncompleteLesson,
582
581
  followThread,
582
+ generateAuthSessionUrl,
583
583
  getActiveDiscussions,
584
584
  getActivePath,
585
585
  getAllCompleted,
586
586
  getAllCompletedByIds,
587
587
  getAllStarted,
588
588
  getAllStartedOrCompleted,
589
- getAuthKey,
590
589
  getAwardStatistics,
591
590
  getCompletedAwards,
592
591
  getContentAwards,
@@ -650,7 +649,6 @@ declare module 'musora-content-services' {
650
649
  likePost,
651
650
  lockThread,
652
651
  login,
653
- loginWithAuthKey,
654
652
  logout,
655
653
  mapContentToParent,
656
654
  markAllNotificationsAsRead,
package/src/index.js CHANGED
@@ -400,9 +400,8 @@ import {
400
400
  } from './services/user/profile.js';
401
401
 
402
402
  import {
403
- getAuthKey,
403
+ generateAuthSessionUrl,
404
404
  login,
405
- loginWithAuthKey,
406
405
  logout
407
406
  } from './services/user/sessions.js';
408
407
 
@@ -579,13 +578,13 @@ export {
579
578
  fetchUserPractices,
580
579
  findIncompleteLesson,
581
580
  followThread,
581
+ generateAuthSessionUrl,
582
582
  getActiveDiscussions,
583
583
  getActivePath,
584
584
  getAllCompleted,
585
585
  getAllCompletedByIds,
586
586
  getAllStarted,
587
587
  getAllStartedOrCompleted,
588
- getAuthKey,
589
588
  getAwardStatistics,
590
589
  getCompletedAwards,
591
590
  getContentAwards,
@@ -649,7 +648,6 @@ export {
649
648
  likePost,
650
649
  lockThread,
651
650
  login,
652
- loginWithAuthKey,
653
651
  logout,
654
652
  mapContentToParent,
655
653
  markAllNotificationsAsRead,
@@ -74,9 +74,10 @@ export class HttpClient {
74
74
  headers['Data-Version'] = dataVersion
75
75
  }
76
76
 
77
- // Add auth token if available
78
- if (this.token) {
79
- headers['Authorization'] = `Bearer ${this.token}`
77
+ // Add auth token if available (check both instance token and global config)
78
+ const token = this.token || globalConfig?.sessionConfig?.token || null
79
+ if (token) {
80
+ headers['Authorization'] = `Bearer ${token}`
80
81
  }
81
82
 
82
83
  return headers
File without changes
File without changes
package/src/lib/brands.ts 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
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @module GuidedCourses
3
3
  */
4
- import { GET, POST } from '../../infrastructure/http/HttpClient.js'
4
+ import { GET, POST } from '../../infrastructure/http/HttpClient.ts'
5
5
  import { contentStatusStarted, getProgressState } from '../contentProgress.js'
6
6
  import './playlists-types.js'
7
7
 
@@ -2,7 +2,7 @@
2
2
  * @module LearningPaths
3
3
  */
4
4
 
5
- import { GET, POST } from '../../infrastructure/http/HttpClient.js'
5
+ import { GET, POST } from '../../infrastructure/http/HttpClient.ts'
6
6
  import { fetchByRailContentId, fetchByRailContentIds, fetchMethodV2Structure } from '../sanity.js'
7
7
  import { addContextToLearningPaths } from '../contentAggregator.js'
8
8
  import {
File without changes
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @module Playlists
3
3
  */
4
- import { GET, POST, PUT, DELETE } from '../../infrastructure/http/HttpClient.js'
4
+ import { GET, POST, PUT, DELETE } from '../../infrastructure/http/HttpClient.ts'
5
5
  import { getNavigateToForPlaylists } from '../contentAggregator.js'
6
6
  import './playlists-types.js'
7
7
 
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
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import { globalConfig } from './config.js'
6
- import { GET, HttpClient } from '../infrastructure/http/HttpClient.js'
6
+ import { GET, HttpClient } from '../infrastructure/http/HttpClient.ts'
7
7
 
8
8
  /**
9
9
  * Exported functions that are excluded from index generation.
File without changes
File without changes
File without changes
@@ -24,7 +24,7 @@ import {
24
24
  } from '../contentTypeConfig.js'
25
25
  import { fetchSimilarItems } from './recommendations.js'
26
26
  import { processMetadata } from '../contentMetaData.js'
27
- import { GET } from '../infrastructure/http/HttpClient.js'
27
+ import { GET } from '../infrastructure/http/HttpClient.ts'
28
28
 
29
29
  import { globalConfig } from './config.js'
30
30
 
@@ -457,7 +457,8 @@ export async function fetchByRailContentIds(
457
457
  ids,
458
458
  contentType = undefined,
459
459
  brand = undefined,
460
- includePermissionsAndStatusFilter = false
460
+ includePermissionsAndStatusFilter = false,
461
+ filterOptions = {}
461
462
  ) {
462
463
  if (!ids?.length) {
463
464
  return []
@@ -471,7 +472,7 @@ export async function fetchByRailContentIds(
471
472
  const fields = await getFieldsForContentTypeWithFilteredChildren(contentType, true)
472
473
  const baseFilter = `railcontent_id in [${idsString}]${brandFilter}`
473
474
  const finalFilter = includePermissionsAndStatusFilter
474
- ? await new FilterBuilder(baseFilter).buildFilter()
475
+ ? await new FilterBuilder(baseFilter, filterOptions).buildFilter()
475
476
  : baseFilter
476
477
  const query = `*[
477
478
  ${finalFilter}
@@ -509,7 +510,6 @@ export async function fetchByRailContentIds(
509
510
 
510
511
  // Sort results to match the order of the input IDs
511
512
  const sortedResults = results?.sort(sortFuction) ?? null
512
-
513
513
  return sortedResults
514
514
  }
515
515
 
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
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
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
@@ -1,4 +1,4 @@
1
- import { GET } from '../../infrastructure/http/HttpClient.js'
1
+ import { GET } from '../../infrastructure/http/HttpClient.ts'
2
2
 
3
3
  /**
4
4
  * @module UserChat
@@ -2,7 +2,7 @@
2
2
  * @module Interests
3
3
  */
4
4
  import { globalConfig } from '../config.js'
5
- import { GET, POST, DELETE } from '../../infrastructure/http/HttpClient.js'
5
+ import { GET, POST, DELETE } from '../../infrastructure/http/HttpClient.ts'
6
6
  import './types.js'
7
7
 
8
8
  const baseUrl = `/api/user-management-system`
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @module UserManagement
3
3
  */
4
- import { GET, POST, PUT, DELETE } from '../../infrastructure/http/HttpClient.js'
4
+ import { GET, POST, PUT, DELETE } from '../../infrastructure/http/HttpClient.ts'
5
5
  import { globalConfig } from '../config.js'
6
6
  import './types.js'
7
7
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @module UserNotifications
3
3
  */
4
- import { GET, PUT, DELETE } from '../../infrastructure/http/HttpClient.js'
4
+ import { GET, PUT, DELETE } from '../../infrastructure/http/HttpClient.ts'
5
5
  import eventsAPI from '../eventsAPI.js'
6
6
  import './types.js'
7
7
  import {globalConfig} from "../config";
File without changes
File without changes
@@ -2,7 +2,7 @@
2
2
  * @module UserProfile
3
3
  */
4
4
  import { globalConfig } from '../config.js'
5
- import { GET, DELETE } from '../../infrastructure/http/HttpClient.js'
5
+ import { GET, DELETE } from '../../infrastructure/http/HttpClient.ts'
6
6
  import { calculateLongestStreaks } from '../userActivity.js'
7
7
  import './types.js'
8
8
 
@@ -98,50 +98,42 @@ export async function logout() {
98
98
  }
99
99
 
100
100
  /**
101
- * @param {string|null} brand - Optional brand parameter (drumeo, pianote, guitareo, singeo)
102
- * @returns {Promise<{data: string}>} Temporary auth key valid for 5 minutes
101
+ * @param {number} userId
102
+ * @param {string} redirectTo
103
+ * @returns {Promise<string>}
103
104
  *
104
105
  * @example
105
- * getAuthKey('drumeo')
106
- * .then(response => {
107
- * const authKey = response.data
108
- * const webViewUrl = `https://app.musora.com/page?user_id=${userId}&auth_key=${authKey}`
109
- * })
110
- * .catch(error => console.error(error));
106
+ * const authUrl = await generateAuthSessionUrl(592656, 'https://app.musora.com/drumeo')
111
107
  */
112
- export async function getAuthKey(brand = null) {
108
+ export async function generateAuthSessionUrl(userId, redirectTo) {
113
109
  const baseUrl = `${globalConfig.baseUrl}/api/user-management-system`
114
- const url = brand ? `${baseUrl}/v1/auth-key?brand=${brand}` : `${baseUrl}/v1/auth-key`
115
110
 
116
- const response = await fetch(url, {
111
+ const headers = {
112
+ 'Content-Type': 'application/json',
113
+ }
114
+
115
+ if (globalConfig.isMA) {
116
+ headers.Authorization = `Bearer ${globalConfig.sessionConfig.authToken}`
117
+ }
118
+
119
+ const response = await fetch(`${baseUrl}/v1/auth-key`, {
117
120
  method: 'GET',
118
- headers: {
119
- Authorization: `Bearer 503154|sArOCAtYT3ejVnCdoZTj8ocEfQbfDWi5GTTtooQ107d93d29`,
120
- 'Content-Type': 'application/json',
121
- },
121
+ headers,
122
+ credentials: globalConfig.isMA ? undefined : 'include',
122
123
  })
123
124
 
124
125
  if (!response.ok) {
125
- throw new Error(`Failed to get auth key: ${response.status}`)
126
+ throw new Error(`Failed to generate auth key: ${response.status}`)
126
127
  }
127
128
 
128
- return response.json()
129
- }
129
+ const authKeyResponse = await response.json()
130
+ const authKey = authKeyResponse.data || authKeyResponse.auth_key
130
131
 
131
- export async function loginWithAuthKey(userId, authKey, deviceName, deviceToken, platform) {
132
- const baseUrl = `${globalConfig.baseUrl}/api/user-management-system`
133
- return fetch(`${baseUrl}/v1/sessions/auth-key`, {
134
- method: 'POST',
135
- headers: {
136
- 'Content-Type': 'application/json',
137
- Authorization: null,
138
- },
139
- body: JSON.stringify({
140
- user_id: userId,
141
- auth_key: authKey,
142
- device_name: deviceName,
143
- device_token: deviceToken,
144
- platform: platform,
145
- }),
132
+ const params = new URLSearchParams({
133
+ user_id: userId.toString(),
134
+ auth_key: authKey,
135
+ redirect_to: redirectTo,
146
136
  })
137
+
138
+ return `${baseUrl}/v1/sessions/auth-key?${params.toString()}`
147
139
  }
@@ -107,6 +107,12 @@
107
107
  * @property {User} user
108
108
  */
109
109
 
110
+ /**
111
+ * @typedef {Object} AuthKeyResponse
112
+ * @property {number} user_id
113
+ * @property {string} auth_key
114
+ */
115
+
110
116
  /**
111
117
  * @typedef {Object} UserPermissions
112
118
  *
File without changes
@@ -8,7 +8,7 @@ import {
8
8
  fetchUserPracticeNotes,
9
9
  fetchRecentUserActivities,
10
10
  } from './railcontent'
11
- import { GET, POST, PUT, DELETE } from '../infrastructure/http/HttpClient.js'
11
+ import { GET, POST, PUT, DELETE } from '../infrastructure/http/HttpClient.ts'
12
12
  import { DataContext, UserActivityVersionKey } from './dataContext.js'
13
13
  import {
14
14
  fetchByRailContentId,
@@ -539,14 +539,26 @@ export async function getPracticeNotes(date) {
539
539
  export async function getRecentActivity({ page = 1, limit = 5, tabName = null } = {}) {
540
540
  const recentActivityData = await fetchRecentUserActivities({ page, limit, tabName })
541
541
  const contentIds = recentActivityData.data.map((p) => p.contentId).filter((id) => id !== null)
542
- const contents = await addContextToContent(fetchByRailContentIds, contentIds, {
543
- addNavigateTo: true,
544
- addNextLesson: true,
545
- })
542
+
543
+ const contents = await addContextToContent(
544
+ fetchByRailContentIds,
545
+ contentIds,
546
+ 'progress-tracker',
547
+ undefined,
548
+ true,
549
+ { bypassPermissions: true },
550
+ {
551
+ addNavigateTo: true,
552
+ addNextLesson: true,
553
+ }
554
+ )
555
+
546
556
  recentActivityData.data = recentActivityData.data.map((practice) => {
547
557
  const content = contents?.find((c) => c.id === practice.contentId) || {}
548
558
  return {
549
559
  ...practice,
560
+ thumbnail: content.thumbnail,
561
+ title: content.title,
550
562
  parent_id: content.parent_id || null,
551
563
  navigateTo: content.navigateTo,
552
564
  }
@@ -796,10 +808,18 @@ export async function calculateLongestStreaks(userId = globalConfig.sessionConfi
796
808
 
797
809
  async function formatPracticeMeta(practices = []) {
798
810
  const contentIds = practices.map((p) => p.content_id).filter((id) => id !== null)
799
- const contents = await addContextToContent(fetchByRailContentIds, contentIds, {
800
- addNavigateTo: true,
801
- addNextLesson: true,
802
- })
811
+ const contents = await addContextToContent(
812
+ fetchByRailContentIds,
813
+ contentIds,
814
+ 'progress-tracker',
815
+ undefined,
816
+ true,
817
+ { bypassPermissions: true },
818
+ {
819
+ addNavigateTo: true,
820
+ addNextLesson: true,
821
+ }
822
+ )
803
823
 
804
824
  return practices.map((practice) => {
805
825
  const content =
@@ -1111,7 +1131,6 @@ async function processContentItem(content) {
1111
1131
  ctaText = 'Revisit Show'
1112
1132
  }
1113
1133
  }
1114
- console.log('Progress Timestamp', content.progressTimestamp)
1115
1134
  return {
1116
1135
  id: content.id,
1117
1136
  progressType: 'content',
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
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/test/log.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