@coorpacademy/app-review 0.1.21-alpha.12 → 0.1.21-alpha.8
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/es/services/index.js +3 -5
- package/es/test/util/services.mock.js +1 -66
- package/es/types/common.d.ts +0 -1
- package/lib/services/index.js +3 -5
- package/lib/test/util/services.mock.js +1 -67
- package/lib/types/common.d.ts +0 -1
- package/package.json +3 -3
- package/src/services/index.ts +3 -5
- package/src/test/util/services.mock.ts +1 -68
- package/src/types/common.ts +0 -6
package/es/services/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { fetchCorrection } from './fetch-correction';
|
|
2
1
|
import { fetchSkills } from './fetch-skills';
|
|
2
|
+
import { postProgression } from './post-progression';
|
|
3
3
|
import { fetchSlide } from './fetch-slide';
|
|
4
4
|
import { postAnswer } from './post-answer';
|
|
5
|
-
import { postProgression } from './post-progression';
|
|
6
5
|
export const getServices = () => ({
|
|
7
|
-
fetchCorrection,
|
|
8
6
|
fetchSkills,
|
|
9
7
|
fetchSlide,
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
postProgression,
|
|
9
|
+
postAnswer
|
|
12
10
|
});
|
|
@@ -330,70 +330,6 @@ export const progressionSlideWithPendingSlide = {
|
|
|
330
330
|
stars: 32
|
|
331
331
|
}
|
|
332
332
|
};
|
|
333
|
-
const getChoicesCorrection = (ref, wrongChoice = false) => {
|
|
334
|
-
switch (ref) {
|
|
335
|
-
case qcmSlide.universalRef: {
|
|
336
|
-
const correctAnswer = [get('question.content.choices.0.label', qcmSlide)];
|
|
337
|
-
return {
|
|
338
|
-
correctAnswer,
|
|
339
|
-
corrections: wrongChoice
|
|
340
|
-
? [
|
|
341
|
-
{
|
|
342
|
-
answer: get('question.content.choices.2.label', qcmSlide),
|
|
343
|
-
isCorrect: false
|
|
344
|
-
}
|
|
345
|
-
]
|
|
346
|
-
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
case qcmGraphicSlide.universalRef: {
|
|
350
|
-
const correctAnswer = [get('question.content.choices.1.label', qcmGraphicSlide)];
|
|
351
|
-
return {
|
|
352
|
-
correctAnswer,
|
|
353
|
-
corrections: wrongChoice
|
|
354
|
-
? [{ answer: get('question.content.choices.0.label', qcmGraphicSlide), isCorrect: false }]
|
|
355
|
-
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
case freeTextSlide.universalRef: {
|
|
359
|
-
const correctAnswer = ['Benchmark'];
|
|
360
|
-
return {
|
|
361
|
-
correctAnswer,
|
|
362
|
-
corrections: wrongChoice
|
|
363
|
-
? [{ answer: 'Nope', isCorrect: false }]
|
|
364
|
-
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
case templateSlide.universalRef: {
|
|
368
|
-
const correctAnswer = [get('question.content.choices.1.items.1.text', templateSlide)];
|
|
369
|
-
return {
|
|
370
|
-
correctAnswer,
|
|
371
|
-
corrections: wrongChoice
|
|
372
|
-
? [
|
|
373
|
-
{
|
|
374
|
-
answer: get('question.content.choices.1.items.0.text', templateSlide),
|
|
375
|
-
isCorrect: false
|
|
376
|
-
}
|
|
377
|
-
]
|
|
378
|
-
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
default: {
|
|
382
|
-
const correctAnswer = ['7', '7 ans'];
|
|
383
|
-
return {
|
|
384
|
-
correctAnswer,
|
|
385
|
-
corrections: wrongChoice
|
|
386
|
-
? [
|
|
387
|
-
{
|
|
388
|
-
answer: '8',
|
|
389
|
-
isCorrect: false
|
|
390
|
-
}
|
|
391
|
-
]
|
|
392
|
-
: [{ answer: '7', isCorrect: true }]
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
};
|
|
397
333
|
export const services = {
|
|
398
334
|
fetchSkills: () => Promise.resolve(fetchSkillsResponse),
|
|
399
335
|
fetchSlide: ref => Promise.resolve({ ...getSlideFixture(ref), universalRef: ref, id: ref }),
|
|
@@ -401,6 +337,5 @@ export const services = {
|
|
|
401
337
|
postAnswer: progression => {
|
|
402
338
|
const currentSlide = progression.state.nextContent.ref;
|
|
403
339
|
return Promise.resolve(get(currentSlide, postAnswerResponses));
|
|
404
|
-
}
|
|
405
|
-
fetchCorrection: ref => Promise.resolve(getChoicesCorrection(ref))
|
|
340
|
+
}
|
|
406
341
|
};
|
package/es/types/common.d.ts
CHANGED
|
@@ -129,7 +129,6 @@ export declare type Services = {
|
|
|
129
129
|
fetchSlide(slideRef: string, token: string): Promise<SlideFromAPI | void>;
|
|
130
130
|
postProgression(skillRef: string, token: string): Promise<ProgressionFromAPI>;
|
|
131
131
|
postAnswer(progression: ProgressionFromAPI, token: string, answer: string[]): Promise<ProgressionFromAPI>;
|
|
132
|
-
fetchCorrection(slideRef: string, token: string, progressionId: string, answer: string[]): Promise<CorrectionFromAPI | void>;
|
|
133
132
|
};
|
|
134
133
|
export declare type Options = {
|
|
135
134
|
services: Services;
|
package/lib/services/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { fetchCorrection } from './fetch-correction';
|
|
2
1
|
import { fetchSkills } from './fetch-skills';
|
|
2
|
+
import { postProgression } from './post-progression';
|
|
3
3
|
import { fetchSlide } from './fetch-slide';
|
|
4
4
|
import { postAnswer } from './post-answer';
|
|
5
|
-
import { postProgression } from './post-progression';
|
|
6
5
|
export var getServices = function () { return ({
|
|
7
|
-
fetchCorrection: fetchCorrection,
|
|
8
6
|
fetchSkills: fetchSkills,
|
|
9
7
|
fetchSlide: fetchSlide,
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
postProgression: postProgression,
|
|
9
|
+
postAnswer: postAnswer
|
|
12
10
|
}); };
|
|
@@ -342,71 +342,6 @@ export var progressionSlideWithPendingSlide = {
|
|
|
342
342
|
stars: 32
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
|
-
var getChoicesCorrection = function (ref, wrongChoice) {
|
|
346
|
-
if (wrongChoice === void 0) { wrongChoice = false; }
|
|
347
|
-
switch (ref) {
|
|
348
|
-
case qcmSlide.universalRef: {
|
|
349
|
-
var correctAnswer = [get('question.content.choices.0.label', qcmSlide)];
|
|
350
|
-
return {
|
|
351
|
-
correctAnswer: correctAnswer,
|
|
352
|
-
corrections: wrongChoice
|
|
353
|
-
? [
|
|
354
|
-
{
|
|
355
|
-
answer: get('question.content.choices.2.label', qcmSlide),
|
|
356
|
-
isCorrect: false
|
|
357
|
-
}
|
|
358
|
-
]
|
|
359
|
-
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
case qcmGraphicSlide.universalRef: {
|
|
363
|
-
var correctAnswer = [get('question.content.choices.1.label', qcmGraphicSlide)];
|
|
364
|
-
return {
|
|
365
|
-
correctAnswer: correctAnswer,
|
|
366
|
-
corrections: wrongChoice
|
|
367
|
-
? [{ answer: get('question.content.choices.0.label', qcmGraphicSlide), isCorrect: false }]
|
|
368
|
-
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
case freeTextSlide.universalRef: {
|
|
372
|
-
var correctAnswer = ['Benchmark'];
|
|
373
|
-
return {
|
|
374
|
-
correctAnswer: correctAnswer,
|
|
375
|
-
corrections: wrongChoice
|
|
376
|
-
? [{ answer: 'Nope', isCorrect: false }]
|
|
377
|
-
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
case templateSlide.universalRef: {
|
|
381
|
-
var correctAnswer = [get('question.content.choices.1.items.1.text', templateSlide)];
|
|
382
|
-
return {
|
|
383
|
-
correctAnswer: correctAnswer,
|
|
384
|
-
corrections: wrongChoice
|
|
385
|
-
? [
|
|
386
|
-
{
|
|
387
|
-
answer: get('question.content.choices.1.items.0.text', templateSlide),
|
|
388
|
-
isCorrect: false
|
|
389
|
-
}
|
|
390
|
-
]
|
|
391
|
-
: [{ answer: correctAnswer[0], isCorrect: true }]
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
default: {
|
|
395
|
-
var correctAnswer = ['7', '7 ans'];
|
|
396
|
-
return {
|
|
397
|
-
correctAnswer: correctAnswer,
|
|
398
|
-
corrections: wrongChoice
|
|
399
|
-
? [
|
|
400
|
-
{
|
|
401
|
-
answer: '8',
|
|
402
|
-
isCorrect: false
|
|
403
|
-
}
|
|
404
|
-
]
|
|
405
|
-
: [{ answer: '7', isCorrect: true }]
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
345
|
export var services = {
|
|
411
346
|
fetchSkills: function () { return Promise.resolve(fetchSkillsResponse); },
|
|
412
347
|
fetchSlide: function (ref) { return Promise.resolve(__assign(__assign({}, getSlideFixture(ref)), { universalRef: ref, id: ref })); },
|
|
@@ -414,6 +349,5 @@ export var services = {
|
|
|
414
349
|
postAnswer: function (progression) {
|
|
415
350
|
var currentSlide = progression.state.nextContent.ref;
|
|
416
351
|
return Promise.resolve(get(currentSlide, postAnswerResponses));
|
|
417
|
-
}
|
|
418
|
-
fetchCorrection: function (ref) { return Promise.resolve(getChoicesCorrection(ref)); }
|
|
352
|
+
}
|
|
419
353
|
};
|
package/lib/types/common.d.ts
CHANGED
|
@@ -129,7 +129,6 @@ export declare type Services = {
|
|
|
129
129
|
fetchSlide(slideRef: string, token: string): Promise<SlideFromAPI | void>;
|
|
130
130
|
postProgression(skillRef: string, token: string): Promise<ProgressionFromAPI>;
|
|
131
131
|
postAnswer(progression: ProgressionFromAPI, token: string, answer: string[]): Promise<ProgressionFromAPI>;
|
|
132
|
-
fetchCorrection(slideRef: string, token: string, progressionId: string, answer: string[]): Promise<CorrectionFromAPI | void>;
|
|
133
132
|
};
|
|
134
133
|
export declare type Options = {
|
|
135
134
|
services: Services;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.1.21-alpha.
|
|
3
|
+
"version": "0.1.21-alpha.8+d10426e39",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@coorpacademy/components": "10.22.15-alpha.
|
|
44
|
+
"@coorpacademy/components": "10.22.15-alpha.8+d10426e39",
|
|
45
45
|
"@coorpacademy/redux-task": "1.1.5",
|
|
46
46
|
"cross-fetch": "^3.1.5",
|
|
47
47
|
"jwt-decode": "^3.1.2",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"ts-node": "^10.9.1",
|
|
79
79
|
"typescript": "^4.7.4"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "d10426e390835b81b9b692661522c08ead9db231"
|
|
82
82
|
}
|
package/src/services/index.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import {Services} from '../types/common';
|
|
2
|
-
import {fetchCorrection} from './fetch-correction';
|
|
3
2
|
import {fetchSkills} from './fetch-skills';
|
|
3
|
+
import {postProgression} from './post-progression';
|
|
4
4
|
import {fetchSlide} from './fetch-slide';
|
|
5
5
|
import {postAnswer} from './post-answer';
|
|
6
|
-
import {postProgression} from './post-progression';
|
|
7
6
|
|
|
8
7
|
export const getServices = (): Services => ({
|
|
9
|
-
fetchCorrection,
|
|
10
8
|
fetchSkills,
|
|
11
9
|
fetchSlide,
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
postProgression,
|
|
11
|
+
postAnswer
|
|
14
12
|
});
|
|
@@ -6,7 +6,6 @@ import {freeTextSlide} from '../../views/slides/test/fixtures/free-text';
|
|
|
6
6
|
import {sliderSlide} from '../../views/slides/test/fixtures/slider';
|
|
7
7
|
import {templateSlide} from '../../views/slides/test/fixtures/template';
|
|
8
8
|
import {
|
|
9
|
-
CorrectionFromAPI,
|
|
10
9
|
ProgressionFromAPI,
|
|
11
10
|
ReviewContent,
|
|
12
11
|
ReviewEngine,
|
|
@@ -346,71 +345,6 @@ export const progressionSlideWithPendingSlide: ProgressionFromAPI = {
|
|
|
346
345
|
}
|
|
347
346
|
};
|
|
348
347
|
|
|
349
|
-
const getChoicesCorrection = (ref: string, wrongChoice = false): CorrectionFromAPI => {
|
|
350
|
-
switch (ref) {
|
|
351
|
-
case qcmSlide.universalRef: {
|
|
352
|
-
const correctAnswer = [get('question.content.choices.0.label', qcmSlide)];
|
|
353
|
-
return {
|
|
354
|
-
correctAnswer,
|
|
355
|
-
corrections: wrongChoice
|
|
356
|
-
? [
|
|
357
|
-
{
|
|
358
|
-
answer: get('question.content.choices.2.label', qcmSlide),
|
|
359
|
-
isCorrect: false
|
|
360
|
-
}
|
|
361
|
-
]
|
|
362
|
-
: [{answer: correctAnswer[0], isCorrect: true}]
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
case qcmGraphicSlide.universalRef: {
|
|
366
|
-
const correctAnswer = [get('question.content.choices.1.label', qcmGraphicSlide)];
|
|
367
|
-
return {
|
|
368
|
-
correctAnswer,
|
|
369
|
-
corrections: wrongChoice
|
|
370
|
-
? [{answer: get('question.content.choices.0.label', qcmGraphicSlide), isCorrect: false}]
|
|
371
|
-
: [{answer: correctAnswer[0], isCorrect: true}]
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
case freeTextSlide.universalRef: {
|
|
375
|
-
const correctAnswer = ['Benchmark'];
|
|
376
|
-
return {
|
|
377
|
-
correctAnswer,
|
|
378
|
-
corrections: wrongChoice
|
|
379
|
-
? [{answer: 'Nope', isCorrect: false}]
|
|
380
|
-
: [{answer: correctAnswer[0], isCorrect: true}]
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
case templateSlide.universalRef: {
|
|
384
|
-
const correctAnswer = [get('question.content.choices.1.items.1.text', templateSlide)];
|
|
385
|
-
return {
|
|
386
|
-
correctAnswer,
|
|
387
|
-
corrections: wrongChoice
|
|
388
|
-
? [
|
|
389
|
-
{
|
|
390
|
-
answer: get('question.content.choices.1.items.0.text', templateSlide),
|
|
391
|
-
isCorrect: false
|
|
392
|
-
}
|
|
393
|
-
]
|
|
394
|
-
: [{answer: correctAnswer[0], isCorrect: true}]
|
|
395
|
-
};
|
|
396
|
-
}
|
|
397
|
-
default: {
|
|
398
|
-
const correctAnswer = ['7', '7 ans'];
|
|
399
|
-
return {
|
|
400
|
-
correctAnswer,
|
|
401
|
-
corrections: wrongChoice
|
|
402
|
-
? [
|
|
403
|
-
{
|
|
404
|
-
answer: '8',
|
|
405
|
-
isCorrect: false
|
|
406
|
-
}
|
|
407
|
-
]
|
|
408
|
-
: [{answer: '7', isCorrect: true}]
|
|
409
|
-
};
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
};
|
|
413
|
-
|
|
414
348
|
export const services: Services = {
|
|
415
349
|
fetchSkills: () => Promise.resolve(fetchSkillsResponse),
|
|
416
350
|
fetchSlide: ref => Promise.resolve({...getSlideFixture(ref), universalRef: ref, id: ref}),
|
|
@@ -418,6 +352,5 @@ export const services: Services = {
|
|
|
418
352
|
postAnswer: progression => {
|
|
419
353
|
const currentSlide = progression.state.nextContent.ref;
|
|
420
354
|
return Promise.resolve(get(currentSlide, postAnswerResponses));
|
|
421
|
-
}
|
|
422
|
-
fetchCorrection: ref => Promise.resolve(getChoicesCorrection(ref))
|
|
355
|
+
}
|
|
423
356
|
};
|
package/src/types/common.ts
CHANGED
|
@@ -157,12 +157,6 @@ export type Services = {
|
|
|
157
157
|
token: string,
|
|
158
158
|
answer: string[]
|
|
159
159
|
): Promise<ProgressionFromAPI>;
|
|
160
|
-
fetchCorrection(
|
|
161
|
-
slideRef: string,
|
|
162
|
-
token: string,
|
|
163
|
-
progressionId: string,
|
|
164
|
-
answer: string[]
|
|
165
|
-
): Promise<CorrectionFromAPI | void>;
|
|
166
160
|
};
|
|
167
161
|
|
|
168
162
|
export type Options = {
|