@coorpacademy/app-review 0.14.5-alpha.8 → 0.14.5

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.
@@ -18,4 +18,4 @@ export declare type ReceivedSlide = {
18
18
  slideRef: string;
19
19
  };
20
20
  };
21
- export declare const fetchSlide: (slideRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services, appendVideoOptions }: ThunkOptions) => Promise<void>;
21
+ export declare const fetchSlide: (slideRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => Promise<void>;
@@ -6,7 +6,7 @@ import { setCurrentSlide } from '../ui/slides';
6
6
  export const SLIDE_FETCH_REQUEST = '@@slides/FETCH_REQUEST';
7
7
  export const SLIDE_FETCH_SUCCESS = '@@slides/FETCH_SUCCESS';
8
8
  export const SLIDE_FETCH_FAILURE = '@@slides/FETCH_FAILURE';
9
- export const fetchSlide = (slideRef) => async (dispatch, getState, { services, appendVideoOptions }) => {
9
+ export const fetchSlide = (slideRef) => async (dispatch, getState, { services }) => {
10
10
  const action = buildTask({
11
11
  types: [SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS, SLIDE_FETCH_FAILURE],
12
12
  bailout: (state) => {
@@ -25,11 +25,6 @@ export const fetchSlide = (slideRef) => async (dispatch, getState, { services, a
25
25
  const state = getState();
26
26
  const slides = get('data.progression.state.slides', state);
27
27
  if (isEmpty(slides)) {
28
- const slideMedia = get('question.medias.0', slideFromAPI);
29
- if (slideMedia && slideMedia.type === 'video') {
30
- const props = (await appendVideoOptions(slideMedia));
31
- slideFromAPI.question.medias = [props];
32
- }
33
28
  dispatch(setCurrentSlide(slideFromAPI));
34
29
  }
35
30
  }
@@ -12,8 +12,7 @@ export default function configureStore(options) {
12
12
  : compose;
13
13
  const thunkOptions = {
14
14
  services: options.services || getServices(),
15
- callbackOnViewChanged: options.callbackOnViewChanged,
16
- appendVideoOptions: options.appendVideoOptions
15
+ callbackOnViewChanged: options.callbackOnViewChanged
17
16
  };
18
17
  const thunkMiddleware = thunk.withExtraArgument(thunkOptions);
19
18
  const enhancer = _compose(applyMiddleware(thunkMiddleware));
@@ -1,4 +1,4 @@
1
- import type { Services, VideoMedia } from '@coorpacademy/review-services';
1
+ import type { Services } from '@coorpacademy/review-services';
2
2
  export declare type WithRequired<T, K extends keyof T> = T & {
3
3
  [P in K]-?: T[P];
4
4
  };
@@ -21,11 +21,9 @@ export declare type AppOptions = ConnectedOptions & {
21
21
  skillRef?: string;
22
22
  services?: Services;
23
23
  callbackOnViewChanged?: (viewName: ViewName) => void;
24
- appendVideoOptions: (media: VideoMedia) => Promise<unknown>;
25
24
  };
26
25
  export declare type ThunkOptions = {
27
26
  callbackOnViewChanged?: AppOptions['callbackOnViewChanged'];
28
- appendVideoOptions: (media: VideoMedia) => Promise<unknown>;
29
27
  services: Services;
30
28
  };
31
29
  export declare type Options = {
@@ -74,6 +74,5 @@ export declare type Template = {
74
74
  export declare type AnswerUI = {
75
75
  model: QcmDrag | Qcm | QcmGraphic | FreeText | DropDown | QuestionRange | Template;
76
76
  help: string;
77
- media?: unknown;
78
77
  };
79
78
  export declare type SlideUIAnimations = 'unstack' | 'restack';
@@ -163,35 +163,13 @@ const getAnswerUIModel = (question, answers, dispatch, translate) => {
163
163
  throw new Error(`${type} is not an handled question.type`);
164
164
  }
165
165
  };
166
- const getMedia = (media) => {
167
- if (!media)
168
- return;
169
- const { type } = media;
170
- const resource = get('src.0', media);
171
- switch (type) {
172
- case 'img':
173
- case 'audio':
174
- return {
175
- ...resource,
176
- type,
177
- url: get('url', resource)
178
- };
179
- case 'video':
180
- return {
181
- ...resource,
182
- type
183
- };
184
- }
185
- };
186
166
  export const mapApiSlideToUi = (dispatch, translate) => (slide, answers) => {
187
167
  const questionText = getOr('', 'question.header', slide);
188
- const media = get('question.medias.0', slide);
189
168
  return {
190
169
  questionText,
191
170
  answerUI: {
192
171
  model: getAnswerUIModel(slide.question, answers, dispatch, translate),
193
- help: getHelp(slide),
194
- media: getMedia(media)
172
+ help: getHelp(slide)
195
173
  }
196
174
  };
197
175
  };
@@ -18,4 +18,4 @@ export declare type ReceivedSlide = {
18
18
  slideRef: string;
19
19
  };
20
20
  };
21
- export declare const fetchSlide: (slideRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services, appendVideoOptions }: ThunkOptions) => Promise<void>;
21
+ export declare const fetchSlide: (slideRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => Promise<void>;
@@ -12,7 +12,7 @@ const slides_1 = require("../ui/slides");
12
12
  exports.SLIDE_FETCH_REQUEST = '@@slides/FETCH_REQUEST';
13
13
  exports.SLIDE_FETCH_SUCCESS = '@@slides/FETCH_SUCCESS';
14
14
  exports.SLIDE_FETCH_FAILURE = '@@slides/FETCH_FAILURE';
15
- const fetchSlide = (slideRef) => async (dispatch, getState, { services, appendVideoOptions }) => {
15
+ const fetchSlide = (slideRef) => async (dispatch, getState, { services }) => {
16
16
  const action = (0, redux_task_1.default)({
17
17
  types: [exports.SLIDE_FETCH_REQUEST, exports.SLIDE_FETCH_SUCCESS, exports.SLIDE_FETCH_FAILURE],
18
18
  bailout: (state) => {
@@ -31,11 +31,6 @@ const fetchSlide = (slideRef) => async (dispatch, getState, { services, appendVi
31
31
  const state = getState();
32
32
  const slides = (0, get_1.default)('data.progression.state.slides', state);
33
33
  if ((0, isEmpty_1.default)(slides)) {
34
- const slideMedia = (0, get_1.default)('question.medias.0', slideFromAPI);
35
- if (slideMedia && slideMedia.type === 'video') {
36
- const props = (await appendVideoOptions(slideMedia));
37
- slideFromAPI.question.medias = [props];
38
- }
39
34
  dispatch((0, slides_1.setCurrentSlide)(slideFromAPI));
40
35
  }
41
36
  }
@@ -17,8 +17,7 @@ function configureStore(options) {
17
17
  : redux_1.compose;
18
18
  const thunkOptions = {
19
19
  services: options.services || (0, review_services_1.getServices)(),
20
- callbackOnViewChanged: options.callbackOnViewChanged,
21
- appendVideoOptions: options.appendVideoOptions
20
+ callbackOnViewChanged: options.callbackOnViewChanged
22
21
  };
23
22
  const thunkMiddleware = redux_thunk_1.default.withExtraArgument(thunkOptions);
24
23
  const enhancer = _compose((0, redux_1.applyMiddleware)(thunkMiddleware));
@@ -1,4 +1,4 @@
1
- import type { Services, VideoMedia } from '@coorpacademy/review-services';
1
+ import type { Services } from '@coorpacademy/review-services';
2
2
  export declare type WithRequired<T, K extends keyof T> = T & {
3
3
  [P in K]-?: T[P];
4
4
  };
@@ -21,11 +21,9 @@ export declare type AppOptions = ConnectedOptions & {
21
21
  skillRef?: string;
22
22
  services?: Services;
23
23
  callbackOnViewChanged?: (viewName: ViewName) => void;
24
- appendVideoOptions: (media: VideoMedia) => Promise<unknown>;
25
24
  };
26
25
  export declare type ThunkOptions = {
27
26
  callbackOnViewChanged?: AppOptions['callbackOnViewChanged'];
28
- appendVideoOptions: (media: VideoMedia) => Promise<unknown>;
29
27
  services: Services;
30
28
  };
31
29
  export declare type Options = {
@@ -74,6 +74,5 @@ export declare type Template = {
74
74
  export declare type AnswerUI = {
75
75
  model: QcmDrag | Qcm | QcmGraphic | FreeText | DropDown | QuestionRange | Template;
76
76
  help: string;
77
- media?: unknown;
78
77
  };
79
78
  export declare type SlideUIAnimations = 'unstack' | 'restack';
@@ -167,35 +167,13 @@ const getAnswerUIModel = (question, answers, dispatch, translate) => {
167
167
  throw new Error(`${type} is not an handled question.type`);
168
168
  }
169
169
  };
170
- const getMedia = (media) => {
171
- if (!media)
172
- return;
173
- const { type } = media;
174
- const resource = (0, fp_1.get)('src.0', media);
175
- switch (type) {
176
- case 'img':
177
- case 'audio':
178
- return {
179
- ...resource,
180
- type,
181
- url: (0, fp_1.get)('url', resource)
182
- };
183
- case 'video':
184
- return {
185
- ...resource,
186
- type
187
- };
188
- }
189
- };
190
170
  const mapApiSlideToUi = (dispatch, translate) => (slide, answers) => {
191
171
  const questionText = (0, fp_1.getOr)('', 'question.header', slide);
192
- const media = (0, fp_1.get)('question.medias.0', slide);
193
172
  return {
194
173
  questionText,
195
174
  answerUI: {
196
175
  model: getAnswerUIModel(slide.question, answers, dispatch, translate),
197
- help: getHelp(slide),
198
- media: getMedia(media)
176
+ help: getHelp(slide)
199
177
  }
200
178
  };
201
179
  };
@@ -0,0 +1 @@
1
+ {"ignore_dirs":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/app-review",
3
- "version": "0.14.5-alpha.8+e51b2ed20",
3
+ "version": "0.14.5",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=16.15.0"
@@ -35,7 +35,7 @@
35
35
  "main": "lib/index.js",
36
36
  "module": "es/index.js",
37
37
  "dependencies": {
38
- "@coorpacademy/components": "11.4.2",
38
+ "@coorpacademy/components": "11.4.3",
39
39
  "@coorpacademy/progression-engine": "11.5.3",
40
40
  "@coorpacademy/redux-task": "1.1.6",
41
41
  "@coorpacademy/review-services": "1.1.0",
@@ -74,5 +74,5 @@
74
74
  "webpack-cli": "^4.10.0",
75
75
  "webpack-dev-server": "^4.11.1"
76
76
  },
77
- "gitHead": "e51b2ed20cb6feaf177a880600a10e922208e6e0"
77
+ "gitHead": "60d618e1eb1b21e7e3c63ab16c75ecd2b60c1e39"
78
78
  }