@coorpacademy/app-review 0.8.9 → 0.8.10-alpha.1

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/index.js CHANGED
@@ -24,7 +24,7 @@ const ConnectedApp = (options) => {
24
24
  const AppReview = ({ options }) => {
25
25
  const [store, setStore] = useState(null);
26
26
  const [isProgressionCreated, setIsProgressionCreated] = useState(false);
27
- const { translate, onQuitClick } = options;
27
+ const { translate, onQuitClick, skin } = options;
28
28
  useEffect(() => {
29
29
  if (store)
30
30
  return;
@@ -68,6 +68,6 @@ const AppReview = ({ options }) => {
68
68
  if (!store)
69
69
  return null;
70
70
  return (React.createElement(Provider, { store: store },
71
- React.createElement(ConnectedApp, { onQuitClick: onQuitClick, translate: translate })));
71
+ React.createElement(ConnectedApp, { onQuitClick: onQuitClick, translate: translate, skin: skin })));
72
72
  };
73
73
  export default AppReview;
@@ -151,6 +151,7 @@ export declare type Options = {
151
151
  export declare type ConnectedOptions = {
152
152
  translate: Translate;
153
153
  onQuitClick: () => void;
154
+ skin: PrimarySkin;
154
155
  };
155
156
  export declare type AppOptions = ConnectedOptions & {
156
157
  token: string;
@@ -174,4 +175,9 @@ export declare type JWT = {
174
175
  export declare type WithRequired<T, K extends keyof T> = T & {
175
176
  [P in K]-?: T[P];
176
177
  };
178
+ export declare type PrimarySkin = {
179
+ common: {
180
+ primary: string;
181
+ };
182
+ };
177
183
  export {};
@@ -201,7 +201,7 @@ const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf, tr
201
201
  type: isCorrect ? 'right' : 'wrong'
202
202
  };
203
203
  };
204
- const buildQuitPopinProps = (dispatch) => (onQuitClick, translate) => {
204
+ const buildQuitPopinProps = (dispatch) => (onQuitClick, translate, skin) => {
205
205
  return {
206
206
  content: translate('Quit Title'),
207
207
  icon: `MoonRocket`,
@@ -211,7 +211,7 @@ const buildQuitPopinProps = (dispatch) => (onQuitClick, translate) => {
211
211
  label: translate('Stop learning'),
212
212
  type: 'tertiary',
213
213
  customStyle: {
214
- color: '#ED3436'
214
+ color: skin.common.primary
215
215
  },
216
216
  handleOnclick: onQuitClick,
217
217
  'aria-label': translate('Stop learning')
@@ -312,7 +312,7 @@ const isEndOfProgression = (progression) => {
312
312
  return progression.state.nextContent.ref === 'successExitNode';
313
313
  };
314
314
  export const mapStateToSlidesProps = (state, dispatch, options) => {
315
- const { translate, onQuitClick } = options;
315
+ const { translate, onQuitClick, skin } = options;
316
316
  const currentSlideRef = getCurrentSlideRef(state);
317
317
  const endReview = isEndOfProgression(state.data.progression);
318
318
  const correction = get(['data', 'corrections', currentSlideRef], state);
@@ -345,6 +345,8 @@ export const mapStateToSlidesProps = (state, dispatch, options) => {
345
345
  endReview: endReview && state.ui.showCongrats
346
346
  },
347
347
  congrats: buildCongratsProps(state, dispatch, options),
348
- quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick, translate) : undefined
348
+ quitPopin: showQuitPopin
349
+ ? buildQuitPopinProps(dispatch)(onQuitClick, translate, skin)
350
+ : undefined
349
351
  };
350
352
  };
package/lib/index.js CHANGED
@@ -52,7 +52,7 @@ const ConnectedApp = (options) => {
52
52
  const AppReview = ({ options }) => {
53
53
  const [store, setStore] = (0, react_1.useState)(null);
54
54
  const [isProgressionCreated, setIsProgressionCreated] = (0, react_1.useState)(false);
55
- const { translate, onQuitClick } = options;
55
+ const { translate, onQuitClick, skin } = options;
56
56
  (0, react_1.useEffect)(() => {
57
57
  if (store)
58
58
  return;
@@ -96,6 +96,6 @@ const AppReview = ({ options }) => {
96
96
  if (!store)
97
97
  return null;
98
98
  return (react_1.default.createElement(react_redux_1.Provider, { store: store },
99
- react_1.default.createElement(ConnectedApp, { onQuitClick: onQuitClick, translate: translate })));
99
+ react_1.default.createElement(ConnectedApp, { onQuitClick: onQuitClick, translate: translate, skin: skin })));
100
100
  };
101
101
  exports.default = AppReview;
@@ -151,6 +151,7 @@ export declare type Options = {
151
151
  export declare type ConnectedOptions = {
152
152
  translate: Translate;
153
153
  onQuitClick: () => void;
154
+ skin: PrimarySkin;
154
155
  };
155
156
  export declare type AppOptions = ConnectedOptions & {
156
157
  token: string;
@@ -174,4 +175,9 @@ export declare type JWT = {
174
175
  export declare type WithRequired<T, K extends keyof T> = T & {
175
176
  [P in K]-?: T[P];
176
177
  };
178
+ export declare type PrimarySkin = {
179
+ common: {
180
+ primary: string;
181
+ };
182
+ };
177
183
  export {};
@@ -208,7 +208,7 @@ const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf, tr
208
208
  type: isCorrect ? 'right' : 'wrong'
209
209
  };
210
210
  };
211
- const buildQuitPopinProps = (dispatch) => (onQuitClick, translate) => {
211
+ const buildQuitPopinProps = (dispatch) => (onQuitClick, translate, skin) => {
212
212
  return {
213
213
  content: translate('Quit Title'),
214
214
  icon: `MoonRocket`,
@@ -218,7 +218,7 @@ const buildQuitPopinProps = (dispatch) => (onQuitClick, translate) => {
218
218
  label: translate('Stop learning'),
219
219
  type: 'tertiary',
220
220
  customStyle: {
221
- color: '#ED3436'
221
+ color: skin.common.primary
222
222
  },
223
223
  handleOnclick: onQuitClick,
224
224
  'aria-label': translate('Stop learning')
@@ -319,7 +319,7 @@ const isEndOfProgression = (progression) => {
319
319
  return progression.state.nextContent.ref === 'successExitNode';
320
320
  };
321
321
  const mapStateToSlidesProps = (state, dispatch, options) => {
322
- const { translate, onQuitClick } = options;
322
+ const { translate, onQuitClick, skin } = options;
323
323
  const currentSlideRef = getCurrentSlideRef(state);
324
324
  const endReview = isEndOfProgression(state.data.progression);
325
325
  const correction = (0, get_1.default)(['data', 'corrections', currentSlideRef], state);
@@ -352,7 +352,9 @@ const mapStateToSlidesProps = (state, dispatch, options) => {
352
352
  endReview: endReview && state.ui.showCongrats
353
353
  },
354
354
  congrats: buildCongratsProps(state, dispatch, options),
355
- quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick, translate) : undefined
355
+ quitPopin: showQuitPopin
356
+ ? buildQuitPopinProps(dispatch)(onQuitClick, translate, skin)
357
+ : undefined
356
358
  };
357
359
  };
358
360
  exports.mapStateToSlidesProps = mapStateToSlidesProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/app-review",
3
- "version": "0.8.9",
3
+ "version": "0.8.10-alpha.1+2503fa1e9",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=16.15.0"
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@coorpacademy/components": "10.28.7",
39
39
  "@coorpacademy/redux-task": "1.1.6",
40
- "@coorpacademy/translate": "^6.1.5",
40
+ "@coorpacademy/translate": "6.1.5",
41
41
  "cross-fetch": "^3.1.5",
42
42
  "jwt-decode": "^3.1.2",
43
43
  "react-redux": "^7.2.9",
@@ -71,5 +71,5 @@
71
71
  "webpack-cli": "^4.10.0",
72
72
  "webpack-dev-server": "^4.11.1"
73
73
  },
74
- "gitHead": "761de76bebf26748140505da5eb938de2c543d1f"
74
+ "gitHead": "2503fa1e90128d836b29cfd57bdf05d68e8e30c7"
75
75
  }