@coorpacademy/components 10.19.13-alpha.8 → 10.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +5 -0
  2. package/es/molecule/review-header-steps/index.js +4 -2
  3. package/es/molecule/review-header-steps/index.js.map +1 -1
  4. package/es/template/app-review/slides/index.js +100 -84
  5. package/es/template/app-review/slides/index.js.map +1 -1
  6. package/es/template/app-review/slides/index.native.js +4 -4
  7. package/es/template/app-review/slides/index.native.js.map +1 -1
  8. package/es/template/app-review/slides/prop-types.js +62 -18
  9. package/es/template/app-review/slides/prop-types.js.map +1 -1
  10. package/es/template/app-review/slides/style.css +2 -0
  11. package/lib/molecule/review-header-steps/index.js +6 -2
  12. package/lib/molecule/review-header-steps/index.js.map +1 -1
  13. package/lib/template/app-review/slides/index.js +104 -84
  14. package/lib/template/app-review/slides/index.js.map +1 -1
  15. package/lib/template/app-review/slides/index.native.js +4 -4
  16. package/lib/template/app-review/slides/index.native.js.map +1 -1
  17. package/lib/template/app-review/slides/prop-types.js +65 -18
  18. package/lib/template/app-review/slides/prop-types.js.map +1 -1
  19. package/lib/template/app-review/slides/style.css +2 -0
  20. package/locales/bs/global.json +4 -4
  21. package/locales/cs/global.json +4 -4
  22. package/locales/de/global.json +4 -4
  23. package/locales/en/global.json +4 -4
  24. package/locales/es/global.json +4 -4
  25. package/locales/et/global.json +4 -4
  26. package/locales/fr/global.json +5 -5
  27. package/locales/hr/global.json +4 -4
  28. package/locales/hu/global.json +4 -4
  29. package/locales/hy/global.json +4 -4
  30. package/locales/it/global.json +2 -2
  31. package/locales/ja/global.json +3 -3
  32. package/locales/ko/global.json +4 -4
  33. package/locales/nl/global.json +4 -4
  34. package/locales/pl/global.json +4 -4
  35. package/locales/pt/global.json +4 -4
  36. package/locales/ro/global.json +4 -4
  37. package/locales/ru/global.json +4 -4
  38. package/locales/sk/global.json +3 -3
  39. package/locales/tl/global.json +4 -4
  40. package/locales/tr/global.json +4 -4
  41. package/locales/uk/global.json +4 -4
  42. package/locales/vi/global.json +3 -3
  43. package/locales/zh/global.json +4 -4
  44. package/locales/zh_TW/global.json +3 -3
  45. package/package.json +11 -10
package/README.md CHANGED
@@ -160,6 +160,11 @@ Build modifications:
160
160
  [@coorpacademy-components] > npm run build:es
161
161
  ```
162
162
 
163
+
164
+ ## Use in mobile app
165
+ Run `npm run build:watch``
166
+ For more info see the mobile documentaion (`docs/local-sync.md`)
167
+
163
168
  ## Troubleshooting
164
169
 
165
170
  Error when trying to launch the storybook:
