@coorpacademy/app-review 0.0.18 → 0.0.20

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 (44) hide show
  1. package/es/components/__tmp-backup-vues-mobile/revision-home.d.ts +1 -0
  2. package/es/components/__tmp-backup-vues-mobile/revision-home.d.ts.map +1 -1
  3. package/es/components/__tmp-backup-vues-mobile/revision-onboarding.d.ts +1 -0
  4. package/es/components/__tmp-backup-vues-mobile/revision-onboarding.d.ts.map +1 -1
  5. package/es/components/__tmp-backup-vues-mobile/revision-quizzer.d.ts +1 -0
  6. package/es/components/__tmp-backup-vues-mobile/revision-quizzer.d.ts.map +1 -1
  7. package/es/configure-store.d.ts +2 -2
  8. package/es/configure-store.d.ts.map +1 -1
  9. package/es/configure-store.js +7 -6
  10. package/es/index.d.ts +6 -0
  11. package/es/index.d.ts.map +1 -1
  12. package/es/index.js +6 -3
  13. package/lib/actions/courses.js +3 -7
  14. package/lib/actions/index.js +3 -19
  15. package/lib/actions/navigation.js +9 -15
  16. package/lib/actions/token.js +3 -7
  17. package/lib/components/__tmp-backup-vues-mobile/revision-home.d.ts +1 -0
  18. package/lib/components/__tmp-backup-vues-mobile/revision-home.d.ts.map +1 -1
  19. package/lib/components/__tmp-backup-vues-mobile/revision-home.js +13 -15
  20. package/lib/components/__tmp-backup-vues-mobile/revision-onboarding.d.ts +1 -0
  21. package/lib/components/__tmp-backup-vues-mobile/revision-onboarding.d.ts.map +1 -1
  22. package/lib/components/__tmp-backup-vues-mobile/revision-onboarding.js +7 -9
  23. package/lib/components/__tmp-backup-vues-mobile/revision-quizzer.d.ts +1 -0
  24. package/lib/components/__tmp-backup-vues-mobile/revision-quizzer.d.ts.map +1 -1
  25. package/lib/components/__tmp-backup-vues-mobile/revision-quizzer.js +18 -20
  26. package/lib/configure-store.d.ts +2 -2
  27. package/lib/configure-store.d.ts.map +1 -1
  28. package/lib/configure-store.js +64 -19
  29. package/lib/index.d.ts +6 -0
  30. package/lib/index.d.ts.map +1 -1
  31. package/lib/index.js +64 -19
  32. package/lib/middlewares/on-start-app.js +7 -9
  33. package/lib/reducers/courses.js +5 -8
  34. package/lib/reducers/index.js +9 -11
  35. package/lib/reducers/navigation.js +7 -11
  36. package/lib/reducers/token.js +6 -10
  37. package/lib/services/fetch-demo.js +8 -10
  38. package/lib/services/fetch-demo.test.js +5 -7
  39. package/lib/services/fetch-responses.js +4 -10
  40. package/lib/services/fetch.mocks.js +10 -19
  41. package/package.json +6 -6
  42. package/readme.md +1 -0
  43. package/src/configure-store.ts +11 -10
  44. package/src/index.tsx +13 -3
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  skillsToRevise: {
3
4
  title?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"revision-home.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-home.tsx"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,cAAc,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;CACnD;AAoGD,QAAA,MAAM,YAAY,UAAW,KAAK,gBASjC,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"revision-home.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-home.tsx"],"names":[],"mappings":";AAWA,UAAU,KAAK;IACb,cAAc,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;CACnD;AAoGD,QAAA,MAAM,YAAY,UAAW,KAAK,gBASjC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const RevisionOnboarding: () => JSX.Element;
2
3
  export default RevisionOnboarding;
3
4
  //# sourceMappingURL=revision-onboarding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"revision-onboarding.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-onboarding.tsx"],"names":[],"mappings":"AAkEA,QAAA,MAAM,kBAAkB,mBAevB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"revision-onboarding.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-onboarding.tsx"],"names":[],"mappings":";AAkEA,QAAA,MAAM,kBAAkB,mBAevB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare type _Choice_ = {
2
3
  text?: string;
3
4
  selected: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"revision-quizzer.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-quizzer.tsx"],"names":[],"mappings":"AASA,oBAAY,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,oBAAY,OAAO,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,aAAa,CAAC;IAC3D,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB,CAAC;AAEF,UAAU,KAAK;IACb,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AA2ID,QAAA,MAAM,eAAe,cAAa,KAAK,gBAStC,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"revision-quizzer.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-quizzer.tsx"],"names":[],"mappings":";AASA,oBAAY,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,oBAAY,OAAO,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,aAAa,CAAC;IAC3D,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB,CAAC;AAEF,UAAU,KAAK;IACb,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AA2ID,QAAA,MAAM,eAAe,cAAa,KAAK,gBAStC,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { State as NavigationState } from './reducers/navigation';
2
2
  import { State as TokenState } from './reducers/token';
