@coorpacademy/app-review 0.9.7 → 0.10.0
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/actions/api/fetch-correction.d.ts +2 -1
- package/es/actions/api/fetch-rank.d.ts +2 -1
- package/es/actions/api/fetch-skill.d.ts +2 -1
- package/es/actions/api/fetch-skills.d.ts +2 -1
- package/es/actions/api/fetch-slide.d.ts +2 -1
- package/es/actions/api/fetch-slides-to-review-by-skill-ref.d.ts +2 -1
- package/es/actions/api/post-answer.d.ts +2 -1
- package/es/actions/api/post-progression.d.ts +2 -1
- package/es/actions/ui/navigation.d.ts +1 -1
- package/es/actions/ui/slides.d.ts +1 -1
- package/es/common/index.d.ts +1 -1
- package/es/configure-store.d.ts +1 -1
- package/es/configure-store.js +1 -1
- package/es/reducers/data/corrections.d.ts +1 -1
- package/es/reducers/data/current-skill.d.ts +1 -1
- package/es/reducers/data/progression.d.ts +1 -1
- package/es/reducers/data/skills.d.ts +1 -1
- package/es/reducers/data/slides.d.ts +1 -1
- package/es/reducers/ui/slide.d.ts +0 -1
- package/es/reducers/ui/slide.js +2 -3
- package/es/types/common.d.ts +10 -186
- package/es/views/skills/index.d.ts +1 -1
- package/es/views/slides/index.d.ts +1 -1
- package/es/views/slides/index.js +0 -2
- package/es/views/slides/map-api-slide-to-ui.d.ts +2 -1
- package/lib/actions/api/fetch-correction.d.ts +2 -1
- package/lib/actions/api/fetch-rank.d.ts +2 -1
- package/lib/actions/api/fetch-skill.d.ts +2 -1
- package/lib/actions/api/fetch-skills.d.ts +2 -1
- package/lib/actions/api/fetch-slide.d.ts +2 -1
- package/lib/actions/api/fetch-slides-to-review-by-skill-ref.d.ts +2 -1
- package/lib/actions/api/post-answer.d.ts +2 -1
- package/lib/actions/api/post-progression.d.ts +2 -1
- package/lib/actions/ui/navigation.d.ts +1 -1
- package/lib/actions/ui/slides.d.ts +1 -1
- package/lib/common/index.d.ts +1 -1
- package/lib/configure-store.d.ts +1 -1
- package/lib/configure-store.js +2 -2
- package/lib/reducers/data/corrections.d.ts +1 -1
- package/lib/reducers/data/current-skill.d.ts +1 -1
- package/lib/reducers/data/progression.d.ts +1 -1
- package/lib/reducers/data/skills.d.ts +1 -1
- package/lib/reducers/data/slides.d.ts +1 -1
- package/lib/reducers/ui/slide.d.ts +0 -1
- package/lib/reducers/ui/slide.js +2 -3
- package/lib/types/common.d.ts +10 -186
- package/lib/views/skills/index.d.ts +1 -1
- package/lib/views/slides/index.d.ts +1 -1
- package/lib/views/slides/index.js +0 -2
- package/lib/views/slides/map-api-slide-to-ui.d.ts +2 -1
- package/locales/bs/review.json +1 -4
- package/locales/cs/review.json +6 -6
- package/locales/de/review.json +7 -7
- package/locales/es/review.json +7 -7
- package/locales/hr/review.json +1 -1
- package/locales/hu/review.json +7 -7
- package/locales/hy/review.json +1 -4
- package/locales/id/review.json +3 -3
- package/locales/it/review.json +6 -6
- package/locales/ja/review.json +5 -5
- package/locales/ko/review.json +7 -7
- package/locales/nl/review.json +6 -6
- package/locales/pl/review.json +6 -6
- package/locales/pt/review.json +7 -7
- package/locales/ro/review.json +6 -6
- package/locales/sk/review.json +3 -3
- package/locales/th/review.json +5 -5
- package/locales/tl/review.json +7 -7
- package/locales/tr/review.json +2 -2
- package/locales/uk/review.json +7 -7
- package/locales/vi/review.json +3 -3
- package/locales/zh/review.json +4 -4
- package/locales/zh_TW/review.json +6 -6
- package/package.json +4 -3
- package/es/services/fetch-correction.d.ts +0 -2
- package/es/services/fetch-correction.js +0 -14
- package/es/services/fetch-rank.d.ts +0 -2
- package/es/services/fetch-rank.js +0 -10
- package/es/services/fetch-skill.d.ts +0 -2
- package/es/services/fetch-skill.js +0 -11
- package/es/services/fetch-skills.d.ts +0 -2
- package/es/services/fetch-skills.js +0 -10
- package/es/services/fetch-slide.d.ts +0 -2
- package/es/services/fetch-slide.js +0 -10
- package/es/services/fetch-slides-to-review-by-skill-ref.d.ts +0 -2
- package/es/services/fetch-slides-to-review-by-skill-ref.js +0 -10
- package/es/services/index.d.ts +0 -2
- package/es/services/index.js +0 -18
- package/es/services/post-answer.d.ts +0 -2
- package/es/services/post-answer.js +0 -20
- package/es/services/post-progression.d.ts +0 -2
- package/es/services/post-progression.js +0 -21
- package/es/services/tools/fetch-responses.d.ts +0 -7
- package/es/services/tools/fetch-responses.js +0 -33
- package/es/services/tools/sleep.d.ts +0 -1
- package/es/services/tools/sleep.js +0 -3
- package/lib/services/fetch-correction.d.ts +0 -2
- package/lib/services/fetch-correction.js +0 -21
- package/lib/services/fetch-rank.d.ts +0 -2
- package/lib/services/fetch-rank.js +0 -17
- package/lib/services/fetch-skill.d.ts +0 -2
- package/lib/services/fetch-skill.js +0 -18
- package/lib/services/fetch-skills.d.ts +0 -2
- package/lib/services/fetch-skills.js +0 -17
- package/lib/services/fetch-slide.d.ts +0 -2
- package/lib/services/fetch-slide.js +0 -17
- package/lib/services/fetch-slides-to-review-by-skill-ref.d.ts +0 -2
- package/lib/services/fetch-slides-to-review-by-skill-ref.js +0 -17
- package/lib/services/index.d.ts +0 -2
- package/lib/services/index.js +0 -22
- package/lib/services/post-answer.d.ts +0 -2
- package/lib/services/post-answer.js +0 -27
- package/lib/services/post-progression.d.ts +0 -2
- package/lib/services/post-progression.js +0 -28
- package/lib/services/tools/fetch-responses.d.ts +0 -7
- package/lib/services/tools/fetch-responses.js +0 -40
- package/lib/services/tools/sleep.d.ts +0 -1
- package/lib/services/tools/sleep.js +0 -7
package/locales/tl/review.json
CHANGED
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"list_title": "Mga
|
|
47
|
-
"list_aria_label": "
|
|
46
|
+
"list_title": "Mga kasanayan na maaari mong repasuhin",
|
|
47
|
+
"list_aria_label": "Lalagyan ng Mga Kasanayang Rerepasuhin",
|
|
48
48
|
"card": {
|
|
49
|
-
"aria_label": "
|
|
50
|
-
"text": "{{total}}
|
|
51
|
-
"button_text": "Repasuhin ang
|
|
49
|
+
"aria_label": "Card ng Kasanayan",
|
|
50
|
+
"text": "{{total}} tanong na rerepasuhin",
|
|
51
|
+
"button_text": "Repasuhin ang kasanayang ito"
|
|
52
52
|
},
|
|
53
53
|
"no_skills": {
|
|
54
|
-
"title": "Wala ka pang
|
|
55
|
-
"text": "
|
|
54
|
+
"title": "Wala ka pang kasanayang maire-revise",
|
|
55
|
+
"text": "Kailangan mo munang makakumpleto ng mga kurso bago ka makapagrepaso ng iba't-ibang kasanayan."
|
|
56
56
|
}
|
|
57
57
|
}
|
package/locales/tr/review.json
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"button_text": "Bu beceriyi incele"
|
|
52
52
|
},
|
|
53
53
|
"no_skills": {
|
|
54
|
-
"title": "Henüz
|
|
55
|
-
"text": "Farklı becerileri
|
|
54
|
+
"title": "Henüz tekrarlanacak becerin yok",
|
|
55
|
+
"text": "Farklı becerileri inceleyebilmek için önce dersleri tamamlaman gerekiyor."
|
|
56
56
|
}
|
|
57
57
|
}
|
package/locales/uk/review.json
CHANGED
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"list_title": "Навички, які ви можете
|
|
47
|
-
"list_aria_label": "
|
|
46
|
+
"list_title": "Навички, які ви можете переглянути",
|
|
47
|
+
"list_aria_label": "Контейнер Перегляду Навичок",
|
|
48
48
|
"card": {
|
|
49
|
-
"aria_label": "Картка
|
|
50
|
-
"text": "{{total}}
|
|
51
|
-
"button_text": "
|
|
49
|
+
"aria_label": "Картка Навички",
|
|
50
|
+
"text": "{{total}} питань до перегляду",
|
|
51
|
+
"button_text": "Переглянути цю навичку"
|
|
52
52
|
},
|
|
53
53
|
"no_skills": {
|
|
54
|
-
"title": "У вас ще немає навичок
|
|
55
|
-
"text": "
|
|
54
|
+
"title": "У вас ще немає навичок для перевірки",
|
|
55
|
+
"text": "Перш ніж переглядати різні навички, вам слід завершити курси."
|
|
56
56
|
}
|
|
57
57
|
}
|
package/locales/vi/review.json
CHANGED
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"list_title": "Các kỹ năng bạn có thể ôn tập",
|
|
47
|
-
"list_aria_label": "
|
|
47
|
+
"list_aria_label": "Vùng chứa Ôn tập Kỹ năng",
|
|
48
48
|
"card": {
|
|
49
49
|
"aria_label": "Thẻ Kỹ năng",
|
|
50
|
-
"text": "{{total}} câu hỏi
|
|
50
|
+
"text": "{{total}} câu hỏi cần ôn tập",
|
|
51
51
|
"button_text": "Ôn tập kỹ năng này"
|
|
52
52
|
},
|
|
53
53
|
"no_skills": {
|
|
54
54
|
"title": "Bạn chưa có kỹ năng nào để ôn tập",
|
|
55
|
-
"text": "Trước tiên, bạn cần hoàn thành các khóa học
|
|
55
|
+
"text": "Trước tiên, bạn cần hoàn thành các khóa học trước khi có thể ôn tập các kỹ năng khác nhau."
|
|
56
56
|
}
|
|
57
57
|
}
|
package/locales/zh/review.json
CHANGED
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"list_title": "您可以复习的技能",
|
|
47
|
-
"list_aria_label": "
|
|
47
|
+
"list_aria_label": "复习技能容器",
|
|
48
48
|
"card": {
|
|
49
49
|
"aria_label": "技能卡",
|
|
50
|
-
"text": "{{total}}
|
|
50
|
+
"text": "共需复习 {{total}} 个问题",
|
|
51
51
|
"button_text": "复习此技能"
|
|
52
52
|
},
|
|
53
53
|
"no_skills": {
|
|
54
|
-
"title": "
|
|
55
|
-
"text": "
|
|
54
|
+
"title": "您还没有需要温习的技能",
|
|
55
|
+
"text": "您需要先完成课程,然后才能复习不同技能。"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"list_title": "
|
|
47
|
-
"list_aria_label": "
|
|
46
|
+
"list_title": "你可以複習的技能",
|
|
47
|
+
"list_aria_label": "複習技能箱",
|
|
48
48
|
"card": {
|
|
49
49
|
"aria_label": "技能卡",
|
|
50
|
-
"text": "
|
|
51
|
-
"button_text": "
|
|
50
|
+
"text": "{{total}} 個問題需要複習",
|
|
51
|
+
"button_text": "複習這項技能"
|
|
52
52
|
},
|
|
53
53
|
"no_skills": {
|
|
54
|
-
"title": "
|
|
55
|
-
"text": "
|
|
54
|
+
"title": "你尚未有任何的技能可以複習",
|
|
55
|
+
"text": "你必須先完成課程,然後才能複習不同的技能。"
|
|
56
56
|
}
|
|
57
57
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -35,9 +35,10 @@
|
|
|
35
35
|
"main": "lib/index.js",
|
|
36
36
|
"module": "es/index.js",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@coorpacademy/components": "10.29.
|
|
38
|
+
"@coorpacademy/components": "10.29.5-alpha.0",
|
|
39
39
|
"@coorpacademy/progression-engine": "11.5.2",
|
|
40
40
|
"@coorpacademy/redux-task": "1.1.6",
|
|
41
|
+
"@coorpacademy/review-services": "1.0.1",
|
|
41
42
|
"@coorpacademy/translate": "6.2.0",
|
|
42
43
|
"cross-fetch": "^3.1.5",
|
|
43
44
|
"jwt-decode": "^3.1.2",
|
|
@@ -72,5 +73,5 @@
|
|
|
72
73
|
"webpack-cli": "^4.10.0",
|
|
73
74
|
"webpack-dev-server": "^4.11.1"
|
|
74
75
|
},
|
|
75
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "c87618fe91e37b1321eecaadf7657eafc2d9bb0e"
|
|
76
77
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import crossFetch from 'cross-fetch';
|
|
2
|
-
import decode from 'jwt-decode';
|
|
3
|
-
import { toJSON } from './tools/fetch-responses';
|
|
4
|
-
export const fetchCorrection = async (slideRef, token, progressionId, answer) => {
|
|
5
|
-
const { host } = decode(token);
|
|
6
|
-
const response = await crossFetch(`${host}/api/v2/progressions/${progressionId}/answers/${slideRef}`, {
|
|
7
|
-
method: 'post',
|
|
8
|
-
headers: { authorization: token },
|
|
9
|
-
body: JSON.stringify({
|
|
10
|
-
answer
|
|
11
|
-
})
|
|
12
|
-
});
|
|
13
|
-
return toJSON(response);
|
|
14
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import crossFetch from 'cross-fetch';
|
|
2
|
-
import decode from 'jwt-decode';
|
|
3
|
-
import { toJSON } from './tools/fetch-responses';
|
|
4
|
-
export const fetchRank = async (token) => {
|
|
5
|
-
const { user: userId, host } = decode(token);
|
|
6
|
-
const response = await crossFetch(`${host}/api/v1/leaderboard/rank/${userId}?group=ALL`, {
|
|
7
|
-
headers: { authorization: token }
|
|
8
|
-
});
|
|
9
|
-
return toJSON(response);
|
|
10
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import crossFetch from 'cross-fetch';
|
|
2
|
-
import decode from 'jwt-decode';
|
|
3
|
-
import { toJSON } from './tools/fetch-responses';
|
|
4
|
-
export const fetchSkill = async (skillRef, token) => {
|
|
5
|
-
const { host } = decode(token);
|
|
6
|
-
const response = await crossFetch(`${host}/api/v2/skills?conditions={"ref":"${skillRef}"}`, {
|
|
7
|
-
headers: { authorization: token }
|
|
8
|
-
});
|
|
9
|
-
const skills = await toJSON(response);
|
|
10
|
-
return skills[0];
|
|
11
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import crossFetch from 'cross-fetch';
|
|
2
|
-
import decode from 'jwt-decode';
|
|
3
|
-
import { toJSON } from './tools/fetch-responses';
|
|
4
|
-
export const fetchSkills = async (token) => {
|
|
5
|
-
const { user: userId, host } = decode(token);
|
|
6
|
-
const response = await crossFetch(`${host}/api/v2/skills/review/user/${userId}`, {
|
|
7
|
-
headers: { authorization: token }
|
|
8
|
-
});
|
|
9
|
-
return toJSON(response);
|
|
10
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import crossFetch from 'cross-fetch';
|
|
2
|
-
import decode from 'jwt-decode';
|
|
3
|
-
import { toJSON } from './tools/fetch-responses';
|
|
4
|
-
export const fetchSlide = async (slideRef, token) => {
|
|
5
|
-
const { host } = decode(token);
|
|
6
|
-
const response = await crossFetch(`${host}/api/v1/slides/${slideRef}/parentContentTitle`, {
|
|
7
|
-
headers: { authorization: token }
|
|
8
|
-
});
|
|
9
|
-
return toJSON(response);
|
|
10
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import crossFetch from 'cross-fetch';
|
|
2
|
-
import decode from 'jwt-decode';
|
|
3
|
-
import { toJSON } from './tools/fetch-responses';
|
|
4
|
-
export const fetchSlidesToReviewBySkillRef = async (token, skillRef) => {
|
|
5
|
-
const { user: userId, host } = decode(token);
|
|
6
|
-
const response = await crossFetch(`${host}/api/v2/skills/${skillRef}/review/user/${userId}/slide`, {
|
|
7
|
-
headers: { authorization: token }
|
|
8
|
-
});
|
|
9
|
-
return toJSON(response);
|
|
10
|
-
};
|
package/es/services/index.d.ts
DELETED
package/es/services/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { fetchCorrection } from './fetch-correction';
|
|
2
|
-
import { fetchRank } from './fetch-rank';
|
|
3
|
-
import { fetchSkills } from './fetch-skills';
|
|
4
|
-
import { fetchSlide } from './fetch-slide';
|
|
5
|
-
import { fetchSlidesToReviewBySkillRef } from './fetch-slides-to-review-by-skill-ref';
|
|
6
|
-
import { postAnswer } from './post-answer';
|
|
7
|
-
import { postProgression } from './post-progression';
|
|
8
|
-
import { fetchSkill } from './fetch-skill';
|
|
9
|
-
export const getServices = () => ({
|
|
10
|
-
fetchCorrection,
|
|
11
|
-
fetchRank,
|
|
12
|
-
fetchSkill,
|
|
13
|
-
fetchSkills,
|
|
14
|
-
fetchSlide,
|
|
15
|
-
fetchSlidesToReviewBySkillRef,
|
|
16
|
-
postAnswer,
|
|
17
|
-
postProgression
|
|
18
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import crossFetch from 'cross-fetch';
|
|
2
|
-
import decode from 'jwt-decode';
|
|
3
|
-
import { toJSON } from './tools/fetch-responses';
|
|
4
|
-
export const postAnswer = async (progression, token, answer) => {
|
|
5
|
-
const progressionId = progression._id;
|
|
6
|
-
const slideRef = progression.state.nextContent.ref;
|
|
7
|
-
const { host } = decode(token);
|
|
8
|
-
const response = await crossFetch(`${host}/api/v2/progressions/${progressionId}/answers`, {
|
|
9
|
-
method: 'post',
|
|
10
|
-
headers: { authorization: token, 'content-type': 'application/json' },
|
|
11
|
-
body: JSON.stringify({
|
|
12
|
-
content: {
|
|
13
|
-
ref: slideRef,
|
|
14
|
-
type: 'slide'
|
|
15
|
-
},
|
|
16
|
-
answer
|
|
17
|
-
})
|
|
18
|
-
});
|
|
19
|
-
return toJSON(response);
|
|
20
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import crossFetch from 'cross-fetch';
|
|
2
|
-
import decode from 'jwt-decode';
|
|
3
|
-
import { toJSON } from './tools/fetch-responses';
|
|
4
|
-
export const postProgression = async (skillRef, token) => {
|
|
5
|
-
const { host } = decode(token);
|
|
6
|
-
const response = await crossFetch(`${host}/api/v2/progressions`, {
|
|
7
|
-
method: 'post',
|
|
8
|
-
headers: { authorization: token, 'content-type': 'application/json' },
|
|
9
|
-
body: JSON.stringify({
|
|
10
|
-
content: {
|
|
11
|
-
ref: skillRef,
|
|
12
|
-
type: 'skill'
|
|
13
|
-
},
|
|
14
|
-
engine: {
|
|
15
|
-
ref: 'review',
|
|
16
|
-
version: '1'
|
|
17
|
-
}
|
|
18
|
-
})
|
|
19
|
-
});
|
|
20
|
-
return toJSON(response);
|
|
21
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare class ResponseError extends Error {
|
|
2
|
-
statusCode: number;
|
|
3
|
-
constructor(statusCode: number, statusText: string, body?: string);
|
|
4
|
-
}
|
|
5
|
-
export declare const toJSON: <T = unknown>(response: Response) => Promise<T>;
|
|
6
|
-
export declare const toText: (response: Response) => Promise<string>;
|
|
7
|
-
export declare const toVoid: (response: Response) => Promise<void>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export class ResponseError extends Error {
|
|
2
|
-
constructor(statusCode, statusText, body = '') {
|
|
3
|
-
super(`${statusText} ${body}`.trim());
|
|
4
|
-
this.name = 'ResponseError';
|
|
5
|
-
this.statusCode = statusCode;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export const toJSON = async (response) => {
|
|
9
|
-
if (!response.ok) {
|
|
10
|
-
const body = await response.text();
|
|
11
|
-
throw new ResponseError(response.status, response.statusText, body);
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
return await response.json();
|
|
15
|
-
}
|
|
16
|
-
catch (err) {
|
|
17
|
-
throw new ResponseError(response.status, response.statusText);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
export const toText = async (response) => {
|
|
21
|
-
const body = await response.text();
|
|
22
|
-
if (!response.ok) {
|
|
23
|
-
throw new ResponseError(response.status, response.statusText, body);
|
|
24
|
-
}
|
|
25
|
-
return body;
|
|
26
|
-
};
|
|
27
|
-
export const toVoid = async (response) => {
|
|
28
|
-
if (!response.ok) {
|
|
29
|
-
const body = await response.text();
|
|
30
|
-
throw new ResponseError(response.status, response.statusText, body);
|
|
31
|
-
}
|
|
32
|
-
return;
|
|
33
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const sleep: (msToSleep: number) => Promise<void>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchCorrection = void 0;
|
|
7
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
|
-
const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
9
|
-
const fetch_responses_1 = require("./tools/fetch-responses");
|
|
10
|
-
const fetchCorrection = async (slideRef, token, progressionId, answer) => {
|
|
11
|
-
const { host } = (0, jwt_decode_1.default)(token);
|
|
12
|
-
const response = await (0, cross_fetch_1.default)(`${host}/api/v2/progressions/${progressionId}/answers/${slideRef}`, {
|
|
13
|
-
method: 'post',
|
|
14
|
-
headers: { authorization: token },
|
|
15
|
-
body: JSON.stringify({
|
|
16
|
-
answer
|
|
17
|
-
})
|
|
18
|
-
});
|
|
19
|
-
return (0, fetch_responses_1.toJSON)(response);
|
|
20
|
-
};
|
|
21
|
-
exports.fetchCorrection = fetchCorrection;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchRank = void 0;
|
|
7
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
|
-
const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
9
|
-
const fetch_responses_1 = require("./tools/fetch-responses");
|
|
10
|
-
const fetchRank = async (token) => {
|
|
11
|
-
const { user: userId, host } = (0, jwt_decode_1.default)(token);
|
|
12
|
-
const response = await (0, cross_fetch_1.default)(`${host}/api/v1/leaderboard/rank/${userId}?group=ALL`, {
|
|
13
|
-
headers: { authorization: token }
|
|
14
|
-
});
|
|
15
|
-
return (0, fetch_responses_1.toJSON)(response);
|
|
16
|
-
};
|
|
17
|
-
exports.fetchRank = fetchRank;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchSkill = void 0;
|
|
7
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
|
-
const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
9
|
-
const fetch_responses_1 = require("./tools/fetch-responses");
|
|
10
|
-
const fetchSkill = async (skillRef, token) => {
|
|
11
|
-
const { host } = (0, jwt_decode_1.default)(token);
|
|
12
|
-
const response = await (0, cross_fetch_1.default)(`${host}/api/v2/skills?conditions={"ref":"${skillRef}"}`, {
|
|
13
|
-
headers: { authorization: token }
|
|
14
|
-
});
|
|
15
|
-
const skills = await (0, fetch_responses_1.toJSON)(response);
|
|
16
|
-
return skills[0];
|
|
17
|
-
};
|
|
18
|
-
exports.fetchSkill = fetchSkill;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchSkills = void 0;
|
|
7
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
|
-
const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
9
|
-
const fetch_responses_1 = require("./tools/fetch-responses");
|
|
10
|
-
const fetchSkills = async (token) => {
|
|
11
|
-
const { user: userId, host } = (0, jwt_decode_1.default)(token);
|
|
12
|
-
const response = await (0, cross_fetch_1.default)(`${host}/api/v2/skills/review/user/${userId}`, {
|
|
13
|
-
headers: { authorization: token }
|
|
14
|
-
});
|
|
15
|
-
return (0, fetch_responses_1.toJSON)(response);
|
|
16
|
-
};
|
|
17
|
-
exports.fetchSkills = fetchSkills;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchSlide = void 0;
|
|
7
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
|
-
const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
9
|
-
const fetch_responses_1 = require("./tools/fetch-responses");
|
|
10
|
-
const fetchSlide = async (slideRef, token) => {
|
|
11
|
-
const { host } = (0, jwt_decode_1.default)(token);
|
|
12
|
-
const response = await (0, cross_fetch_1.default)(`${host}/api/v1/slides/${slideRef}/parentContentTitle`, {
|
|
13
|
-
headers: { authorization: token }
|
|
14
|
-
});
|
|
15
|
-
return (0, fetch_responses_1.toJSON)(response);
|
|
16
|
-
};
|
|
17
|
-
exports.fetchSlide = fetchSlide;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchSlidesToReviewBySkillRef = void 0;
|
|
7
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
|
-
const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
9
|
-
const fetch_responses_1 = require("./tools/fetch-responses");
|
|
10
|
-
const fetchSlidesToReviewBySkillRef = async (token, skillRef) => {
|
|
11
|
-
const { user: userId, host } = (0, jwt_decode_1.default)(token);
|
|
12
|
-
const response = await (0, cross_fetch_1.default)(`${host}/api/v2/skills/${skillRef}/review/user/${userId}/slide`, {
|
|
13
|
-
headers: { authorization: token }
|
|
14
|
-
});
|
|
15
|
-
return (0, fetch_responses_1.toJSON)(response);
|
|
16
|
-
};
|
|
17
|
-
exports.fetchSlidesToReviewBySkillRef = fetchSlidesToReviewBySkillRef;
|
package/lib/services/index.d.ts
DELETED
package/lib/services/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getServices = void 0;
|
|
4
|
-
const fetch_correction_1 = require("./fetch-correction");
|
|
5
|
-
const fetch_rank_1 = require("./fetch-rank");
|
|
6
|
-
const fetch_skills_1 = require("./fetch-skills");
|
|
7
|
-
const fetch_slide_1 = require("./fetch-slide");
|
|
8
|
-
const fetch_slides_to_review_by_skill_ref_1 = require("./fetch-slides-to-review-by-skill-ref");
|
|
9
|
-
const post_answer_1 = require("./post-answer");
|
|
10
|
-
const post_progression_1 = require("./post-progression");
|
|
11
|
-
const fetch_skill_1 = require("./fetch-skill");
|
|
12
|
-
const getServices = () => ({
|
|
13
|
-
fetchCorrection: fetch_correction_1.fetchCorrection,
|
|
14
|
-
fetchRank: fetch_rank_1.fetchRank,
|
|
15
|
-
fetchSkill: fetch_skill_1.fetchSkill,
|
|
16
|
-
fetchSkills: fetch_skills_1.fetchSkills,
|
|
17
|
-
fetchSlide: fetch_slide_1.fetchSlide,
|
|
18
|
-
fetchSlidesToReviewBySkillRef: fetch_slides_to_review_by_skill_ref_1.fetchSlidesToReviewBySkillRef,
|
|
19
|
-
postAnswer: post_answer_1.postAnswer,
|
|
20
|
-
postProgression: post_progression_1.postProgression
|
|
21
|
-
});
|
|
22
|
-
exports.getServices = getServices;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.postAnswer = void 0;
|
|
7
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
|
-
const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
9
|
-
const fetch_responses_1 = require("./tools/fetch-responses");
|
|
10
|
-
const postAnswer = async (progression, token, answer) => {
|
|
11
|
-
const progressionId = progression._id;
|
|
12
|
-
const slideRef = progression.state.nextContent.ref;
|
|
13
|
-
const { host } = (0, jwt_decode_1.default)(token);
|
|
14
|
-
const response = await (0, cross_fetch_1.default)(`${host}/api/v2/progressions/${progressionId}/answers`, {
|
|
15
|
-
method: 'post',
|
|
16
|
-
headers: { authorization: token, 'content-type': 'application/json' },
|
|
17
|
-
body: JSON.stringify({
|
|
18
|
-
content: {
|
|
19
|
-
ref: slideRef,
|
|
20
|
-
type: 'slide'
|
|
21
|
-
},
|
|
22
|
-
answer
|
|
23
|
-
})
|
|
24
|
-
});
|
|
25
|
-
return (0, fetch_responses_1.toJSON)(response);
|
|
26
|
-
};
|
|
27
|
-
exports.postAnswer = postAnswer;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.postProgression = void 0;
|
|
7
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
8
|
-
const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
9
|
-
const fetch_responses_1 = require("./tools/fetch-responses");
|
|
10
|
-
const postProgression = async (skillRef, token) => {
|
|
11
|
-
const { host } = (0, jwt_decode_1.default)(token);
|
|
12
|
-
const response = await (0, cross_fetch_1.default)(`${host}/api/v2/progressions`, {
|
|
13
|
-
method: 'post',
|
|
14
|
-
headers: { authorization: token, 'content-type': 'application/json' },
|
|
15
|
-
body: JSON.stringify({
|
|
16
|
-
content: {
|
|
17
|
-
ref: skillRef,
|
|
18
|
-
type: 'skill'
|
|
19
|
-
},
|
|
20
|
-
engine: {
|
|
21
|
-
ref: 'review',
|
|
22
|
-
version: '1'
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
return (0, fetch_responses_1.toJSON)(response);
|
|
27
|
-
};
|
|
28
|
-
exports.postProgression = postProgression;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare class ResponseError extends Error {
|
|
2
|
-
statusCode: number;
|
|
3
|
-
constructor(statusCode: number, statusText: string, body?: string);
|
|
4
|
-
}
|
|
5
|
-
export declare const toJSON: <T = unknown>(response: Response) => Promise<T>;
|
|
6
|
-
export declare const toText: (response: Response) => Promise<string>;
|
|
7
|
-
export declare const toVoid: (response: Response) => Promise<void>;
|