commons-assessment 12.0.32 → 12.0.34
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/README.md +40 -15
- package/bundles/commons-assessment.umd.js +1065 -173
- package/bundles/commons-assessment.umd.js.map +1 -1
- package/esm2015/lib/commons-assessment.module.js +6 -4
- package/esm2015/lib/modules/assessment-maker/assessment-maker.component.js +119 -19
- package/esm2015/lib/modules/assessment-maker/components/add-edit-section-introduction/add-edit-section-introduction.component.js +1 -1
- package/esm2015/lib/modules/assessment-maker/components/assessment-builder/assessment-builder.component.js +15 -4
- package/esm2015/lib/modules/assessment-maker/components/question-details/question-details.component.js +12 -2
- package/esm2015/lib/modules/assessment-maker/services/assessment-builder.service.js +3 -3
- package/esm2015/lib/modules/assessment-maker/services/assessment-maker.service.js +27 -27
- package/esm2015/lib/modules/assessment-taker/assessment-taker.component.js +221 -35
- package/esm2015/lib/modules/assessment-taker/assessment-taker.module.js +9 -3
- package/esm2015/lib/modules/assessment-taker/components/proctoring-consent/proctoring-consent.component.js +119 -0
- package/esm2015/lib/modules/assessment-taker/components/proctoring-result/proctoring-result.component.js +177 -0
- package/esm2015/lib/modules/assessment-taker/components/question-type-date-picker/question-type-date-picker.component.js +2 -3
- package/esm2015/lib/modules/assessment-taker/components/question-type-editor/question-type-editor.component.js +1 -1
- package/esm2015/lib/modules/assessment-taker/components/question-type-file-upload/question-type-file-upload.component.js +5 -2
- package/esm2015/lib/modules/assessment-taker/components/question-type-long/question-type-long.component.js +1 -1
- package/esm2015/lib/modules/assessment-taker/components/question-type-multiselect/question-type-multiselect.component.js +6 -2
- package/esm2015/lib/modules/assessment-taker/components/question-type-objective/question-type-objective.component.js +6 -2
- package/esm2015/lib/modules/assessment-taker/components/question-type-preference/question-type-preference.component.js +6 -2
- package/esm2015/lib/modules/assessment-taker/components/question-type-short/question-type-short.component.js +78 -8
- package/esm2015/lib/modules/assessment-taker/components/section-instructions/section-instructions.component.js +1 -1
- package/esm2015/lib/modules/assessment-taker/services/assessment-taker.service.js +39 -27
- package/esm2015/lib/modules/assessment-taker/services/proctoring.service.js +109 -0
- package/esm2015/lib/shared/components/confirmation-dialog/confirmation-dialog.component.js +56 -0
- package/esm2015/lib/shared/components/skill-allocation/skill-allocation.component.js +5 -2
- package/esm2015/lib/shared/controllers.js +14 -4
- package/esm2015/lib/shared/interfaces/assessment.interface.js +1 -1
- package/esm2015/lib/shared/interfaces/proctoring.interface.js +2 -0
- package/esm2015/lib/shared/material-modules.js +1 -16
- package/esm2015/lib/shared/shared.module.js +8 -3
- package/fesm2015/commons-assessment.js +985 -138
- package/fesm2015/commons-assessment.js.map +1 -1
- package/lib/commons-assessment.module.d.ts +1 -2
- package/lib/modules/assessment-maker/assessment-maker.component.d.ts +22 -1
- package/lib/modules/assessment-maker/components/assessment-builder/assessment-builder.component.d.ts +4 -0
- package/lib/modules/assessment-maker/components/question-details/question-details.component.d.ts +3 -0
- package/lib/modules/assessment-maker/services/assessment-builder.service.d.ts +2 -2
- package/lib/modules/assessment-maker/services/assessment-maker.service.d.ts +4 -3
- package/lib/modules/assessment-taker/assessment-taker.component.d.ts +40 -2
- package/lib/modules/assessment-taker/assessment-taker.module.d.ts +7 -5
- package/lib/modules/assessment-taker/components/proctoring-consent/proctoring-consent.component.d.ts +48 -0
- package/lib/modules/assessment-taker/components/proctoring-result/proctoring-result.component.d.ts +82 -0
- package/lib/modules/assessment-taker/components/question-type-file-upload/question-type-file-upload.component.d.ts +1 -0
- package/lib/modules/assessment-taker/components/question-type-multiselect/question-type-multiselect.component.d.ts +1 -0
- package/lib/modules/assessment-taker/components/question-type-objective/question-type-objective.component.d.ts +1 -0
- package/lib/modules/assessment-taker/components/question-type-preference/question-type-preference.component.d.ts +1 -0
- package/lib/modules/assessment-taker/components/question-type-short/question-type-short.component.d.ts +14 -2
- package/lib/modules/assessment-taker/services/assessment-taker.service.d.ts +8 -3
- package/lib/modules/assessment-taker/services/proctoring.service.d.ts +34 -0
- package/lib/shared/components/confirmation-dialog/confirmation-dialog.component.d.ts +36 -0
- package/lib/shared/components/skill-allocation/skill-allocation.component.d.ts +1 -0
- package/lib/shared/controllers.d.ts +10 -1
- package/lib/shared/interfaces/assessment.interface.d.ts +2 -0
- package/lib/shared/interfaces/proctoring.interface.d.ts +92 -0
- package/lib/shared/material-modules.d.ts +5 -8
- package/lib/shared/shared.module.d.ts +6 -5
- package/package.json +8 -2
- package/src/lib/assets/images/proctoring.svg +3 -0
- package/src/lib/assets/images/user.svg +3 -0
- package/src/lib/assets/json/imageConfig.json +3 -1
- package/src/lib/assets/json/labelConfig.json +62 -0
- package/src/lib/assets/theme/_theme.global.scss +6 -0
- package/src/lib/assets/theme/_theme.scss +17 -346
- package/src/lib/assets/theme/styles.scss +13 -0
- package/esm2015/lib/configuration.js +0 -4
- package/lib/configuration.d.ts +0 -5
package/README.md
CHANGED
|
@@ -15,57 +15,76 @@ The library uses Bootstrap styles and requires the following modules to be impor
|
|
|
15
15
|
- `AssessmentMakerModule` (If creating assessments)
|
|
16
16
|
- `AssessmentTakerModule` (If rendering assessments)
|
|
17
17
|
|
|
18
|
+
**Proctoring (optional):** if you use the proctoring feature, install the `@proctorlink/sdk` peer dependency (`npm install @proctorlink/sdk`) — it is loaded on demand only when a proctored session starts. Also allow the proctoring enclave in your app's `Content-Security-Policy`: `frame-src https://app-dev.proctorlink.com;`.
|
|
19
|
+
|
|
18
20
|
## Installation & Configuration
|
|
19
21
|
|
|
20
22
|
### 1. Import Modules
|
|
21
23
|
|
|
22
|
-
Import the
|
|
24
|
+
Import the `CommonsAssessmentModule.forRoot()` in your root `app.module.ts` once to register the singleton service providers. Other modules can then import the specific feature modules as needed:
|
|
23
25
|
|
|
24
26
|
```typescript
|
|
25
27
|
import { CommonsAssessmentModule, AssessmentMakerModule, AssessmentTakerModule } from 'commons-assessment';
|
|
26
28
|
|
|
27
29
|
@NgModule({
|
|
28
30
|
imports: [
|
|
29
|
-
CommonsAssessmentModule.forRoot(
|
|
30
|
-
baseURL: 'https://dev.platformcommons.org', // Use your backend API base URL
|
|
31
|
-
}),
|
|
31
|
+
CommonsAssessmentModule.forRoot(), // Import once in root app.module
|
|
32
32
|
AssessmentMakerModule,
|
|
33
33
|
AssessmentTakerModule
|
|
34
34
|
]
|
|
35
35
|
})
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
### 2. Configure
|
|
38
|
+
### 2. Configure HTTP Interceptor (Decoupled base URL)
|
|
39
|
+
|
|
40
|
+
Since the library uses relative paths, you must configure an HTTP Interceptor in your application to detect library API requests (which carry the `X-Library-Source: commons-assessment` header), prepend your backend API base URL, and strip the header before forwarding the request.
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { Injectable } from '@angular/core';
|
|
44
|
+
import { HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
|
45
|
+
|
|
46
|
+
@Injectable()
|
|
47
|
+
export class ApiInterceptor implements HttpInterceptor {
|
|
48
|
+
intercept(req: HttpRequest<any>, next: HttpHandler) {
|
|
49
|
+
let headers = req.headers;
|
|
50
|
+
let url = req.url;
|
|
51
|
+
|
|
52
|
+
if (headers.has('X-Library-Source')) {
|
|
53
|
+
headers = headers.delete('X-Library-Source');
|
|
54
|
+
url = 'https://your-api-domain.org' + url; // Prepend your backend base URL
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
req = req.clone({ url, headers });
|
|
58
|
+
return next.handle(req);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 3. Configure `angular.json`
|
|
39
64
|
|
|
40
65
|
Add the necessary assets and global styles in your `angular.json` file inside the `architect.build.options` block.
|
|
41
66
|
|
|
42
67
|
**Assets:**
|
|
43
|
-
Add the library assets
|
|
68
|
+
Add the library assets to the `assets` array.
|
|
44
69
|
```json
|
|
45
70
|
"assets": [
|
|
46
71
|
{
|
|
47
72
|
"glob": "**/*",
|
|
48
73
|
"input": "node_modules/commons-assessment/src/lib/assets",
|
|
49
74
|
"output": "assets/commons-assessment"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"glob": "**/*",
|
|
53
|
-
"input": "node_modules/@kolkov/angular-editor/assets/icons",
|
|
54
|
-
"output": "assets/ae-icons/"
|
|
55
75
|
}
|
|
56
76
|
]
|
|
57
77
|
```
|
|
58
78
|
|
|
59
79
|
**Styles:**
|
|
60
|
-
Include the library's global styles
|
|
80
|
+
Include the library's global styles in the `styles` array.
|
|
61
81
|
```json
|
|
62
82
|
"styles": [
|
|
63
|
-
"src/styles.scss"
|
|
64
|
-
"node_modules/@kolkov/angular-editor/themes/default.scss"
|
|
83
|
+
"src/styles.scss"
|
|
65
84
|
]
|
|
66
85
|
```
|
|
67
86
|
|
|
68
|
-
###
|
|
87
|
+
### 4. Theming Setup (`styles.scss`)
|
|
69
88
|
|
|
70
89
|
The library provides a mixin to easily customize the theme, including fonts and color variables. Set this up in your application's global `styles.scss`:
|
|
71
90
|
|
|
@@ -142,10 +161,14 @@ export class Component {
|
|
|
142
161
|
| `[predefinedAssessmentInstance]` | `@Input` | `AssessmentInstance` | The default contextual configuration object for creating new assessment instances. |
|
|
143
162
|
| `[minimumRequiredSections]` | `@Input` | `number` | Minimum number of sections needed before assessment can be published. Default is 0. |
|
|
144
163
|
| `[assessmentContext]` | `@Input` | `AssessmentContext` | (Optional) Pre-loaded assessment context data to bypass the initial data load API call. |
|
|
164
|
+
| `[checkForResponses]` | `@Input` | `boolean` | If true, show a warning on deletion of sections and questions if any responses are linked to them. Default is false. |
|
|
165
|
+
| `[showProctoringToggle]` | `@Input` | `boolean` | (Optional) If true, shows a toggle to enable/disable proctoring. Default is false. Works only when partial response submission is allowed. |
|
|
145
166
|
| `(assessmentIdChange)` | `@Output` | `EventEmitter<number>` | Emits the new `assessmentId` when an assessment is successfully created. |
|
|
146
167
|
| `(assessmentInstanceIdChange)` | `@Output` | `EventEmitter<number>` | Emits the new instance ID integer when an assessment is published. |
|
|
147
168
|
| `(snackbarMessage)` | `@Output` | `EventEmitter<{ message: string, type: 'success' \| 'error' \| 'info' }>` | Emits message status updates representing errors and workflow successes from the service. |
|
|
148
169
|
|
|
170
|
+
> **Assessment configuration (e.g. allowing partial responses):** behavioral flags such as allowing partial responses are set via `assessmentConfigs` on the assessment DTO. See [Assessment Configuration](../../documentation/assessment-maker.md#assessment-configuration-assessmentconfigs) in the maker documentation for the available config keys and examples.
|
|
171
|
+
|
|
149
172
|
### Assessment Taker
|
|
150
173
|
|
|
151
174
|
To render the assessment taker interface, use the `<lib-assessment-taker>` component in your template.
|
|
@@ -194,6 +217,8 @@ To render the assessment taker interface, use the `<lib-assessment-taker>` compo
|
|
|
194
217
|
| `[showCorrectAnswers]` | `@Input` | `boolean` | (Optional) Shows correct and incorrect answers for objective and multiselect type questions. Default is false. |
|
|
195
218
|
| `[enableSkillsToQuestionMapping]` | `@Input` | `boolean` | (Optional) Enables ability to map skills to questions. Default is false. |
|
|
196
219
|
| `(stepChanged)` | `@Output` | `EventEmitter<{ currentStepIndex: number, totalSteps: number, isLastStep: boolean }>` | Emits initially and on every step change. Provides the current step index, total steps, and indicating boolean. |
|
|
220
|
+
| `(proctoringConsent)` | `@Output` | `EventEmitter<boolean>` | When the assessment is proctored, a mandatory, non-dismissable consent dialog is shown before the session starts. On consent the button shows a loader while the proctoring session is created/refreshed and the dialog stays open until the API responds. Emits `true` once the candidate consents and the session begins. |
|
|
221
|
+
| `(proctoringSession)` | `@Output` | `EventEmitter<ProctoringSession>` | Emits the proctoring session issued on consent. |
|
|
197
222
|
| `(submitAssessment)` | `@Output` | `EventEmitter<{ assesseeId: number, completed: boolean }>` | Emits when the assessment is submitted, containing the `assesseeId` and a `completed` flag indicating if the taker finished the entire assessment. |
|
|
198
223
|
| `(snackbarMessage)` | `@Output` | `EventEmitter<{ message: string, type: 'success' \| 'error' \| 'info' }>` | Emits message status updates representing errors and workflow successes from the service. |
|
|
199
224
|
|