@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.
Files changed (118) hide show
  1. package/es/actions/api/fetch-correction.d.ts +2 -1
  2. package/es/actions/api/fetch-rank.d.ts +2 -1
  3. package/es/actions/api/fetch-skill.d.ts +2 -1
  4. package/es/actions/api/fetch-skills.d.ts +2 -1
  5. package/es/actions/api/fetch-slide.d.ts +2 -1
  6. package/es/actions/api/fetch-slides-to-review-by-skill-ref.d.ts +2 -1
  7. package/es/actions/api/post-answer.d.ts +2 -1
  8. package/es/actions/api/post-progression.d.ts +2 -1
  9. package/es/actions/ui/navigation.d.ts +1 -1
  10. package/es/actions/ui/slides.d.ts +1 -1
  11. package/es/common/index.d.ts +1 -1
  12. package/es/configure-store.d.ts +1 -1
  13. package/es/configure-store.js +1 -1
  14. package/es/reducers/data/corrections.d.ts +1 -1
  15. package/es/reducers/data/current-skill.d.ts +1 -1
  16. package/es/reducers/data/progression.d.ts +1 -1
  17. package/es/reducers/data/skills.d.ts +1 -1
  18. package/es/reducers/data/slides.d.ts +1 -1
  19. package/es/reducers/ui/slide.d.ts +0 -1
  20. package/es/reducers/ui/slide.js +2 -3
  21. package/es/types/common.d.ts +10 -186
  22. package/es/views/skills/index.d.ts +1 -1
  23. package/es/views/slides/index.d.ts +1 -1
  24. package/es/views/slides/index.js +0 -2
  25. package/es/views/slides/map-api-slide-to-ui.d.ts +2 -1
  26. package/lib/actions/api/fetch-correction.d.ts +2 -1
  27. package/lib/actions/api/fetch-rank.d.ts +2 -1
  28. package/lib/actions/api/fetch-skill.d.ts +2 -1
  29. package/lib/actions/api/fetch-skills.d.ts +2 -1
  30. package/lib/actions/api/fetch-slide.d.ts +2 -1
  31. package/lib/actions/api/fetch-slides-to-review-by-skill-ref.d.ts +2 -1
  32. package/lib/actions/api/post-answer.d.ts +2 -1
  33. package/lib/actions/api/post-progression.d.ts +2 -1
  34. package/lib/actions/ui/navigation.d.ts +1 -1
  35. package/lib/actions/ui/slides.d.ts +1 -1
  36. package/lib/common/index.d.ts +1 -1
  37. package/lib/configure-store.d.ts +1 -1
  38. package/lib/configure-store.js +2 -2
  39. package/lib/reducers/data/corrections.d.ts +1 -1
  40. package/lib/reducers/data/current-skill.d.ts +1 -1
  41. package/lib/reducers/data/progression.d.ts +1 -1
  42. package/lib/reducers/data/skills.d.ts +1 -1
  43. package/lib/reducers/data/slides.d.ts +1 -1
  44. package/lib/reducers/ui/slide.d.ts +0 -1
  45. package/lib/reducers/ui/slide.js +2 -3
  46. package/lib/types/common.d.ts +10 -186
  47. package/lib/views/skills/index.d.ts +1 -1
  48. package/lib/views/slides/index.d.ts +1 -1
  49. package/lib/views/slides/index.js +0 -2
  50. package/lib/views/slides/map-api-slide-to-ui.d.ts +2 -1
  51. package/locales/bs/review.json +1 -4
  52. package/locales/cs/review.json +6 -6
  53. package/locales/de/review.json +7 -7
  54. package/locales/es/review.json +7 -7
  55. package/locales/hr/review.json +1 -1
  56. package/locales/hu/review.json +7 -7
  57. package/locales/hy/review.json +1 -4
  58. package/locales/id/review.json +3 -3
  59. package/locales/it/review.json +6 -6
  60. package/locales/ja/review.json +5 -5
  61. package/locales/ko/review.json +7 -7
  62. package/locales/nl/review.json +6 -6
  63. package/locales/pl/review.json +6 -6
  64. package/locales/pt/review.json +7 -7
  65. package/locales/ro/review.json +6 -6
  66. package/locales/sk/review.json +3 -3
  67. package/locales/th/review.json +5 -5
  68. package/locales/tl/review.json +7 -7
  69. package/locales/tr/review.json +2 -2
  70. package/locales/uk/review.json +7 -7
  71. package/locales/vi/review.json +3 -3
  72. package/locales/zh/review.json +4 -4
  73. package/locales/zh_TW/review.json +6 -6
  74. package/package.json +4 -3
  75. package/es/services/fetch-correction.d.ts +0 -2
  76. package/es/services/fetch-correction.js +0 -14
  77. package/es/services/fetch-rank.d.ts +0 -2
  78. package/es/services/fetch-rank.js +0 -10
  79. package/es/services/fetch-skill.d.ts +0 -2
  80. package/es/services/fetch-skill.js +0 -11
  81. package/es/services/fetch-skills.d.ts +0 -2
  82. package/es/services/fetch-skills.js +0 -10
  83. package/es/services/fetch-slide.d.ts +0 -2
  84. package/es/services/fetch-slide.js +0 -10
  85. package/es/services/fetch-slides-to-review-by-skill-ref.d.ts +0 -2
  86. package/es/services/fetch-slides-to-review-by-skill-ref.js +0 -10
  87. package/es/services/index.d.ts +0 -2
  88. package/es/services/index.js +0 -18
  89. package/es/services/post-answer.d.ts +0 -2
  90. package/es/services/post-answer.js +0 -20
  91. package/es/services/post-progression.d.ts +0 -2
  92. package/es/services/post-progression.js +0 -21
  93. package/es/services/tools/fetch-responses.d.ts +0 -7
  94. package/es/services/tools/fetch-responses.js +0 -33
  95. package/es/services/tools/sleep.d.ts +0 -1
  96. package/es/services/tools/sleep.js +0 -3
  97. package/lib/services/fetch-correction.d.ts +0 -2
  98. package/lib/services/fetch-correction.js +0 -21
  99. package/lib/services/fetch-rank.d.ts +0 -2
  100. package/lib/services/fetch-rank.js +0 -17
  101. package/lib/services/fetch-skill.d.ts +0 -2
  102. package/lib/services/fetch-skill.js +0 -18
  103. package/lib/services/fetch-skills.d.ts +0 -2
  104. package/lib/services/fetch-skills.js +0 -17
  105. package/lib/services/fetch-slide.d.ts +0 -2
  106. package/lib/services/fetch-slide.js +0 -17
  107. package/lib/services/fetch-slides-to-review-by-skill-ref.d.ts +0 -2
  108. package/lib/services/fetch-slides-to-review-by-skill-ref.js +0 -17
  109. package/lib/services/index.d.ts +0 -2
  110. package/lib/services/index.js +0 -22
  111. package/lib/services/post-answer.d.ts +0 -2
  112. package/lib/services/post-answer.js +0 -27
  113. package/lib/services/post-progression.d.ts +0 -2
  114. package/lib/services/post-progression.js +0 -28
  115. package/lib/services/tools/fetch-responses.d.ts +0 -7
  116. package/lib/services/tools/fetch-responses.js +0 -40
  117. package/lib/services/tools/sleep.d.ts +0 -1
  118. package/lib/services/tools/sleep.js +0 -7