3
- export default function configureStore(): import("redux").Store<import("redux").EmptyObject & {
3
+ export default function configureStore(): Promise<import("redux").Store<import("redux").EmptyObject & {
4
4
  courses: import("./reducers/courses").State;
5
5
  navigation: NavigationState;
6
6
  token: string;
7
7
  }, import("redux").AnyAction> & {
8
8
  dispatch: {};
9
- };
9
+ }>;
10
10
  export declare type StoreState = {
11
11
  navigation: NavigationState;
12
12
  token: TokenState;
@@ -1 +1 @@
1
- {"version":3,"file":"configure-store.d.ts","sourceRoot":"","sources":["../src/configure-store.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,KAAK,IAAI,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAC,KAAK,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAOrD,MAAM,CAAC,OAAO,UAAU,cAAc;;;;;;EAcrC;AAID,oBAAY,UAAU,GAAG;IACvB,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"configure-store.d.ts","sourceRoot":"","sources":["../src/configure-store.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,KAAK,IAAI,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAC,KAAK,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAOrD,wBAA8B,cAAc;;;;;;GAgB3C;AAID,oBAAY,UAAU,GAAG;IACvB,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC"}
@@ -1,18 +1,19 @@
1
1
  import { applyMiddleware, compose, createStore } from 'redux';
2
2
  import thunk from 'redux-thunk';
3
- import { composeWithDevTools } from 'redux-devtools-extension';
4
3
  import rootReducer from './reducers';
5
4
  import onStartApp from './middlewares/on-start-app';
6
5
  const preloadedState = undefined;
7
6
  // -----------------------------------------------------------------------------
8
- export default function configureStore() {
9
- const _compose = process.env.NODE_ENV !== 'production'
10
- ? composeWithDevTools({
7
+ export default async function configureStore() {
8
+ let _compose = compose;
9
+ if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
10
+ const { composeWithDevTools } = await import('redux-devtools-extension');
11
+ _compose = composeWithDevTools({
11
12
  name: 'app-review',
12
13
  trace: true,
13
14
  traceLimit: 25
14
- })
15
- : compose;
15
+ });
16
+ }
16
17
  const enhancer = _compose(applyMiddleware(thunk, onStartApp));
17
18
  const store = createStore(rootReducer, preloadedState, enhancer);
18
19
  return store;
package/es/index.d.ts CHANGED
@@ -1,4 +1,10 @@
1
+ /// <reference types="react" />
1
2
  declare const AppRevision: ({ options }: Props) => JSX.Element;
3
+ declare global {
4
+ interface Window {
5
+ __REDUX_DEVTOOLS_EXTENSION__?: boolean;
6
+ }
7
+ }
2
8
  declare type Props = {
3
9
  options: AppOptions;
4
10
  };
package/es/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAmBA,QAAA,MAAM,WAAW,gBAAe,KAAK,gBAgBpC,CAAC;AAIF,aAAK,KAAK,GAAG;IAAC,OAAO,EAAE,UAAU,CAAA;CAAC,CAAC;AAEnC,oBAAY,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAmBA,QAAA,MAAM,WAAW,gBAAe,KAAK,gBAoBpC,CAAC;AAIF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,4BAA4B,CAAC,EAAE,OAAO,CAAC;KACxC;CACF;AAED,aAAK,KAAK,GAAG;IAAC,OAAO,EAAE,UAAU,CAAA;CAAC,CAAC;AAEnC,oBAAY,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB,CAAC;AAEF,eAAe,WAAW,CAAC"}
package/es/index.js CHANGED
@@ -14,9 +14,12 @@ const App = connect(mapStateToProps, mapDispatchToProps)(AppReviewRootView);
14
14
  const AppRevision = ({ options }) => {
15
15
  const [store, setStore] = useState(null);
16
16
  useEffect(() => {
17
- const store = configureStore();
18
- store.dispatch(startApp(options));
19
- setStore(store);
17
+ const _configure = async () => {
18
+ const store = await configureStore();
19
+ store.dispatch(startApp(options));
20
+ setStore(store);
21
+ };
22
+ _configure();
20
23
  }, []);
21
24
  if (!store)
22
25
  return null;
@@ -1,9 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.receivedCourse = exports.RECEIVED_COURSE = void 0;
4
- exports.RECEIVED_COURSE = '@@api/RECEIVED_COURSE';
5
- var receivedCourse = function (course) { return ({
6
- type: exports.RECEIVED_COURSE,
1
+ export var RECEIVED_COURSE = '@@api/RECEIVED_COURSE';
2
+ export var receivedCourse = function (course) { return ({
3
+ type: RECEIVED_COURSE,
7
4
  payload: course
8
5
  }); };
9
- exports.receivedCourse = receivedCourse;
@@ -1,19 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./courses"), exports);
18
- __exportStar(require("./navigation"), exports);
19
- __exportStar(require("./token"), exports);
1
+ export * from './courses';
2
+ export * from './navigation';
3
+ export * from './token';
@@ -1,20 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.startApp = exports.navigateBack = exports.navigateTo = exports.START_APP = exports.NAVIGATE_BACK = exports.NAVIGATE_TO = void 0;
4
- exports.NAVIGATE_TO = '@@navigation/NAVIGATE_TO';
5
- exports.NAVIGATE_BACK = '@@navigation/NAVIGATE_BACK';
6
- exports.START_APP = '@@navigation/START_APP';
7
- var navigateTo = function (newPath) { return ({
8
- type: exports.NAVIGATE_TO,
1
+ export var NAVIGATE_TO = '@@navigation/NAVIGATE_TO';
2
+ export var NAVIGATE_BACK = '@@navigation/NAVIGATE_BACK';
3
+ export var START_APP = '@@navigation/START_APP';
4
+ export var navigateTo = function (newPath) { return ({
5
+ type: NAVIGATE_TO,
9
6
  payload: newPath
10
7
  }); };
11
- exports.navigateTo = navigateTo;
12
- var navigateBack = function () { return ({
13
- type: exports.NAVIGATE_BACK
8
+ export var navigateBack = function () { return ({
9
+ type: NAVIGATE_BACK
14
10
  }); };
15
- exports.navigateBack = navigateBack;
16
- var startApp = function (options) { return ({
17
- type: exports.START_APP,
11
+ export var startApp = function (options) { return ({
12
+ type: START_APP,
18
13
  payload: options
19
14
  }); };
20
- exports.startApp = startApp;
@@ -1,9 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.storeToken = exports.STORE_TOKEN = void 0;
4
- exports.STORE_TOKEN = '@@token/STORE_TOKEN';
5
- var storeToken = function (token) { return ({
6
- type: exports.STORE_TOKEN,
1
+ export var STORE_TOKEN = '@@token/STORE_TOKEN';
2
+ export var storeToken = function (token) { return ({
3
+ type: STORE_TOKEN,
7
4
  payload: token
8
5
  }); };
9
- exports.storeToken = storeToken;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  skillsToRevise: {
3
4
  title?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"revision-home.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-home.tsx"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,cAAc,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;CACnD;AAoGD,QAAA,MAAM,YAAY,UAAW,KAAK,gBASjC,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"revision-home.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-home.tsx"],"names":[],"mappings":";AAWA,UAAU,KAAK;IACb,cAAc,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;CACnD;AAoGD,QAAA,MAAM,YAAY,UAAW,KAAK,gBASjC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
2
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
3
  if (ar || !(i in from)) {
@@ -8,11 +7,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
8
7
  }
9
8
  return to.concat(ar || Array.prototype.slice.call(from));
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- var React = require("react");
13
- var react_native_1 = require("react-native");
14
- var nova_icons_1 = require("@coorpacademy/nova-icons");
15
- var styles = react_native_1.StyleSheet.create({
10
+ import * as React from 'react';
11
+ import { View, FlatList, Pressable, StyleSheet, Text } from 'react-native';
12
+ import { NovaCompositionNavigationArrowRight as ArrowRight } from '@coorpacademy/nova-icons';
13
+ var styles = StyleSheet.create({
16
14
  container: {
17
15
  flex: 1,
18
16
  padding: 20
@@ -81,20 +79,20 @@ var styles = react_native_1.StyleSheet.create({
81
79
  var onSelectSkill = function (title) { return function () {
82
80
  console.log('pressed on', { title: title });
83
81
  }; };
84
- var ExtraSpace = function () { return React.createElement(react_native_1.View, { style: styles.extraSpace }); };
82
+ var ExtraSpace = function () { return React.createElement(View, { style: styles.extraSpace }); };
85
83
  var Skill = function (_a) {
86
84
  var title = _a.title, info = _a.info;
87
- return (React.createElement(react_native_1.Pressable, { style: styles.skill, onPress: onSelectSkill(title) },
88
- React.createElement(react_native_1.View, { style: styles.skillTexts },
89
- React.createElement(react_native_1.Text, { style: styles.skillTitle }, title),
90
- React.createElement(react_native_1.Text, { style: styles.skillInfo }, info)),
91
- React.createElement(nova_icons_1.NovaCompositionNavigationArrowRight, { color: "#ededed", height: 20, width: 20 })));
85
+ return (React.createElement(Pressable, { style: styles.skill, onPress: onSelectSkill(title) },
86
+ React.createElement(View, { style: styles.skillTexts },
87
+ React.createElement(Text, { style: styles.skillTitle }, title),
88
+ React.createElement(Text, { style: styles.skillInfo }, info)),
89
+ React.createElement(ArrowRight, { color: "#ededed", height: 20, width: 20 })));
92
90
  };
93
91
  var renderSkill = function (_a) {
94
92
  var _b = _a.item, title = _b.title, info = _b.info, _c = _b.isExtraSpace, isExtraSpace = _c === void 0 ? false : _c;
95
93
  return isExtraSpace ? React.createElement(ExtraSpace, null) : React.createElement(Skill, { title: title, info: info });
96
94
  };
97
- var Skills = function (props) { return (React.createElement(react_native_1.FlatList, { contentContainerStyle: styles.skills, data: props.skills, renderItem: renderSkill })); };
95
+ var Skills = function (props) { return (React.createElement(FlatList, { contentContainerStyle: styles.skills, data: props.skills, renderItem: renderSkill })); };
98
96
  var NoSkills = function () { return (React.createElement(React.Fragment, null)); };
99
- var RevisionHome = function (props) { return (React.createElement(react_native_1.View, { style: styles.container }, !props.skillsToRevise || props.skillsToRevise.length === 0 ? (React.createElement(NoSkills, null)) : (React.createElement(Skills, { skills: __spreadArray(__spreadArray([], props.skillsToRevise, true), [{ isExtraSpace: true }], false) })))); };
100
- exports.default = RevisionHome;
97
+ var RevisionHome = function (props) { return (React.createElement(View, { style: styles.container }, !props.skillsToRevise || props.skillsToRevise.length === 0 ? (React.createElement(NoSkills, null)) : (React.createElement(Skills, { skills: __spreadArray(__spreadArray([], props.skillsToRevise, true), [{ isExtraSpace: true }], false) })))); };
98
+ export default RevisionHome;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const RevisionOnboarding: () => JSX.Element;
2
3
  export default RevisionOnboarding;
3
4
  //# sourceMappingURL=revision-onboarding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"revision-onboarding.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-onboarding.tsx"],"names":[],"mappings":"AAkEA,QAAA,MAAM,kBAAkB,mBAevB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"revision-onboarding.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-onboarding.tsx"],"names":[],"mappings":";AAkEA,QAAA,MAAM,kBAAkB,mBAevB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,12 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var React = require("react");
4
- var react_native_1 = require("react-native");
1
+ import * as React from 'react';
2
+ import { View, StyleSheet, Text } from 'react-native';
5
3
  // import theme from '../../../modules/theme';
6
4
  // import translations from '../../../translations';
7
5
  // import Button from '../../../app-shared/components/button';
8
6
  // import {HEADER_HEIGHT} from '../../../app-shared/components/header-v2';
9
- var styles = react_native_1.StyleSheet.create({
7
+ var styles = StyleSheet.create({
10
8
  container: {
11
9
  justifyContent: 'space-between',
12
10
  flex: 1,
@@ -55,8 +53,8 @@ var styles = react_native_1.StyleSheet.create({
55
53
  var onButtonPress = function () { };
56
54
  var Tip = function (_a) {
57
55
  var Icon = _a.Icon, text = _a.text;
58
- return (React.createElement(react_native_1.View, { style: styles.tip },
59
- React.createElement(react_native_1.Text, { style: styles.tipText }, text)));
56
+ return (React.createElement(View, { style: styles.tip },
57
+ React.createElement(Text, { style: styles.tipText }, text)));
60
58
  };
61
- var RevisionOnboarding = function () { return (React.createElement(react_native_1.View, { style: styles.container })); };
62
- exports.default = RevisionOnboarding;
59
+ var RevisionOnboarding = function () { return (React.createElement(View, { style: styles.container })); };
60
+ export default RevisionOnboarding;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare type _Choice_ = {
2
3
  text?: string;
3
4
  selected: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"revision-quizzer.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-quizzer.tsx"],"names":[],"mappings":"AASA,oBAAY,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,oBAAY,OAAO,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,aAAa,CAAC;IAC3D,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB,CAAC;AAEF,UAAU,KAAK;IACb,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AA2ID,QAAA,MAAM,eAAe,cAAa,KAAK,gBAStC,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"revision-quizzer.d.ts","sourceRoot":"","sources":["../../../src/components/__tmp-backup-vues-mobile/revision-quizzer.tsx"],"names":[],"mappings":";AASA,oBAAY,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,oBAAY,OAAO,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,aAAa,CAAC;IAC3D,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB,CAAC;AAEF,UAAU,KAAK;IACb,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AA2ID,QAAA,MAAM,eAAe,cAAa,KAAK,gBAStC,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,8 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var React = require("react");
4
- var react_native_1 = require("react-native");
5
- var quizzerStyle = react_native_1.StyleSheet.create({
1
+ import * as React from 'react';
2
+ import { View, StyleSheet, Text, useWindowDimensions } from 'react-native';
3
+ var quizzerStyle = StyleSheet.create({
6
4
  container: {
7
5
  flex: 1,
8
6
  padding: 20,
@@ -12,16 +10,16 @@ var quizzerStyle = react_native_1.StyleSheet.create({
12
10
  alignItems: 'center'
13
11
  }
14
12
  });
15
- var SLIDE_HEIGHT = function () { return (0, react_native_1.useWindowDimensions)().height * 0.75; };
13
+ var SLIDE_HEIGHT = function () { return useWindowDimensions().height * 0.75; };
16
14
  var creatSlideStyle = function (num) {
17
- return react_native_1.StyleSheet.create({
15
+ return StyleSheet.create({
18
16
  slide: {
19
17
  position: 'absolute',
20
18
  // backgroundColor: theme.colors.white, @todo with props
21
- top: (0, react_native_1.useWindowDimensions)().height / 2 - SLIDE_HEIGHT() / 2 - num * 4,
19
+ top: useWindowDimensions().height / 2 - SLIDE_HEIGHT() / 2 - num * 4,
22
20
  flex: 1,
23
21
  height: SLIDE_HEIGHT(),
24
- width: (0, react_native_1.useWindowDimensions)().width - 40 - num * 8,
22
+ width: useWindowDimensions().width - 40 - num * 8,
25
23
  justifyContent: 'space-between',
26
24
  alignItems: 'center',
27
25
  padding: 25,
@@ -65,7 +63,7 @@ var creatSlideStyle = function (num) {
65
63
  };
66
64
  var createOptionStyle = function (selected) {
67
65
  // const brandTheme = React.useContext(BrandThemeContext); @todo with props
68
- return react_native_1.StyleSheet.create({
66
+ return StyleSheet.create({
69
67
  box: {
70
68
  width: '100%',
71
69
  // https://stackoverflow.com/a/66561995/959219
@@ -89,7 +87,7 @@ var createOptionStyle = function (selected) {
89
87
  }
90
88
  });
91
89
  };
92
- var choicesStyle = react_native_1.StyleSheet.create({
90
+ var choicesStyle = StyleSheet.create({
93
91
  container: {
94
92
  flex: 1,
95
93
  width: '100%',
@@ -100,11 +98,11 @@ var choicesStyle = react_native_1.StyleSheet.create({
100
98
  var onButtonPress = function () { };
101
99
  var Choices = function (_a) {
102
100
  var choices = _a.choices;
103
- return (React.createElement(react_native_1.View, { style: choicesStyle.container }, choices.map(function (_a) {
101
+ return (React.createElement(View, { style: choicesStyle.container }, choices.map(function (_a) {
104
102
  var text = _a.text, _b = _a.selected, selected = _b === void 0 ? false : _b;
105
103
  var optionStyle = createOptionStyle(selected);
106
- return (React.createElement(react_native_1.View, { style: optionStyle.box },
107
- React.createElement(react_native_1.Text, { style: optionStyle.text },
104
+ return (React.createElement(View, { style: optionStyle.box },
105
+ React.createElement(Text, { style: optionStyle.text },
108
106
  text,
109
107
  " ",
110
108
  selected)));
@@ -113,18 +111,18 @@ var Choices = function (_a) {
113
111
  var Slide = function (_a) {
114
112
  var slide = _a.slide, num = _a.num;
115
113
  var slideStyle = creatSlideStyle(num);
116
- return (React.createElement(react_native_1.View, { style: slideStyle.slide },
117
- React.createElement(react_native_1.Text, { style: slideStyle.category },
114
+ return (React.createElement(View, { style: slideStyle.slide },
115
+ React.createElement(Text, { style: slideStyle.category },
118
116
  slide.category,
119
117
  " ",
120
118
  num),
121
- React.createElement(react_native_1.Text, { style: slideStyle.question }, slide.question),
122
- React.createElement(react_native_1.Text, { style: slideStyle.instruction }, slide.instruction),
119
+ React.createElement(Text, { style: slideStyle.question }, slide.question),
120
+ React.createElement(Text, { style: slideStyle.instruction }, slide.instruction),
123
121
  React.createElement(Choices, { choices: slide.choices })));
124
122
  };
125
123
  var RevisionQuizzer = function (_a) {
126
124
  var slide = _a.slide;
127
125
  var slides = [slide, slide, slide, slide, slide];
128
- return (React.createElement(react_native_1.View, { style: quizzerStyle.container }, slides.reverse().map(function (slide, index) { return (React.createElement(Slide, { slide: slide, num: slides.length - index })); })));
126
+ return (React.createElement(View, { style: quizzerStyle.container }, slides.reverse().map(function (slide, index) { return (React.createElement(Slide, { slide: slide, num: slides.length - index })); })));
129
127
  };
130
- exports.default = RevisionQuizzer;
128
+ export default RevisionQuizzer;
@@ -1,12 +1,12 @@
1
1
  import { State as NavigationState } from './reducers/navigation';
2
2
  import { State as TokenState } from './reducers/token';
3
- export default function configureStore(): import("redux").Store<import("redux").EmptyObject & {
3
+ export default function configureStore(): Promise<import("redux").Store<import("redux").EmptyObject & {
4
4
  courses: import("./reducers/courses").State;
5
5
  navigation: NavigationState;
6
6
  token: string;
7
7
  }, import("redux").AnyAction> & {
8
8
  dispatch: {};
9
- };
9
+ }>;
10
10
  export declare type StoreState = {
11
11
  navigation: NavigationState;
12
12
  token: TokenState;
@@ -1 +1 @@
1
- {"version":3,"file":"configure-store.d.ts","sourceRoot":"","sources":["../src/configure-store.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,KAAK,IAAI,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAC,KAAK,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAOrD,MAAM,CAAC,OAAO,UAAU,cAAc;;;;;;EAcrC;AAID,oBAAY,UAAU,GAAG;IACvB,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"configure-store.d.ts","sourceRoot":"","sources":["../src/configure-store.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,KAAK,IAAI,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAC,KAAK,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAOrD,wBAA8B,cAAc;;;;;;GAgB3C;AAID,oBAAY,UAAU,GAAG;IACvB,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC"}
@@ -1,22 +1,67 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var redux_1 = require("redux");
4
- var redux_thunk_1 = require("redux-thunk");
5
- var redux_devtools_extension_1 = require("redux-devtools-extension");
6
- var reducers_1 = require("./reducers");
7
- var on_start_app_1 = require("./middlewares/on-start-app");
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { applyMiddleware, compose, createStore } from 'redux';
38
+ import thunk from 'redux-thunk';
39
+ import rootReducer from './reducers';
40
+ import onStartApp from './middlewares/on-start-app';
8
41
  var preloadedState = undefined;
9
42
  // -----------------------------------------------------------------------------
10
- function configureStore() {
11
- var _compose = process.env.NODE_ENV !== 'production'
12
- ? (0, redux_devtools_extension_1.composeWithDevTools)({
13
- name: 'app-review',
14
- trace: true,
15
- traceLimit: 25
16
- })
17
- : redux_1.compose;
18
- var enhancer = _compose((0, redux_1.applyMiddleware)(redux_thunk_1.default, on_start_app_1.default));
19
- var store = (0, redux_1.createStore)(reducers_1.default, preloadedState, enhancer);
20
- return store;
43
+ export default function configureStore() {
44
+ return __awaiter(this, void 0, void 0, function () {
45
+ var _compose, composeWithDevTools, enhancer, store;
46
+ return __generator(this, function (_a) {
47
+ switch (_a.label) {
48
+ case 0:
49
+ _compose = compose;
50
+ if (!(typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__)) return [3 /*break*/, 2];
51
+ return [4 /*yield*/, import('redux-devtools-extension')];
52
+ case 1:
53
+ composeWithDevTools = (_a.sent()).composeWithDevTools;
54
+ _compose = composeWithDevTools({
55
+ name: 'app-review',
56
+ trace: true,
57
+ traceLimit: 25
58
+ });
59
+ _a.label = 2;
60
+ case 2:
61
+ enhancer = _compose(applyMiddleware(thunk, onStartApp));
62
+ store = createStore(rootReducer, preloadedState, enhancer);
63
+ return [2 /*return*/, store];
64
+ }
65
+ });
66
+ });
21
67
  }
22
- exports.default = configureStore;
package/lib/index.d.ts CHANGED
@@ -1,4 +1,10 @@
1
+ /// <reference types="react" />
1
2
  declare const AppRevision: ({ options }: Props) => JSX.Element;
3
+ declare global {
4
+ interface Window {
5
+ __REDUX_DEVTOOLS_EXTENSION__?: boolean;
6
+ }
7
+ }
2
8
  declare type Props = {
3
9
  options: AppOptions;
4
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAmBA,QAAA,MAAM,WAAW,gBAAe,KAAK,gBAgBpC,CAAC;AAIF,aAAK,KAAK,GAAG;IAAC,OAAO,EAAE,UAAU,CAAA;CAAC,CAAC;AAEnC,oBAAY,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAmBA,QAAA,MAAM,WAAW,gBAAe,KAAK,gBAoBpC,CAAC;AAIF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,4BAA4B,CAAC,EAAE,OAAO,CAAC;KACxC;CACF;AAED,aAAK,KAAK,GAAG;IAAC,OAAO,EAAE,UAAU,CAAA;CAAC,CAAC;AAEnC,oBAAY,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB,CAAC;AAEF,eAAe,WAAW,CAAC"}
package/lib/index.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __assign = (this && this.__assign) || function () {
3
2
  __assign = Object.assign || function(t) {
4
3
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -10,31 +9,77 @@ var __assign = (this && this.__assign) || function () {
10
9
  };
11
10
  return __assign.apply(this, arguments);
12
11
  };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- var react_1 = require("react");
15
- var react_redux_1 = require("react-redux");
16
- var root_view_1 = require("@coorpacademy/components/es/template/app-review/root-view/root-view");
17
- var configure_store_1 = require("./configure-store");
18
- var navigation_1 = require("./actions/navigation");
19
- var navigation_2 = require("./reducers/navigation");
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import React, { useEffect, useState } from 'react';
49
+ import { connect, Provider } from 'react-redux';
50
+ import AppReviewRootView from '@coorpacademy/components/es/template/app-review/root-view/root-view';
51
+ import configureStore from './configure-store';
52
+ import { navigateTo, navigateBack, startApp } from './actions/navigation';
53
+ import { getCurrentViewName } from './reducers/navigation';
20
54
  // -----------------------------------------------------------------------------
21
55
  var mapStateToProps = function (state, ownProps) {
22
- return __assign(__assign({}, ownProps), { viewName: (0, navigation_2.getCurrentViewName)(state) });
56
+ return __assign(__assign({}, ownProps), { viewName: getCurrentViewName(state) });
23
57
  };
24
- var mapDispatchToProps = { navigateTo: navigation_1.navigateTo, navigateBack: navigation_1.navigateBack };
25
- var App = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(root_view_1.default);
58
+ var mapDispatchToProps = { navigateTo: navigateTo, navigateBack: navigateBack };
59
+ var App = connect(mapStateToProps, mapDispatchToProps)(AppReviewRootView);
26
60
  // -----------------------------------------------------------------------------
27
61
  var AppRevision = function (_a) {
28
62
  var options = _a.options;
29
- var _b = (0, react_1.useState)(null), store = _b[0], setStore = _b[1];
30
- (0, react_1.useEffect)(function () {
31
- var store = (0, configure_store_1.default)();
32
- store.dispatch((0, navigation_1.startApp)(options));
33
- setStore(store);
63
+ var _b = useState(null), store = _b[0], setStore = _b[1];
64
+ useEffect(function () {
65
+ var _configure = function () { return __awaiter(void 0, void 0, void 0, function () {
66
+ var store;
67
+ return __generator(this, function (_a) {
68
+ switch (_a.label) {
69
+ case 0: return [4 /*yield*/, configureStore()];
70
+ case 1:
71
+ store = _a.sent();
72
+ store.dispatch(startApp(options));
73
+ setStore(store);
74
+ return [2 /*return*/];
75
+ }
76
+ });
77
+ }); };
78
+ _configure();
34
79
  }, []);
35
80
  if (!store)
36
81
  return null;
37
- return (react_1.default.createElement(react_redux_1.Provider, { store: store },
38
- react_1.default.createElement(App, null)));
82
+ return (React.createElement(Provider, { store: store },
83
+ React.createElement(App, null)));
39
84
  };
40
- exports.default = AppRevision;
85
+ export default AppRevision;
@@ -1,22 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var actions_1 = require("../actions");
4
- var fetch_demo_1 = require("../services/fetch-demo");
1
+ import { receivedCourse, START_APP, storeToken } from '../actions';
2
+ import fetchCourse from '../services/fetch-demo';
5
3
  var onStartApp = function (_a) {
6
4
  var dispatch = _a.dispatch;
7
5
  return function (next) { return function (action) {
8
- if (action.type === actions_1.START_APP) {
6
+ if (action.type === START_APP) {
9
7
  var token = action.payload.token;
10
- dispatch((0, actions_1.storeToken)(token));
8
+ dispatch(storeToken(token));
11
9
  // --------------
12
10
  // demo service
13
11
  var language = 'fr';
14
12
  var universalRef = 'dis_xxx15';
15
- (0, fetch_demo_1.default)(token, language, universalRef).then(function (course) {
16
- dispatch((0, actions_1.receivedCourse)(course));
13
+ fetchCourse(token, language, universalRef).then(function (course) {
14
+ dispatch(receivedCourse(course));
17
15
  });
18
16
  }
19
17
  return next(action);
20
18
  }; };
21
19
  };
22
- exports.default = onStartApp;
20
+ export default onStartApp;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
2
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
3
  if (ar || !(i in from)) {
@@ -8,15 +7,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
8
7
  }
9
8
  return to.concat(ar || Array.prototype.slice.call(from));
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.initialState = void 0;
13
- var actions_1 = require("../actions");
14
- exports.initialState = [];
10
+ import { RECEIVED_COURSE } from '../actions';
11
+ export var initialState = [];
15
12
  // -----------------------------------------------------------------------------
16
13
  var reducer = function (state, action) {
17
- if (state === void 0) { state = exports.initialState; }
14
+ if (state === void 0) { state = initialState; }
18
15
  switch (action.type) {
19
- case actions_1.RECEIVED_COURSE: {
16
+ case RECEIVED_COURSE: {
20
17
  return __spreadArray(__spreadArray([], state, true), [action.payload], false);
21
18
  }
22
19
  default:
@@ -24,4 +21,4 @@ var reducer = function (state, action) {
24
21
  }
25
22
  };
26
23
  // -----------------------------------------------------------------------------
27
- exports.default = reducer;
24
+ export default reducer;
@@ -1,12 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var redux_1 = require("redux");
4
- var courses_1 = require("./courses");
5
- var navigation_1 = require("./navigation");
6
- var token_1 = require("./token");
7
- var rootReducer = (0, redux_1.combineReducers)({
8
- courses: courses_1.default,
9
- navigation: navigation_1.default,
10
- token: token_1.default
1
+ import { combineReducers } from 'redux';
2
+ import courses from './courses';
3
+ import navigation from './navigation';
4
+ import token from './token';
5
+ var rootReducer = combineReducers({
6
+ courses: courses,
7
+ navigation: navigation,
8
+ token: token
11
9
  });
12
- exports.default = rootReducer;
10
+ export default rootReducer;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
2
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
3
  if (ar || !(i in from)) {
@@ -8,18 +7,16 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
8
7
  }
9
8
  return to.concat(ar || Array.prototype.slice.call(from));
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getCurrentViewName = exports.initialState = void 0;
13
- var navigation_1 = require("../actions/navigation");
14
- exports.initialState = ['home'];
10
+ import { NAVIGATE_BACK, NAVIGATE_TO } from '../actions/navigation';
11
+ export var initialState = ['home'];
15
12
  // -----------------------------------------------------------------------------
16
13
  var reducer = function (state, action) {
17
- if (state === void 0) { state = exports.initialState; }
14
+ if (state === void 0) { state = initialState; }
18
15
  switch (action.type) {
19
- case navigation_1.NAVIGATE_TO: {
16
+ case NAVIGATE_TO: {
20
17
  return __spreadArray(__spreadArray([], state, true), [action.payload], false);
21
18
  }
22
- case navigation_1.NAVIGATE_BACK: {
19
+ case NAVIGATE_BACK: {
23
20
  var newState = __spreadArray([], state, true);
24
21
  newState.pop();
25
22
  return newState;
@@ -29,7 +26,6 @@ var reducer = function (state, action) {
29
26
  }
30
27
  };
31
28
  // -----------------------------------------------------------------------------
32
- var getCurrentViewName = function (appState) { return appState.navigation[appState.navigation.length - 1]; };
33
- exports.getCurrentViewName = getCurrentViewName;
29
+ export var getCurrentViewName = function (appState) { return appState.navigation[appState.navigation.length - 1]; };
34
30
  // -----------------------------------------------------------------------------
35
- exports.default = reducer;
31
+ export default reducer;
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getToken = exports.initialState = void 0;
4
- var actions_1 = require("../actions");
5
- exports.initialState = null;
1
+ import { STORE_TOKEN } from '../actions';
2
+ export var initialState = null;
6
3
  // -----------------------------------------------------------------------------
7
4
  var reducer = function (state, action) {
8
- if (state === void 0) { state = exports.initialState; }
5
+ if (state === void 0) { state = initialState; }
9
6
  switch (action.type) {
10
- case actions_1.STORE_TOKEN: {
7
+ case STORE_TOKEN: {
11
8
  return action.payload;
12
9
  }
13
10
  default:
@@ -15,7 +12,6 @@ var reducer = function (state, action) {
15
12
  }
16
13
  };
17
14
  // -----------------------------------------------------------------------------
18
- var getToken = function (appState) { return appState.token; };
19
- exports.getToken = getToken;
15
+ export var getToken = function (appState) { return appState.token; };
20
16
  // -----------------------------------------------------------------------------
21
- exports.default = reducer;
17
+ export default reducer;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,11 +34,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
34
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
35
  }
37
36
  };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.fetchCourse = void 0;
40
- var cross_fetch_1 = require("cross-fetch");
41
- var jwt_decode_1 = require("jwt-decode");
42
- var fetch_responses_1 = require("./fetch-responses");
37
+ import crossFetch from 'cross-fetch';
38
+ import decode from 'jwt-decode';
39
+ import { toJSON } from './fetch-responses';
43
40
  var buildUrlQueryParams = function (params) {
44
41
  return Object.keys(params)
45
42
  .map(function (key) {
@@ -54,7 +51,7 @@ var fetchCourse = function (fetch) { return function (token, language, universal
54
51
  return __generator(this, function (_a) {
55
52
  switch (_a.label) {
56
53
  case 0:
57
- jwt = (0, jwt_decode_1.default)(token);
54
+ jwt = decode(token);
58
55
  query = {
59
56
  type: 'course',
60
57
  universalRef: universalRef,
@@ -65,12 +62,13 @@ var fetchCourse = function (fetch) { return function (token, language, universal
65
62
  })];
66
63
  case 1:
67
64
  response = _a.sent();
68
- return [4 /*yield*/, (0, fetch_responses_1.toJSON)(response)];
65
+ return [4 /*yield*/, toJSON(response)];
69
66
  case 2:
70
67
  hits = (_a.sent()).hits;
71
68
  return [2 /*return*/, hits === null || hits === void 0 ? void 0 : hits[0]];
72
69
  }
73
70
  });
74
71
  }); }; };
75
- exports.fetchCourse = fetchCourse;
76
- exports.default = fetchCourse(cross_fetch_1.default);
72
+ // -----------------------------------------------------------------------------
73
+ export { fetchCourse };
74
+ export default fetchCourse(crossFetch);
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,11 +34,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
34
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
35
  }
37
36
  };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var ava_1 = require("ava");
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 () {
37
+ import test from 'ava';
38
+ import { fetchCourse as _fetchCourse } from './fetch-demo';
39
+ import { okJSONResponse } from './fetch.mocks';
40
+ test('should fetch a demo course', function (t) { return __awaiter(void 0, void 0, void 0, function () {
43
41
  var token, language, universalRef, result, fetchCourse, course;
44
42
  return __generator(this, function (_a) {
45
43
  switch (_a.label) {
@@ -48,7 +46,7 @@ var fetch_mocks_1 = require("./fetch.mocks");
48
46
  language = 'fr';
49
47
  universalRef = 'bar';
50
48
  result = { hits: [{ title: 'Digital IQ test' }] };
51
- fetchCourse = (0, fetch_demo_1.fetchCourse)((0, fetch_mocks_1.okJSONResponse)(result));
49
+ fetchCourse = _fetchCourse(okJSONResponse(result));
52
50
  return [4 /*yield*/, fetchCourse(token, language, universalRef)];
53
51
  case 1:
54
52
  course = _a.sent();
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __extends = (this && this.__extends) || (function () {
3
2
  var extendStatics = function (d, b) {
4
3
  extendStatics = Object.setPrototypeOf ||
@@ -50,8 +49,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
49
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
50
  }
52
51
  };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.toVoid = exports.toText = exports.toJSON = exports.ResponseError = void 0;
55
52
  var ResponseError = /** @class */ (function (_super) {
56
53
  __extends(ResponseError, _super);
57
54
  function ResponseError(status, statusText, body) {
@@ -63,8 +60,8 @@ var ResponseError = /** @class */ (function (_super) {
63
60
  }
64
61
  return ResponseError;
65
62
  }(Error));
66
- exports.ResponseError = ResponseError;
67
- var toJSON = function (response) { return __awaiter(void 0, void 0, void 0, function () {
63
+ export { ResponseError };
64
+ export var toJSON = function (response) { return __awaiter(void 0, void 0, void 0, function () {
68
65
  var body, err_1;
69
66
  return __generator(this, function (_a) {
70
67
  switch (_a.label) {
@@ -85,8 +82,7 @@ var toJSON = function (response) { return __awaiter(void 0, void 0, void 0, func
85
82
  }
86
83
  });
87
84
  }); };
88
- exports.toJSON = toJSON;
89
- var toText = function (response) { return __awaiter(void 0, void 0, void 0, function () {
85
+ export var toText = function (response) { return __awaiter(void 0, void 0, void 0, function () {
90
86
  var body;
91
87
  return __generator(this, function (_a) {
92
88
  switch (_a.label) {
@@ -100,8 +96,7 @@ var toText = function (response) { return __awaiter(void 0, void 0, void 0, func
100
96
  }
101
97
  });
102
98
  }); };
103
- exports.toText = toText;
104
- var toVoid = function (response) { return __awaiter(void 0, void 0, void 0, function () {
99
+ export var toVoid = function (response) { return __awaiter(void 0, void 0, void 0, function () {
105
100
  var body;
106
101
  return __generator(this, function (_a) {
107
102
  switch (_a.label) {
@@ -115,4 +110,3 @@ var toVoid = function (response) { return __awaiter(void 0, void 0, void 0, func
115
110
  }
116
111
  });
117
112
  }); };
118
- exports.toVoid = toVoid;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.internalServerErrorTextResponse = exports.okTextResponse = exports.notFoundJSONResponse = exports.internalServerErrorJSONResponse = exports.okJSONResponse = exports.toResponse = void 0;
4
- var toResponse = function (status, statusText, body) {
1
+ export var toResponse = function (status, statusText, body) {
5
2
  return Promise.resolve({
6
3
  ok: status < 400,
7
4
  status: status,
@@ -10,22 +7,16 @@ var toResponse = function (status, statusText, body) {
10
7
  text: function () { return Promise.resolve(body); }
11
8
  });
12
9
  };
13
- exports.toResponse = toResponse;
14
- var okJSONResponse = function (body) { return function () {
15
- return (0, exports.toResponse)(200, 'OK', JSON.stringify(body));
10
+ export var okJSONResponse = function (body) { return function () {
11
+ return toResponse(200, 'OK', JSON.stringify(body));
16
12
  }; };
17
- exports.okJSONResponse = okJSONResponse;
18
- var internalServerErrorJSONResponse = function (body) { return function () {
19
- return (0, exports.toResponse)(500, 'InternalServerError', JSON.stringify(body));
13
+ export var internalServerErrorJSONResponse = function (body) { return function () {
14
+ return toResponse(500, 'InternalServerError', JSON.stringify(body));
20
15
  }; };
21
- exports.internalServerErrorJSONResponse = internalServerErrorJSONResponse;
22
- var notFoundJSONResponse = function (body) { return function () {
23
- return (0, exports.toResponse)(404, 'Not Found', JSON.stringify(body));
16
+ export var notFoundJSONResponse = function (body) { return function () {
17
+ return toResponse(404, 'Not Found', JSON.stringify(body));
24
18
  }; };
25
- exports.notFoundJSONResponse = notFoundJSONResponse;
26
- var okTextResponse = function (body) { return function () { return (0, exports.toResponse)(200, 'OK', body); }; };
27
- exports.okTextResponse = okTextResponse;
28
- var internalServerErrorTextResponse = function (body) { return function () {
29
- return (0, exports.toResponse)(500, 'InternalServerError', body);
19
+ export var okTextResponse = function (body) { return function () { return toResponse(200, 'OK', body); }; };
20
+ export var internalServerErrorTextResponse = function (body) { return function () {
21
+ return toResponse(500, 'InternalServerError', body);
30
22
  }; };
31
- exports.internalServerErrorTextResponse = internalServerErrorTextResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/app-review",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=16.15.0"
@@ -36,11 +36,12 @@
36
36
  "./package.json": "./package.json"
37
37
  },
38
38
  "dependencies": {
39
- "@coorpacademy/components": "10.19.10",
39
+ "@coorpacademy/components": "10.19.12",
40
40
  "cross-fetch": "^3.1.5",
41
41
  "jwt-decode": "^3.1.2",
42
42
  "react-redux": "^8.0.1",
43
- "redux": "^4.2.0"
43
+ "redux": "^4.2.0",
44
+ "redux-devtools-extension": "^2.13.9"
44
45
  },
45
46
  "peerDependencies": {
46
47
  "react": "^17.0.2",
@@ -58,9 +59,8 @@
58
59
  "live-server": "^1.2.2",
59
60
  "postcss-modules-values-replace": "^3.4.0",
60
61
  "react-dom": "^17.0.2",
61
- "redux-devtools-extension": "^2.13.9",
62
- "ts-node": "^10.8.0",
62
+ "ts-node": "^10.8.1",
63
63
  "typescript": "^4.6.4"
64
64
  },
65
- "gitHead": "a7b81a6e80b8f07ec4cf97e16c975dbf5a502dc4"
65
+ "gitHead": "4fc0ae07513c922d7cbe6e5fddfbcb316ccf6fa5"
66
66
  }
package/readme.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # App Review
2
2
 
3
3
  📚 [Static Demo](http://coorpacademy.github.io/components/app-review)
4
+ 🏹 Architecture illustrated with [Excalidraw](../../../documentation/documentation/review-mode/frontend-app-review.excalidraw). This package is the `@app-review` section.
4
5
 
5
6
  ## start local sandbox
6
7
 
@@ -1,6 +1,5 @@
1
1
  import {applyMiddleware, compose, createStore} from 'redux';
2
2
  import thunk from 'redux-thunk';
3
- import {composeWithDevTools} from 'redux-devtools-extension';
4
3
 
5
4
  import rootReducer from './reducers';
6
5
 
@@ -12,15 +11,17 @@ const preloadedState = undefined;
12
11
 
13
12
  // -----------------------------------------------------------------------------
14
13
 
15
- export default function configureStore() {
16
- const _compose =
17
- process.env.NODE_ENV !== 'production'
18
- ? composeWithDevTools({
19
- name: 'app-review',
20
- trace: true,
21
- traceLimit: 25
22
- })
23
- : compose;
14
+ export default async function configureStore() {
15
+ let _compose = compose;
16
+
17
+ if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
18
+ const {composeWithDevTools} = await import('redux-devtools-extension');
19
+ _compose = composeWithDevTools({
20
+ name: 'app-review',
21
+ trace: true,
22
+ traceLimit: 25
23
+ });
24
+ }
24
25
 
25
26
  const enhancer = _compose(applyMiddleware(thunk, onStartApp));
26
27
  const store = createStore(rootReducer, preloadedState, enhancer);
package/src/index.tsx CHANGED
@@ -21,9 +21,13 @@ const AppRevision = ({options}: Props) => {
21
21
  const [store, setStore] = useState(null);
22
22
 
23
23
  useEffect(() => {
24
- const store = configureStore();
25
- store.dispatch(startApp(options));
26
- setStore(store);
24
+ const _configure = async () => {
25
+ const store = await configureStore();
26
+ store.dispatch(startApp(options));
27
+ setStore(store);
28
+ };
29
+
30
+ _configure();
27
31
  }, []);
28
32
 
29
33
  if (!store) return null;
@@ -37,6 +41,12 @@ const AppRevision = ({options}: Props) => {
37
41
 
38
42
  // -----------------------------------------------------------------------------
39
43
 
44
+ declare global {
45
+ interface Window {
46
+ __REDUX_DEVTOOLS_EXTENSION__?: boolean;
47
+ }
48
+ }
49
+
40
50
  type Props = {options: AppOptions};
41
51
 
42
52
  export type AppOptions = {