@coorpacademy/components 10.19.12 → 10.19.13-alpha.8

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 (70) hide show
  1. package/es/organism/review-skills/index.js +2 -0
  2. package/es/organism/review-skills/index.js.map +1 -1
  3. package/es/template/app-review/index.js +35 -0
  4. package/es/template/app-review/index.js.map +1 -0
  5. package/es/template/app-review/{root-view/root-view.native.js → index.native.js} +2 -3
  6. package/es/template/app-review/index.native.js.map +1 -0
  7. package/es/template/app-review/onboarding/index.js +3 -0
  8. package/es/template/app-review/onboarding/index.js.map +1 -0
  9. package/es/template/app-review/onboarding/index.native.js +84 -0
  10. package/es/template/app-review/onboarding/index.native.js.map +1 -0
  11. package/es/template/app-review/{root-view/prop-types.js → prop-types.js} +11 -7
  12. package/es/template/app-review/prop-types.js.map +1 -0
  13. package/es/template/app-review/skills/index.js +3 -0
  14. package/es/template/app-review/skills/index.js.map +1 -0
  15. package/es/template/app-review/skills/index.native.js +179 -0
  16. package/es/template/app-review/skills/index.native.js.map +1 -0
  17. package/es/template/app-review/skills/stories.js +15 -0
  18. package/es/template/app-review/skills/stories.js.map +1 -0
  19. package/es/template/app-review/slides/index.js +338 -0
  20. package/es/template/app-review/slides/index.js.map +1 -0
  21. package/es/template/app-review/slides/index.native.js +212 -0
  22. package/es/template/app-review/slides/index.native.js.map +1 -0
  23. package/es/template/app-review/slides/prop-types.js +67 -0
  24. package/es/template/app-review/slides/prop-types.js.map +1 -0
  25. package/es/template/app-review/{slides-review → slides}/style.css +0 -0
  26. package/lib/organism/review-skills/index.js +5 -1
  27. package/lib/organism/review-skills/index.js.map +1 -1
  28. package/lib/template/app-review/index.js +52 -0
  29. package/lib/template/app-review/index.js.map +1 -0
  30. package/lib/template/app-review/{root-view/root-view.native.js → index.native.js} +5 -9
  31. package/lib/template/app-review/index.native.js.map +1 -0
  32. package/lib/template/app-review/onboarding/index.js +12 -0
  33. package/lib/template/app-review/onboarding/index.js.map +1 -0
  34. package/lib/template/app-review/onboarding/index.native.js +100 -0
  35. package/lib/template/app-review/onboarding/index.native.js.map +1 -0
  36. package/lib/template/app-review/prop-types.js +33 -0
  37. package/lib/template/app-review/prop-types.js.map +1 -0
  38. package/lib/template/app-review/skills/index.js +12 -0
  39. package/lib/template/app-review/skills/index.js.map +1 -0
  40. package/lib/template/app-review/skills/index.native.js +197 -0
  41. package/lib/template/app-review/skills/index.native.js.map +1 -0
  42. package/lib/template/app-review/skills/stories.js +16 -0
  43. package/lib/template/app-review/skills/stories.js.map +1 -0
  44. package/lib/template/app-review/slides/index.js +367 -0
  45. package/lib/template/app-review/slides/index.js.map +1 -0
  46. package/lib/template/app-review/slides/index.native.js +229 -0
  47. package/lib/template/app-review/slides/index.native.js.map +1 -0
  48. package/lib/template/app-review/slides/prop-types.js +84 -0
  49. package/lib/template/app-review/slides/prop-types.js.map +1 -0
  50. package/lib/template/app-review/{slides-review → slides}/style.css +0 -0
  51. package/package.json +2 -2
  52. package/es/template/app-review/root-view/common.js +0 -6
  53. package/es/template/app-review/root-view/common.js.map +0 -1
  54. package/es/template/app-review/root-view/prop-types.js.map +0 -1
  55. package/es/template/app-review/root-view/root-view.js +0 -14
  56. package/es/template/app-review/root-view/root-view.js.map +0 -1
  57. package/es/template/app-review/root-view/root-view.modules.css +0 -8
  58. package/es/template/app-review/root-view/root-view.native.js.map +0 -1
  59. package/es/template/app-review/slides-review/index.js +0 -427
  60. package/es/template/app-review/slides-review/index.js.map +0 -1
  61. package/lib/template/app-review/root-view/common.js +0 -11
  62. package/lib/template/app-review/root-view/common.js.map +0 -1
  63. package/lib/template/app-review/root-view/prop-types.js +0 -28
  64. package/lib/template/app-review/root-view/prop-types.js.map +0 -1
  65. package/lib/template/app-review/root-view/root-view.js +0 -25
  66. package/lib/template/app-review/root-view/root-view.js.map +0 -1
  67. package/lib/template/app-review/root-view/root-view.modules.css +0 -8
  68. package/lib/template/app-review/root-view/root-view.native.js.map +0 -1
  69. package/lib/template/app-review/slides-review/index.js +0 -453
  70. package/lib/template/app-review/slides-review/index.js.map +0 -1
