Learning Plugin

commercetools learning gatsby plugin

A gatsby theme plugins providing UI components and helper utilities to integrate self-learning functionality.

Works against commercetools' learning-api, which is not a part of this open source project.

Configuration

gatsby-theme-learning plugin expects the following parameters and also needs the gatsby-theme-sso-ui-kit

  • auth0Domain: the auth0 application domain url (it is defined in the auth0 management app)
  • learnApiBaseUrl: the learn API base url. It can be omitted if the host running the site matches the api host.
  • features: an array of strings representing feature flags used to toggle specific functionalities. Expected values:
    • status-indicator: feature flag to toggle the course status indicator.

In order to enable the plugin, the following configuration should be added to the gatsby-config.js plugin section:

{
resolve: '@commercetools-docs/gatsby-theme-learning',
options: {
auth0Domain: 'auth0domain.dummy.tld',
learnApiBaseUrl: 'https://api.host.tld',
},
}

Components

Quiz

Quiz component can be used in any mdx page. It's responsible for fetching, rendering and handling all the interaction logic of a quiz answer submission. The component simply renders a login CTA if the user is not logged in, otherwise the quiz is rendered.

The component expects 2 mandatory props:

  • courseId: Id of the course defined in the LMS
  • quizId: Id of the quiz defined in the LMS

Example

you write:md
<Quiz courseId="5565" quizId="85065"/>