@coorpacademy/app-review 0.9.0 → 0.9.1-alpha.12

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: Skin;
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 Skin = {
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`,
@@ -219,6 +219,9 @@ const buildQuitPopinProps = (dispatch) => (onQuitClick, translate) => {
219
219
  secondButton: {
220
220
  label: translate('Continue learning'),
221
221
  type: 'primary',
222
+ customStyle: {
223
+ backgroundColor: skin.common.primary
224
+ },
222
225
  handleOnclick: () => {
223
226
  dispatch(closeQuitPopin);
224
227
  },
@@ -312,7 +315,7 @@ const isEndOfProgression = (progression) => {
312
315
  return progression.state.nextContent.ref === 'successExitNode';
313
316
  };
314
317
  export const mapStateToSlidesProps = (state, dispatch, options) => {
315
- const { translate, onQuitClick } = options;
318
+ const { translate, onQuitClick, skin } = options;
316
319
  const currentSlideRef = getCurrentSlideRef(state);
317
320
  const endReview = isEndOfProgression(state.data.progression);
318
321
  const correction = get(['data', 'corrections', currentSlideRef], state);
@@ -345,6 +348,8 @@ export const mapStateToSlidesProps = (state, dispatch, options) => {
345
348
  endReview: endReview && state.ui.showCongrats
346
349
  },
347
350
  congrats: buildCongratsProps(state, dispatch, options),
348
- quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick, translate) : undefined
351
+ quitPopin: showQuitPopin
352
+ ? buildQuitPopinProps(dispatch)(onQuitClick, translate, skin)
353
+ : undefined
349
354
  };
350
355
  };
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: Skin;
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 Skin = {
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`,
@@ -226,6 +226,9 @@ const buildQuitPopinProps = (dispatch) => (onQuitClick, translate) => {
226
226
  secondButton: {
227
227
  label: translate('Continue learning'),
228
228
  type: 'primary',
229
+ customStyle: {
230
+ backgroundColor: skin.common.primary
231
+ },
229
232
  handleOnclick: () => {
230
233
  dispatch(quit_popin_1.closeQuitPopin);
231
234
  },
@@ -319,7 +322,7 @@ const isEndOfProgression = (progression) => {
319
322
  return progression.state.nextContent.ref === 'successExitNode';
320
323
  };
321
324
  const mapStateToSlidesProps = (state, dispatch, options) => {
322
- const { translate, onQuitClick } = options;
325
+ const { translate, onQuitClick, skin } = options;
323
326
  const currentSlideRef = getCurrentSlideRef(state);
324
327
  const endReview = isEndOfProgression(state.data.progression);
325
328
  const correction = (0, get_1.default)(['data', 'corrections', currentSlideRef], state);
@@ -352,7 +355,9 @@ const mapStateToSlidesProps = (state, dispatch, options) => {
352
355
  endReview: endReview && state.ui.showCongrats
353
356
  },
354
357
  congrats: buildCongratsProps(state, dispatch, options),
355
- quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick, translate) : undefined
358
+ quitPopin: showQuitPopin
359
+ ? buildQuitPopinProps(dispatch)(onQuitClick, translate, skin)
360
+ : undefined
356
361
  };
357
362
  };
358
363
  exports.mapStateToSlidesProps = mapStateToSlidesProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/app-review",
3
- "version": "0.9.0",
3
+ "version": "0.9.1-alpha.12+238f6dd65",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=16.15.0"
@@ -35,7 +35,7 @@
35
35
  "main": "lib/index.js",
36
36
  "module": "es/index.js",
37
37
  "dependencies": {
38
- "@coorpacademy/components": "10.29.0",
38
+ "@coorpacademy/components": "10.29.1-alpha.12+238f6dd65",
39
39
  "@coorpacademy/redux-task": "1.1.6",
40
40
  "@coorpacademy/translate": "6.2.0",
41
41
  "cross-fetch": "^3.1.5",
@@ -71,5 +71,5 @@
71
71
  "webpack-cli": "^4.10.0",
72
72
  "webpack-dev-server": "^4.11.1"
73
73
  },
74
- "gitHead": "d86b61ca4d94a5e0c8691bc10bc5c8e67e45153d"
74
+ "gitHead": "238f6dd650f5af8fcb1d52f35eaadf9a4abc91e6"
75
75
  }
@@ -1 +0,0 @@
1
- {"ignore_dirs":[]}