@coorpacademy/app-review 0.0.14-alpha.3 → 0.0.14-alpha.4.3
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/courses.d.ts +2 -2
- package/es/actions/courses.d.ts.map +1 -1
- package/es/actions/index.d.ts +4 -4
- package/es/actions/index.d.ts.map +1 -1
- package/es/actions/navigation.d.ts +6 -6
- package/es/actions/navigation.d.ts.map +1 -1
- package/es/actions/token.d.ts +2 -2
- package/es/actions/token.d.ts.map +1 -1
- package/es/components/__tmp-backup-vues-mobile/revision-home.stories.d.ts +0 -1
- package/es/components/__tmp-backup-vues-mobile/revision-home.stories.js +14 -14
- package/es/reducers/courses.d.ts +2 -2
- package/es/reducers/courses.d.ts.map +1 -1
- package/es/reducers/navigation.d.ts +2 -2
- package/es/reducers/navigation.d.ts.map +1 -1
- package/es/reducers/token.d.ts +2 -2
- package/es/reducers/token.d.ts.map +1 -1
- package/es/services/fetch-demo.d.ts +8 -2
- package/es/services/fetch-demo.d.ts.map +1 -1
- package/es/services/fetch-demo.js +2 -1
- package/es/services/fetch-demo.test.js +7 -8
- package/es/services/{fetch.test.d.ts → fetch.mocks.d.ts} +2 -2
- package/es/services/fetch.mocks.d.ts.map +1 -0
- package/lib/actions/courses.d.ts +2 -2
- package/lib/actions/courses.d.ts.map +1 -1
- package/lib/actions/index.d.ts +4 -4
- package/lib/actions/index.d.ts.map +1 -1
- package/lib/actions/navigation.d.ts +6 -6
- package/lib/actions/navigation.d.ts.map +1 -1
- package/lib/actions/token.d.ts +2 -2
- package/lib/actions/token.d.ts.map +1 -1
- package/lib/components/__tmp-backup-vues-mobile/revision-home.stories.d.ts +0 -1
- package/lib/components/__tmp-backup-vues-mobile/revision-home.stories.js +14 -16
- package/lib/reducers/courses.d.ts +2 -2
- package/lib/reducers/courses.d.ts.map +1 -1
- package/lib/reducers/navigation.d.ts +2 -2
- package/lib/reducers/navigation.d.ts.map +1 -1
- package/lib/reducers/token.d.ts +2 -2
- package/lib/reducers/token.d.ts.map +1 -1
- package/lib/services/fetch-demo.d.ts +8 -2
- package/lib/services/fetch-demo.d.ts.map +1 -1
- package/lib/services/fetch-demo.js +2 -1
- package/lib/services/fetch-demo.test.js +8 -9
- package/lib/services/{fetch.test.d.ts → fetch.mocks.d.ts} +2 -2
- package/lib/services/fetch.mocks.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/actions/courses.ts +2 -2
- package/src/actions/index.ts +4 -4
- package/src/actions/navigation.ts +6 -6
- package/src/actions/token.ts +2 -2
- package/src/components/__tmp-backup-vues-mobile/revision-home.stories.tsx +14 -14
- package/src/reducers/courses.ts +2 -2
- package/src/reducers/navigation.ts +2 -2
- package/src/reducers/token.ts +2 -2
- package/src/services/fetch-demo.test.ts +9 -8
- package/src/services/fetch-demo.ts +9 -3
- package/src/services/{fetch.test.ts → fetch.mocks.ts} +1 -1
- package/es/services/fetch.test.d.ts.map +0 -1
- package/lib/services/fetch.test.d.ts.map +0 -1
- /package/es/services/{fetch.test.js → fetch.mocks.js} +0 -0
- /package/lib/services/{fetch.test.js → fetch.mocks.js} +0 -0
package/es/actions/courses.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const RECEIVED_COURSE = "@@api/RECEIVED_COURSE";
|
|
2
|
-
export declare type
|
|
2
|
+
export declare type ReceivedCourse = {
|
|
3
3
|
type: '@@api/RECEIVED_COURSE';
|
|
4
4
|
payload: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const receivedCourse: (course: any) =>
|
|
6
|
+
export declare const receivedCourse: (course: any) => ReceivedCourse;
|
|
7
7
|
//# sourceMappingURL=courses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"courses.d.ts","sourceRoot":"","sources":["../../src/actions/courses.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,0BAA0B,CAAC;AAEvD,oBAAY,
|
|
1
|
+
{"version":3,"file":"courses.d.ts","sourceRoot":"","sources":["../../src/actions/courses.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,0BAA0B,CAAC;AAEvD,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,cAAc,WAAY,GAAG,KAAG,cAG3C,CAAC"}
|
package/es/actions/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ReceivedCourse } from './courses';
|
|
2
|
+
import { NavigateBack, NavigateTo, StartApp } from './navigation';
|
|
3
|
+
import { StoreToken } from './token';
|
|
4
4
|
export * from './courses';
|
|
5
5
|
export * from './navigation';
|
|
6
6
|
export * from './token';
|
|
7
|
-
export declare type Action =
|
|
7
|
+
export declare type Action = StartApp | StoreToken | NavigateBack | NavigateTo | ReceivedCourse;
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AACzC,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAChE,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AAEnC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,oBAAY,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,cAAc,CAAC"}
|
|
@@ -3,18 +3,18 @@ import { AppOptions } from '..';
|
|
|
3
3
|
export declare const NAVIGATE_TO = "@@navigation/NAVIGATE_TO";
|
|
4
4
|
export declare const NAVIGATE_BACK = "@@navigation/NAVIGATE_BACK";
|
|
5
5
|
export declare const START_APP = "@@navigation/START_APP";
|
|
6
|
-
export declare type
|
|
6
|
+
export declare type NavigateTo = {
|
|
7
7
|
type: '@@navigation/NAVIGATE_TO';
|
|
8
8
|
payload: string;
|
|
9
9
|
};
|
|
10
|
-
export declare type
|
|
10
|
+
export declare type NavigateBack = {
|
|
11
11
|
type: '@@navigation/NAVIGATE_BACK';
|
|
12
12
|
};
|
|
13
|
-
export declare type
|
|
13
|
+
export declare type StartApp = {
|
|
14
14
|
type: '@@navigation/START_APP';
|
|
15
15
|
payload: AppOptions;
|
|
16
16
|
};
|
|
17
|
-
export declare const navigateTo: ActionCreator
|
|
18
|
-
export declare const navigateBack: ActionCreator
|
|
19
|
-
export declare const startApp: (options: AppOptions) =>
|
|
17
|
+
export declare const navigateTo: ActionCreator<NavigateTo>;
|
|
18
|
+
export declare const navigateBack: ActionCreator<NavigateBack>;
|
|
19
|
+
export declare const startApp: (options: AppOptions) => StartApp;
|
|
20
20
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/actions/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AACpC,OAAO,EAAC,UAAU,EAAC,MAAM,IAAI,CAAC;AAE9B,eAAO,MAAM,WAAW,6BAA6B,CAAC;AACtD,eAAO,MAAM,aAAa,+BAA+B,CAAC;AAC1D,eAAO,MAAM,SAAS,2BAA2B,CAAC;AAElD,oBAAY,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/actions/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AACpC,OAAO,EAAC,UAAU,EAAC,MAAM,IAAI,CAAC;AAE9B,eAAO,MAAM,WAAW,6BAA6B,CAAC;AACtD,eAAO,MAAM,aAAa,+BAA+B,CAAC;AAC1D,eAAO,MAAM,SAAS,2BAA2B,CAAC;AAElD,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,4BAA4B,CAAC;CACpC,CAAC;AAEF,oBAAY,QAAQ,GAAG;IACrB,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,UAAU,CAG/C,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,YAAY,CAEnD,CAAC;AAEH,eAAO,MAAM,QAAQ,YAAa,UAAU,KAAG,QAG7C,CAAC"}
|
package/es/actions/token.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const STORE_TOKEN = "@@token/STORE_TOKEN";
|
|
2
|
-
export declare type
|
|
2
|
+
export declare type StoreToken = {
|
|
3
3
|
type: '@@token/STORE_TOKEN';
|
|
4
4
|
payload: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const storeToken: (token: string) =>
|
|
6
|
+
export declare const storeToken: (token: string) => StoreToken;
|
|
7
7
|
//# sourceMappingURL=token.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/actions/token.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,wBAAwB,CAAC;AAEjD,oBAAY,
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/actions/token.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,wBAAwB,CAAC;AAEjD,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,qBAAqB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,UAGzC,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import RevisionHome from './revision-home';
|
|
4
|
-
const emptySkills = [];
|
|
5
|
-
const skillsToRevise = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
];
|
|
12
|
-
storiesOf('RevisionHome', module)
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
// import * as React from 'react';
|
|
2
|
+
// import {storiesOf} from '@storybook/react-native';
|
|
3
|
+
// import RevisionHome from './revision-home';
|
|
4
|
+
// const emptySkills: [] = [];
|
|
5
|
+
// const skillsToRevise: {title: string; info: string}[] = [
|
|
6
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
7
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
8
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
9
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
10
|
+
// {title: 'Creativity and innovation', info: '75 questions to revise'}
|
|
11
|
+
// ];
|
|
12
|
+
// storiesOf('RevisionHome', module)
|
|
13
|
+
// .add('No skills', () => <RevisionHome skillsToRevise={emptySkills} />)
|
|
14
|
+
// .add('Few skills', () => <RevisionHome skillsToRevise={skillsToRevise} />);
|
package/es/reducers/courses.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReceivedCourse } from '../actions';
|
|
2
2
|
export declare type State = Array<any>;
|
|
3
3
|
export declare const initialState: State;
|
|
4
|
-
declare const reducer: (state: State, action:
|
|
4
|
+
declare const reducer: (state: State, action: ReceivedCourse) => State;
|
|
5
5
|
export default reducer;
|
|
6
6
|
//# sourceMappingURL=courses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"courses.d.ts","sourceRoot":"","sources":["../../src/reducers/courses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"courses.d.ts","sourceRoot":"","sources":["../../src/reducers/courses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAkB,MAAM,YAAY,CAAC;AAI3D,oBAAY,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAC/B,eAAO,MAAM,YAAY,EAAE,KAAU,CAAC;AAItC,QAAA,MAAM,OAAO,yBAAyC,cAAc,UAQnE,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NavigateTo, NavigateBack } from '../actions/navigation';
|
|
2
2
|
export declare type State = Array<string>;
|
|
3
3
|
export declare const initialState: State;
|
|
4
|
-
declare const reducer: (state: State, action:
|
|
4
|
+
declare const reducer: (state: State, action: NavigateTo | NavigateBack) => State;
|
|
5
5
|
export declare const getCurrentViewName: (appState: any) => any;
|
|
6
6
|
export default reducer;
|
|
7
7
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/reducers/navigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/reducers/navigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAIpE,oBAAY,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAClC,eAAO,MAAM,YAAY,EAAE,KAAgB,CAAC;AAI5C,QAAA,MAAM,OAAO,yBAAyC,UAAU,GAAG,YAAY,UAa9E,CAAC;AAIF,eAAO,MAAM,kBAAkB,wBAAkE,CAAC;AAIlG,eAAe,OAAO,CAAC"}
|
package/es/reducers/token.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StoreToken } from '../actions';
|
|
2
2
|
export declare type State = string;
|
|
3
3
|
export declare const initialState: State;
|
|
4
|
-
declare const reducer: (state: State, action:
|
|
4
|
+
declare const reducer: (state: State, action: StoreToken) => State;
|
|
5
5
|
export declare const getToken: (appState: any) => any;
|
|
6
6
|
export default reducer;
|
|
7
7
|
//# sourceMappingURL=token.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/reducers/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/reducers/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAc,MAAM,YAAY,CAAC;AAInD,oBAAY,KAAK,GAAG,MAAM,CAAC;AAC3B,eAAO,MAAM,YAAY,EAAE,KAAY,CAAC;AAIxC,QAAA,MAAM,OAAO,UAAW,KAAK,UAAyB,UAAU,KAAG,KAQlE,CAAC;AAIF,eAAO,MAAM,QAAQ,wBAA6B,CAAC;AAInD,eAAe,OAAO,CAAC"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Fetch } from './fetch-responses';
|
|
2
|
-
declare const fetchCourse: (fetch: Fetch) => (token: any, language: any, universalRef: any) => Promise<
|
|
2
|
+
declare const fetchCourse: (fetch: Fetch) => (token: any, language: any, universalRef: any) => Promise<Course>;
|
|
3
|
+
export declare type Course = {
|
|
4
|
+
title: any;
|
|
5
|
+
};
|
|
6
|
+
export declare type CatalogHits = {
|
|
7
|
+
hits: Course[];
|
|
8
|
+
};
|
|
3
9
|
export { fetchCourse };
|
|
4
|
-
declare const _default: (token: any, language: any, universalRef: any) => Promise<
|
|
10
|
+
declare const _default: (token: any, language: any, universalRef: any) => Promise<Course>;
|
|
5
11
|
export default _default;
|
|
6
12
|
//# sourceMappingURL=fetch-demo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-demo.d.ts","sourceRoot":"","sources":["../../src/services/fetch-demo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch-demo.d.ts","sourceRoot":"","sources":["../../src/services/fetch-demo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAS,MAAM,mBAAmB,CAAC;AA4BhD,QAAA,MAAM,WAAW,UAAW,KAAK,uDAA4C,QAAQ,MAAM,CAc1F,CAAC;AAIF,oBAAY,MAAM,GAAG;IAAC,KAAK,MAAA;CAAC,CAAC;AAC7B,oBAAY,WAAW,GAAG;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC;AAI3C,OAAO,EAAC,WAAW,EAAC,CAAC;;AACrB,wBAAuC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import crossFetch from 'cross-fetch';
|
|
1
2
|
import decode from 'jwt-decode';
|
|
2
3
|
import { toJSON } from './fetch-responses';
|
|
3
4
|
const buildUrlQueryParams = (params) => Object.keys(params)
|
|
@@ -22,4 +23,4 @@ const fetchCourse = (fetch) => async (token, language, universalRef) => {
|
|
|
22
23
|
};
|
|
23
24
|
// -----------------------------------------------------------------------------
|
|
24
25
|
export { fetchCourse };
|
|
25
|
-
export default fetchCourse(
|
|
26
|
+
export default fetchCourse(crossFetch);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
-
import { fetchCourse as _fetchCourse } from './fetch-demo
|
|
3
|
-
import { okJSONResponse } from './fetch.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
test('should fetch a demo course with mobile-staging dev token', async (t) => {
|
|
7
|
-
const token = 'foo';
|
|
2
|
+
import { fetchCourse as _fetchCourse } from './fetch-demo';
|
|
3
|
+
import { okJSONResponse } from './fetch.mocks';
|
|
4
|
+
test('should fetch a demo course', async (t) => {
|
|
5
|
+
const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
|
|
8
6
|
const language = 'fr';
|
|
9
7
|
const universalRef = 'bar';
|
|
10
|
-
const
|
|
8
|
+
const result = { hits: [{ title: 'Digital IQ test' }] };
|
|
9
|
+
const fetchCourse = _fetchCourse(okJSONResponse(result));
|
|
11
10
|
const course = await fetchCourse(token, language, universalRef);
|
|
12
|
-
t.is(course.title, 'Digital
|
|
11
|
+
t.is(course.title, 'Digital IQ test');
|
|
13
12
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Response } from './fetch-responses
|
|
1
|
+
import { Response } from './fetch-responses';
|
|
2
2
|
export declare const toResponse: (status: number, statusText: string, body: string) => Promise<Response>;
|
|
3
3
|
declare type FetchFunction = () => Promise<Response>;
|
|
4
4
|
export declare const okJSONResponse: (body: unknown) => FetchFunction;
|
|
@@ -7,4 +7,4 @@ export declare const notFoundJSONResponse: (body: unknown) => FetchFunction;
|
|
|
7
7
|
export declare const okTextResponse: (body: string) => FetchFunction;
|
|
8
8
|
export declare const internalServerErrorTextResponse: (body: string) => FetchFunction;
|
|
9
9
|
export {};
|
|
10
|
-
//# sourceMappingURL=fetch.
|
|
10
|
+
//# sourceMappingURL=fetch.mocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.mocks.d.ts","sourceRoot":"","sources":["../../src/services/fetch.mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE3C,eAAO,MAAM,UAAU,WAAY,MAAM,cAAc,MAAM,QAAQ,MAAM,KAAG,QAAQ,QAAQ,CAO1F,CAAC;AAEL,aAAK,aAAa,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7C,eAAO,MAAM,cAAc,SAAU,OAAO,KAAG,aACF,CAAC;AAE9C,eAAO,MAAM,+BAA+B,SAAU,OAAO,KAAG,aACF,CAAC;AAE/D,eAAO,MAAM,oBAAoB,SAAU,OAAO,KAAG,aACD,CAAC;AAErD,eAAO,MAAM,cAAc,SAAU,MAAM,KAAG,aAAkD,CAAC;AAEjG,eAAO,MAAM,+BAA+B,SAAU,MAAM,KAAG,aACjB,CAAC"}
|
package/lib/actions/courses.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const RECEIVED_COURSE = "@@api/RECEIVED_COURSE";
|
|
2
|
-
export declare type
|
|
2
|
+
export declare type ReceivedCourse = {
|
|
3
3
|
type: '@@api/RECEIVED_COURSE';
|
|
4
4
|
payload: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const receivedCourse: (course: any) =>
|
|
6
|
+
export declare const receivedCourse: (course: any) => ReceivedCourse;
|
|
7
7
|
//# sourceMappingURL=courses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"courses.d.ts","sourceRoot":"","sources":["../../src/actions/courses.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,0BAA0B,CAAC;AAEvD,oBAAY,
|
|
1
|
+
{"version":3,"file":"courses.d.ts","sourceRoot":"","sources":["../../src/actions/courses.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,0BAA0B,CAAC;AAEvD,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,cAAc,WAAY,GAAG,KAAG,cAG3C,CAAC"}
|
package/lib/actions/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ReceivedCourse } from './courses';
|
|
2
|
+
import { NavigateBack, NavigateTo, StartApp } from './navigation';
|
|
3
|
+
import { StoreToken } from './token';
|
|
4
4
|
export * from './courses';
|
|
5
5
|
export * from './navigation';
|
|
6
6
|
export * from './token';
|
|
7
|
-
export declare type Action =
|
|
7
|
+
export declare type Action = StartApp | StoreToken | NavigateBack | NavigateTo | ReceivedCourse;
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AACzC,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAChE,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AAEnC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,oBAAY,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,cAAc,CAAC"}
|
|
@@ -3,18 +3,18 @@ import { AppOptions } from '..';
|
|
|
3
3
|
export declare const NAVIGATE_TO = "@@navigation/NAVIGATE_TO";
|
|
4
4
|
export declare const NAVIGATE_BACK = "@@navigation/NAVIGATE_BACK";
|
|
5
5
|
export declare const START_APP = "@@navigation/START_APP";
|
|
6
|
-
export declare type
|
|
6
|
+
export declare type NavigateTo = {
|
|
7
7
|
type: '@@navigation/NAVIGATE_TO';
|
|
8
8
|
payload: string;
|
|
9
9
|
};
|
|
10
|
-
export declare type
|
|
10
|
+
export declare type NavigateBack = {
|
|
11
11
|
type: '@@navigation/NAVIGATE_BACK';
|
|
12
12
|
};
|
|
13
|
-
export declare type
|
|
13
|
+
export declare type StartApp = {
|
|
14
14
|
type: '@@navigation/START_APP';
|
|
15
15
|
payload: AppOptions;
|
|
16
16
|
};
|
|
17
|
-
export declare const navigateTo: ActionCreator
|
|
18
|
-
export declare const navigateBack: ActionCreator
|
|
19
|
-
export declare const startApp: (options: AppOptions) =>
|
|
17
|
+
export declare const navigateTo: ActionCreator<NavigateTo>;
|
|
18
|
+
export declare const navigateBack: ActionCreator<NavigateBack>;
|
|
19
|
+
export declare const startApp: (options: AppOptions) => StartApp;
|
|
20
20
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/actions/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AACpC,OAAO,EAAC,UAAU,EAAC,MAAM,IAAI,CAAC;AAE9B,eAAO,MAAM,WAAW,6BAA6B,CAAC;AACtD,eAAO,MAAM,aAAa,+BAA+B,CAAC;AAC1D,eAAO,MAAM,SAAS,2BAA2B,CAAC;AAElD,oBAAY,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/actions/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AACpC,OAAO,EAAC,UAAU,EAAC,MAAM,IAAI,CAAC;AAE9B,eAAO,MAAM,WAAW,6BAA6B,CAAC;AACtD,eAAO,MAAM,aAAa,+BAA+B,CAAC;AAC1D,eAAO,MAAM,SAAS,2BAA2B,CAAC;AAElD,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,4BAA4B,CAAC;CACpC,CAAC;AAEF,oBAAY,QAAQ,GAAG;IACrB,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,UAAU,CAG/C,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,YAAY,CAEnD,CAAC;AAEH,eAAO,MAAM,QAAQ,YAAa,UAAU,KAAG,QAG7C,CAAC"}
|
package/lib/actions/token.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const STORE_TOKEN = "@@token/STORE_TOKEN";
|
|
2
|
-
export declare type
|
|
2
|
+
export declare type StoreToken = {
|
|
3
3
|
type: '@@token/STORE_TOKEN';
|
|
4
4
|
payload: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const storeToken: (token: string) =>
|
|
6
|
+
export declare const storeToken: (token: string) => StoreToken;
|
|
7
7
|
//# sourceMappingURL=token.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/actions/token.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,wBAAwB,CAAC;AAEjD,oBAAY,
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/actions/token.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,wBAAwB,CAAC;AAEjD,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,qBAAqB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,UAGzC,CAAC"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.add('No skills', function () { return React.createElement(revision_home_1.default, { skillsToRevise: emptySkills }); })
|
|
16
|
-
.add('Few skills', function () { return React.createElement(revision_home_1.default, { skillsToRevise: skillsToRevise }); });
|
|
1
|
+
// import * as React from 'react';
|
|
2
|
+
// import {storiesOf} from '@storybook/react-native';
|
|
3
|
+
// import RevisionHome from './revision-home';
|
|
4
|
+
// const emptySkills: [] = [];
|
|
5
|
+
// const skillsToRevise: {title: string; info: string}[] = [
|
|
6
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
7
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
8
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
9
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
10
|
+
// {title: 'Creativity and innovation', info: '75 questions to revise'}
|
|
11
|
+
// ];
|
|
12
|
+
// storiesOf('RevisionHome', module)
|
|
13
|
+
// .add('No skills', () => <RevisionHome skillsToRevise={emptySkills} />)
|
|
14
|
+
// .add('Few skills', () => <RevisionHome skillsToRevise={skillsToRevise} />);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReceivedCourse } from '../actions';
|
|
2
2
|
export declare type State = Array<any>;
|
|
3
3
|
export declare const initialState: State;
|
|
4
|
-
declare const reducer: (state: State, action:
|
|
4
|
+
declare const reducer: (state: State, action: ReceivedCourse) => State;
|
|
5
5
|
export default reducer;
|
|
6
6
|
//# sourceMappingURL=courses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"courses.d.ts","sourceRoot":"","sources":["../../src/reducers/courses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"courses.d.ts","sourceRoot":"","sources":["../../src/reducers/courses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAkB,MAAM,YAAY,CAAC;AAI3D,oBAAY,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAC/B,eAAO,MAAM,YAAY,EAAE,KAAU,CAAC;AAItC,QAAA,MAAM,OAAO,yBAAyC,cAAc,UAQnE,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NavigateTo, NavigateBack } from '../actions/navigation';
|
|
2
2
|
export declare type State = Array<string>;
|
|
3
3
|
export declare const initialState: State;
|
|
4
|
-
declare const reducer: (state: State, action:
|
|
4
|
+
declare const reducer: (state: State, action: NavigateTo | NavigateBack) => State;
|
|
5
5
|
export declare const getCurrentViewName: (appState: any) => any;
|
|
6
6
|
export default reducer;
|
|
7
7
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/reducers/navigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/reducers/navigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAIpE,oBAAY,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAClC,eAAO,MAAM,YAAY,EAAE,KAAgB,CAAC;AAI5C,QAAA,MAAM,OAAO,yBAAyC,UAAU,GAAG,YAAY,UAa9E,CAAC;AAIF,eAAO,MAAM,kBAAkB,wBAAkE,CAAC;AAIlG,eAAe,OAAO,CAAC"}
|
package/lib/reducers/token.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StoreToken } from '../actions';
|
|
2
2
|
export declare type State = string;
|
|
3
3
|
export declare const initialState: State;
|
|
4
|
-
declare const reducer: (state: State, action:
|
|
4
|
+
declare const reducer: (state: State, action: StoreToken) => State;
|
|
5
5
|
export declare const getToken: (appState: any) => any;
|
|
6
6
|
export default reducer;
|
|
7
7
|
//# sourceMappingURL=token.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/reducers/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/reducers/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAc,MAAM,YAAY,CAAC;AAInD,oBAAY,KAAK,GAAG,MAAM,CAAC;AAC3B,eAAO,MAAM,YAAY,EAAE,KAAY,CAAC;AAIxC,QAAA,MAAM,OAAO,UAAW,KAAK,UAAyB,UAAU,KAAG,KAQlE,CAAC;AAIF,eAAO,MAAM,QAAQ,wBAA6B,CAAC;AAInD,eAAe,OAAO,CAAC"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Fetch } from './fetch-responses';
|
|
2
|
-
declare const fetchCourse: (fetch: Fetch) => (token: any, language: any, universalRef: any) => Promise<
|
|
2
|
+
declare const fetchCourse: (fetch: Fetch) => (token: any, language: any, universalRef: any) => Promise<Course>;
|
|
3
|
+
export declare type Course = {
|
|
4
|
+
title: any;
|
|
5
|
+
};
|
|
6
|
+
export declare type CatalogHits = {
|
|
7
|
+
hits: Course[];
|
|
8
|
+
};
|
|
3
9
|
export { fetchCourse };
|
|
4
|
-
declare const _default: (token: any, language: any, universalRef: any) => Promise<
|
|
10
|
+
declare const _default: (token: any, language: any, universalRef: any) => Promise<Course>;
|
|
5
11
|
export default _default;
|
|
6
12
|
//# sourceMappingURL=fetch-demo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-demo.d.ts","sourceRoot":"","sources":["../../src/services/fetch-demo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch-demo.d.ts","sourceRoot":"","sources":["../../src/services/fetch-demo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAS,MAAM,mBAAmB,CAAC;AA4BhD,QAAA,MAAM,WAAW,UAAW,KAAK,uDAA4C,QAAQ,MAAM,CAc1F,CAAC;AAIF,oBAAY,MAAM,GAAG;IAAC,KAAK,MAAA;CAAC,CAAC;AAC7B,oBAAY,WAAW,GAAG;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC;AAI3C,OAAO,EAAC,WAAW,EAAC,CAAC;;AACrB,wBAAuC"}
|
|
@@ -37,6 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.fetchCourse = void 0;
|
|
40
|
+
var cross_fetch_1 = require("cross-fetch");
|
|
40
41
|
var jwt_decode_1 = require("jwt-decode");
|
|
41
42
|
var fetch_responses_1 = require("./fetch-responses");
|
|
42
43
|
var buildUrlQueryParams = function (params) {
|
|
@@ -72,4 +73,4 @@ var fetchCourse = function (fetch) { return function (token, language, universal
|
|
|
72
73
|
});
|
|
73
74
|
}); }; };
|
|
74
75
|
exports.fetchCourse = fetchCourse;
|
|
75
|
-
exports.default = fetchCourse(
|
|
76
|
+
exports.default = fetchCourse(cross_fetch_1.default);
|
|
@@ -37,23 +37,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
var ava_1 = require("ava");
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
(0, ava_1.default)('should fetch a demo course with mobile-staging dev token', function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
-
var token, language, universalRef, fetchCourse, course;
|
|
40
|
+
var fetch_demo_1 = require("./fetch-demo");
|
|
41
|
+
var fetch_mocks_1 = require("./fetch.mocks");
|
|
42
|
+
(0, ava_1.default)('should fetch a demo course', function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
+
var token, language, universalRef, result, fetchCourse, course;
|
|
46
44
|
return __generator(this, function (_a) {
|
|
47
45
|
switch (_a.label) {
|
|
48
46
|
case 0:
|
|
49
|
-
token = '
|
|
47
|
+
token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
|
|
50
48
|
language = 'fr';
|
|
51
49
|
universalRef = 'bar';
|
|
52
|
-
|
|
50
|
+
result = { hits: [{ title: 'Digital IQ test' }] };
|
|
51
|
+
fetchCourse = (0, fetch_demo_1.fetchCourse)((0, fetch_mocks_1.okJSONResponse)(result));
|
|
53
52
|
return [4 /*yield*/, fetchCourse(token, language, universalRef)];
|
|
54
53
|
case 1:
|
|
55
54
|
course = _a.sent();
|
|
56
|
-
t.is(course.title, 'Digital
|
|
55
|
+
t.is(course.title, 'Digital IQ test');
|
|
57
56
|
return [2 /*return*/];
|
|
58
57
|
}
|
|
59
58
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Response } from './fetch-responses
|
|
1
|
+
import { Response } from './fetch-responses';
|
|
2
2
|
export declare const toResponse: (status: number, statusText: string, body: string) => Promise<Response>;
|
|
3
3
|
declare type FetchFunction = () => Promise<Response>;
|
|
4
4
|
export declare const okJSONResponse: (body: unknown) => FetchFunction;
|
|
@@ -7,4 +7,4 @@ export declare const notFoundJSONResponse: (body: unknown) => FetchFunction;
|
|
|
7
7
|
export declare const okTextResponse: (body: string) => FetchFunction;
|
|
8
8
|
export declare const internalServerErrorTextResponse: (body: string) => FetchFunction;
|
|
9
9
|
export {};
|
|
10
|
-
//# sourceMappingURL=fetch.
|
|
10
|
+
//# sourceMappingURL=fetch.mocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.mocks.d.ts","sourceRoot":"","sources":["../../src/services/fetch.mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE3C,eAAO,MAAM,UAAU,WAAY,MAAM,cAAc,MAAM,QAAQ,MAAM,KAAG,QAAQ,QAAQ,CAO1F,CAAC;AAEL,aAAK,aAAa,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7C,eAAO,MAAM,cAAc,SAAU,OAAO,KAAG,aACF,CAAC;AAE9C,eAAO,MAAM,+BAA+B,SAAU,OAAO,KAAG,aACF,CAAC;AAE/D,eAAO,MAAM,oBAAoB,SAAU,OAAO,KAAG,aACD,CAAC;AAErD,eAAO,MAAM,cAAc,SAAU,MAAM,KAAG,aAAkD,CAAC;AAEjG,eAAO,MAAM,+BAA+B,SAAU,MAAM,KAAG,aACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.0.14-alpha.3+
|
|
3
|
+
"version": "0.0.14-alpha.4.3+2bcc9ae60",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=16.15.0"
|
|
8
8
|
},
|
|
9
|
+
"license": "UNLICENSED",
|
|
9
10
|
"scripts": {
|
|
10
11
|
"start": "node commands/start.js",
|
|
11
12
|
"static": "node commands/build-static-webapp.js",
|
|
@@ -45,8 +46,6 @@
|
|
|
45
46
|
"redux": "^4.2.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@ava/typescript": "^3.0.1",
|
|
49
|
-
"@storybook/react-native": "^5.3.25",
|
|
50
49
|
"ava": "^4.2.0",
|
|
51
50
|
"chalk": "^5.0.1",
|
|
52
51
|
"concurrently": "^5.2.0",
|
|
@@ -58,7 +57,8 @@
|
|
|
58
57
|
"live-server": "^1.2.2",
|
|
59
58
|
"react-dom": "^17.0.2",
|
|
60
59
|
"redux-devtools-extension": "^2.13.9",
|
|
60
|
+
"ts-node": "^10.8.0",
|
|
61
61
|
"typescript": "^4.6.4"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "2bcc9ae603abb8cef2a45d5fa0d373ed52b4c40e"
|
|
64
64
|
}
|
package/src/actions/courses.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const RECEIVED_COURSE = '@@api/RECEIVED_COURSE';
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type ReceivedCourse = {
|
|
4
4
|
type: '@@api/RECEIVED_COURSE';
|
|
5
5
|
payload: string;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
export const receivedCourse = (course: any):
|
|
8
|
+
export const receivedCourse = (course: any): ReceivedCourse => ({
|
|
9
9
|
type: RECEIVED_COURSE,
|
|
10
10
|
payload: course
|
|
11
11
|
});
|
package/src/actions/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {ReceivedCourse} from './courses';
|
|
2
|
+
import {NavigateBack, NavigateTo, StartApp} from './navigation';
|
|
3
|
+
import {StoreToken} from './token';
|
|
4
4
|
|
|
5
5
|
export * from './courses';
|
|
6
6
|
export * from './navigation';
|
|
7
7
|
export * from './token';
|
|
8
8
|
|
|
9
|
-
export type Action =
|
|
9
|
+
export type Action = StartApp | StoreToken | NavigateBack | NavigateTo | ReceivedCourse;
|
|
@@ -5,30 +5,30 @@ export const NAVIGATE_TO = '@@navigation/NAVIGATE_TO';
|
|
|
5
5
|
export const NAVIGATE_BACK = '@@navigation/NAVIGATE_BACK';
|
|
6
6
|
export const START_APP = '@@navigation/START_APP';
|
|
7
7
|
|
|
8
|
-
export type
|
|
8
|
+
export type NavigateTo = {
|
|
9
9
|
type: '@@navigation/NAVIGATE_TO';
|
|
10
10
|
payload: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export type
|
|
13
|
+
export type NavigateBack = {
|
|
14
14
|
type: '@@navigation/NAVIGATE_BACK';
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export type
|
|
17
|
+
export type StartApp = {
|
|
18
18
|
type: '@@navigation/START_APP';
|
|
19
19
|
payload: AppOptions;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export const navigateTo: ActionCreator
|
|
22
|
+
export const navigateTo: ActionCreator<NavigateTo> = (newPath: string) => ({
|
|
23
23
|
type: NAVIGATE_TO,
|
|
24
24
|
payload: newPath
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
export const navigateBack: ActionCreator
|
|
27
|
+
export const navigateBack: ActionCreator<NavigateBack> = () => ({
|
|
28
28
|
type: NAVIGATE_BACK
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
export const startApp = (options: AppOptions):
|
|
31
|
+
export const startApp = (options: AppOptions): StartApp => ({
|
|
32
32
|
type: START_APP,
|
|
33
33
|
payload: options
|
|
34
34
|
});
|
package/src/actions/token.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const STORE_TOKEN = '@@token/STORE_TOKEN';
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type StoreToken = {
|
|
4
4
|
type: '@@token/STORE_TOKEN';
|
|
5
5
|
payload: string;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
export const storeToken = (token: string):
|
|
8
|
+
export const storeToken = (token: string): StoreToken => ({
|
|
9
9
|
type: STORE_TOKEN,
|
|
10
10
|
payload: token
|
|
11
11
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {storiesOf} from '@storybook/react-native';
|
|
3
|
-
import RevisionHome from './revision-home';
|
|
1
|
+
// import * as React from 'react';
|
|
2
|
+
// import {storiesOf} from '@storybook/react-native';
|
|
3
|
+
// import RevisionHome from './revision-home';
|
|
4
4
|
|
|
5
|
-
const emptySkills: [] = [];
|
|
6
|
-
const skillsToRevise: {title: string; info: string}[] = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
];
|
|
5
|
+
// const emptySkills: [] = [];
|
|
6
|
+
// const skillsToRevise: {title: string; info: string}[] = [
|
|
7
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
8
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
9
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
10
|
+
// {title: 'Negotiation and powers of persuasion', info: '75 questions to revise'},
|
|
11
|
+
// {title: 'Creativity and innovation', info: '75 questions to revise'}
|
|
12
|
+
// ];
|
|
13
13
|
|
|
14
|
-
storiesOf('RevisionHome', module)
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
// storiesOf('RevisionHome', module)
|
|
15
|
+
// .add('No skills', () => <RevisionHome skillsToRevise={emptySkills} />)
|
|
16
|
+
// .add('Few skills', () => <RevisionHome skillsToRevise={skillsToRevise} />);
|
package/src/reducers/courses.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ReceivedCourse, RECEIVED_COURSE} from '../actions';
|
|
2
2
|
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ export const initialState: State = [];
|
|
|
7
7
|
|
|
8
8
|
// -----------------------------------------------------------------------------
|
|
9
9
|
|
|
10
|
-
const reducer = (state: State = initialState, action:
|
|
10
|
+
const reducer = (state: State = initialState, action: ReceivedCourse): State => {
|
|
11
11
|
switch (action.type) {
|
|
12
12
|
case RECEIVED_COURSE: {
|
|
13
13
|
return [...state, action.payload];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {NAVIGATE_BACK, NAVIGATE_TO} from '../actions/navigation';
|
|
2
|
-
import type {
|
|
2
|
+
import type {NavigateTo, NavigateBack} from '../actions/navigation';
|
|
3
3
|
|
|
4
4
|
// -----------------------------------------------------------------------------
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ export const initialState: State = ['home'];
|
|
|
8
8
|
|
|
9
9
|
// -----------------------------------------------------------------------------
|
|
10
10
|
|
|
11
|
-
const reducer = (state: State = initialState, action:
|
|
11
|
+
const reducer = (state: State = initialState, action: NavigateTo | NavigateBack): State => {
|
|
12
12
|
switch (action.type) {
|
|
13
13
|
case NAVIGATE_TO: {
|
|
14
14
|
return [...state, action.payload];
|
package/src/reducers/token.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {StoreToken, STORE_TOKEN} from '../actions';
|
|
2
2
|
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ export const initialState: State = null;
|
|
|
7
7
|
|
|
8
8
|
// -----------------------------------------------------------------------------
|
|
9
9
|
|
|
10
|
-
const reducer = (state: State = initialState, action:
|
|
10
|
+
const reducer = (state: State = initialState, action: StoreToken): State => {
|
|
11
11
|
switch (action.type) {
|
|
12
12
|
case STORE_TOKEN: {
|
|
13
13
|
return action.payload;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
-
import {fetchCourse as _fetchCourse} from './fetch-demo
|
|
3
|
-
import {okJSONResponse} from './fetch.
|
|
4
|
-
import
|
|
5
|
-
dotenv.config();
|
|
2
|
+
import {fetchCourse as _fetchCourse} from './fetch-demo';
|
|
3
|
+
import {okJSONResponse} from './fetch.mocks';
|
|
4
|
+
import type {CatalogHits} from './fetch-demo';
|
|
6
5
|
|
|
7
|
-
test('should fetch a demo course
|
|
8
|
-
const token =
|
|
6
|
+
test('should fetch a demo course', async t => {
|
|
7
|
+
const token =
|
|
8
|
+
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
|
|
9
9
|
const language = 'fr';
|
|
10
10
|
const universalRef = 'bar';
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const result: CatalogHits = {hits: [{title: 'Digital IQ test'}]};
|
|
13
|
+
const fetchCourse = _fetchCourse(okJSONResponse(result));
|
|
13
14
|
const course = await fetchCourse(token, language, universalRef);
|
|
14
|
-
t.is(course.title, 'Digital
|
|
15
|
+
t.is(course.title, 'Digital IQ test');
|
|
15
16
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import crossFetch from 'cross-fetch';
|
|
1
2
|
import decode from 'jwt-decode';
|
|
2
3
|
import {Fetch, toJSON} from './fetch-responses';
|
|
3
4
|
|
|
@@ -27,7 +28,7 @@ const buildUrlQueryParams = (params: QueryParams) =>
|
|
|
27
28
|
|
|
28
29
|
// -----------------------------------------------------------------------------
|
|
29
30
|
|
|
30
|
-
const fetchCourse = (fetch: Fetch) => async (token, language, universalRef) => {
|
|
31
|
+
const fetchCourse = (fetch: Fetch) => async (token, language, universalRef): Promise<Course> => {
|
|
31
32
|
const jwt: JWT = decode(token);
|
|
32
33
|
const query = {
|
|
33
34
|
type: 'course',
|
|
@@ -39,11 +40,16 @@ const fetchCourse = (fetch: Fetch) => async (token, language, universalRef) => {
|
|
|
39
40
|
headers: {authorization: token}
|
|
40
41
|
});
|
|
41
42
|
|
|
42
|
-
const {hits} = (await toJSON(response)) as
|
|
43
|
+
const {hits} = (await toJSON(response)) as CatalogHits;
|
|
43
44
|
return hits?.[0];
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
// -----------------------------------------------------------------------------
|
|
47
48
|
|
|
49
|
+
export type Course = {title};
|
|
50
|
+
export type CatalogHits = {hits: Course[]};
|
|
51
|
+
|
|
52
|
+
// -----------------------------------------------------------------------------
|
|
53
|
+
|
|
48
54
|
export {fetchCourse};
|
|
49
|
-
export default fetchCourse(
|
|
55
|
+
export default fetchCourse(crossFetch);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.test.d.ts","sourceRoot":"","sources":["../../src/services/fetch.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,eAAO,MAAM,UAAU,WAAY,MAAM,cAAc,MAAM,QAAQ,MAAM,KAAG,QAAQ,QAAQ,CAO1F,CAAC;AAEL,aAAK,aAAa,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7C,eAAO,MAAM,cAAc,SAAU,OAAO,KAAG,aACF,CAAC;AAE9C,eAAO,MAAM,+BAA+B,SAAU,OAAO,KAAG,aACF,CAAC;AAE/D,eAAO,MAAM,oBAAoB,SAAU,OAAO,KAAG,aACD,CAAC;AAErD,eAAO,MAAM,cAAc,SAAU,MAAM,KAAG,aAAkD,CAAC;AAEjG,eAAO,MAAM,+BAA+B,SAAU,MAAM,KAAG,aACjB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.test.d.ts","sourceRoot":"","sources":["../../src/services/fetch.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,eAAO,MAAM,UAAU,WAAY,MAAM,cAAc,MAAM,QAAQ,MAAM,KAAG,QAAQ,QAAQ,CAO1F,CAAC;AAEL,aAAK,aAAa,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7C,eAAO,MAAM,cAAc,SAAU,OAAO,KAAG,aACF,CAAC;AAE9C,eAAO,MAAM,+BAA+B,SAAU,OAAO,KAAG,aACF,CAAC;AAE/D,eAAO,MAAM,oBAAoB,SAAU,OAAO,KAAG,aACD,CAAC;AAErD,eAAO,MAAM,cAAc,SAAU,MAAM,KAAG,aAAkD,CAAC;AAEjG,eAAO,MAAM,+BAA+B,SAAU,MAAM,KAAG,aACjB,CAAC"}
|
|
File without changes
|
|
File without changes
|