Authoring Web Component

AlgebraKiT offers a web component that facilitates the creation of AlgebraKiT exercises by authors. This web component can be integrated into your own authoring environment.

Setup

Inserting the web component

The authoring component is a html/javascript component that can be added to a web page with just a few lines of code:

<html>
   <head></head>
   <body>
      ...  <!-- Whatever your page contains... -->

      <!--Insert the authoring component here -->
      <akit-exercise-editor></akit-exercise-editor>

      ...  <!-- Whatever your page contains... -->

      <!--Configure proxy -->
      <script>
            AlgebraKIT = {
                config: {
                    secureProxy: '/algebrakit-secure',
                }
            }
      </script>

      <!--Load frontend API -->
      <script href="https://widgets.algebrakit.eu/akit-widgets.min.js"></script>
   </body>
</html>

Proxy setup

The authoring web component must be able to access the AlgebraKiT web service to test and run exercises. For security reasons, this communication must be handled through a proxy on your backend. This proxy relays incoming traffic to https://algebrakit.eu while adding the x-api-key header with your security token. The example code might clearify how to setup such a proxy.

Getting and setting exercises

You can call the following methods on the akit-exercise-editor element. All methods return a Promise

Method Description
getExercise getExercise(): Promise<ExerciseDefinition>
Resolves with the exercise definition that can be used to create a new session.
updateExercise updateExercise(ex: ExerciseDefinition): Promise<void>
Initialises the authoring components with the given exercise definition.

Configuring the authoring component

Attribute Description
audiences An audience refers to a student profile, which AlgebraKiT uses to adjust language, mathematical notation and solution strategies. This attribute specifies which audiences are available for the author. If ommitted, AlgebraKiT will assume the exercise is intended for a UK student at A-level.
Example: audiences='[ {"name": "Nederlands", "id":"vwo-b"}, {"name": "English", "id": "uk_KS5"}]'
enable‑multiple-questions If set to false, the authoring component cannot be used to generate multipart exercises. A multipart exercise consists of multiple questions, that are indexed with a, b, c, etc. Default value is true.