LearningPaths

Methods

(async, inner) completeLearningPathIntroVideo(introVideoId, learningPathId, lessonsToImport, brand) → {Promise.<Array>|Promise.<(Object|null)>|Promise.<void>|Promise.<Array.<Object>>|Promise.<(Object|null)>}

Description:
  • Handles completion of learning path intro video and other related actions.
Source:
Parameters:
Name Type Description
introVideoId The learning path intro video content ID.
learningPathId The content_id of the learning path that this learning path intro video belongs to.
lessonsToImport content ids for all lessons with progress found during intro video progress check. empty if user chose not to keep learning path progress.
brand
Returns:
  • response - The response object.
    Type
    Promise.<Array>
  • response.intro_video_response - The intro video completion response or null if already completed.
    Type
    Promise.<(Object|null)>
  • response.learning_path_reset_response - The reset learning path response.
    Type
    Promise.<void>
  • response.lesson_import_response - The responses for completing each content_id within the learning path.
    Type
    Promise.<Array.<Object>>
  • response.update_dailies_response - The updated daily session if it was changed.
    Type
    Promise.<(Object|null)>

(async, inner) completeMethodIntroVideo(introVideoId, brand) → {Promise.<Array>|Promise.<(Object|null)>|Promise.<Object>}

Description:
  • Handles completion of method intro video and other related actions.
Source:
Parameters:
Name Type Description
introVideoId The method intro video content ID.
brand
Returns:
  • response - The response object.
    Type
    Promise.<Array>
  • response.intro_video_response - The intro video completion response or null if already completed.
    Type
    Promise.<(Object|null)>
  • response.active_path_response - The set active learning path response.
    Type
    Promise.<Object>

(async, inner) fetchLearningPathLessons(learningPathId, brand, userDate) → {Promise.<Object>|number|string|string|Array|boolean|number|string|Array|Array|Array|number|Array|Array|number}

Description:
  • Fetches and organizes learning path lessons.
Source:
Parameters:
Name Type Description
learningPathId number The learning path ID.
brand string
userDate Date Users local date - format 2025-10-31
Returns:
  • result - The result object.
    Type
    Promise.<Object>
  • result.id - The learning path ID.
    Type
    number
  • result.thumbnail - Optional thumbnail URL for the learning path.
    Type
    string
  • result.title - The title of the learning path.
    Type
    string
  • result.children - Array of all lessons.
    Type
    Array
  • result.is_active_learning_path - Whether the learning path is currently active.
    Type
    boolean
  • result.active_learning_path_id - The active learning path ID from daily session.
    Type
    number
  • result.active_learning_path_created_at - The datetime the learning path was set as active.
    Type
    string
  • result.upcoming_lessons - Array of upcoming lessons.
    Type
    Array
  • result.learning_path_dailies - Array of today's dailies in this learning path.
    Type
    Array
  • result.next_learning_path_dailies - Array of today's dailies in the next learning path.
    Type
    Array
  • result.next_learning_path_id - the next learning path (after the active path).
    Type
    number
  • result.completed_lessons - Array of completed lessons in this learning path.
    Type
    Array
  • result.previous_learning_path_dailies - Array of today's dailies in the previous learning path.
    Type
    Array
  • result.previous_learning_path_id - the previous learning path (before the active path)
    Type
    number

(async, inner) fetchLearningPathProgressCheckLessons(contentIds) → {Promise.<Array.<number>>}

Description:
  • For an array of contentIds, fetch any content progress with state=completed, including other learning paths and a la carte progress.
Source:
Parameters:
Name Type Description
contentIds Array.<number> The array of content IDs within the learning path
Returns:
Array with completed content IDs
Type
Promise.<Array.<number>>

(async, inner) getActivePath(brand, forceRefresh)

Description:
  • Gets user's active learning path.
Source:
Parameters:
Name Type Default Description
brand
forceRefresh false force cache refresh

(async, inner) getDailySession(brand, userDate, forceRefresh)

Description:
  • Gets today's daily session for the user. If the daily session doesn't exist, it will be created.
Source:
Parameters:
Name Type Default Description
brand
userDate local datetime. must have date and time - format 2025-10-31T13:45:00
forceRefresh false force cache refresh

(async, inner) getEnrichedLearningPath(learningPathId) → {Promise.<Object>}

Description:
  • Returns learning path with lessons and progress data
Source:
Parameters:
Name Type Description
learningPathId number The learning path ID
Returns:
Learning path with enriched lesson data
Type
Promise.<Object>

(async, inner) getEnrichedLearningPaths(learningPathIds) → {Promise.<Object>}

Description:
  • Returns learning paths with lessons and progress data
Source:
Parameters:
Name Type Description
learningPathIds Array.<number> The learning path IDs
Returns:
Learning paths with enriched lesson data
Type
Promise.<Object>

(async, inner) getLearningPathLessonsByIds(contentIds, learningPathId) → {Promise.<Array>}

Description:
  • Get specific learning path lessons by content IDs
Source:
Parameters:
Name Type Description
contentIds Array.<number> Array of content IDs to filter
learningPathId number The learning path ID
Returns:
Filtered lessons
Type
Promise.<Array>

(inner) mapContentToParent(lessons, options)

Description:
  • Maps content to its parent learning path - fixes multi-parent problems for cta when lessons have a special collection.
Source:
Parameters:
Name Type Description
lessons sanity documents
options
Properties
Name Type Description
lessonType
parentContentId

(async, inner) resetAllLearningPaths()

Description:
  • Resets the user's learning path.
Source:

(async, inner) startLearningPath(brand, learningPathId)

Description:
  • Sets a new learning path as the user's active learning path.
Source:
Parameters:
Name Type Description
brand
learningPathId

(async, inner) updateDailySession(brand, userDate, keepFirstLearningPath)

Description:
  • Updates the daily session for the user. Optionally, keeps the first learning path's dailies from a matching day's session.
Source:
Parameters:
Name Type Default Description
brand
userDate format 2025-10-31
keepFirstLearningPath false