@@ -43,15 +43,15 @@
43
43
  }
44
44
  }
45
45
  },
46
- "list_title": "Mga skill na maaari mong repasuhin",
47
- "list_aria_label": "Repasuhin ang Skill Container",
46
+ "list_title": "Mga kasanayan na maaari mong repasuhin",
47
+ "list_aria_label": "Lalagyan ng Mga Kasanayang Rerepasuhin",
48
48
  "card": {
49
- "aria_label": "Skill Card",
50
- "text": "{{total}} (na) tanong na rerepasuhin",
51
- "button_text": "Repasuhin ang skill na ito"
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 skill na rerebisahin",
55
- "text": "Una, kailangan mong kumpletuhin ang mga kurso bago ka makapag-repaso ng iba't ibang skill."
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
  }
@@ -51,7 +51,7 @@
51
51
  "button_text": "Bu beceriyi incele"
52
52
  },
53
53
  "no_skills": {
54
- "title": "Henüz revize etme becerin yok",
55
- "text": "Farklı becerileri inceleyebilmen için önce kursları tamamlaman gerekir."
54
+ "title": "Henüz tekrarlanacak becerin yok",
55
+ "text": "Farklı becerileri inceleyebilmek için önce dersleri tamamlaman gerekiyor."
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
- "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
  }
