@coorpacademy/app-review 0.7.7-alpha.3 → 0.8.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.
@@ -0,0 +1,11 @@
1
+ import { Dispatch } from 'redux';
2
+ import type { StoreState } from '../../reducers';
3
+ import type { Skill, ThunkOptions } from '../../types/common';
4
+ export declare const SKILL_FETCH_REQUEST: "@@skill/FETCH_REQUEST";
5
+ export declare const SKILL_FETCH_SUCCESS: "@@skill/FETCH_SUCCESS";
6
+ export declare const SKILL_FETCH_FAILURE: "@@skill/FETCH_FAILURE";
7
+ export declare type ReceivedSkill = {
8
+ type: typeof SKILL_FETCH_SUCCESS;
9
+ payload: Skill;
10
+ };
11
+ export declare const fetchSkill: (skillRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => ReceivedSkill;
@@ -0,0 +1,16 @@
1
+ import get from 'lodash/fp/get';
2
+ import buildTask from '@coorpacademy/redux-task';
3
+ export const SKILL_FETCH_REQUEST = '@@skill/FETCH_REQUEST';
4
+ export const SKILL_FETCH_SUCCESS = '@@skill/FETCH_SUCCESS';
5
+ export const SKILL_FETCH_FAILURE = '@@skill/FETCH_FAILURE';
6
+ export const fetchSkill = (skillRef) => (dispatch, getState, { services }) => {
7
+ const action = buildTask({
8
+ types: [SKILL_FETCH_REQUEST, SKILL_FETCH_SUCCESS, SKILL_FETCH_FAILURE],
9
+ task: () => {
10
+ const state = getState();
11
+ const token = get(['data', 'token'], state);
12
+ return services.fetchSkill(skillRef, token);
13
+ }
14
+ });
15
+ return dispatch(action);
16
+ };
@@ -1,6 +1,7 @@
1
1
  import buildTask from '@coorpacademy/redux-task';
2
2
  import get from 'lodash/fp/get';
3
3
  import { fetchSlide } from './fetch-slide';
4
+ import { fetchSkill } from './fetch-skill';
4
5
  export const POST_PROGRESSION_REQUEST = '@@progression/POST_REQUEST';
5
6
  export const POST_PROGRESSION_SUCCESS = '@@progression/POST_SUCCESS';
6
7
  export const POST_PROGRESSION_FAILURE = '@@progression/POST_FAILURE';
@@ -16,5 +17,6 @@ export const postProgression = (skillRef) => async (dispatch, getState, { servic
16
17
  const progression = response.payload;
17
18
  const slideRef = progression.state.nextContent.ref;
18
19
  await dispatch(fetchSlide(slideRef));
20
+ await dispatch(fetchSkill(skillRef));
19
21
  }
20
22
  };
@@ -60,7 +60,8 @@ const getCurrentSlideRef = (state) => {
60
60
  const content = progression.state.content;
61
61
  return content.ref;
62
62
  };
63
- const buildStackSlides = (state, dispatch) => {
63
+ const buildStackSlides = (state, dispatch, options) => {
64
+ const { translate } = options;
64
65
  const currentSlideRef = getCurrentSlideRef(state);
65
66
  const progression = state.data.progression;
66
67
  if (!currentSlideRef || !progression)
@@ -93,7 +94,10 @@ const buildStackSlides = (state, dispatch) => {
93
94
  loading: false,
94
95
  questionText,
95
96
  answerUI,
96
- parentContentTitle: `From "${parentContentTitle}" ${parentContentType}`,
97
+ parentContentTitle: translate('Content Parent Title', {
98
+ contentTitle: parentContentTitle,
99
+ contentType: parentContentType
100
+ }),
97
101
  animationType
98
102
  };
99
103
  return set(index, updatedUiSlide, acc);
@@ -320,7 +324,7 @@ export const mapStateToSlidesProps = (state, dispatch, options) => {
320
324
  hiddenSteps: showCongrats
321
325
  },
322
326
  stack: {
323
- slides: buildStackSlides(state, dispatch),
327
+ slides: buildStackSlides(state, dispatch, options),
324
328
  validateButton: {
325
329
  label: translate('Validate'),
326
330
  disabled: !get(['ui', 'slide', currentSlideRef, 'validateButton'], state),
@@ -0,0 +1,11 @@
1
+ import { Dispatch } from 'redux';
2
+ import type { StoreState } from '../../reducers';
3
+ import type { Skill, ThunkOptions } from '../../types/common';
4
+ export declare const SKILL_FETCH_REQUEST: "@@skill/FETCH_REQUEST";
5
+ export declare const SKILL_FETCH_SUCCESS: "@@skill/FETCH_SUCCESS";
6
+ export declare const SKILL_FETCH_FAILURE: "@@skill/FETCH_FAILURE";
7
+ export declare type ReceivedSkill = {
8
+ type: typeof SKILL_FETCH_SUCCESS;
9
+ payload: Skill;
10
+ };
11
+ export declare const fetchSkill: (skillRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => ReceivedSkill;
@@ -0,0 +1,23 @@
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 = exports.SKILL_FETCH_FAILURE = exports.SKILL_FETCH_SUCCESS = exports.SKILL_FETCH_REQUEST = void 0;
7
+ const get_1 = __importDefault(require("lodash/fp/get"));
8
+ const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
9
+ exports.SKILL_FETCH_REQUEST = '@@skill/FETCH_REQUEST';
10
+ exports.SKILL_FETCH_SUCCESS = '@@skill/FETCH_SUCCESS';
11
+ exports.SKILL_FETCH_FAILURE = '@@skill/FETCH_FAILURE';
12
+ const fetchSkill = (skillRef) => (dispatch, getState, { services }) => {
13
+ const action = (0, redux_task_1.default)({
14
+ types: [exports.SKILL_FETCH_REQUEST, exports.SKILL_FETCH_SUCCESS, exports.SKILL_FETCH_FAILURE],
15
+ task: () => {
16
+ const state = getState();
17
+ const token = (0, get_1.default)(['data', 'token'], state);
18
+ return services.fetchSkill(skillRef, token);
19
+ }
20
+ });
21
+ return dispatch(action);
22
+ };
23
+ exports.fetchSkill = fetchSkill;
@@ -7,6 +7,7 @@ exports.postProgression = exports.POST_PROGRESSION_FAILURE = exports.POST_PROGRE
7
7
  const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
8
8
  const get_1 = __importDefault(require("lodash/fp/get"));
9
9
  const fetch_slide_1 = require("./fetch-slide");
10
+ const fetch_skill_1 = require("./fetch-skill");
10
11
  exports.POST_PROGRESSION_REQUEST = '@@progression/POST_REQUEST';
11
12
  exports.POST_PROGRESSION_SUCCESS = '@@progression/POST_SUCCESS';
12
13
  exports.POST_PROGRESSION_FAILURE = '@@progression/POST_FAILURE';
@@ -22,6 +23,7 @@ const postProgression = (skillRef) => async (dispatch, getState, { services }) =
22
23
  const progression = response.payload;
23
24
  const slideRef = progression.state.nextContent.ref;
24
25
  await dispatch((0, fetch_slide_1.fetchSlide)(slideRef));
26
+ await dispatch((0, fetch_skill_1.fetchSkill)(skillRef));
25
27
  }
26
28
  };
27
29
  exports.postProgression = postProgression;
@@ -66,7 +66,8 @@ const getCurrentSlideRef = (state) => {
66
66
  const content = progression.state.content;
67
67
  return content.ref;
68
68
  };
69
- const buildStackSlides = (state, dispatch) => {
69
+ const buildStackSlides = (state, dispatch, options) => {
70
+ const { translate } = options;
70
71
  const currentSlideRef = getCurrentSlideRef(state);
71
72
  const progression = state.data.progression;
72
73
  if (!currentSlideRef || !progression)
@@ -99,7 +100,10 @@ const buildStackSlides = (state, dispatch) => {
99
100
  loading: false,
100
101
  questionText,
101
102
  answerUI,
102
- parentContentTitle: `From "${parentContentTitle}" ${parentContentType}`,
103
+ parentContentTitle: translate('Content Parent Title', {
104
+ contentTitle: parentContentTitle,
105
+ contentType: parentContentType
106
+ }),
103
107
  animationType
104
108
  };
105
109
  return (0, set_1.default)(index, updatedUiSlide, acc);
@@ -327,7 +331,7 @@ const mapStateToSlidesProps = (state, dispatch, options) => {
327
331
  hiddenSteps: showCongrats
328
332
  },
329
333
  stack: {
330
- slides: buildStackSlides(state, dispatch),
334
+ slides: buildStackSlides(state, dispatch, options),
331
335
  validateButton: {
332
336
  label: translate('Validate'),
333
337
  disabled: !(0, get_1.default)(['ui', 'slide', currentSlideRef, 'validateButton'], state),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "Review Title": "Review Mode",
3
- "Content Parent Title": "From `{{contentTitle}}` `{{contentType}}`",
3
+ "Content Parent Title": "From \"{{contentTitle}}\" {{contentType}}",
4
4
  "Validate": "Validate",
5
5
  "Next Question": "Next Question",
6
6
  "KLF": "Key point",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/app-review",
3
- "version": "0.7.7-alpha.3+672627779",
3
+ "version": "0.8.0",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=16.15.0"
@@ -35,9 +35,9 @@
35
35
  "main": "lib/index.js",
36
36
  "module": "es/index.js",
37
37
  "dependencies": {
38
- "@coorpacademy/components": "10.27.5-alpha.31+672627779",
38
+ "@coorpacademy/components": "10.28.0",
39
39
  "@coorpacademy/redux-task": "1.1.6",
40
- "@coorpacademy/translate": "6.1.5",
40
+ "@coorpacademy/translate": "^6.1.5",
41
41
  "cross-fetch": "^3.1.5",
42
42
  "jwt-decode": "^3.1.2",
43
43
  "react-redux": "^7.2.9",
@@ -51,7 +51,7 @@
51
51
  "devDependencies": {
52
52
  "@coorpacademy/css-modules-require-hook": "3.0.0",
53
53
  "@coorpacademy/eslint-plugin-coorpacademy": "^11.0.0",
54
- "@coorpacademy/webpack-config": "12.0.1-alpha.82+672627779",
54
+ "@coorpacademy/webpack-config": "12.0.0",
55
55
  "@testing-library/react": "^12.1.5",
56
56
  "@types/lodash": "^4.14.182",
57
57
  "@typescript-eslint/eslint-plugin": "^5.28.0",
@@ -71,5 +71,5 @@
71
71
  "webpack-cli": "^4.10.0",
72
72
  "webpack-dev-server": "^4.11.1"
73
73
  },
74
- "gitHead": "672627779e08919d1070239fbfe425d9353510d1"
74
+ "gitHead": "469c5b379929740760111811fcf27181d5ba7291"
75
75
  }