@coorpacademy/app-review 0.14.5-alpha.9 → 0.15.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.
@@ -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) => {
@@ -24,11 +24,6 @@ export const fetchSlide = (slideRef) => async (dispatch, getState, { services, a
24
24
  const slideFromAPI = response.payload;
25
25
  const state = getState();
26
26
  const slides = get('data.progression.state.slides', state);
27
- const slideMedia = get('question.medias.0', slideFromAPI);
28
- if (slideMedia && slideMedia.type === 'video') {
29
- const props = (await appendVideoOptions(slideMedia));
30
- slideFromAPI.question.medias = [props];
31
- }
32
27
  if (isEmpty(slides)) {
33
28
  dispatch(setCurrentSlide(slideFromAPI));
34
29
  }
@@ -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 = {
@@ -176,11 +176,6 @@ const getMedia = (media) => {
176
176
  type,
177
177
  url: get('url', resource)
178
178
  };
179
- case 'video':
180
- return {
181
- ...resource,
182
- type
183
- };
184
179
  }
185
180
  };
186
181
  export const mapApiSlideToUi = (dispatch, translate) => (slide, answers) => {
@@ -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) => {
@@ -30,11 +30,6 @@ const fetchSlide = (slideRef) => async (dispatch, getState, { services, appendVi
30
30
  const slideFromAPI = response.payload;
31
31
  const state = getState();
32
32
  const slides = (0, get_1.default)('data.progression.state.slides', state);
33
- const slideMedia = (0, get_1.default)('question.medias.0', slideFromAPI);
34
- if (slideMedia && slideMedia.type === 'video') {
35
- const props = (await appendVideoOptions(slideMedia));
36
- slideFromAPI.question.medias = [props];
37
- }
38
33
  if ((0, isEmpty_1.default)(slides)) {
39
34
  dispatch((0, slides_1.setCurrentSlide)(slideFromAPI));
40
35
  }
@@ -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 = {
@@ -180,11 +180,6 @@ const getMedia = (media) => {
180
180
  type,
181
181
  url: (0, fp_1.get)('url', resource)
182
182
  };
183
- case 'video':
184
- return {
185
- ...resource,
186
- type
187
- };
188
183
  }
189
184
  };
190
185
  const mapApiSlideToUi = (dispatch, translate) => (slide, answers) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/app-review",
3
- "version": "0.14.5-alpha.9+d443a6ec3",
3
+ "version": "0.15.0",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=16.15.0"
@@ -35,11 +35,11 @@
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
- "@coorpacademy/review-services": "1.1.0",
42
- "@coorpacademy/review-services-mocks": "1.1.1",
41
+ "@coorpacademy/review-services": "1.2.0",
42
+ "@coorpacademy/review-services-mocks": "1.2.0",
43
43
  "@coorpacademy/translate": "6.2.0",
44
44
  "cross-fetch": "^3.1.5",
45
45
  "jwt-decode": "^3.1.2",
@@ -74,5 +74,5 @@
74
74
  "webpack-cli": "^4.10.0",
75
75
  "webpack-dev-server": "^4.11.1"
76
76
  },
77
- "gitHead": "d443a6ec3d8f56fc91a93c139da3d5ad5495faab"
77
+ "gitHead": "c27ccb6948548f93b8002440aeae923f171217c3"
78
78
  }