@@ -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": "Bộ chứa Ôn tập Kỹ năng",
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 để ôn tập",
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 rồi mới có thể ôn tập các kỹ năng khác nhau."
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
  }
@@ -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": "共有 {{total}} 個問題可複習",
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.9.7",
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.6",
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": "6c47db2b4f14131249c57d399e67b5e01b4c0593"
76
+ "gitHead": "c87618fe91e37b1321eecaadf7657eafc2d9bb0e"
76
77
  }
@@ -1,2 +0,0 @@
1
- import { CorrectionFromAPI } from '../types/common';
2
- export declare const fetchCorrection: (slideRef: string, token: string, progressionId: string, answer: string[]) => Promise<CorrectionFromAPI | void>;
@@ -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,2 +0,0 @@
1
- import { Rank } from '../types/common';
2
- export declare const fetchRank: (token: string) => Promise<Rank>;
@@ -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,2 +0,0 @@
1
- import { Skill } from '../types/common';
2
- export declare const fetchSkill: (skillRef: string, token: string) => Promise<Skill>;
@@ -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,2 +0,0 @@
1
- import { SkillToReview } from '../types/common';
2
- export declare const fetchSkills: (token: string) => Promise<SkillToReview[]>;
@@ -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,2 +0,0 @@
1
- import { SlideFromAPI } from '../types/common';
2
- export declare const fetchSlide: (slideRef: string, token: string) => Promise<SlideFromAPI | void>;
@@ -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,2 +0,0 @@
1
- import { SlideIdFromAPI } from '../types/common';
2
- export declare const fetchSlidesToReviewBySkillRef: (token: string, skillRef: string) => Promise<SlideIdFromAPI[]>;
@@ -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
- };
@@ -1,2 +0,0 @@
1
- import { Services } from '../types/common';
2
- export declare const getServices: () => Services;
@@ -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,2 +0,0 @@
1
- import { ProgressionFromAPI } from '../types/common';
2
- export declare const postAnswer: (progression: ProgressionFromAPI, token: string, answer: string[]) => Promise<ProgressionFromAPI>;
@@ -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,2 +0,0 @@
1
- import { ProgressionFromAPI } from '../types/common';
2
- export declare const postProgression: (skillRef: string, token: string) => Promise<ProgressionFromAPI>;
@@ -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,3 +0,0 @@
1
- export const sleep = (msToSleep) => new Promise(resolve => {
2
- setTimeout(resolve, msToSleep);
3
- });
@@ -1,2 +0,0 @@
1
- import { CorrectionFromAPI } from '../types/common';
2
- export declare const fetchCorrection: (slideRef: string, token: string, progressionId: string, answer: string[]) => Promise<CorrectionFromAPI | 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,2 +0,0 @@
1
- import { Rank } from '../types/common';
2
- export declare const fetchRank: (token: string) => Promise<Rank>;
@@ -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,2 +0,0 @@
1
- import { Skill } from '../types/common';
2
- export declare const fetchSkill: (skillRef: string, token: string) => Promise<Skill>;
@@ -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,2 +0,0 @@
1
- import { SkillToReview } from '../types/common';
2
- export declare const fetchSkills: (token: string) => Promise<SkillToReview[]>;
@@ -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,2 +0,0 @@
1
- import { SlideFromAPI } from '../types/common';
2
- export declare const fetchSlide: (slideRef: string, token: string) => Promise<SlideFromAPI | void>;
@@ -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,2 +0,0 @@
1
- import { SlideIdFromAPI } from '../types/common';
2
- export declare const fetchSlidesToReviewBySkillRef: (token: string, skillRef: string) => Promise<SlideIdFromAPI[]>;
@@ -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;
@@ -1,2 +0,0 @@
1
- import { Services } from '../types/common';
2
- export declare const getServices: () => Services;
@@ -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,2 +0,0 @@
1
- import { ProgressionFromAPI } from '../types/common';
2
- export declare const postAnswer: (progression: ProgressionFromAPI, token: string, answer: string[]) => Promise<ProgressionFromAPI>;
@@ -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,2 +0,0 @@
1
- import { ProgressionFromAPI } from '../types/common';
2
- export declare const postProgression: (skillRef: string, token: string) => Promise<ProgressionFromAPI>;
@@ -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>;