@@ -1,453 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
-
6
- var _react = _interopRequireWildcard(require("react"));
7
-
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
-
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
-
12
- var _getOr = _interopRequireDefault(require("lodash/fp/getOr"));
13
-
14
- var _omit = _interopRequireDefault(require("lodash/fp/omit"));
15
-
16
- var _isNil = _interopRequireDefault(require("lodash/fp/isNil"));
17
-
18
- var _reviewBackground = _interopRequireDefault(require("../../../atom/review-background"));
19
-
20
- var _reviewHeaderStepItem = require("../../../atom/review-header-step-item");
21
-
22
- var _reviewCongrats = _interopRequireDefault(require("../../../organism/review-congrats"));
23
-
24
- var _reviewHeader = _interopRequireDefault(require("../../../organism/review-header"));
25
-
26
- var _reviewCorrectionPopin = _interopRequireDefault(require("../../../molecule/review-correction-popin"));
27
-
28
- var _answer = _interopRequireDefault(require("../../../molecule/answer"));
29
-
30
- var _buttonLink = _interopRequireDefault(require("../../../atom/button-link"));
31
-
32
- var _style = _interopRequireDefault(require("./style.css"));
33
-
34
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
-
36
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
37
-
38
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
39
-
40
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
41
-
42
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
43
-
44
- const stylesByPosition = {
45
- 0: _style.default.position0,
46
- 1: _style.default.position1,
47
- 2: _style.default.position2,
48
- 3: _style.default.position3,
49
- 4: _style.default.position4
50
- };
51
- const TOTAL_SLIDES_STACK = 5;
52
- const HIGHEST_INDEX = TOTAL_SLIDES_STACK - 1;
53
-
54
- const getSlideAnimation = (action, position, hidden) => {
55
- switch (action) {
56
- case 'unstack':
57
- return _style.default.slideOutHideAndIn;
58
-
59
- case 'restack':
60
- return _style.default.slideOutAndIn;
61
-
62
- default:
63
- return hidden ? _style.default.hiddenSlide : stylesByPosition[position];
64
- }
65
- };
66
-
67
- const buildSlide = (slideNumber, slidesState, updateSlides, primarySkinColor, validate, correctionPopinProps, updateStepItems, finishedSlides, updateFinishedSlides, updateReviewState, updateShouldMountSlides) => {
68
- const {
69
- hidden,
70
- endReview,
71
- position,
72
- action,
73
- validationResult,
74
- question,
75
- answer
76
- } = slidesState.get(slideNumber);
77
- const {
78
- onClick: onValidateClick,
79
- label: validateLabel
80
- } = validate;
81
- const validateButtonProps = {
82
- customStyle: {
83
- backgroundColor: primarySkinColor
84
- },
85
-
86
- /*
87
- slide validation action, this will trigger the correction popin but will not trigger any
88
- animations unless the endReview signal is received (all slides will disappear),
89
- if there is a nextSlide content, it will be loaded here
90
- if it is the last slide and the content needs to be different, then that update will
91
- be handled on the next slide logic but the content will be carried from here.
92
- */
93
- onClick: async () => {
94
- const {
95
- validationResult: result,
96
- nextSlide,
97
- endReview: _endReview
98
- } = await onValidateClick();
99
- updateSlides([slideNumber, {
100
- hidden,
101
- position,
102
- validationResult: result,
103
- answer,
104
- question,
105
- nextSlide,
106
- numberOfFinishedSlides: finishedSlides.size,
107
- endReview: _endReview
108
- }]); // on endReview, this gives some time for the slides to slide out && then launch
109
- // the 'finished' logic as it would happen when normally finishing the review
110
-
111
- if (_endReview) {
112
- updateReviewState('finished');
113
- setTimeout(() => updateShouldMountSlides(false), 2000);
114
- }
115
-
116
- updateStepItems([slideNumber, {
117
- icon: result === 'success' ? _reviewHeaderStepItem.ICON_VALUES.right : _reviewHeaderStepItem.ICON_VALUES.wrong,
118
- finishedSlides
119
- }]); // only stores successful slides
120
-
121
- if (result === 'success') updateFinishedSlides([slideNumber, true]);
122
- },
123
- 'aria-label': validateLabel,
124
- label: validateLabel,
125
- 'data-name': `slide-validate-button-${slideNumber}`,
126
- className: _style.default.validateButton,
127
- disabled: !(0, _isNil.default)(validationResult)
128
- };
129
- const {
130
- klf,
131
- information,
132
- next,
133
- successLabel,
134
- failureLabel
135
- } = correctionPopinProps;
136
- const _correctionPopinProps = {
137
- next: {
138
- /*
139
- next slide action, this will trigger the slides animations
140
- if it is the last slide AND the content needs to be different, then that update
141
- of the content will be handled here (and in the validate as it happens normally )
142
- from the content carried from the validate action.
143
- */
144
- onClick: () => {
145
- updateSlides([slideNumber, {
146
- hidden: validationResult === 'success',
147
- position: HIGHEST_INDEX - finishedSlides.size,
148
- action: validationResult === 'success' ? 'unstack' : 'restack',
149
- answer,
150
- question,
151
- validationResult,
152
- numberOfFinishedSlides: finishedSlides.size,
153
- endReview
154
- }]);
155
- updateStepItems([slideNumber, {
156
- setNext: true,
157
- finishedSlides,
158
- current: finishedSlides.size === HIGHEST_INDEX && validationResult !== 'success'
159
- }]); // if slides are successfully reviewed, then trigger the 'finished' state
160
-
161
- if (finishedSlides.size === TOTAL_SLIDES_STACK) {
162
- updateReviewState('finished');
163
- setTimeout(() => updateShouldMountSlides(false), 2000);
164
- }
165
- },
166
- label: next.label,
167
- 'data-name': `next-question-button-${slideNumber}`,
168
- 'aria-label': next['aria-label']
169
- },
170
- klf,
171
- information,
172
- type: validationResult === 'success' ? 'right' : 'wrong',
173
- resultLabel: validationResult === 'success' ? successLabel : failureLabel
174
- };
175
- const questionOrigin = 'From "Master Design Thinking to become more agile" course';
176
- return /*#__PURE__*/_react.default.createElement("div", {
177
- key: `slide-${slideNumber}`,
178
- "data-name": `slide-${slideNumber}`,
179
- className: (0, _classnames.default)(_style.default.slideBase, getSlideAnimation(action, position, hidden), endReview ? _style.default.endReview : null)
180
- }, answer && question ? /*#__PURE__*/_react.default.createElement("div", {
181
- key: "content-container",
182
- className: _style.default.slideContentContainer
183
- }, /*#__PURE__*/_react.default.createElement("div", {
184
- key: "from-course",
185
- className: _style.default.questionOrigin
186
- }, questionOrigin), /*#__PURE__*/_react.default.createElement("div", {
187
- key: "title",
188
- className: _style.default.question
189
- }, question), /*#__PURE__*/_react.default.createElement("div", {
190
- key: "help",
191
- className: _style.default.help
192
- }, answer.help), /*#__PURE__*/_react.default.createElement("div", {
193
- key: "answer-container",
194
- className: _style.default.answerContainer
195
- }, /*#__PURE__*/_react.default.createElement(_answer.default, _extends({}, answer, {
196
- key: "answer"
197
- })))) : null, /*#__PURE__*/_react.default.createElement("div", {
198
- key: "button-wrapper",
199
- className: _style.default.validateButtonWrapper
200
- }, /*#__PURE__*/_react.default.createElement(_buttonLink.default, validateButtonProps)), /*#__PURE__*/_react.default.createElement("div", {
201
- className: validationResult ? _style.default.correctionPopinWrapper : _style.default.hiddenCorrectionPopinWrapper,
202
- style: _extends({}, finishedSlides.size !== HIGHEST_INDEX && !validationResult && {
203
- display: 'none'
204
- })
205
- }, /*#__PURE__*/_react.default.createElement(_reviewCorrectionPopin.default, _correctionPopinProps)));
206
- }; // ||-------> Handles the updates of a given slide (using the 'id' in the action),
207
- // & then updates de remaining slides if this given change should impact their content
208
-
209
-
210
- const slidesStateReducer = (state, action) => {
211
- const [id, value] = action;
212
-
213
- const _state = new Map();
214
-
215
- const {
216
- nextSlide,
217
- numberOfFinishedSlides
218
- } = value,
219
- newValue = _objectWithoutPropertiesLoose(value, ["nextSlide", "numberOfFinishedSlides"]); // eslint-disable-next-line fp/no-loops
220
-
221
-
222
- for (const [index, previousValue] of state) {
223
- if (index === id) {
224
- // update the given slide
225
- if (nextSlide && numberOfFinishedSlides === HIGHEST_INDEX) {
226
- _state.set(index, _extends(_extends({}, previousValue), {}, {
227
- nextSlide,
228
- position: newValue.position,
229
- validationResult: newValue.validationResult
230
- }));
231
- } else if (numberOfFinishedSlides === HIGHEST_INDEX && previousValue.nextSlide) {
232
- _state.set(index, _extends(_extends({}, previousValue.nextSlide), {}, {
233
- position: previousValue.position
234
- }));
235
- } else _state.set(id, newValue);
236
- } else {
237
- // updates the rest of the slides here
238
- const {
239
- hidden,
240
- position,
241
- answer,
242
- question
243
- } = previousValue;
244
-
245
- if (nextSlide) {
246
- _state.set(index, _extends(_extends({}, nextSlide), {}, {
247
- endReview: newValue.endReview,
248
- hidden,
249
- position
250
- }));
251
- } else {
252
- _state.set(index, {
253
- hidden,
254
- position: position - 1,
255
- answer,
256
- question,
257
- endReview: newValue.endReview
258
- });
259
- }
260
- }
261
- }
262
-
263
- return _state;
264
- }; // ||-------> aux function, finds the consecutive index to loop from 0 to HIGHEST_INDEX (4) & again to 0
265
-
266
-
267
- const getNextIndex = currentIndex => currentIndex === HIGHEST_INDEX ? 0 : currentIndex + 1; // ||-------> calculates which should be the next step to visit (as there can be already answered slides &&
268
- // they have to be skipped)
269
-
270
-
271
- const calculateNextStepIndex = (currentSlideIndex, finishedSlides, lastVisitedIndex = null) => {
272
- // only one slide remaining
273
- if (lastVisitedIndex === currentSlideIndex) {
274
- return currentSlideIndex;
275
- }
276
-
277
- const indexToVisit = getNextIndex((0, _isNil.default)(lastVisitedIndex) ? currentSlideIndex : lastVisitedIndex);
278
- return finishedSlides.has(indexToVisit) ? calculateNextStepIndex(currentSlideIndex, finishedSlides, indexToVisit) : indexToVisit;
279
- }; // ||-------> Handles the updates of a given step item (using the 'id' in the action),
280
- // & then updates de remaining step items if this given change should impact their content
281
-
282
-
283
- const stepItemsReducer = (state, action) => {
284
- const [id, value] = action;
285
-
286
- const {
287
- setNext,
288
- finishedSlides
289
- } = value,
290
- rest = _objectWithoutPropertiesLoose(value, ["setNext", "finishedSlides"]);
291
-
292
- const _state = new Map();
293
-
294
- const nextIndex = !rest.current && setNext ? calculateNextStepIndex(id, finishedSlides) : null; // eslint-disable-next-line fp/no-loops
295
-
296
- for (const [index, previousValue] of state) {
297
- if (id === index) _state.set(id, _extends(_extends({}, previousValue), rest));else if (setNext && nextIndex === index) {
298
- _state.set(index, _extends(_extends({}, previousValue), {}, {
299
- current: true
300
- }));
301
- } else _state.set(index, previousValue);
302
- }
303
-
304
- return _state;
305
- }; // ||-------> Stores the correctly answered (finished) slides, the initial state is an empty Map
306
-
307
-
308
- const finishedSlidesReducer = (state, action) => {
309
- const [id, value] = action;
310
-
311
- const _state = new Map(); // eslint-disable-next-line fp/no-loops
312
-
313
-
314
- for (const [index, previousValue] of state) {
315
- _state.set(index, previousValue);
316
- }
317
-
318
- _state.set(id, value);
319
-
320
- return _state;
321
- };
322
-
323
- const SlidesReview = ({
324
- headerProps,
325
- reviewBackgroundAriaLabel,
326
- validate,
327
- correctionPopinProps,
328
- firstSlide,
329
- congratsProps
330
- }, context) => {
331
- const {
332
- skin
333
- } = context;
334
- const primarySkinColor = (0, _react.useMemo)(() => (0, _getOr.default)('#00B0FF', 'common.primary', skin), [skin]); // ||-------> States init: build initial states && memoize them + reducers creation
335
-
336
- const slidesInitialState = (0, _react.useMemo)(() => {
337
- const states = new Map();
338
- const {
339
- answer,
340
- question
341
- } = firstSlide; // eslint-disable-next-line fp/no-loops
342
-
343
- for (let index = 0; index < TOTAL_SLIDES_STACK; index++) {
344
- const content = index === 0 ? {
345
- answer,
346
- question
347
- } : {};
348
- states.set(index, _extends(_extends({}, content), {}, {
349
- hidden: false,
350
- position: index
351
- }));
352
- }
353
-
354
- return states;
355
- }, [firstSlide]);
356
- const stepItemsInitialState = (0, _react.useMemo)(() => {
357
- const states = new Map(); // eslint-disable-next-line fp/no-loops
358
-
359
- for (let index = 0; index < TOTAL_SLIDES_STACK; index++) {
360
- const current = index === 0;
361
- states.set(index, {
362
- current,
363
- value: `${index + 1}`,
364
- icon: null
365
- });
366
- }
367
-
368
- return states;
369
- }, []);
370
- const [finishedSlides, updateFinishedSlides] = (0, _react.useReducer)(finishedSlidesReducer, new Map());
371
- const [slidesState, updateSlides] = (0, _react.useReducer)(slidesStateReducer, slidesInitialState);
372
- const [stepItemsState, updateStepItems] = (0, _react.useReducer)(stepItemsReducer, stepItemsInitialState);
373
- const [reviewState, updateReviewState] = (0, _react.useState)('ongoing');
374
- /*
375
- ||-------> the slides have an slightly longer lifespan than the "ongoing" review State,
376
- after reviewState changes to "finished" the slides don't have to unmount until the last
377
- slide-out animation is finished, the slides have to be unmounted to be RGAA complaint
378
- (if they are only invisible but still mounted, then they will be found the assisting tools & clutter it)
379
- */
380
-
381
- const [shouldMountSlides, updateShouldMountSlides] = (0, _react.useState)(true); // ||-------> build each slide, passing down the reducers that will act on validation & next clicks
382
-
383
- const builtStackedSlides = (0, _react.useMemo)(() => {
384
- const StackedSlides = []; // eslint-disable-next-line fp/no-loops
385
-
386
- for (let slideNumber = 0; slideNumber < TOTAL_SLIDES_STACK; slideNumber++) {
387
- StackedSlides.push(buildSlide(slideNumber, slidesState, updateSlides, primarySkinColor, validate, correctionPopinProps, updateStepItems, finishedSlides, updateFinishedSlides, updateReviewState, updateShouldMountSlides));
388
- }
389
-
390
- return StackedSlides;
391
- }, [slidesState, primarySkinColor, validate, correctionPopinProps, finishedSlides]); // ||-------> transform the step items state (Map structure) to an Array
392
-
393
- const stepItemsArray = (0, _react.useMemo)(() => {
394
- // eslint-disable-next-line unicorn/prefer-spread
395
- return Array.from(stepItemsState.values());
396
- }, [stepItemsState]);
397
-
398
- const _headerProps = _extends(_extends({}, headerProps), {}, {
399
- steps: stepItemsArray,
400
- key: 'review-header',
401
- hiddenSteps: reviewState !== 'ongoing'
402
- });
403
-
404
- return /*#__PURE__*/_react.default.createElement("div", {
405
- key: "slides-revision-container",
406
- "data-name": "slides-revision-container",
407
- className: _style.default.slidesRevisionContainer
408
- }, /*#__PURE__*/_react.default.createElement("div", {
409
- key: "player-background-container",
410
- className: _style.default.playerBackground
411
- }, /*#__PURE__*/_react.default.createElement(_reviewBackground.default, {
412
- "aria-label": reviewBackgroundAriaLabel
413
- })), /*#__PURE__*/_react.default.createElement("div", {
414
- key: "review-header-wrapper",
415
- className: _style.default.reviewHeaderContainer
416
- }, /*#__PURE__*/_react.default.createElement(_reviewHeader.default, _headerProps)), shouldMountSlides ? /*#__PURE__*/_react.default.createElement("div", {
417
- key: "stacked-slides-container-y-overflow",
418
- className: _style.default.stackedSlidesYAxisOverflowContainer
419
- }, /*#__PURE__*/_react.default.createElement("div", {
420
- key: "stacked-slides-container",
421
- "data-name": "stacked-slides-container",
422
- className: _style.default.stackedSlidesContainer
423
- }, builtStackedSlides)) : null, reviewState === 'finished' ? /*#__PURE__*/_react.default.createElement("div", {
424
- className: _style.default.congrats
425
- }, /*#__PURE__*/_react.default.createElement(_reviewCongrats.default, congratsProps)) : null);
426
- };
427
-
428
- SlidesReview.propTypes = process.env.NODE_ENV !== "production" ? {
429
- headerProps: _propTypes.default.shape((0, _omit.default)(['steps', ''], _reviewHeader.default.propTypes)),
430
- reviewBackgroundAriaLabel: _reviewBackground.default.propTypes['aria-label'],
431
- validate: _propTypes.default.shape({
432
- label: _propTypes.default.string,
433
- onClick: _propTypes.default.func
434
- }),
435
- firstSlide: _propTypes.default.shape({
436
- question: _propTypes.default.string,
437
- answer: _propTypes.default.shape(_answer.default.propTypes)
438
- }),
439
- correctionPopinProps: _propTypes.default.shape({
440
- klf: _reviewCorrectionPopin.default.propTypes.klf,
441
- information: _reviewCorrectionPopin.default.propTypes.information,
442
- next: _propTypes.default.shape({
443
- label: _propTypes.default.string,
444
- 'aria-label': _propTypes.default.string
445
- }),
446
- successLabel: _reviewCorrectionPopin.default.propTypes.resultLabel,
447
- failureLabel: _reviewCorrectionPopin.default.propTypes.resultLabel
448
- }),
449
- congratsProps: _propTypes.default.shape(_reviewCongrats.default.propTypes)
450
- } : {};
451
- var _default = SlidesReview;
452
- exports.default = _default;
453
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/template/app-review/slides-review/index.js"],"names":["stylesByPosition","style","position0","position1","position2","position3","position4","TOTAL_SLIDES_STACK","HIGHEST_INDEX","getSlideAnimation","action","position","hidden","slideOutHideAndIn","slideOutAndIn","hiddenSlide","buildSlide","slideNumber","slidesState","updateSlides","primarySkinColor","validate","correctionPopinProps","updateStepItems","finishedSlides","updateFinishedSlides","updateReviewState","updateShouldMountSlides","endReview","validationResult","question","answer","get","onClick","onValidateClick","label","validateLabel","validateButtonProps","customStyle","backgroundColor","result","nextSlide","_endReview","numberOfFinishedSlides","size","setTimeout","icon","ICON_VALUES","right","wrong","className","validateButton","disabled","klf","information","next","successLabel","failureLabel","_correctionPopinProps","setNext","current","type","resultLabel","questionOrigin","slideBase","slideContentContainer","help","answerContainer","validateButtonWrapper","correctionPopinWrapper","hiddenCorrectionPopinWrapper","display","slidesStateReducer","state","id","value","_state","Map","newValue","index","previousValue","set","getNextIndex","currentIndex","calculateNextStepIndex","currentSlideIndex","lastVisitedIndex","indexToVisit","has","stepItemsReducer","rest","nextIndex","finishedSlidesReducer","SlidesReview","headerProps","reviewBackgroundAriaLabel","firstSlide","congratsProps","context","skin","slidesInitialState","states","content","stepItemsInitialState","stepItemsState","reviewState","shouldMountSlides","builtStackedSlides","StackedSlides","push","stepItemsArray","Array","from","values","_headerProps","steps","key","hiddenSteps","slidesRevisionContainer","playerBackground","reviewHeaderContainer","stackedSlidesYAxisOverflowContainer","stackedSlidesContainer","congrats","propTypes","PropTypes","shape","ReviewHeader","ReviewBackground","string","func","Answer","ReviewCorrectionPopin","ReviewCongrats"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,MAAMA,gBAAgB,GAAG;AACvB,KAAGC,eAAMC,SADc;AAEvB,KAAGD,eAAME,SAFc;AAGvB,KAAGF,eAAMG,SAHc;AAIvB,KAAGH,eAAMI,SAJc;AAKvB,KAAGJ,eAAMK;AALc,CAAzB;AAQA,MAAMC,kBAAkB,GAAG,CAA3B;AACA,MAAMC,aAAa,GAAGD,kBAAkB,GAAG,CAA3C;;AAEA,MAAME,iBAAiB,GAAG,CAACC,MAAD,EAASC,QAAT,EAAmBC,MAAnB,KAA8B;AACtD,UAAQF,MAAR;AACE,SAAK,SAAL;AACE,aAAOT,eAAMY,iBAAb;;AACF,SAAK,SAAL;AACE,aAAOZ,eAAMa,aAAb;;AACF;AACE,aAAOF,MAAM,GAAGX,eAAMc,WAAT,GAAuBf,gBAAgB,CAACW,QAAD,CAApD;AANJ;AAQD,CATD;;AAWA,MAAMK,UAAU,GAAG,CACjBC,WADiB,EAEjBC,WAFiB,EAGjBC,YAHiB,EAIjBC,gBAJiB,EAKjBC,QALiB,EAMjBC,oBANiB,EAOjBC,eAPiB,EAQjBC,cARiB,EASjBC,oBATiB,EAUjBC,iBAViB,EAWjBC,uBAXiB,KAYd;AACH,QAAM;AAACf,IAAAA,MAAD;AAASgB,IAAAA,SAAT;AAAoBjB,IAAAA,QAApB;AAA8BD,IAAAA,MAA9B;AAAsCmB,IAAAA,gBAAtC;AAAwDC,IAAAA,QAAxD;AAAkEC,IAAAA;AAAlE,MAA4Eb,WAAW,CAACc,GAAZ,CAChFf,WADgF,CAAlF;AAGA,QAAM;AAACgB,IAAAA,OAAO,EAAEC,eAAV;AAA2BC,I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EvB7B,EAAAA,yBAAyB,EAAEiC,0BAAiBJ,SAAjB,CAA2B,YAA3B,CAFJ;AAGvBvG,EAAAA,QAAQ,EAAEwG,mBAAUC,KAAV,CAAgB;AACxB3F,IAAAA,KAAK,EAAE0F,mBAAUI,MADO;AAExBhG,IAAAA,OAAO,EAAE4F,mBAAUK;AAFK,GAAhB,CAHa;AAOvBlC,EAAAA,UAAU,EAAE6B,mBAAUC,KAAV,CAAgB;AAC1BhG,IAAAA,QAAQ,EAAE+F,mBAAUI,MADM;AAE1BlG,IAAAA,MAAM,EAAE8F,mBAAUC,KAAV,CAAgBK,gBAAOP,SAAvB;AAFkB,GAAhB,CAPW;AAWvBtG,EAAAA,oBAAoB,EAAEuG,mBAAUC,KAAV,CAAgB;AACpCzE,IAAAA,GAAG,EAAE+E,+BAAsBR,SAAtB,CAAgCvE,GADD;AAEpCC,IAAAA,WAAW,EAAE8E,+BAAsBR,SAAtB,CAAgCtE,WAFT;AAGpCC,IAAAA,IAAI,EAAEsE,mBAAUC,KAAV,CAAgB;AACpB3F,MAAAA,KAAK,EAAE0F,mBAAUI,MADG;AAEpB,oBAAcJ,mBAAUI;AAFJ,KAAhB,CAH8B;AAOpCzE,IAAAA,YAAY,EAAE4E,+BAAsBR,SAAtB,CAAgC9D,WAPV;AAQpCL,IAAAA,YAAY,EAAE2E,+BAAsBR,SAAtB,CAAgC9D;AARV,GAAhB,CAXC;AAqBvBmC,EAAAA,aAAa,EAAE4B,mBAAUC,KAAV,CAAgBO,wBAAeT,SAA/B;AArBQ,CAAzB;eAwBe/B,Y","sourcesContent":["import React, {useState, useReducer, useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport getOr from 'lodash/fp/getOr';\nimport omit from 'lodash/fp/omit';\nimport isNil from 'lodash/fp/isNil';\nimport ReviewBackground from '../../../atom/review-background';\nimport {ICON_VALUES} from '../../../atom/review-header-step-item';\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';\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\nconst TOTAL_SLIDES_STACK = 5;\nconst 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 buildSlide = (\n slideNumber,\n slidesState,\n updateSlides,\n primarySkinColor,\n validate,\n correctionPopinProps,\n updateStepItems,\n finishedSlides,\n updateFinishedSlides,\n updateReviewState,\n updateShouldMountSlides\n) => {\n const {hidden, endReview, position, action, validationResult, question, answer} = slidesState.get(\n slideNumber\n );\n const {onClick: onValidateClick, 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 const {validationResult: result, nextSlide, endReview: _endReview} = await onValidateClick();\n updateSlides([\n slideNumber,\n {\n hidden,\n position,\n validationResult: result,\n answer,\n question,\n nextSlide,\n numberOfFinishedSlides: finishedSlides.size,\n endReview: _endReview\n }\n ]);\n // on endReview, this gives some time for the slides to slide out && then launch\n // the 'finished' logic as it would happen when normally finishing the review\n if (_endReview) {\n updateReviewState('finished');\n setTimeout(() => updateShouldMountSlides(false), 2000);\n }\n updateStepItems([\n slideNumber,\n {\n icon: result === 'success' ? ICON_VALUES.right : ICON_VALUES.wrong,\n finishedSlides\n }\n ]);\n // only stores successful slides\n if (result === 'success') updateFinishedSlides([slideNumber, true]);\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, information, next, successLabel, 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 updateSlides([\n slideNumber,\n {\n hidden: validationResult === 'success',\n position: HIGHEST_INDEX - finishedSlides.size,\n action: validationResult === 'success' ? 'unstack' : 'restack',\n answer,\n question,\n validationResult,\n numberOfFinishedSlides: finishedSlides.size,\n endReview\n }\n ]);\n updateStepItems([\n slideNumber,\n {\n setNext: true,\n finishedSlides,\n current: finishedSlides.size === HIGHEST_INDEX && validationResult !== 'success'\n }\n ]);\n // if slides are successfully reviewed, then trigger the 'finished' state\n if (finishedSlides.size === TOTAL_SLIDES_STACK) {\n updateReviewState('finished');\n setTimeout(() => updateShouldMountSlides(false), 2000);\n }\n },\n label: next.label,\n 'data-name': `next-question-button-${slideNumber}`,\n 'aria-label': 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\n return (\n <div\n key={`slide-${slideNumber}`}\n data-name={`slide-${slideNumber}`}\n className={classnames(\n style.slideBase,\n getSlideAnimation(action, position, hidden),\n endReview ? style.endReview : null\n )}\n >\n {answer && question ? (\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 {question}\n </div>\n <div key=\"help\" className={style.help}>\n {answer.help}\n </div>\n <div key=\"answer-container\" className={style.answerContainer}>\n <Answer {...answer} 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\n// ||-------> Handles the updates of a given slide (using the 'id' in the action),\n// & then updates de remaining slides if this given change should impact their content\nconst slidesStateReducer = (state, action) => {\n const [id, value] = action;\n const _state = new Map();\n\n const {nextSlide, numberOfFinishedSlides, ...newValue} = value;\n\n // eslint-disable-next-line fp/no-loops\n for (const [index, previousValue] of state) {\n if (index === id) {\n // update the given slide\n if (nextSlide && numberOfFinishedSlides === HIGHEST_INDEX) {\n _state.set(index, {\n ...previousValue,\n nextSlide,\n position: newValue.position,\n validationResult: newValue.validationResult\n });\n } else if (numberOfFinishedSlides === HIGHEST_INDEX && previousValue.nextSlide) {\n _state.set(index, {...previousValue.nextSlide, position: previousValue.position});\n } else _state.set(id, newValue);\n } else {\n // updates the rest of the slides here\n const {hidden, position, answer, question} = previousValue;\n if (nextSlide) {\n _state.set(index, {...nextSlide, endReview: newValue.endReview, hidden, position});\n } else {\n _state.set(index, {\n hidden,\n position: position - 1,\n answer,\n question,\n endReview: newValue.endReview\n });\n }\n }\n }\n\n return _state;\n};\n\n// ||-------> aux function, finds the consecutive index to loop from 0 to HIGHEST_INDEX (4) & again to 0\nconst getNextIndex = currentIndex => (currentIndex === HIGHEST_INDEX ? 0 : currentIndex + 1);\n\n// ||-------> calculates which should be the next step to visit (as there can be already answered slides &&\n// they have to be skipped)\nconst calculateNextStepIndex = (currentSlideIndex, finishedSlides, lastVisitedIndex = null) => {\n // only one slide remaining\n if (lastVisitedIndex === currentSlideIndex) {\n return currentSlideIndex;\n }\n\n const indexToVisit = getNextIndex(isNil(lastVisitedIndex) ? currentSlideIndex : lastVisitedIndex);\n\n return finishedSlides.has(indexToVisit)\n ? calculateNextStepIndex(currentSlideIndex, finishedSlides, indexToVisit)\n : indexToVisit;\n};\n\n// ||-------> Handles the updates of a given step item (using the 'id' in the action),\n// & then updates de remaining step items if this given change should impact their content\nconst stepItemsReducer = (state, action) => {\n const [id, value] = action;\n const {setNext, finishedSlides, ...rest} = value;\n const _state = new Map();\n const nextIndex = !rest.current && setNext ? calculateNextStepIndex(id, finishedSlides) : null;\n\n // eslint-disable-next-line fp/no-loops\n for (const [index, previousValue] of state) {\n if (id === index)\n _state.set(id, {\n ...previousValue,\n ...rest\n });\n else if (setNext && nextIndex === index) {\n _state.set(index, {...previousValue, current: true});\n } else _state.set(index, previousValue);\n }\n\n return _state;\n};\n\n// ||-------> Stores the correctly answered (finished) slides, the initial state is an empty Map\nconst finishedSlidesReducer = (state, action) => {\n const [id, value] = action;\n const _state = new Map();\n\n // eslint-disable-next-line fp/no-loops\n for (const [index, previousValue] of state) {\n _state.set(index, previousValue);\n }\n\n _state.set(id, value);\n\n return _state;\n};\n\nconst SlidesReview = (\n {\n headerProps,\n reviewBackgroundAriaLabel,\n validate,\n correctionPopinProps,\n firstSlide,\n congratsProps\n },\n context\n) => {\n const {skin} = context;\n const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n\n // ||-------> States init: build initial states && memoize them + reducers creation\n const slidesInitialState = useMemo(() => {\n const states = new Map();\n const {answer, question} = firstSlide;\n // eslint-disable-next-line fp/no-loops\n for (let index = 0; index < TOTAL_SLIDES_STACK; index++) {\n const content = index === 0 ? {answer, question} : {};\n states.set(index, {...content, hidden: false, position: index});\n }\n return states;\n }, [firstSlide]);\n\n const stepItemsInitialState = useMemo(() => {\n const states = new Map();\n // eslint-disable-next-line fp/no-loops\n for (let index = 0; index < TOTAL_SLIDES_STACK; index++) {\n const current = index === 0;\n states.set(index, {current, value: `${index + 1}`, icon: null});\n }\n return states;\n }, []);\n\n const [finishedSlides, updateFinishedSlides] = useReducer(finishedSlidesReducer, new Map());\n\n const [slidesState, updateSlides] = useReducer(slidesStateReducer, slidesInitialState);\n\n const [stepItemsState, updateStepItems] = useReducer(stepItemsReducer, stepItemsInitialState);\n\n const [reviewState, updateReviewState] = useState('ongoing');\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 // ||-------> build each slide, passing down the reducers that will act on validation & next clicks\n const builtStackedSlides = useMemo(() => {\n const StackedSlides = [];\n // eslint-disable-next-line fp/no-loops\n for (let slideNumber = 0; slideNumber < TOTAL_SLIDES_STACK; slideNumber++) {\n StackedSlides.push(\n buildSlide(\n slideNumber,\n slidesState,\n updateSlides,\n primarySkinColor,\n validate,\n correctionPopinProps,\n updateStepItems,\n finishedSlides,\n updateFinishedSlides,\n updateReviewState,\n updateShouldMountSlides\n )\n );\n }\n\n return StackedSlides;\n }, [slidesState, primarySkinColor, validate, correctionPopinProps, finishedSlides]);\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(stepItemsState.values());\n }, [stepItemsState]);\n\n const _headerProps = {\n ...headerProps,\n steps: stepItemsArray,\n key: 'review-header',\n hiddenSteps: reviewState !== '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 {builtStackedSlides}\n </div>\n </div>\n ) : null}\n\n {reviewState === 'finished' ? (\n <div className={style.congrats}>\n <ReviewCongrats {...congratsProps} />\n </div>\n ) : null}\n </div>\n );\n};\n\nSlidesReview.propTypes = {\n headerProps: PropTypes.shape(omit(['steps', ''], ReviewHeader.propTypes)),\n reviewBackgroundAriaLabel: ReviewBackground.propTypes['aria-label'],\n validate: PropTypes.shape({\n label: PropTypes.string,\n onClick: PropTypes.func\n }),\n firstSlide: PropTypes.shape({\n question: PropTypes.string,\n answer: PropTypes.shape(Answer.propTypes)\n }),\n correctionPopinProps: PropTypes.shape({\n klf: ReviewCorrectionPopin.propTypes.klf,\n information: ReviewCorrectionPopin.propTypes.information,\n next: PropTypes.shape({\n label: PropTypes.string,\n 'aria-label': PropTypes.string\n }),\n successLabel: ReviewCorrectionPopin.propTypes.resultLabel,\n failureLabel: ReviewCorrectionPopin.propTypes.resultLabel\n }),\n congratsProps: PropTypes.shape(ReviewCongrats.propTypes)\n};\n\nexport default SlidesReview;\n"],"file":"index.js"}