@@ -10,8 +10,10 @@ const ReviewHeaderSteps = props => {
10
10
  const {
11
11
  steps
12
12
  } = props;
13
- const items = map(step => /*#__PURE__*/React.createElement(ReviewHeaderStepItem, _extends({}, step, {
14
- key: step.value
13
+ const items = map.convert({
14
+ cap: false
15
+ })((step, index) => /*#__PURE__*/React.createElement(ReviewHeaderStepItem, _extends({}, step, {
16
+ key: index
15
17
  })), steps);
16
18
  return /*#__PURE__*/React.createElement("div", {
17
19
  className: style.wrapper,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/molecule/review-header-steps/index.js"],"names":["React","PropTypes","map","ReviewHeaderStepItem","style","ReviewHeaderSteps","props","steps","items","step","value","wrapper","propTypes","arrayOf","shape"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,iBAAiB,GAAGC,KAAK,IAAI;AACjC,QAAM;AAACC,IAAAA;AAAD,MAAUD,KAAhB;AAEA,QAAME,KAAK,GAAGN,GAAG,CAACO,IAAI,iBAAI,oBAAC,oBAAD,eAA0BA,IAA1B;AAAgC,IAAA,GAAG,EAAEA,IAAI,CAACC;AAA1C,KAAT,EAA8DH,KAA9D,CAAjB;AAEA,sBACE;AAAK,IAAA,SAAS,EAAEH,KAAK,CAACO,OAAtB;AAA+B,iBAAU;AAAzC,KACGH,KADH,CADF;AAKD,CAVD;;AAYAH,iBAAiB,CAACO,SAAlB,2CAA8B;AAC5BL,EAAAA,KAAK,EAAEN,SAAS,CAACY,OAAV,CAAkBZ,SAAS,CAACa,KAAV,CAAgBX,oBAAoB,CAACG,KAArC,CAAlB;AADqB,CAA9B;AAIA,eAAeD,iBAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport map from 'lodash/fp/map';\nimport ReviewHeaderStepItem from '../../atom/review-header-step-item';\nimport style from './style.css';\n\nconst ReviewHeaderSteps = props => {\n const {steps} = props;\n\n const items = map(step => <ReviewHeaderStepItem {...step} key={step.value} />, steps);\n\n return (\n <div className={style.wrapper} data-name=\"header-steps\">\n {items}\n </div>\n );\n};\n\nReviewHeaderSteps.propTypes = {\n steps: PropTypes.arrayOf(PropTypes.shape(ReviewHeaderStepItem.props))\n};\n\nexport default ReviewHeaderSteps;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/molecule/review-header-steps/index.js"],"names":["React","PropTypes","map","ReviewHeaderStepItem","style","ReviewHeaderSteps","props","steps","items","convert","cap","step","index","wrapper","propTypes","arrayOf","shape"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,iBAAiB,GAAGC,KAAK,IAAI;AACjC,QAAM;AAACC,IAAAA;AAAD,MAAUD,KAAhB;AAEA,QAAME,KAAK,GAAGN,GAAG,CAACO,OAAJ,CAAY;AAACC,IAAAA,GAAG,EAAE;AAAN,GAAZ,EACZ,CAACC,IAAD,EAAOC,KAAP,kBAAiB,oBAAC,oBAAD,eAA0BD,IAA1B;AAAgC,IAAA,GAAG,EAAEC;AAArC,KADL,EAEZL,KAFY,CAAd;AAKA,sBACE;AAAK,IAAA,SAAS,EAAEH,KAAK,CAACS,OAAtB;AAA+B,iBAAU;AAAzC,KACGL,KADH,CADF;AAKD,CAbD;;AAeAH,iBAAiB,CAACS,SAAlB,2CAA8B;AAC5BP,EAAAA,KAAK,EAAEN,SAAS,CAACc,OAAV,CAAkBd,SAAS,CAACe,KAAV,CAAgBb,oBAAoB,CAACG,KAArC,CAAlB;AADqB,CAA9B;AAIA,eAAeD,iBAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport map from 'lodash/fp/map';\nimport ReviewHeaderStepItem from '../../atom/review-header-step-item';\nimport style from './style.css';\n\nconst ReviewHeaderSteps = props => {\n const {steps} = props;\n\n const items = map.convert({cap: false})(\n (step, index) => <ReviewHeaderStepItem {...step} key={index} />,\n steps\n );\n\n return (\n <div className={style.wrapper} data-name=\"header-steps\">\n {items}\n </div>\n );\n};\n\nReviewHeaderSteps.propTypes = {\n steps: PropTypes.arrayOf(PropTypes.shape(ReviewHeaderStepItem.props))\n};\n\nexport default ReviewHeaderSteps;\n"],"file":"index.js"}
@@ -5,6 +5,10 @@ import classnames from 'classnames';
5
5
  import get from 'lodash/fp/get';
6
6
  import getOr from 'lodash/fp/getOr';
7
7
  import isNil from 'lodash/fp/isNil';
8
+ import map from 'lodash/fp/map';
9
+ import omit from 'lodash/fp/omit';
10
+ import pipe from 'lodash/fp/pipe';
11
+ import size from 'lodash/fp/size';
8
12
  import { ICON_VALUES } from '../../../atom/review-header-step-item';
9
13
  import ReviewBackground from '../../../atom/review-background';
10
14
  import ReviewCongrats from '../../../organism/review-congrats';
@@ -26,9 +30,12 @@ export const HIGHEST_INDEX = TOTAL_SLIDES_STACK - 1;
26
30
 
27
31
  const getSlideAnimation = (action, position, hidden) => {
28
32
  switch (action) {
33
+ /* istanbul ignore next */
29
34
  case 'unstack':
30
35
  return style.slideOutHideAndIn;
31
36
 
37
+ /* istanbul ignore next */
38
+
32
39
  case 'restack':
33
40
  return style.slideOutAndIn;
34
41
 
@@ -39,45 +46,37 @@ const getSlideAnimation = (action, position, hidden) => {
39
46
 
40
47
  const Slide = ({
41
48
  slideNumber,
42
- slidesState,
49
+ slides,
43
50
  primarySkinColor,
44
51
  validate,
45
52
  validateSlide,
46
53
  finishedSlides,
47
- updateSlidesOnValidation,
54
+ finishedSlidesSize,
48
55
  updateSlidesOnNext,
49
56
  updateReviewStatus,
50
- updateStepItemsOnValidation,
51
57
  updateStepItemsOnNext,
52
- updateFinishedSlides,
53
58
  slideValidationResult,
54
- correctionPopinProps = {}
59
+ correctionPopinProps
55
60
  }) => {
56
- const result = get('result', slideValidationResult);
57
- const exitNode = get('exitNode', slideValidationResult);
58
- const nextSlide = get('nextSlide', slideValidationResult); // const validatedSlideNumber = get('slideNumber', slideValidationResult);
59
-
60
- const {
61
- hidden,
62
- endReview,
63
- position,
64
- animationType,
65
- validationResult,
66
- questionText,
67
- answerUI
68
- } = slidesState.get(slideNumber);
69
- const {
70
- label: validateLabel
71
- } = validate;
61
+ const hidden = getOr(false, `${slideNumber}.hidden`, slides);
62
+ const endReview = getOr(false, `${slideNumber}.endReview`, slides);
63
+ const position = get(`${slideNumber}.position`, slides);
64
+ const animationType = getOr(false, `${slideNumber}.animationType`, slides);
65
+ const validationResult = getOr(null, `${slideNumber}.validationResult`, slides);
66
+ const questionText = get(`${slideNumber}.questionText`, slides);
67
+ const answerUI = get(`${slideNumber}.answerUI`, slides);
68
+ const validateLabel = getOr('', 'label', validate);
72
69
  const validateButtonProps = {
73
70
  customStyle: {
74
71
  backgroundColor: primarySkinColor
75
72
  },
76
73
 
77
74
  /*
78
- slide validation action, this will trigger the correction popin but will not trigger any
79
- animations unless the endReview signal is received (all slides will disappear),
80
- if there is a nextSlide content, it will be loaded here
75
+ slide validation action, this will trigger the correction popin
76
+ (with the useEffect that fires the dispatchers, if there is a nextSlide content,
77
+ it will be loaded here) but will not trigger any animations unless the endReview
78
+ signal is received (all slides will disappear, also fired in a useEffect),
79
+
81
80
  if it is the last slide and the content needs to be different, then that update will
82
81
  be handled on the next slide logic but the content will be carried from here.
83
82
  */
@@ -85,26 +84,6 @@ const Slide = ({
85
84
  // result: 'success' | 'failure'
86
85
  // endReview based on nextContent ref exit node values: 'successExitNode' : 'failExitNode'
87
86
  await validateSlide();
88
- updateSlidesOnValidation({
89
- slideNumber,
90
- newSlideContent: {
91
- hidden,
92
- position,
93
- validationResult: result,
94
- endReview: !!exitNode
95
- },
96
- numberOfFinishedSlides: finishedSlides.size,
97
- nextSlide
98
- });
99
- updateStepItemsOnValidation({
100
- stepNumber: slideNumber,
101
- icon: result === 'success' ? ICON_VALUES.right : ICON_VALUES.wrong
102
- });
103
- if (result === 'success') updateFinishedSlides([slideNumber, true]);
104
-
105
- if (endReview) {
106
- updateReviewStatus('finished');
107
- }
108
87
  },
109
88
  'aria-label': validateLabel,
110
89
  label: validateLabel,
@@ -112,16 +91,14 @@ const Slide = ({
112
91
  className: style.validateButton,
113
92
  disabled: !isNil(validationResult)
114
93
  };
115
- const {
116
- klf = {},
117
- information = {
118
- label: '',
119
- message: ''
120
- },
121
- next,
122
- successLabel = '',
123
- failureLabel = ''
124
- } = correctionPopinProps;
94
+ const klf = getOr({}, 'klf', correctionPopinProps);
95
+ const information = getOr({
96
+ label: '',
97
+ message: ''
98
+ }, 'information', correctionPopinProps);
99
+ const next = get('next', correctionPopinProps);
100
+ const successLabel = getOr('', 'successLabel', correctionPopinProps);
101
+ const failureLabel = getOr('', 'failureLabel', correctionPopinProps);
125
102
  const _correctionPopinProps = {
126
103
  next: {
127
104
  /*
@@ -131,28 +108,29 @@ const Slide = ({
131
108
  from the content carried from the validate action.
132
109
  */
133
110
  onClick: () => {
111
+ const exitNode = get('exitNode', slideValidationResult);
134
112
  updateSlidesOnNext({
135
113
  slideNumber,
136
114
  newSlideContent: {
137
115
  hidden: validationResult === 'success',
138
- position: HIGHEST_INDEX - finishedSlides.size,
116
+ position: HIGHEST_INDEX - finishedSlidesSize,
117
+ // to restack the slide
139
118
  animationType: validationResult === 'success' ? 'unstack' : 'restack',
140
119
  validationResult,
141
120
  endReview: !!exitNode,
142
121
  answerUI,
143
122
  questionText
144
123
  },
145
- numberOfFinishedSlides: finishedSlides.size
124
+ numberOfFinishedSlides: finishedSlidesSize
146
125
  });
147
126
  updateStepItemsOnNext({
148
127
  stepNumber: slideNumber,
149
128
  finishedSlides,
150
- current: finishedSlides.size === HIGHEST_INDEX && validationResult !== 'success'
129
+ current: finishedSlidesSize === HIGHEST_INDEX &&
130
+ /* istanbul ignore next */
131
+ validationResult !== 'success'
151
132
  });
152
-
153
- if (finishedSlides.size === TOTAL_SLIDES_STACK) {
154
- updateReviewStatus('finished');
155
- }
133
+ if (finishedSlidesSize === TOTAL_SLIDES_STACK) updateReviewStatus('finished');
156
134
  },
157
135
  label: next && next.label,
158
136
  'data-name': `next-question-button-${slideNumber}`,
@@ -164,7 +142,9 @@ const Slide = ({
164
142
  resultLabel: validationResult === 'success' ? successLabel : failureLabel
165
143
  };
166
144
  const questionOrigin = 'From "Master Design Thinking to become more agile" course';
167
- const answerProps = get(['model', 'choices'], answerUI) ? _extends(_extends({}, answerUI), {}, {
145
+ const answerProps = get(['model', 'choices'], answerUI) ?
146
+ /* istanbul ignore next */
147
+ _extends(_extends({}, answerUI), {}, {
168
148
  model: _extends(_extends({}, answerUI.model), {}, {
169
149
  answers: answerUI.model.choices
170
150
  })
@@ -195,7 +175,7 @@ const Slide = ({
195
175
  className: style.validateButtonWrapper
196
176
  }, /*#__PURE__*/React.createElement(ButtonLink, validateButtonProps)), /*#__PURE__*/React.createElement("div", {
197
177
  className: validationResult ? style.correctionPopinWrapper : style.hiddenCorrectionPopinWrapper,
198
- style: _extends({}, finishedSlides.size !== HIGHEST_INDEX && !validationResult && {
178
+ style: _extends({}, finishedSlidesSize !== HIGHEST_INDEX && !validationResult && {
199
179
  display: 'none'
200
180
  })
201
181
  }, /*#__PURE__*/React.createElement(ReviewCorrectionPopin, _correctionPopinProps)));
@@ -209,12 +189,10 @@ const StackedSlides = ({
209
189
  validate,
210
190
  validateSlide,
211
191
  finishedSlides,
212
- updateSlidesOnValidation,
192
+ finishedSlidesSize,
213
193
  updateSlidesOnNext,
214
194
  updateReviewStatus,
215
- updateStepItemsOnValidation,
216
195
  updateStepItemsOnNext,
217
- updateFinishedSlides,
218
196
  slideValidationResult,
219
197
  correctionPopinProps
220
198
  }) => {
@@ -228,12 +206,10 @@ const StackedSlides = ({
228
206
  validate,
229
207
  validateSlide,
230
208
  finishedSlides,
231
- updateSlidesOnValidation,
209
+ finishedSlidesSize,
232
210
  updateSlidesOnNext,
233
211
  updateReviewStatus,
234
- updateStepItemsOnValidation,
235
212
  updateStepItemsOnNext,
236
- updateFinishedSlides,
237
213
  slideValidationResult,
238
214
  correctionPopinProps
239
215
  }, {
@@ -264,30 +240,69 @@ const SlidesReview = ({
264
240
  updateStepItemsOnValidation,
265
241
  updateStepItemsOnNext,
266
242
  updateFinishedSlides,
267
- slideValidationResult = {}
243
+ slideValidationResult
268
244
  }, context) => {
269
245
  const {
270
246
  skin
271
247
  } = context;
272
248
  const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);
249
+ const finishedSlidesSize = useMemo(() => pipe(omit('slideNumbers'), size)(finishedSlides), [finishedSlides]);
273
250
  /*
274
251
  ||-------> the slides have an slightly longer lifespan than the "ongoing" review State,
275
252
  after reviewState changes to "finished" the slides don't have to unmount until the last
276
- slide-out animation is finished, the slides have to be unmounted to be RGAA complaint
277
- (if they are only invisible but still mounted, then they will be found the assisting tools & clutter it)
253
+ slide-out animation is finished, the slides have to be unmounted to be RGAA complaint.
254
+ (if they are only invisible -but- still mounted, then they will be found by the assisting
255
+ tools & clutter them)
278
256
  */
279
257
 
280
258
  const [shouldMountSlides, updateShouldMountSlides] = useState(true);
281
- useEffect(() => {
282
- if (reviewStatus === 'finished' || finishedSlides.size === TOTAL_SLIDES_STACK) {
259
+ useEffect(
260
+ /* istanbul ignore next */
261
+ () => {
262
+ const slideNumber = get('slideNumber', slideValidationResult);
263
+
264
+ if (slideValidationResult) {
265
+ const hidden = getOr(false, `${slideNumber}.hidden`, slides);
266
+ const endReview = getOr(false, `${slideNumber}.endReview`, slides);
267
+ const position = get(`${slideNumber}.position`, slides);
268
+ const result = get('result', slideValidationResult);
269
+ const exitNode = get('exitNode', slideValidationResult);
270
+ const nextSlide = get('nextSlide', slideValidationResult);
271
+ updateSlidesOnValidation({
272
+ slideNumber,
273
+ newSlideContent: {
274
+ hidden,
275
+ position,
276
+ validationResult: result,
277
+ endReview: !!exitNode
278
+ },
279
+ numberOfFinishedSlides: finishedSlidesSize,
280
+ nextSlide
281
+ });
282
+ updateStepItemsOnValidation({
283
+ stepNumber: slideNumber,
284
+ icon: result === 'success' ? ICON_VALUES.right : ICON_VALUES.wrong
285
+ });
286
+ if (result === 'success') updateFinishedSlides({
287
+ slideNumber,
288
+ value: true
289
+ });
290
+
291
+ if (endReview) {
292
+ updateReviewStatus('finished');
293
+ }
294
+ }
295
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
296
+ [slideValidationResult]);
297
+ useEffect(
298
+ /* istanbul ignore next */
299
+ () => {
300
+ if (reviewStatus === 'finished') {
283
301
  setTimeout(() => updateShouldMountSlides(false), 2000);
284
302
  }
285
- }, [finishedSlides.size, reviewStatus, updateReviewStatus]); // ||-------> transform the step items state (Map structure) to an Array
303
+ }, [finishedSlidesSize, reviewStatus, updateReviewStatus]); // ||-------> transform the step items state to Array
286
304
 
287
- const stepItemsArray = useMemo(() => {
288
- // eslint-disable-next-line unicorn/prefer-spread
289
- return Array.from(stepItems.values());
290
- }, [stepItems]);
305
+ const stepItemsArray = useMemo(() => pipe(omit('slideNumbers'), map(stepItem => stepItem))(stepItems), [stepItems]);
291
306
 
292
307
  const _headerProps = _extends(_extends({}, headerProps), {}, {
293
308
  steps: stepItemsArray,
@@ -320,16 +335,17 @@ const SlidesReview = ({
320
335
  validate,
321
336
  validateSlide,
322
337
  finishedSlides,
323
- updateSlidesOnValidation,
338
+ finishedSlidesSize,
324
339
  updateSlidesOnNext,
325
340
  updateReviewStatus,
326
- updateStepItemsOnValidation,
327
341
  updateStepItemsOnNext,
328
- updateFinishedSlides,
329
342
  slideValidationResult,
330
343
  correctionPopinProps
331
- }))) : null, reviewStatus === 'finished' ? /*#__PURE__*/React.createElement("div", {
332
- className: style.congrats
344
+ }))) :
345
+ /* istanbul ignore next */
346
+ null, reviewStatus === 'finished' ? /*#__PURE__*/React.createElement("div", {
347
+ className: style.congrats,
348
+ "data-name": "congrats-container"
333
349
  }, /*#__PURE__*/React.createElement(ReviewCongrats, congratsProps)) : null);
334
350
  };
335
351
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/template/app-review/slides/index.js"],"names":["React","useState","useMemo","useEffect","classnames","get","getOr","isNil","ICON_VALUES","ReviewBackground","ReviewCongrats","ReviewHeader","ReviewCorrectionPopin","Answer","ButtonLink","style","SlidesReviewPropTypes","SlidePropTypes","StackedSlidesPropTypes","stylesByPosition","position0","position1","position2","position3","position4","TOTAL_SLIDES_STACK","HIGHEST_INDEX","getSlideAnimation","action","position","hidden","slideOutHideAndIn","slideOutAndIn","hiddenSlide","Slide","slideNumber","slidesState","primarySkinColor","validate","validateSlide","finishedSlides","updateSlidesOnValidation","updateSlidesOnNext","updateReviewStatus","updateStepItemsOnValidation","updateStepItemsOnNext","updateFinishedSlides","slideValidationResult","correctionPopinProps","result","exitNode","nextSlide","endReview","animationType","validationResult","questionText","answerUI","label","validateLabel","validateButtonProps","customStyle","backgroundColor","onClick","newSlideContent","numberOfFinishedSlides","size","stepNumber","icon","right","wrong","className","validateButton","disabled","klf","information","message","next","successLabel","failureLabel","_correctionPopinProps","current","type","resultLabel","questionOrigin","answerProps","model","answers","choices","slideBase","slideContentContainer","question","help","answerContainer","validateButtonWrapper","correctionPopinWrapper","hiddenCorrectionPopinWrapper","display","propTypes","StackedSlides","slides","stackedSlides","slide","push","SlidesReview","headerProps","reviewBackgroundAriaLabel","stepItems","reviewStatus","congratsProps","context","skin","shouldMountSlides","updateShouldMountSlides","setTimeout","stepItemsArray","Array","from","values","_headerProps","steps","key","hiddenSteps","slidesRevisionContainer","playerBackground","reviewHeaderContainer","stackedSlidesYAxisOverflowContainer","stackedSlidesContainer","congrats"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,OAAzB,EAAkCC,SAAlC,QAAkD,OAAlD;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,SAAQC,WAAR,QAA0B,uCAA1B;AACA,OAAOC,gBAAP,MAA6B,iCAA7B;AACA,OAAOC,cAAP,MAA2B,mCAA3B;AACA,OAAOC,YAAP,MAAyB,iCAAzB;AACA,OAAOC,qBAAP,MAAkC,2CAAlC;AACA,OAAOC,MAAP,MAAmB,0BAAnB;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,SAAQC,qBAAR,EAA+BC,cAA/B,EAA+CC,sBAA/C,QAA4E,cAA5E;AAEA,MAAMC,gBAAgB,GAAG;AACvB,KAAGJ,KAAK,CAACK,SADc;AAEvB,KAAGL,KAAK,CAACM,SAFc;AAGvB,KAAGN,KAAK,CAACO,SAHc;AAIvB,KAAGP,KAAK,CAACQ,SAJc;AAKvB,KAAGR,KAAK,CAACS;AALc,CAAzB;AAQA,OAAO,MAAMC,kBAAkB,GAAG,CAA3B;AACP,OAAO,MAAMC,aAAa,GAAGD,kBAAkB,GAAG,CAA3C;;AAEP,MAAME,iBAAiB,GAAG,CAACC,MAAD,EAASC,QAAT,EAAmBC,MAAnB,KAA8B;AACtD,UAAQF,MAAR;AACE,SAAK,SAAL;AACE,aAAOb,KAAK,CAACgB,iBAAb;;AACF,SAAK,SAAL;AACE,aAAOhB,KAAK,CAACiB,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BjF,qBAAzB;AAEA,eAAeuF,YAAf","sourcesContent":["import React, {useState, useMemo, useEffect} from 'react';\nimport classnames from 'classnames';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport isNil from 'lodash/fp/isNil';\nimport {ICON_VALUES} from '../../../atom/review-header-step-item';\nimport ReviewBackground from '../../../atom/review-background';\nimport ReviewCongrats from '../../../organism/review-congrats';\nimport ReviewHeader from '../../../organism/review-header';\nimport ReviewCorrectionPopin from '../../../molecule/review-correction-popin';\nimport Answer from '../../../molecule/answer';\nimport ButtonLink from '../../../atom/button-link';\nimport style from './style.css';\nimport {SlidesReviewPropTypes, SlidePropTypes, StackedSlidesPropTypes} from './prop-types';\n\nconst stylesByPosition = {\n 0: style.position0,\n 1: style.position1,\n 2: style.position2,\n 3: style.position3,\n 4: style.position4\n};\n\nexport const TOTAL_SLIDES_STACK = 5;\nexport const HIGHEST_INDEX = TOTAL_SLIDES_STACK - 1;\n\nconst getSlideAnimation = (action, position, hidden) => {\n switch (action) {\n case 'unstack':\n return style.slideOutHideAndIn;\n case 'restack':\n return style.slideOutAndIn;\n default:\n return hidden ? style.hiddenSlide : stylesByPosition[position];\n }\n};\n\nconst Slide = ({\n slideNumber,\n slidesState,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n updateSlidesOnValidation,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnValidation,\n updateStepItemsOnNext,\n updateFinishedSlides,\n slideValidationResult,\n correctionPopinProps = {}\n}) => {\n const result = get('result', slideValidationResult);\n const exitNode = get('exitNode', slideValidationResult);\n const nextSlide = get('nextSlide', slideValidationResult);\n // const validatedSlideNumber = get('slideNumber', slideValidationResult);\n\n const {\n hidden,\n endReview,\n position,\n animationType,\n validationResult,\n questionText,\n answerUI\n } = slidesState.get(slideNumber);\n\n const {label: validateLabel} = validate;\n\n const validateButtonProps = {\n customStyle: {\n backgroundColor: primarySkinColor\n },\n /*\n slide validation action, this will trigger the correction popin but will not trigger any\n animations unless the endReview signal is received (all slides will disappear),\n if there is a nextSlide content, it will be loaded here\n if it is the last slide and the content needs to be different, then that update will\n be handled on the next slide logic but the content will be carried from here.\n */\n onClick: async () => {\n // result: 'success' | 'failure'\n // endReview based on nextContent ref exit node values: 'successExitNode' : 'failExitNode'\n await validateSlide();\n updateSlidesOnValidation({\n slideNumber,\n newSlideContent: {\n hidden,\n position,\n validationResult: result,\n endReview: !!exitNode\n },\n numberOfFinishedSlides: finishedSlides.size,\n nextSlide\n });\n updateStepItemsOnValidation({\n stepNumber: slideNumber,\n icon: result === 'success' ? ICON_VALUES.right : ICON_VALUES.wrong\n });\n if (result === 'success') updateFinishedSlides([slideNumber, true]);\n if (endReview) {\n updateReviewStatus('finished');\n }\n },\n 'aria-label': validateLabel,\n label: validateLabel,\n 'data-name': `slide-validate-button-${slideNumber}`,\n className: style.validateButton,\n disabled: !isNil(validationResult)\n };\n\n const {\n klf = {},\n information = {label: '', message: ''},\n next,\n successLabel = '',\n failureLabel = ''\n } = correctionPopinProps;\n\n const _correctionPopinProps = {\n next: {\n /*\n next slide action, this will trigger the slides animations\n if it is the last slide AND the content needs to be different, then that update\n of the content will be handled here (and in the validate as it happens normally )\n from the content carried from the validate action.\n */\n onClick: () => {\n updateSlidesOnNext({\n slideNumber,\n newSlideContent: {\n hidden: validationResult === 'success',\n position: HIGHEST_INDEX - finishedSlides.size,\n animationType: validationResult === 'success' ? 'unstack' : 'restack',\n validationResult,\n endReview: !!exitNode,\n answerUI,\n questionText\n },\n numberOfFinishedSlides: finishedSlides.size\n });\n updateStepItemsOnNext({\n stepNumber: slideNumber,\n finishedSlides,\n current: finishedSlides.size === HIGHEST_INDEX && validationResult !== 'success'\n });\n if (finishedSlides.size === TOTAL_SLIDES_STACK) {\n updateReviewStatus('finished');\n }\n },\n label: next && next.label,\n 'data-name': `next-question-button-${slideNumber}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: validationResult === 'success' ? 'right' : 'wrong',\n resultLabel: validationResult === 'success' ? successLabel : failureLabel\n };\n\n const questionOrigin = 'From \"Master Design Thinking to become more agile\" course';\n const answerProps = get(['model', 'choices'], answerUI)\n ? {\n ...answerUI,\n model: {\n ...answerUI.model,\n answers: answerUI.model.choices\n }\n }\n : answerUI;\n\n return (\n <div\n key={`slide-${slideNumber}`}\n data-name={`slide-${slideNumber}`}\n className={classnames(\n style.slideBase,\n getSlideAnimation(animationType, position, hidden),\n endReview ? style.endReview : null\n )}\n >\n {answerUI && questionText ? (\n <div key=\"content-container\" className={style.slideContentContainer}>\n <div key=\"from-course\" className={style.questionOrigin}>\n {questionOrigin}\n </div>\n <div key=\"title\" className={style.question}>\n {questionText}\n </div>\n <div key=\"help\" className={style.help}>\n {answerUI.help}\n </div>\n <div key=\"answer-container\" className={style.answerContainer}>\n <Answer {...answerProps} key=\"answer\" />\n </div>\n </div>\n ) : null}\n\n <div key=\"button-wrapper\" className={style.validateButtonWrapper}>\n <ButtonLink {...validateButtonProps} />\n </div>\n <div\n className={\n validationResult ? style.correctionPopinWrapper : style.hiddenCorrectionPopinWrapper\n }\n style={{\n ...(finishedSlides.size !== HIGHEST_INDEX &&\n !validationResult && {\n display: 'none'\n })\n }}\n >\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </div>\n </div>\n );\n};\n\nSlide.propTypes = SlidePropTypes;\n\nconst StackedSlides = ({\n slides,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n updateSlidesOnValidation,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnValidation,\n updateStepItemsOnNext,\n updateFinishedSlides,\n slideValidationResult,\n correctionPopinProps\n}) => {\n const stackedSlides = [];\n // eslint-disable-next-line fp/no-loops\n for (let slideNumber = 0; slideNumber < TOTAL_SLIDES_STACK; slideNumber++) {\n const slide = (\n <Slide\n {...{\n slideNumber,\n slides,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n updateSlidesOnValidation,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnValidation,\n updateStepItemsOnNext,\n updateFinishedSlides,\n slideValidationResult,\n correctionPopinProps\n }}\n key={slideNumber}\n />\n );\n stackedSlides.push(slide);\n }\n\n return stackedSlides;\n};\n\nStackedSlides.propTypes = StackedSlidesPropTypes;\n\nconst SlidesReview = (\n {\n headerProps,\n reviewBackgroundAriaLabel,\n validate,\n correctionPopinProps,\n slides,\n finishedSlides,\n stepItems,\n reviewStatus,\n congratsProps,\n validateSlide,\n updateSlidesOnValidation,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnValidation,\n updateStepItemsOnNext,\n updateFinishedSlides,\n slideValidationResult = {}\n },\n context\n) => {\n const {skin} = context;\n const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n\n /*\n ||-------> the slides have an slightly longer lifespan than the \"ongoing\" review State,\n after reviewState changes to \"finished\" the slides don't have to unmount until the last\n slide-out animation is finished, the slides have to be unmounted to be RGAA complaint\n (if they are only invisible but still mounted, then they will be found the assisting tools & clutter it)\n */\n const [shouldMountSlides, updateShouldMountSlides] = useState(true);\n\n useEffect(() => {\n if (reviewStatus === 'finished' || finishedSlides.size === TOTAL_SLIDES_STACK) {\n setTimeout(() => updateShouldMountSlides(false), 2000);\n }\n }, [finishedSlides.size, reviewStatus, updateReviewStatus]);\n\n // ||-------> transform the step items state (Map structure) to an Array\n const stepItemsArray = useMemo(() => {\n // eslint-disable-next-line unicorn/prefer-spread\n return Array.from(stepItems.values());\n }, [stepItems]);\n\n const _headerProps = {\n ...headerProps,\n steps: stepItemsArray,\n key: 'review-header',\n hiddenSteps: reviewStatus !== 'ongoing'\n };\n\n return (\n <div\n key=\"slides-revision-container\"\n data-name=\"slides-revision-container\"\n className={style.slidesRevisionContainer}\n >\n <div key=\"player-background-container\" className={style.playerBackground}>\n <ReviewBackground aria-label={reviewBackgroundAriaLabel} />\n </div>\n\n <div key=\"review-header-wrapper\" className={style.reviewHeaderContainer}>\n <ReviewHeader {..._headerProps} />\n </div>\n\n {shouldMountSlides ? (\n <div\n key=\"stacked-slides-container-y-overflow\"\n className={style.stackedSlidesYAxisOverflowContainer}\n >\n <div\n key=\"stacked-slides-container\"\n data-name=\"stacked-slides-container\"\n className={style.stackedSlidesContainer}\n >\n <StackedSlides\n {...{\n slides,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n updateSlidesOnValidation,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnValidation,\n updateStepItemsOnNext,\n updateFinishedSlides,\n slideValidationResult,\n correctionPopinProps\n }}\n />\n </div>\n </div>\n ) : null}\n\n {reviewStatus === 'finished' ? (\n <div className={style.congrats}>\n <ReviewCongrats {...congratsProps} />\n </div>\n ) : null}\n </div>\n );\n};\n\nSlidesReview.propTypes = SlidesReviewPropTypes;\n\nexport default SlidesReview;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/template/app-review/slides/index.js"],"names":["React","useState","useMemo","useEffect","classnames","get","getOr","isNil","map","omit","pipe","size","ICON_VALUES","ReviewBackground","ReviewCongrats","ReviewHeader","ReviewCorrectionPopin","Answer","ButtonLink","style","SlidesReviewPropTypes","SlidePropTypes","StackedSlidesPropTypes","stylesByPosition","position0","position1","position2","position3","position4","TOTAL_SLIDES_STACK","HIGHEST_INDEX","getSlideAnimation","action","position","hidden","slideOutHideAndIn","slideOutAndIn","hiddenSlide","Slide","slideNumber","slides","primarySkinColor","validate","validateSlide","finishedSlides","finishedSlidesSize","updateSlidesOnNext","updateReviewStatus","updateStepItemsOnNext","slideValidationResult","correctionPopinProps","endReview","animationType","validationResult","questionText","answerUI","validateLabel","validateButtonProps","customStyle","backgroundColor","onClick","label","className","validateButton","disabled","klf","information","message","next","successLabel","failureLabel","_correctionPopinProps","exitNode","newSlideContent","numberOfFinishedSlides","stepNumber","current","type","resultLabel","questionOrigin","answerProps","model","answers","choices","slideBase","slideContentContainer","question","help","answerContainer","validateButtonWrapper","correctionPopinWrapper","hiddenCorrectionPopinWrapper","display","propTypes","StackedSlides","stackedSlides","slide","push","SlidesReview","headerProps","reviewBackgroundAriaLabel","stepItems","reviewStatus","congratsProps","updateSlidesOnValidation","updateStepItemsOnValidation","updateFinishedSlides","context","skin","shouldMountSlides","updateShouldMountSlides","result","nextSlide","icon","right","wrong","value","setTimeout","stepItemsArray","stepItem","_headerProps","steps","key","hiddenSteps","slidesRevisionContainer","playerBackground","reviewHeaderContainer","stackedSlidesYAxisOverflowContainer","stackedSlidesContainer","congrats"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,OAAzB,EAAkCC,SAAlC,QAAkD,OAAlD;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,SAAQC,WAAR,QAA0B,uCAA1B;AACA,OAAOC,gBAAP,MAA6B,iCAA7B;AACA,OAAOC,cAAP,MAA2B,mCAA3B;AACA,OAAOC,YAAP,MAAyB,iCAAzB;AACA,OAAOC,qBAAP,MAAkC,2CAAlC;AACA,OAAOC,MAAP,MAAmB,0BAAnB;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,SAAQC,qBAAR,EAA+BC,cAA/B,EAA+CC,sBAA/C,QAA4E,cAA5E;AAEA,MAAMC,gBAAgB,GAAG;AACvB,KAAGJ,KAAK,CAACK,SADc;AAEvB,KAAGL,KAAK,CAACM,SAFc;AAGvB,KAAGN,KAAK,CAACO,SAHc;AAIvB,KAAGP,KAAK,CAACQ,SAJc;AAKvB,KAAGR,KAAK,CAACS;AALc,CAAzB;AAQA,OAAO,MAAMC,kBAAkB,GAAG,CAA3B;A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K,CAAC8G,QAAtB;AAAgC,iBAAU;AAA1C,kBACE,oBAAC,cAAD,EAAoB1B,aAApB,CADF,CADD,GAIG,IA9CN,CADF;AAkDD,CArJD;;AAuJAL,YAAY,CAACL,SAAb,2CAAyBzE,qBAAzB;AAEA,eAAe8E,YAAf","sourcesContent":["import React, {useState, useMemo, useEffect} from 'react';\nimport classnames from 'classnames';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport isNil from 'lodash/fp/isNil';\nimport map from 'lodash/fp/map';\nimport omit from 'lodash/fp/omit';\nimport pipe from 'lodash/fp/pipe';\nimport size from 'lodash/fp/size';\nimport {ICON_VALUES} from '../../../atom/review-header-step-item';\nimport ReviewBackground from '../../../atom/review-background';\nimport ReviewCongrats from '../../../organism/review-congrats';\nimport ReviewHeader from '../../../organism/review-header';\nimport ReviewCorrectionPopin from '../../../molecule/review-correction-popin';\nimport Answer from '../../../molecule/answer';\nimport ButtonLink from '../../../atom/button-link';\nimport style from './style.css';\nimport {SlidesReviewPropTypes, SlidePropTypes, StackedSlidesPropTypes} from './prop-types';\n\nconst stylesByPosition = {\n 0: style.position0,\n 1: style.position1,\n 2: style.position2,\n 3: style.position3,\n 4: style.position4\n};\n\nexport const TOTAL_SLIDES_STACK = 5;\nexport const HIGHEST_INDEX = TOTAL_SLIDES_STACK - 1;\n\nconst getSlideAnimation = (action, position, hidden) => {\n switch (action) {\n /* istanbul ignore next */\n case 'unstack':\n return style.slideOutHideAndIn;\n /* istanbul ignore next */\n case 'restack':\n return style.slideOutAndIn;\n default:\n return hidden ? style.hiddenSlide : stylesByPosition[position];\n }\n};\n\nconst Slide = ({\n slideNumber,\n slides,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n finishedSlidesSize,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnNext,\n slideValidationResult,\n correctionPopinProps\n}) => {\n const hidden = getOr(false, `${slideNumber}.hidden`, slides);\n const endReview = getOr(false, `${slideNumber}.endReview`, slides);\n const position = get(`${slideNumber}.position`, slides);\n const animationType = getOr(false, `${slideNumber}.animationType`, slides);\n const validationResult = getOr(null, `${slideNumber}.validationResult`, slides);\n const questionText = get(`${slideNumber}.questionText`, slides);\n const answerUI = get(`${slideNumber}.answerUI`, slides);\n\n const validateLabel = getOr('', 'label', validate);\n\n const validateButtonProps = {\n customStyle: {\n backgroundColor: primarySkinColor\n },\n /*\n slide validation action, this will trigger the correction popin\n (with the useEffect that fires the dispatchers, if there is a nextSlide content,\n it will be loaded here) but will not trigger any animations unless the endReview\n signal is received (all slides will disappear, also fired in a useEffect),\n \n if it is the last slide and the content needs to be different, then that update will\n be handled on the next slide logic but the content will be carried from here.\n */\n onClick: async () => {\n // result: 'success' | 'failure'\n // endReview based on nextContent ref exit node values: 'successExitNode' : 'failExitNode'\n await validateSlide();\n },\n 'aria-label': validateLabel,\n label: validateLabel,\n 'data-name': `slide-validate-button-${slideNumber}`,\n className: style.validateButton,\n disabled: !isNil(validationResult)\n };\n\n const klf = getOr({}, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const successLabel = getOr('', 'successLabel', correctionPopinProps);\n const failureLabel = getOr('', 'failureLabel', correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n /*\n next slide action, this will trigger the slides animations\n if it is the last slide AND the content needs to be different, then that update\n of the content will be handled here (and in the validate as it happens normally )\n from the content carried from the validate action.\n */\n onClick: () => {\n const exitNode = get('exitNode', slideValidationResult);\n\n updateSlidesOnNext({\n slideNumber,\n newSlideContent: {\n hidden: validationResult === 'success',\n position: HIGHEST_INDEX - finishedSlidesSize, // to restack the slide\n animationType: validationResult === 'success' ? 'unstack' : 'restack',\n validationResult,\n endReview: !!exitNode,\n answerUI,\n questionText\n },\n numberOfFinishedSlides: finishedSlidesSize\n });\n updateStepItemsOnNext({\n stepNumber: slideNumber,\n finishedSlides,\n current:\n finishedSlidesSize === HIGHEST_INDEX &&\n /* istanbul ignore next */ validationResult !== 'success'\n });\n\n if (finishedSlidesSize === TOTAL_SLIDES_STACK) updateReviewStatus('finished');\n },\n label: next && next.label,\n 'data-name': `next-question-button-${slideNumber}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: validationResult === 'success' ? 'right' : 'wrong',\n resultLabel: validationResult === 'success' ? successLabel : failureLabel\n };\n\n const questionOrigin = 'From \"Master Design Thinking to become more agile\" course';\n const answerProps = get(['model', 'choices'], answerUI)\n ? /* istanbul ignore next */ {\n ...answerUI,\n model: {\n ...answerUI.model,\n answers: answerUI.model.choices\n }\n }\n : answerUI;\n\n return (\n <div\n key={`slide-${slideNumber}`}\n data-name={`slide-${slideNumber}`}\n className={classnames(\n style.slideBase,\n getSlideAnimation(animationType, position, hidden),\n endReview ? style.endReview : null\n )}\n >\n {answerUI && questionText ? (\n <div key=\"content-container\" className={style.slideContentContainer}>\n <div key=\"from-course\" className={style.questionOrigin}>\n {questionOrigin}\n </div>\n <div key=\"title\" className={style.question}>\n {questionText}\n </div>\n <div key=\"help\" className={style.help}>\n {answerUI.help}\n </div>\n <div key=\"answer-container\" className={style.answerContainer}>\n <Answer {...answerProps} key=\"answer\" />\n </div>\n </div>\n ) : null}\n\n <div key=\"button-wrapper\" className={style.validateButtonWrapper}>\n <ButtonLink {...validateButtonProps} />\n </div>\n <div\n className={\n validationResult ? style.correctionPopinWrapper : style.hiddenCorrectionPopinWrapper\n }\n style={{\n ...(finishedSlidesSize !== HIGHEST_INDEX &&\n !validationResult && {\n display: 'none'\n })\n }}\n >\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </div>\n </div>\n );\n};\n\nSlide.propTypes = SlidePropTypes;\n\nconst StackedSlides = ({\n slides,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n finishedSlidesSize,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnNext,\n slideValidationResult,\n correctionPopinProps\n}) => {\n const stackedSlides = [];\n // eslint-disable-next-line fp/no-loops\n for (let slideNumber = 0; slideNumber < TOTAL_SLIDES_STACK; slideNumber++) {\n const slide = (\n <Slide\n {...{\n slideNumber,\n slides,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n finishedSlidesSize,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnNext,\n slideValidationResult,\n correctionPopinProps\n }}\n key={slideNumber}\n />\n );\n stackedSlides.push(slide);\n }\n\n return stackedSlides;\n};\n\nStackedSlides.propTypes = StackedSlidesPropTypes;\n\nconst SlidesReview = (\n {\n headerProps,\n reviewBackgroundAriaLabel,\n validate,\n correctionPopinProps,\n slides,\n finishedSlides,\n stepItems,\n reviewStatus,\n congratsProps,\n validateSlide,\n updateSlidesOnValidation,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnValidation,\n updateStepItemsOnNext,\n updateFinishedSlides,\n slideValidationResult\n },\n context\n) => {\n const {skin} = context;\n const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n\n const finishedSlidesSize = useMemo(() => pipe(omit('slideNumbers'), size)(finishedSlides), [\n finishedSlides\n ]);\n\n /*\n ||-------> the slides have an slightly longer lifespan than the \"ongoing\" review State,\n after reviewState changes to \"finished\" the slides don't have to unmount until the last\n slide-out animation is finished, the slides have to be unmounted to be RGAA complaint.\n (if they are only invisible -but- still mounted, then they will be found by the assisting\n tools & clutter them)\n */\n const [shouldMountSlides, updateShouldMountSlides] = useState(true);\n\n useEffect(\n /* istanbul ignore next */ () => {\n const slideNumber = get('slideNumber', slideValidationResult);\n if (slideValidationResult) {\n const hidden = getOr(false, `${slideNumber}.hidden`, slides);\n const endReview = getOr(false, `${slideNumber}.endReview`, slides);\n const position = get(`${slideNumber}.position`, slides);\n const result = get('result', slideValidationResult);\n const exitNode = get('exitNode', slideValidationResult);\n const nextSlide = get('nextSlide', slideValidationResult);\n updateSlidesOnValidation({\n slideNumber,\n newSlideContent: {\n hidden,\n position,\n validationResult: result,\n endReview: !!exitNode\n },\n numberOfFinishedSlides: finishedSlidesSize,\n nextSlide\n });\n updateStepItemsOnValidation({\n stepNumber: slideNumber,\n icon: result === 'success' ? ICON_VALUES.right : ICON_VALUES.wrong\n });\n if (result === 'success') updateFinishedSlides({slideNumber, value: true});\n if (endReview) {\n updateReviewStatus('finished');\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [slideValidationResult]\n );\n\n useEffect(\n /* istanbul ignore next */ () => {\n if (reviewStatus === 'finished') {\n setTimeout(() => updateShouldMountSlides(false), 2000);\n }\n },\n [finishedSlidesSize, reviewStatus, updateReviewStatus]\n );\n\n // ||-------> transform the step items state to Array\n const stepItemsArray = useMemo(\n () =>\n pipe(\n omit('slideNumbers'),\n map(stepItem => stepItem)\n )(stepItems),\n [stepItems]\n );\n\n const _headerProps = {\n ...headerProps,\n steps: stepItemsArray,\n key: 'review-header',\n hiddenSteps: reviewStatus !== 'ongoing'\n };\n\n return (\n <div\n key=\"slides-revision-container\"\n data-name=\"slides-revision-container\"\n className={style.slidesRevisionContainer}\n >\n <div key=\"player-background-container\" className={style.playerBackground}>\n <ReviewBackground aria-label={reviewBackgroundAriaLabel} />\n </div>\n\n <div key=\"review-header-wrapper\" className={style.reviewHeaderContainer}>\n <ReviewHeader {..._headerProps} />\n </div>\n\n {shouldMountSlides ? (\n <div\n key=\"stacked-slides-container-y-overflow\"\n className={style.stackedSlidesYAxisOverflowContainer}\n >\n <div\n key=\"stacked-slides-container\"\n data-name=\"stacked-slides-container\"\n className={style.stackedSlidesContainer}\n >\n <StackedSlides\n {...{\n slides,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n finishedSlidesSize,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnNext,\n slideValidationResult,\n correctionPopinProps\n }}\n />\n </div>\n </div>\n ) : /* istanbul ignore next */ null}\n\n {reviewStatus === 'finished' ? (\n <div className={style.congrats} data-name=\"congrats-container\">\n <ReviewCongrats {...congratsProps} />\n </div>\n ) : null}\n </div>\n );\n};\n\nSlidesReview.propTypes = SlidesReviewPropTypes;\n\nexport default SlidesReview;\n"],"file":"index.js"}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { View, StyleSheet, Text, useWindowDimensions, Button } from 'react-native';
4
- import propTypes from './prop-types'; // import theme from '../../../modules/theme';
4
+ import { SlidesReviewPropTypes } from './prop-types'; // import theme from '../../../modules/theme';
5
5
  // import translations from '../../../translations';
6
6
  // import {BrandThemeContext} from '../../../app-shared/components/brand-theme-provider';
7
7
  // import Button from '../../../app-shared/components/button';
@@ -185,8 +185,8 @@ const Slide = ({
185
185
  };
186
186
 
187
187
  Slide.propTypes = process.env.NODE_ENV !== "production" ? {
188
- slide: propTypes.slide,
189
- validateSlide: propTypes.validateSlide,
188
+ slide: SlidesReviewPropTypes.slide,
189
+ validateSlide: SlidesReviewPropTypes.validateSlide,
190
190
  num: PropTypes.number
191
191
  } : {}; // -----------------------------------------------------------------------------
192
192
  // const Slides = ({slide}: Props) => {
@@ -206,7 +206,7 @@ const Slides = ({
206
206
  })));
207
207
  };
208
208
 
209
- Slides.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {}; // -----------------------------------------------------------------------------
209
+ Slides.propTypes = process.env.NODE_ENV !== "production" ? SlidesReviewPropTypes : {}; // -----------------------------------------------------------------------------
210
210
 
211
211
  export default Slides;
212
212
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/template/app-review/slides/index.native.js"],"names":["React","PropTypes","View","StyleSheet","Text","useWindowDimensions","Button","propTypes","quizzerStyle","create","container","flex","padding","justifyContent","alignItems","SLIDE_HEIGHT","height","creatSlideStyle","num","width","slide","position","top","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","borderRadius","category","fontSize","lineHeight","textAlign","question","fontWeight","instruction","button","createOptionStyle","selected","box","marginTop","marginBottom","text","choicesStyle","Choices","choices","map","index","optionStyle","arrayOf","bool","Slide","validateSlide","slideStyle","validateLabel","number","Slides","slides","reverse","_slide","length"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,IAAR,EAAcC,UAAd,EAA0BC,IAA1B,EAAgCC,mBAAhC,EAAqDC,MAArD,QAAkE,cAAlE;AAEA,OAAOC,SAAP,MAAsB,cAAtB,C,CAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;;AAEA,MAAMC,YAAY,GAAGL,UAAU,CAACM,MAAX,CAAkB;AACrCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,OAAO,EAAE,EAFA;AAGT;AACA;AACAC,IAAAA,cAAc,EAAE,eALP;AAMTC,IAAAA,UAAU,EAAE;AANH;AAD0B,CAAlB,CAArB;;AAWA,MAAMC,YAAY,GAAG,MAAMV,mBAAmB,GAAGW,MAAtB,GAA+B,IAA1D,C,CAEA;;;AACA,MAAMC,eAAe,GAAG,CAACC,GAAD,EAAMC,KAAN,EAAaH,MAAb,KACtBb,UAAU,CAACM,MAAX,CAAkB;AAChBW,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE,UADL;AAEL;AACAC,IAAAA,GAAG,EAAEN,MAAM,GAAG,CAAT,GAAaD,YAAY,KAAK,CAA9B,GAAkCG,GAAG,GAAG,CAHxC;AAILP,IAAAA,IAAI,EAAE,CAJD;AAKLK,IAAAA,MAAM,EAAED,YAAY,EALf;AAMLI,IAAAA,KAAK,EAAEA,KAAK,GAAG,EAAR,GAAaD,GAAG,GAAG,CANrB;AAOLL,IAAAA,cAAc,EAAE,eAPX;AAQLC,IAAAA,UAAU,EAAE,QARP;AASLF,IAAAA,OAAO,EAAE,EATJ;AAULW,IAAAA,WAAW,EAAE,MAVR;AAWLC,IAAAA,YAAY,EAA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,CAMA;AAEA;;AACA,MAAMC,MAAM,GAAG,CAAC;AAACpC,EAAAA,KAAD;AAAQgC,EAAAA;AAAR,CAAD,KAA4B;AACzC,QAAMK,MAAM,GAAG,CAACrC,KAAD,EAAQA,KAAR,EAAeA,KAAf,EAAsBA,KAAtB,EAA6BA,KAA7B,CAAf;AACA,sBACE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEZ,YAAY,CAACE;AAA1B,KACG+C,MAAM,CAACC,OAAP,GAAiBZ,GAAjB,CAAqB,CAACa,MAAD,EAASZ,KAAT,kBACpB,oBAAC,KAAD;AACE,IAAA,aAAa,EAAEK,aADjB;AAEE,IAAA,KAAK,EAAEO,MAFT;AAGE,IAAA,GAAG,EAAEF,MAAM,CAACG,MAAP,GAAgBb,KAHvB;AAIE,IAAA,GAAG,EAAG,SAAQA,KAAM;AAJtB,IADD,CADH,CADF;AAYD,CAdD;;AAgBAS,MAAM,CAACjD,SAAP,2CAAmBA,SAAnB,M,CAEA;;AAEA,eAAeiD,MAAf","sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport {View, StyleSheet, Text, useWindowDimensions, Button} from 'react-native';\n\nimport propTypes from './prop-types';\n\n// import theme from '../../../modules/theme';\n// import translations from '../../../translations';\n// import {BrandThemeContext} from '../../../app-shared/components/brand-theme-provider';\n// import Button from '../../../app-shared/components/button';\n// import {HEADER_HEIGHT} from '../../../app-shared/components/header-v2';\n\n// export type _Choice_ = {\n// text?: string,\n// selected: boolean\n// };\n\n// export type _Slide_ = {\n// category: string,\n// question: string,\n// instruction: string,\n// type: 'multiSelection' | 'singleSelection' | 'trueOrFalse',\n// choices?: _Choice_[]\n// };\n\n// interface Props {\n// slide: _Slide_;\n// num: number;\n// }\n\nconst quizzerStyle = StyleSheet.create({\n container: {\n flex: 1,\n padding: 20,\n // paddingTop: HEADER_HEIGHT + 20, @todo with props\n // backgroundColor: theme.colors.white, @todo with props\n justifyContent: 'space-between',\n alignItems: 'center'\n }\n});\n\nconst SLIDE_HEIGHT = () => useWindowDimensions().height * 0.75;\n\n// const creatSlideStyle = (num: number) =>\nconst creatSlideStyle = (num, width, height) =>\n StyleSheet.create({\n slide: {\n position: 'absolute',\n // backgroundColor: theme.colors.white, @todo with props\n top: height / 2 - SLIDE_HEIGHT() / 2 - num * 4,\n flex: 1,\n height: SLIDE_HEIGHT(),\n width: width - 40 - num * 8,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n },\n category: {\n fontSize: 12,\n lineHeight: 16,\n // color: theme.colors.text.primary, @todo with props\n // marginBottom: theme.spacing.tiny, @todo with props\n // marginTop: theme.spacing.small, @todo with props\n textAlign: 'center'\n },\n question: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n // color: theme.colors.text.primary, @todo with props\n textAlign: 'center'\n },\n instruction: {\n fontSize: 12,\n lineHeight: 16,\n // color: theme.colors.gray.medium, @todo with props\n // marginBottom: theme.spacing.base, @todo with props\n // marginTop: theme.spacing.small, @todo with props\n textAlign: 'center'\n },\n button: {\n width: 287,\n height: 52,\n borderRadius: 7\n // marginTop: theme.spacing.base @todo with props\n }\n });\n\nconst createOptionStyle = selected => {\n // const brandTheme = React.useContext(BrandThemeContext); @todo with props\n\n return StyleSheet.create({\n box: {\n width: '100%',\n // https://stackoverflow.com/a/66561995/959219\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.2,\n shadowRadius: 16,\n elevation: 8,\n // backgroundColor: selected ? brandTheme.colors.primary : theme.colors.white, @todo with props\n padding: 12,\n marginTop: 4,\n marginBottom: 4,\n borderRadius: 8\n },\n text: {\n fontSize: 15,\n fontWeight: 'bold',\n lineHeight: 24,\n // color: selected ? theme.colors.white : theme.colors.text.primary, @todo with props\n textAlign: 'center'\n }\n });\n};\n\nconst choicesStyle = StyleSheet.create({\n container: {\n flex: 1,\n width: '100%',\n justifyContent: 'center',\n alignItems: 'center'\n }\n});\n\n// -----------------------------------------------------------------------------\n\n/* {choices.map(({text, selected = false}: _Choice_) => { */\nconst Choices = ({choices}) => (\n <View style={choicesStyle.container}>\n {choices.map(({text, selected = false}, index) => {\n const optionStyle = createOptionStyle(selected);\n return (\n <View style={optionStyle.box} key={`choice-${index}`}>\n <Text style={optionStyle.text}>\n {text} {selected}\n </Text>\n </View>\n );\n })}\n </View>\n);\n\nChoices.propTypes = {\n choices: PropTypes.arrayOf({\n text: PropTypes.text,\n selected: PropTypes.bool\n })\n};\n\n// -----------------------------------------------------------------------------\n\n// const Slide = ({slide, num}: Props) => {\nconst Slide = ({validateSlide, slide, num}) => {\n const {width, height} = useWindowDimensions();\n const slideStyle = creatSlideStyle(num, width, height);\n const validateLabel = '__validate'; // translations.validate\n\n // TODO replace choices with <Answer>; move mobile answers in the package..\n return (\n <View style={slideStyle.slide}>\n <Text style={slideStyle.category}>\n {slide.category} {num}\n </Text>\n <Text style={slideStyle.question}>{slide.question}</Text>\n <Text style={slideStyle.instruction}>{slide.instruction}</Text>\n\n <Choices choices={slide.choices} />\n\n <Button style={slideStyle.button} onPress={validateSlide} testID={`button-quizzer-validate`}>\n {validateLabel}\n </Button>\n </View>\n );\n};\n\nSlide.propTypes = {\n slide: propTypes.slide,\n validateSlide: propTypes.validateSlide,\n num: PropTypes.number\n};\n\n// -----------------------------------------------------------------------------\n\n// const Slides = ({slide}: Props) => {\nconst Slides = ({slide, validateSlide}) => {\n const slides = [slide, slide, slide, slide, slide];\n return (\n <View style={quizzerStyle.container}>\n {slides.reverse().map((_slide, index) => (\n <Slide\n validateSlide={validateSlide}\n slide={_slide}\n num={slides.length - index}\n key={`slide-${index}`}\n />\n ))}\n </View>\n );\n};\n\nSlides.propTypes = propTypes;\n\n// -----------------------------------------------------------------------------\n\nexport default Slides;\n"],"file":"index.native.js"}
1
+ {"version":3,"sources":["../../../../src/template/app-review/slides/index.native.js"],"names":["React","PropTypes","View","StyleSheet","Text","useWindowDimensions","Button","SlidesReviewPropTypes","quizzerStyle","create","container","flex","padding","justifyContent","alignItems","SLIDE_HEIGHT","height","creatSlideStyle","num","width","slide","position","top","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","borderRadius","category","fontSize","lineHeight","textAlign","question","fontWeight","instruction","button","createOptionStyle","selected","box","marginTop","marginBottom","text","choicesStyle","Choices","choices","map","index","optionStyle","propTypes","arrayOf","bool","Slide","validateSlide","slideStyle","validateLabel","number","Slides","slides","reverse","_slide","length"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,IAAR,EAAcC,UAAd,EAA0BC,IAA1B,EAAgCC,mBAAhC,EAAqDC,MAArD,QAAkE,cAAlE;AAEA,SAAQC,qBAAR,QAAoC,cAApC,C,CAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;;AAEA,MAAMC,YAAY,GAAGL,UAAU,CAACM,MAAX,CAAkB;AACrCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,OAAO,EAAE,EAFA;AAGT;AACA;AACAC,IAAAA,cAAc,EAAE,eALP;AAMTC,IAAAA,UAAU,EAAE;AANH;AAD0B,CAAlB,CAArB;;AAWA,MAAMC,YAAY,GAAG,MAAMV,mBAAmB,GAAGW,MAAtB,GAA+B,IAA1D,C,CAEA;;;AACA,MAAMC,eAAe,GAAG,CAACC,GAAD,EAAMC,KAAN,EAAaH,MAAb,KACtBb,UAAU,CAACM,MAAX,CAAkB;AAChBW,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE,UADL;AAEL;AACAC,IAAAA,GAAG,EAAEN,MAAM,GAAG,CAAT,GAAaD,YAAY,KAAK,CAA9B,GAAkCG,GAAG,GAAG,C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AAkC,IAAA,OAAO,EAAEiB,aAA3C;AAA0D,IAAA,MAAM,EAAG;AAAnE,KACGE,aADH,CATF,CADF;AAeD,CArBD;;AAuBAH,KAAK,CAACH,SAAN,2CAAkB;AAChB7B,EAAAA,KAAK,EAAEb,qBAAqB,CAACa,KADb;AAEhBiC,EAAAA,aAAa,EAAE9C,qBAAqB,CAAC8C,aAFrB;AAGhBnC,EAAAA,GAAG,EAAEjB,SAAS,CAACuD;AAHC,CAAlB,M,CAMA;AAEA;;AACA,MAAMC,MAAM,GAAG,CAAC;AAACrC,EAAAA,KAAD;AAAQiC,EAAAA;AAAR,CAAD,KAA4B;AACzC,QAAMK,MAAM,GAAG,CAACtC,KAAD,EAAQA,KAAR,EAAeA,KAAf,EAAsBA,KAAtB,EAA6BA,KAA7B,CAAf;AACA,sBACE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEZ,YAAY,CAACE;AAA1B,KACGgD,MAAM,CAACC,OAAP,GAAiBb,GAAjB,CAAqB,CAACc,MAAD,EAASb,KAAT,kBACpB,oBAAC,KAAD;AACE,IAAA,aAAa,EAAEM,aADjB;AAEE,IAAA,KAAK,EAAEO,MAFT;AAGE,IAAA,GAAG,EAAEF,MAAM,CAACG,MAAP,GAAgBd,KAHvB;AAIE,IAAA,GAAG,EAAG,SAAQA,KAAM;AAJtB,IADD,CADH,CADF;AAYD,CAdD;;AAgBAU,MAAM,CAACR,SAAP,2CAAmB1C,qBAAnB,M,CAEA;;AAEA,eAAekD,MAAf","sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport {View, StyleSheet, Text, useWindowDimensions, Button} from 'react-native';\n\nimport {SlidesReviewPropTypes} from './prop-types';\n\n// import theme from '../../../modules/theme';\n// import translations from '../../../translations';\n// import {BrandThemeContext} from '../../../app-shared/components/brand-theme-provider';\n// import Button from '../../../app-shared/components/button';\n// import {HEADER_HEIGHT} from '../../../app-shared/components/header-v2';\n\n// export type _Choice_ = {\n// text?: string,\n// selected: boolean\n// };\n\n// export type _Slide_ = {\n// category: string,\n// question: string,\n// instruction: string,\n// type: 'multiSelection' | 'singleSelection' | 'trueOrFalse',\n// choices?: _Choice_[]\n// };\n\n// interface Props {\n// slide: _Slide_;\n// num: number;\n// }\n\nconst quizzerStyle = StyleSheet.create({\n container: {\n flex: 1,\n padding: 20,\n // paddingTop: HEADER_HEIGHT + 20, @todo with props\n // backgroundColor: theme.colors.white, @todo with props\n justifyContent: 'space-between',\n alignItems: 'center'\n }\n});\n\nconst SLIDE_HEIGHT = () => useWindowDimensions().height * 0.75;\n\n// const creatSlideStyle = (num: number) =>\nconst creatSlideStyle = (num, width, height) =>\n StyleSheet.create({\n slide: {\n position: 'absolute',\n // backgroundColor: theme.colors.white, @todo with props\n top: height / 2 - SLIDE_HEIGHT() / 2 - num * 4,\n flex: 1,\n height: SLIDE_HEIGHT(),\n width: width - 40 - num * 8,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n },\n category: {\n fontSize: 12,\n lineHeight: 16,\n // color: theme.colors.text.primary, @todo with props\n // marginBottom: theme.spacing.tiny, @todo with props\n // marginTop: theme.spacing.small, @todo with props\n textAlign: 'center'\n },\n question: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n // color: theme.colors.text.primary, @todo with props\n textAlign: 'center'\n },\n instruction: {\n fontSize: 12,\n lineHeight: 16,\n // color: theme.colors.gray.medium, @todo with props\n // marginBottom: theme.spacing.base, @todo with props\n // marginTop: theme.spacing.small, @todo with props\n textAlign: 'center'\n },\n button: {\n width: 287,\n height: 52,\n borderRadius: 7\n // marginTop: theme.spacing.base @todo with props\n }\n });\n\nconst createOptionStyle = selected => {\n // const brandTheme = React.useContext(BrandThemeContext); @todo with props\n\n return StyleSheet.create({\n box: {\n width: '100%',\n // https://stackoverflow.com/a/66561995/959219\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.2,\n shadowRadius: 16,\n elevation: 8,\n // backgroundColor: selected ? brandTheme.colors.primary : theme.colors.white, @todo with props\n padding: 12,\n marginTop: 4,\n marginBottom: 4,\n borderRadius: 8\n },\n text: {\n fontSize: 15,\n fontWeight: 'bold',\n lineHeight: 24,\n // color: selected ? theme.colors.white : theme.colors.text.primary, @todo with props\n textAlign: 'center'\n }\n });\n};\n\nconst choicesStyle = StyleSheet.create({\n container: {\n flex: 1,\n width: '100%',\n justifyContent: 'center',\n alignItems: 'center'\n }\n});\n\n// -----------------------------------------------------------------------------\n\n/* {choices.map(({text, selected = false}: _Choice_) => { */\nconst Choices = ({choices}) => (\n <View style={choicesStyle.container}>\n {choices.map(({text, selected = false}, index) => {\n const optionStyle = createOptionStyle(selected);\n return (\n <View style={optionStyle.box} key={`choice-${index}`}>\n <Text style={optionStyle.text}>\n {text} {selected}\n </Text>\n </View>\n );\n })}\n </View>\n);\n\nChoices.propTypes = {\n choices: PropTypes.arrayOf({\n text: PropTypes.text,\n selected: PropTypes.bool\n })\n};\n\n// -----------------------------------------------------------------------------\n\n// const Slide = ({slide, num}: Props) => {\nconst Slide = ({validateSlide, slide, num}) => {\n const {width, height} = useWindowDimensions();\n const slideStyle = creatSlideStyle(num, width, height);\n const validateLabel = '__validate'; // translations.validate\n\n // TODO replace choices with <Answer>; move mobile answers in the package..\n return (\n <View style={slideStyle.slide}>\n <Text style={slideStyle.category}>\n {slide.category} {num}\n </Text>\n <Text style={slideStyle.question}>{slide.question}</Text>\n <Text style={slideStyle.instruction}>{slide.instruction}</Text>\n\n <Choices choices={slide.choices} />\n\n <Button style={slideStyle.button} onPress={validateSlide} testID={`button-quizzer-validate`}>\n {validateLabel}\n </Button>\n </View>\n );\n};\n\nSlide.propTypes = {\n slide: SlidesReviewPropTypes.slide,\n validateSlide: SlidesReviewPropTypes.validateSlide,\n num: PropTypes.number\n};\n\n// -----------------------------------------------------------------------------\n\n// const Slides = ({slide}: Props) => {\nconst Slides = ({slide, validateSlide}) => {\n const slides = [slide, slide, slide, slide, slide];\n return (\n <View style={quizzerStyle.container}>\n {slides.reverse().map((_slide, index) => (\n <Slide\n validateSlide={validateSlide}\n slide={_slide}\n num={slides.length - index}\n key={`slide-${index}`}\n />\n ))}\n </View>\n );\n};\n\nSlides.propTypes = SlidesReviewPropTypes;\n\n// -----------------------------------------------------------------------------\n\nexport default Slides;\n"],"file":"index.native.js"}