@coorpacademy/components 10.19.1-alpha.0 → 10.19.2

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 (82) hide show
  1. package/es/atom/checkbox-with-title/style.css +1 -1
  2. package/es/atom/lottie-wrapper/index.js +1 -1
  3. package/es/atom/lottie-wrapper/index.js.map +1 -1
  4. package/es/atom/review-background/style.css +1 -1
  5. package/es/atom/review-header-step-item/index.js +7 -3
  6. package/es/atom/review-header-step-item/index.js.map +1 -1
  7. package/es/atom/review-header-step-item/style.css +7 -10
  8. package/es/atom/review-presentation/index.js +10 -2
  9. package/es/atom/review-presentation/index.js.map +1 -1
  10. package/es/molecule/review-card-congrats/style.css +2 -0
  11. package/es/molecule/review-correction-popin/index.js +5 -2
  12. package/es/molecule/review-correction-popin/index.js.map +1 -1
  13. package/es/molecule/review-correction-popin/test/fixtures/wrong.js +1 -0
  14. package/es/molecule/review-correction-popin/test/fixtures/wrong.js.map +1 -1
  15. package/es/molecule/review-header-steps/index.js +3 -3
  16. package/es/molecule/review-header-steps/index.js.map +1 -1
  17. package/es/organism/review-congrats/index.js +17 -3
  18. package/es/organism/review-congrats/index.js.map +1 -1
  19. package/es/organism/review-congrats/style.css +68 -5
  20. package/es/organism/review-congrats/test/fixtures/default.js +7 -0
  21. package/es/organism/review-congrats/test/fixtures/default.js.map +1 -1
  22. package/es/organism/review-header/index.js +3 -3
  23. package/es/organism/review-header/index.js.map +1 -1
  24. package/es/organism/review-header/style.css +1 -1
  25. package/es/organism/review-header/test/fixtures/all-questions-ok.js +3 -1
  26. package/es/organism/review-header/test/fixtures/all-questions-ok.js.map +1 -1
  27. package/es/template/slides-review/index.js +421 -0
  28. package/es/template/slides-review/index.js.map +1 -0
  29. package/es/template/slides-review/style.css +371 -0
  30. package/es/template/slides-review/test/fixtures/failure.js +37 -0
  31. package/es/template/slides-review/test/fixtures/failure.js.map +1 -0
  32. package/es/template/slides-review/test/fixtures/only-once-on-last-slide.js +29 -0
  33. package/es/template/slides-review/test/fixtures/only-once-on-last-slide.js.map +1 -0
  34. package/es/template/slides-review/test/fixtures/random-responses.js +34 -0
  35. package/es/template/slides-review/test/fixtures/random-responses.js.map +1 -0
  36. package/es/template/slides-review/test/fixtures/success.js +54 -0
  37. package/es/template/slides-review/test/fixtures/success.js.map +1 -0
  38. package/es/template/slides-review/test/fixtures.js +19 -0
  39. package/es/template/slides-review/test/fixtures.js.map +1 -0
  40. package/es/template/slides-review/test/slides-review.js +147 -0
  41. package/es/template/slides-review/test/slides-review.js.map +1 -0
  42. package/lib/atom/checkbox-with-title/style.css +1 -1
  43. package/lib/atom/lottie-wrapper/index.js +1 -1
  44. package/lib/atom/lottie-wrapper/index.js.map +1 -1
  45. package/lib/atom/review-background/style.css +1 -1
  46. package/lib/atom/review-header-step-item/index.js +10 -4
  47. package/lib/atom/review-header-step-item/index.js.map +1 -1
  48. package/lib/atom/review-header-step-item/style.css +7 -10
  49. package/lib/atom/review-presentation/index.js +10 -2
  50. package/lib/atom/review-presentation/index.js.map +1 -1
  51. package/lib/molecule/review-card-congrats/style.css +2 -0
  52. package/lib/molecule/review-correction-popin/index.js +5 -2
  53. package/lib/molecule/review-correction-popin/index.js.map +1 -1
  54. package/lib/molecule/review-correction-popin/test/fixtures/wrong.js +1 -0
  55. package/lib/molecule/review-correction-popin/test/fixtures/wrong.js.map +1 -1
  56. package/lib/molecule/review-header-steps/index.js +3 -3
  57. package/lib/molecule/review-header-steps/index.js.map +1 -1
  58. package/lib/organism/review-congrats/index.js +18 -3
  59. package/lib/organism/review-congrats/index.js.map +1 -1
  60. package/lib/organism/review-congrats/style.css +68 -5
  61. package/lib/organism/review-congrats/test/fixtures/default.js +8 -0
  62. package/lib/organism/review-congrats/test/fixtures/default.js.map +1 -1
  63. package/lib/organism/review-header/index.js.map +1 -1
  64. package/lib/organism/review-header/style.css +1 -1
  65. package/lib/organism/review-header/test/fixtures/all-questions-ok.js +3 -1
  66. package/lib/organism/review-header/test/fixtures/all-questions-ok.js.map +1 -1
  67. package/lib/template/slides-review/index.js +447 -0
  68. package/lib/template/slides-review/index.js.map +1 -0
  69. package/lib/template/slides-review/style.css +371 -0
  70. package/lib/template/slides-review/test/fixtures/failure.js +50 -0
  71. package/lib/template/slides-review/test/fixtures/failure.js.map +1 -0
  72. package/lib/template/slides-review/test/fixtures/only-once-on-last-slide.js +39 -0
  73. package/lib/template/slides-review/test/fixtures/only-once-on-last-slide.js.map +1 -0
  74. package/lib/template/slides-review/test/fixtures/random-responses.js +45 -0
  75. package/lib/template/slides-review/test/fixtures/random-responses.js.map +1 -0
  76. package/lib/template/slides-review/test/fixtures/success.js +67 -0
  77. package/lib/template/slides-review/test/fixtures/success.js.map +1 -0
  78. package/lib/template/slides-review/test/fixtures.js +31 -0
  79. package/lib/template/slides-review/test/fixtures.js.map +1 -0
  80. package/lib/template/slides-review/test/slides-review.js +163 -0
  81. package/lib/template/slides-review/test/slides-review.js.map +1 -0
  82. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/organism/review-congrats/test/fixtures/default.js"],"names":["moleculeReviewCardStar","moleculeReviewCardRank","defaultProps","title","cardCongratsStar","props","cardCongratsRank","buttonRevising","label","onClick","console","log","type","buttonRevisingSkill"],"mappings":"AAAA,OAAOA,sBAAP,MAAmC,8DAAnC;AACA,OAAOC,sBAAP,MAAmC,8DAAnC;AAEA,OAAO,MAAMC,YAAY,GAAG;AAC1B,gBAAc,wBADY;AAE1B,eAAa,iBAFa;AAG1BC,EAAAA,KAAK,EAAE,kBAHmB;AAI1BC,EAAAA,gBAAgB,EAAEJ,sBAAsB,CAACK,KAJf;AAK1BC,EAAAA,gBAAgB,EAAEL,sBAAsB,CAACI,KALf;AAM1BE,EAAAA,cAAc,EAAE;AACd,kBAAc,0BADA;AAEdC,IAAAA,KAAK,EAAE,mBAFO;AAGdC,IAAAA,OAAO,EAAE,MAAMC,OAAO,CAACC,GAAR,CAAY,mBAAZ,CAHD;AAIdC,IAAAA,IAAI,EAAE;AAJQ,GANU;AAY1BC,EAAAA,mBAAmB,EAAE;AACnBL,IAAAA,KAAK,EAAE,sBADY;AAEnB,kBAAc,6BAFK;AAGnBC,IAAAA,OAAO,EAAE,MAAMC,OAAO,CAACC,GAAR,CAAY,sBAAZ,CAHI;AAInBC,IAAAA,IAAI,EAAE;AAJa;AAZK,CAArB;AAoBP,eAAe;AAACP,EAAAA,KAAK,EAAEH;AAAR,CAAf","sourcesContent":["import moleculeReviewCardStar from '../../../../molecule/review-card-congrats/test/fixtures/star';\nimport moleculeReviewCardRank from '../../../../molecule/review-card-congrats/test/fixtures/rank';\n\nexport const defaultProps = {\n 'aria-label': 'Review Congratulations',\n 'data-name': 'review-congrats',\n title: 'Congratulations!',\n cardCongratsStar: moleculeReviewCardStar.props,\n cardCongratsRank: moleculeReviewCardRank.props,\n buttonRevising: {\n 'aria-label': 'Continue revising button',\n label: 'Continue revising',\n onClick: () => console.log('Continue revising'),\n type: 'tertiary'\n },\n buttonRevisingSkill: {\n label: 'Revise another skill',\n 'aria-label': 'Revise another skill button',\n onClick: () => console.log('Revise another skill'),\n type: 'primary'\n }\n};\n\nexport default {props: defaultProps};\n"],"file":"default.js"}
1
+ {"version":3,"sources":["../../../../../src/organism/review-congrats/test/fixtures/default.js"],"names":["animationLottie","moleculeReviewCardStar","moleculeReviewCardRank","defaultProps","props","height","undefined","width","title","cardCongratsStar","cardCongratsRank","buttonRevising","label","onClick","console","log","type","buttonRevisingSkill"],"mappings":";;AAAA,OAAOA,eAAP,MAA4B,wDAA5B;AACA,OAAOC,sBAAP,MAAmC,8DAAnC;AACA,OAAOC,sBAAP,MAAmC,8DAAnC;AAEA,OAAO,MAAMC,YAAY,GAAG;AAC1B,gBAAc,wBADY;AAE1B,eAAa,iBAFa;AAG1BH,EAAAA,eAAe,wBAAMA,eAAe,CAACI,KAAtB;AAA6BC,IAAAA,MAAM,EAAEC,SAArC;AAAgDC,IAAAA,KAAK,EAAED;AAAvD,IAHW;AAI1BE,EAAAA,KAAK,EAAE,kBAJmB;AAK1BC,EAAAA,gBAAgB,EAAER,sBAAsB,CAACG,KALf;AAM1BM,EAAAA,gBAAgB,EAAER,sBAAsB,CAACE,KANf;AAO1BO,EAAAA,cAAc,EAAE;AACd,kBAAc,0BADA;AAEdC,IAAAA,KAAK,EAAE,mBAFO;AAGdC,IAAAA,OAAO,EAAE,MAAMC,OAAO,CAACC,GAAR,CAAY,mBAAZ,CAHD;AAIdC,IAAAA,IAAI,EAAE;AAJQ,GAPU;AAa1BC,EAAAA,mBAAmB,EAAE;AACnBL,IAAAA,KAAK,EAAE,sBADY;AAEnB,kBAAc,6BAFK;AAGnBC,IAAAA,OAAO,EAAE,MAAMC,OAAO,CAACC,GAAR,CAAY,sBAAZ,CAHI;AAInBC,IAAAA,IAAI,EAAE;AAJa;AAbK,CAArB;AAqBP,eAAe;AAACZ,EAAAA,KAAK,EAAED;AAAR,CAAf","sourcesContent":["import animationLottie from '../../../../atom/lottie-wrapper/test/fixtures/confetti';\nimport moleculeReviewCardStar from '../../../../molecule/review-card-congrats/test/fixtures/star';\nimport moleculeReviewCardRank from '../../../../molecule/review-card-congrats/test/fixtures/rank';\n\nexport const defaultProps = {\n 'aria-label': 'Review Congratulations',\n 'data-name': 'review-congrats',\n animationLottie: {...animationLottie.props, height: undefined, width: undefined},\n title: 'Congratulations!',\n cardCongratsStar: moleculeReviewCardStar.props,\n cardCongratsRank: moleculeReviewCardRank.props,\n buttonRevising: {\n 'aria-label': 'Continue revising button',\n label: 'Continue revising',\n onClick: () => console.log('Continue revising'),\n type: 'tertiary'\n },\n buttonRevisingSkill: {\n label: 'Revise another skill',\n 'aria-label': 'Revise another skill button',\n onClick: () => console.log('Revise another skill'),\n type: 'primary'\n }\n};\n\nexport default {props: defaultProps};\n"],"file":"default.js"}
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import classnames from 'classnames';
4
4
  import getOr from 'lodash/fp/getOr';
5
5
  import ButtonLinkIconOnly from '../../atom/button-link-icon-only';
6
- import ReviewHeaderStep from '../../molecule/review-header-steps';
6
+ import ReviewHeaderSteps from '../../molecule/review-header-steps';
7
7
  import style from './style.css';
8
8
 
9
9
  const ReviewHeader = (props, context) => {
@@ -50,7 +50,7 @@ const ReviewHeader = (props, context) => {
50
50
  "data-name": "review-header-skill-name"
51
51
  }, skillName)), /*#__PURE__*/React.createElement("div", {
52
52
  className: stepsWrapper
53
- }, /*#__PURE__*/React.createElement(ReviewHeaderStep, {
53
+ }, /*#__PURE__*/React.createElement(ReviewHeaderSteps, {
54
54
  steps: steps,
55
55
  key: 'review-header-steps'
56
56
  })), /*#__PURE__*/React.createElement("div", {
@@ -60,7 +60,7 @@ const ReviewHeader = (props, context) => {
60
60
  };
61
61
 
62
62
  ReviewHeader.propTypes = process.env.NODE_ENV !== "production" ? {
63
- steps: ReviewHeaderStep.propTypes.steps,
63
+ steps: ReviewHeaderSteps.propTypes.steps,
64
64
  mode: PropTypes.string.isRequired,
65
65
  skillName: PropTypes.string.isRequired,
66
66
  'aria-label': PropTypes.string,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/organism/review-header/index.js"],"names":["React","PropTypes","classnames","getOr","ButtonLinkIconOnly","ReviewHeaderStep","style","ReviewHeader","props","context","steps","mode","skillName","ariaLabel","closeButtonAriaLabel","onQuitClick","hiddenSteps","skin","primarySkinColor","buttonProps","icon","onClick","size","className","review","stepsWrapper","stepsWrapperAnimation","headerWrapper","titlesWrapper","title","color","iconButtonWrapper","propTypes","string","isRequired","func","bool"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,kBAAP,MAA+B,kCAA/B;AACA,OAAOC,gBAAP,MAA6B,oCAA7B;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,YAAY,GAAG,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AAkB,IAAA,KAAK,EAAEf,KAAzB;AAAgC,IAAA,GAAG,EAAE;AAArC,IADF,CAlBF,eAsBE;AAAK,IAAA,SAAS,EAAEJ,KAAK,CAACyB,iBAAtB;AAAyC,iBAAU;AAAnD,kBACE,oBAAC,kBAAD,EAAwBZ,WAAxB,CADF,CAtBF,CADF;AA4BD,CAvDD;;AAyDAZ,YAAY,CAACyB,SAAb,2CAAyB;AACvBtB,EAAAA,KAAK,EAAEL,gBAAgB,CAAC2B,SAAjB,CAA2BtB,KADX;AAEvBC,EAAAA,IAAI,EAAEV,SAAS,CAACgC,MAAV,CAAiBC,UAFA;AAGvBtB,EAAAA,SAAS,EAAEX,SAAS,CAACgC,MAAV,CAAiBC,UAHL;AAIvB,gBAAcjC,SAAS,CAACgC,MAJD;AAKvBnB,EAAAA,oBAAoB,EAAEb,SAAS,CAACgC,MALT;AAMvBlB,EAAAA,WAAW,EAAEd,SAAS,CAACkC,IANA;AAOvBnB,EAAAA,WAAW,EAAEf,SAAS,CAACmC;AAPA,CAAzB;AAUA,eAAe7B,YAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport getOr from 'lodash/fp/getOr';\nimport ButtonLinkIconOnly from '../../atom/button-link-icon-only';\nimport ReviewHeaderStep from '../../molecule/review-header-steps';\nimport style from './style.css';\n\nconst ReviewHeader = (props, context) => {\n const {\n steps,\n mode,\n skillName,\n 'aria-label': ariaLabel,\n closeButtonAriaLabel,\n onQuitClick,\n hiddenSteps\n } = props;\n const {skin} = context;\n const primarySkinColor = getOr('#00B0FF', 'common.primary', skin);\n\n const buttonProps = {\n icon: 'close',\n 'data-name': 'review-header-close-button',\n 'aria-label': closeButtonAriaLabel,\n onClick: onQuitClick,\n size: 'responsive',\n className: style.review\n };\n\n const stepsWrapper = classnames(\n style.stepsWrapper,\n hiddenSteps ? style.stepsWrapperAnimation : null\n );\n\n return (\n <div className={style.headerWrapper} data-name=\"review-header\" aria-label={ariaLabel}>\n <div className={style.titlesWrapper}>\n <div className={style.title} title={mode} aria-label={mode} data-name=\"review-header-mode\">\n {mode}\n </div>\n <div\n className={style.skillName}\n style={{\n color: primarySkinColor\n }}\n title={skillName}\n aria-label={skillName}\n data-name=\"review-header-skill-name\"\n >\n {skillName}\n </div>\n </div>\n\n <div className={stepsWrapper}>\n <ReviewHeaderStep steps={steps} key={'review-header-steps'} />\n </div>\n\n <div className={style.iconButtonWrapper} data-name=\"review-header-close-button-wrapper\">\n <ButtonLinkIconOnly {...buttonProps} />\n </div>\n </div>\n );\n};\n\nReviewHeader.propTypes = {\n steps: ReviewHeaderStep.propTypes.steps,\n mode: PropTypes.string.isRequired,\n skillName: PropTypes.string.isRequired,\n 'aria-label': PropTypes.string,\n closeButtonAriaLabel: PropTypes.string,\n onQuitClick: PropTypes.func,\n hiddenSteps: PropTypes.bool\n};\n\nexport default ReviewHeader;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/organism/review-header/index.js"],"names":["React","PropTypes","classnames","getOr","ButtonLinkIconOnly","ReviewHeaderSteps","style","ReviewHeader","props","context","steps","mode","skillName","ariaLabel","closeButtonAriaLabel","onQuitClick","hiddenSteps","skin","primarySkinColor","buttonProps","icon","onClick","size","className","review","stepsWrapper","stepsWrapperAnimation","headerWrapper","titlesWrapper","title","color","iconButtonWrapper","propTypes","string","isRequired","func","bool"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,kBAAP,MAA+B,kCAA/B;AACA,OAAOC,iBAAP,MAA8B,oCAA9B;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,YAAY,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;AACvC,QAAM;AACJC,IAAAA,KADI;AAEJC,IAAAA,IAFI;AAGJC,IAAAA,SAHI;AAIJ,kBA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K,CAACyB,iBAAtB;AAAyC,iBAAU;AAAnD,kBACE,oBAAC,kBAAD,EAAwBZ,WAAxB,CADF,CAtBF,CADF;AA4BD,CAvDD;;AAyDAZ,YAAY,CAACyB,SAAb,2CAAyB;AACvBtB,EAAAA,KAAK,EAAEL,iBAAiB,CAAC2B,SAAlB,CAA4BtB,KADZ;AAEvBC,EAAAA,IAAI,EAAEV,SAAS,CAACgC,MAAV,CAAiBC,UAFA;AAGvBtB,EAAAA,SAAS,EAAEX,SAAS,CAACgC,MAAV,CAAiBC,UAHL;AAIvB,gBAAcjC,SAAS,CAACgC,MAJD;AAKvBnB,EAAAA,oBAAoB,EAAEb,SAAS,CAACgC,MALT;AAMvBlB,EAAAA,WAAW,EAAEd,SAAS,CAACkC,IANA;AAOvBnB,EAAAA,WAAW,EAAEf,SAAS,CAACmC;AAPA,CAAzB;AAUA,eAAe7B,YAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport getOr from 'lodash/fp/getOr';\nimport ButtonLinkIconOnly from '../../atom/button-link-icon-only';\nimport ReviewHeaderSteps from '../../molecule/review-header-steps';\nimport style from './style.css';\n\nconst ReviewHeader = (props, context) => {\n const {\n steps,\n mode,\n skillName,\n 'aria-label': ariaLabel,\n closeButtonAriaLabel,\n onQuitClick,\n hiddenSteps\n } = props;\n const {skin} = context;\n const primarySkinColor = getOr('#00B0FF', 'common.primary', skin);\n\n const buttonProps = {\n icon: 'close',\n 'data-name': 'review-header-close-button',\n 'aria-label': closeButtonAriaLabel,\n onClick: onQuitClick,\n size: 'responsive',\n className: style.review\n };\n\n const stepsWrapper = classnames(\n style.stepsWrapper,\n hiddenSteps ? style.stepsWrapperAnimation : null\n );\n\n return (\n <div className={style.headerWrapper} data-name=\"review-header\" aria-label={ariaLabel}>\n <div className={style.titlesWrapper}>\n <div className={style.title} title={mode} aria-label={mode} data-name=\"review-header-mode\">\n {mode}\n </div>\n <div\n className={style.skillName}\n style={{\n color: primarySkinColor\n }}\n title={skillName}\n aria-label={skillName}\n data-name=\"review-header-skill-name\"\n >\n {skillName}\n </div>\n </div>\n\n <div className={stepsWrapper}>\n <ReviewHeaderSteps steps={steps} key={'review-header-steps'} />\n </div>\n\n <div className={style.iconButtonWrapper} data-name=\"review-header-close-button-wrapper\">\n <ButtonLinkIconOnly {...buttonProps} />\n </div>\n </div>\n );\n};\n\nReviewHeader.propTypes = {\n steps: ReviewHeaderSteps.propTypes.steps,\n mode: PropTypes.string.isRequired,\n skillName: PropTypes.string.isRequired,\n 'aria-label': PropTypes.string,\n closeButtonAriaLabel: PropTypes.string,\n onQuitClick: PropTypes.func,\n hiddenSteps: PropTypes.bool\n};\n\nexport default ReviewHeader;\n"],"file":"index.js"}
@@ -51,7 +51,7 @@
51
51
  .stepsWrapperAnimation {
52
52
  opacity: 0;
53
53
  transform: translate(-50%, -180%);
54
- transition: opacity 0.5s ease-in-out 0.5s, transform 0.5s ease-in-out 0.5s;
54
+ transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
55
55
  }
56
56
 
57
57
  .iconButtonWrapper {
@@ -4,7 +4,9 @@ import stepsProps from '../../../../molecule/review-header-steps/test/fixtures/a
4
4
  export const defaultHeaderProps = {
5
5
  mode: 'Revision mode',
6
6
  skillName: 'Agility',
7
- onQuitClick: () => {},
7
+ onQuitClick: () => {
8
+ console.log('onQuitClick');
9
+ },
8
10
  'aria-label': 'aria-header-wrapper',
9
11
  closeButtonAriaLabel: 'aria-close-button'
10
12
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/organism/review-header/test/fixtures/all-questions-ok.js"],"names":["stepsProps","defaultHeaderProps","mode","skillName","onQuitClick","closeButtonAriaLabel","props","steps"],"mappings":";;AAAA,OAAOA,UAAP,MAAuB,yEAAvB;AAEA,OAAO,MAAMC,kBAAkB,GAAG;AAChCC,EAAAA,IAAI,EAAE,eAD0B;AAEhCC,EAAAA,SAAS,EAAE,SAFqB;AAGhCC,EAAAA,WAAW,EAAE,MAAM,CAAE,CAHW;AAIhC,gBAAc,qBAJkB;AAKhCC,EAAAA,oBAAoB,EAAE;AALU,CAA3B;AAQP,eAAe;AACbC,EAAAA,KAAK,wBACAL,kBADA;AAEHM,IAAAA,KAAK,EAAEP,UAAU,CAACM,KAAX,CAAiBC;AAFrB;AADQ,CAAf","sourcesContent":["import stepsProps from '../../../../molecule/review-header-steps/test/fixtures/all-questions-ok';\n\nexport const defaultHeaderProps = {\n mode: 'Revision mode',\n skillName: 'Agility',\n onQuitClick: () => {},\n 'aria-label': 'aria-header-wrapper',\n closeButtonAriaLabel: 'aria-close-button'\n};\n\nexport default {\n props: {\n ...defaultHeaderProps,\n steps: stepsProps.props.steps\n }\n};\n"],"file":"all-questions-ok.js"}
1
+ {"version":3,"sources":["../../../../../src/organism/review-header/test/fixtures/all-questions-ok.js"],"names":["stepsProps","defaultHeaderProps","mode","skillName","onQuitClick","console","log","closeButtonAriaLabel","props","steps"],"mappings":";;AAAA,OAAOA,UAAP,MAAuB,yEAAvB;AAEA,OAAO,MAAMC,kBAAkB,GAAG;AAChCC,EAAAA,IAAI,EAAE,eAD0B;AAEhCC,EAAAA,SAAS,EAAE,SAFqB;AAGhCC,EAAAA,WAAW,EAAE,MAAM;AACjBC,IAAAA,OAAO,CAACC,GAAR,CAAY,aAAZ;AACD,GAL+B;AAMhC,gBAAc,qBANkB;AAOhCC,EAAAA,oBAAoB,EAAE;AAPU,CAA3B;AAUP,eAAe;AACbC,EAAAA,KAAK,wBACAP,kBADA;AAEHQ,IAAAA,KAAK,EAAET,UAAU,CAACQ,KAAX,CAAiBC;AAFrB;AADQ,CAAf","sourcesContent":["import stepsProps from '../../../../molecule/review-header-steps/test/fixtures/all-questions-ok';\n\nexport const defaultHeaderProps = {\n mode: 'Revision mode',\n skillName: 'Agility',\n onQuitClick: () => {\n console.log('onQuitClick');\n },\n 'aria-label': 'aria-header-wrapper',\n closeButtonAriaLabel: 'aria-close-button'\n};\n\nexport default {\n props: {\n ...defaultHeaderProps,\n steps: stepsProps.props.steps\n }\n};\n"],"file":"all-questions-ok.js"}
@@ -0,0 +1,421 @@
1
+ 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; }
2
+
3
+ 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); }
4
+
5
+ import React, { useState, useReducer, useMemo } from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import classnames from 'classnames';
8
+ import getOr from 'lodash/fp/getOr';
9
+ import omit from 'lodash/fp/omit';
10
+ import isNil from 'lodash/fp/isNil';
11
+ import ReviewBackground from '../../atom/review-background';
12
+ import { ICON_VALUES } from '../../atom/review-header-step-item';
13
+ import ReviewCongrats from '../../organism/review-congrats';
14
+ import ReviewHeader from '../../organism/review-header';
15
+ import ReviewCorrectionPopin from '../../molecule/review-correction-popin';
16
+ import Answer from '../../molecule/answer';
17
+ import ButtonLink from '../../atom/button-link';
18
+ import style from './style.css';
19
+ const stylesByPosition = {
20
+ 0: style.position0,
21
+ 1: style.position1,
22
+ 2: style.position2,
23
+ 3: style.position3,
24
+ 4: style.position4
25
+ };
26
+ const TOTAL_SLIDES_STACK = 5;
27
+ const HIGHEST_INDEX = TOTAL_SLIDES_STACK - 1;
28
+
29
+ const getSlideAnimation = (action, position, hidden) => {
30
+ switch (action) {
31
+ case 'unstack':
32
+ return style.slideOutHideAndIn;
33
+
34
+ case 'restack':
35
+ return style.slideOutAndIn;
36
+
37
+ default:
38
+ return hidden ? style.hiddenSlide : stylesByPosition[position];
39
+ }
40
+ };
41
+
42
+ const buildSlide = (slideNumber, slidesState, updateSlides, primarySkinColor, validate, correctionPopinProps, updateStepItems, finishedSlides, updateFinishedSlides, updateReviewState, updateShouldMountSlides) => {
43
+ const {
44
+ hidden,
45
+ endReview,
46
+ position,
47
+ action,
48
+ validationResult,
49
+ question,
50
+ answer
51
+ } = slidesState.get(slideNumber);
52
+ const {
53
+ onClick: onValidateClick,
54
+ label: validateLabel
55
+ } = validate;
56
+ const validateButtonProps = {
57
+ customStyle: {
58
+ backgroundColor: primarySkinColor
59
+ },
60
+
61
+ /*
62
+ slide validation action, this will trigger the correction popin but will not trigger any
63
+ animations unless the endReview signal is received (all slides will disappear),
64
+ if there is a nextSlide content, it will be loaded here
65
+ if it is the last slide and the content needs to be different, then that update will
66
+ be handled on the next slide logic but the content will be carried from here.
67
+ */
68
+ onClick: async () => {
69
+ const {
70
+ validationResult: result,
71
+ nextSlide,
72
+ endReview: _endReview
73
+ } = await onValidateClick();
74
+ updateSlides([slideNumber, {
75
+ hidden,
76
+ position,
77
+ validationResult: result,
78
+ answer,
79
+ question,
80
+ nextSlide,
81
+ numberOfFinishedSlides: finishedSlides.size,
82
+ endReview: _endReview
83
+ }]); // on endReview, this gives some time for the slides to slide out && then launch
84
+ // the 'finished' logic as it would happen when normally finishing the review
85
+
86
+ if (_endReview) {
87
+ updateReviewState('finished');
88
+ setTimeout(() => updateShouldMountSlides(false), 2000);
89
+ }
90
+
91
+ updateStepItems([slideNumber, {
92
+ icon: result === 'success' ? ICON_VALUES.right : ICON_VALUES.wrong,
93
+ finishedSlides
94
+ }]); // only stores successful slides
95
+
96
+ if (result === 'success') updateFinishedSlides([slideNumber, true]);
97
+ },
98
+ 'aria-label': validateLabel,
99
+ label: validateLabel,
100
+ 'data-name': `slide-validate-button-${slideNumber}`,
101
+ className: style.validateButton,
102
+ disabled: !isNil(validationResult)
103
+ };
104
+ const {
105
+ klf,
106
+ information,
107
+ next,
108
+ successLabel,
109
+ failureLabel
110
+ } = correctionPopinProps;
111
+ const _correctionPopinProps = {
112
+ next: {
113
+ /*
114
+ next slide action, this will trigger the slides animations
115
+ if it is the last slide AND the content needs to be different, then that update
116
+ of the content will be handled here (and in the validate as it happens normally )
117
+ from the content carried from the validate action.
118
+ */
119
+ onClick: () => {
120
+ updateSlides([slideNumber, {
121
+ hidden: validationResult === 'success',
122
+ position: HIGHEST_INDEX - finishedSlides.size,
123
+ action: validationResult === 'success' ? 'unstack' : 'restack',
124
+ answer,
125
+ question,
126
+ validationResult,
127
+ numberOfFinishedSlides: finishedSlides.size,
128
+ endReview
129
+ }]);
130
+ updateStepItems([slideNumber, {
131
+ setNext: true,
132
+ finishedSlides,
133
+ current: finishedSlides.size === HIGHEST_INDEX && validationResult !== 'success'
134
+ }]); // if slides are successfully reviewed, then trigger the 'finished' state
135
+
136
+ if (finishedSlides.size === TOTAL_SLIDES_STACK) {
137
+ updateReviewState('finished');
138
+ setTimeout(() => updateShouldMountSlides(false), 2000);
139
+ }
140
+ },
141
+ label: next.label,
142
+ 'data-name': `next-question-button-${slideNumber}`,
143
+ 'aria-label': next['aria-label']
144
+ },
145
+ klf,
146
+ information,
147
+ type: validationResult === 'success' ? 'right' : 'wrong',
148
+ resultLabel: validationResult === 'success' ? successLabel : failureLabel
149
+ };
150
+ const questionOrigin = 'From "Master Design Thinking to become more agile" course';
151
+ return /*#__PURE__*/React.createElement("div", {
152
+ key: `slide-${slideNumber}`,
153
+ "data-name": `slide-${slideNumber}`,
154
+ className: classnames(style.slideBase, getSlideAnimation(action, position, hidden), endReview ? style.endReview : null)
155
+ }, answer && question ? /*#__PURE__*/React.createElement("div", {
156
+ key: "content-container",
157
+ className: style.slideContentContainer
158
+ }, /*#__PURE__*/React.createElement("div", {
159
+ key: "from-course",
160
+ className: style.questionOrigin
161
+ }, questionOrigin), /*#__PURE__*/React.createElement("div", {
162
+ key: "title",
163
+ className: style.question
164
+ }, question), /*#__PURE__*/React.createElement("div", {
165
+ key: "help",
166
+ className: style.help
167
+ }, answer.help), /*#__PURE__*/React.createElement("div", {
168
+ key: "answer-container",
169
+ className: style.answerContainer
170
+ }, /*#__PURE__*/React.createElement(Answer, _extends({}, answer, {
171
+ key: "answer"
172
+ })))) : null, /*#__PURE__*/React.createElement("div", {
173
+ key: "button-wrapper",
174
+ className: style.validateButtonWrapper
175
+ }, /*#__PURE__*/React.createElement(ButtonLink, validateButtonProps)), /*#__PURE__*/React.createElement("div", {
176
+ className: validationResult ? style.correctionPopinWrapper : style.hiddenCorrectionPopinWrapper,
177
+ style: _extends({}, finishedSlides.size !== HIGHEST_INDEX && !validationResult && {
178
+ display: 'none'
179
+ })
180
+ }, /*#__PURE__*/React.createElement(ReviewCorrectionPopin, _correctionPopinProps)));
181
+ }; // ||-------> Handles the updates of a given slide (using the 'id' in the action),
182
+ // & then updates de remaining slides if this given change should impact their content
183
+
184
+
185
+ const slidesStateReducer = (state, action) => {
186
+ const [id, value] = action;
187
+
188
+ const _state = new Map();
189
+
190
+ const {
191
+ nextSlide,
192
+ numberOfFinishedSlides
193
+ } = value,
194
+ newValue = _objectWithoutPropertiesLoose(value, ["nextSlide", "numberOfFinishedSlides"]); // eslint-disable-next-line fp/no-loops
195
+
196
+
197
+ for (const [index, previousValue] of state) {
198
+ if (index === id) {
199
+ // update the given slide
200
+ if (nextSlide && numberOfFinishedSlides === HIGHEST_INDEX) {
201
+ _state.set(index, _extends(_extends({}, previousValue), {}, {
202
+ nextSlide,
203
+ position: newValue.position,
204
+ validationResult: newValue.validationResult
205
+ }));
206
+ } else if (numberOfFinishedSlides === HIGHEST_INDEX && previousValue.nextSlide) {
207
+ _state.set(index, _extends(_extends({}, previousValue.nextSlide), {}, {
208
+ position: previousValue.position
209
+ }));
210
+ } else _state.set(id, newValue);
211
+ } else {
212
+ // updates the rest of the slides here
213
+ const {
214
+ hidden,
215
+ position,
216
+ answer,
217
+ question
218
+ } = previousValue;
219
+
220
+ if (nextSlide) {
221
+ _state.set(index, _extends(_extends({}, nextSlide), {}, {
222
+ endReview: newValue.endReview,
223
+ hidden,
224
+ position
225
+ }));
226
+ } else {
227
+ _state.set(index, {
228
+ hidden,
229
+ position: position - 1,
230
+ answer,
231
+ question,
232
+ endReview: newValue.endReview
233
+ });
234
+ }
235
+ }
236
+ }
237
+
238
+ return _state;
239
+ }; // ||-------> aux function, finds the consecutive index to loop from 0 to HIGHEST_INDEX (4) & again to 0
240
+
241
+
242
+ 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 &&
243
+ // they have to be skipped)
244
+
245
+
246
+ const calculateNextStepIndex = (currentSlideIndex, finishedSlides, lastVisitedIndex = null) => {
247
+ // only one slide remaining
248
+ if (lastVisitedIndex === currentSlideIndex) {
249
+ return currentSlideIndex;
250
+ }
251
+
252
+ const indexToVisit = getNextIndex(isNil(lastVisitedIndex) ? currentSlideIndex : lastVisitedIndex);
253
+ return finishedSlides.has(indexToVisit) ? calculateNextStepIndex(currentSlideIndex, finishedSlides, indexToVisit) : indexToVisit;
254
+ }; // ||-------> Handles the updates of a given step item (using the 'id' in the action),
255
+ // & then updates de remaining step items if this given change should impact their content
256
+
257
+
258
+ const stepItemsReducer = (state, action) => {
259
+ const [id, value] = action;
260
+
261
+ const {
262
+ setNext,
263
+ finishedSlides
264
+ } = value,
265
+ rest = _objectWithoutPropertiesLoose(value, ["setNext", "finishedSlides"]);
266
+
267
+ const _state = new Map();
268
+
269
+ const nextIndex = !rest.current && setNext ? calculateNextStepIndex(id, finishedSlides) : null; // eslint-disable-next-line fp/no-loops
270
+
271
+ for (const [index, previousValue] of state) {
272
+ if (id === index) _state.set(id, _extends(_extends({}, previousValue), rest));else if (setNext && nextIndex === index) {
273
+ _state.set(index, _extends(_extends({}, previousValue), {}, {
274
+ current: true
275
+ }));
276
+ } else _state.set(index, previousValue);
277
+ }
278
+
279
+ return _state;
280
+ }; // ||-------> Stores the correctly answered (finished) slides, the initial state is an empty Map
281
+
282
+
283
+ const finishedSlidesReducer = (state, action) => {
284
+ const [id, value] = action;
285
+
286
+ const _state = new Map(); // eslint-disable-next-line fp/no-loops
287
+
288
+
289
+ for (const [index, previousValue] of state) {
290
+ _state.set(index, previousValue);
291
+ }
292
+
293
+ _state.set(id, value);
294
+
295
+ return _state;
296
+ };
297
+
298
+ const SlidesReview = ({
299
+ headerProps,
300
+ reviewBackgroundAriaLabel,
301
+ validate,
302
+ correctionPopinProps,
303
+ firstSlide,
304
+ congratsProps
305
+ }, context) => {
306
+ const {
307
+ skin
308
+ } = context;
309
+ const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]); // ||-------> States init: build initial states && memoize them + reducers creation
310
+
311
+ const slidesInitialState = useMemo(() => {
312
+ const states = new Map();
313
+ const {
314
+ answer,
315
+ question
316
+ } = firstSlide; // eslint-disable-next-line fp/no-loops
317
+
318
+ for (let index = 0; index < TOTAL_SLIDES_STACK; index++) {
319
+ const content = index === 0 ? {
320
+ answer,
321
+ question
322
+ } : {};
323
+ states.set(index, _extends(_extends({}, content), {}, {
324
+ hidden: false,
325
+ position: index
326
+ }));
327
+ }
328
+
329
+ return states;
330
+ }, [firstSlide]);
331
+ const stepItemsInitialState = useMemo(() => {
332
+ const states = new Map(); // eslint-disable-next-line fp/no-loops
333
+
334
+ for (let index = 0; index < TOTAL_SLIDES_STACK; index++) {
335
+ const current = index === 0;
336
+ states.set(index, {
337
+ current,
338
+ value: `${index + 1}`,
339
+ icon: null
340
+ });
341
+ }
342
+
343
+ return states;
344
+ }, []);
345
+ const [finishedSlides, updateFinishedSlides] = useReducer(finishedSlidesReducer, new Map());
346
+ const [slidesState, updateSlides] = useReducer(slidesStateReducer, slidesInitialState);
347
+ const [stepItemsState, updateStepItems] = useReducer(stepItemsReducer, stepItemsInitialState);
348
+ const [reviewState, updateReviewState] = useState('ongoing');
349
+ /*
350
+ ||-------> the slides have an slightly longer lifespan than the "ongoing" review State,
351
+ after reviewState changes to "finished" the slides don't have to unmount until the last
352
+ slide-out animation is finished, the slides have to be unmounted to be RGAA complaint
353
+ (if they are only invisible but still mounted, then they will be found the assisting tools & clutter it)
354
+ */
355
+
356
+ const [shouldMountSlides, updateShouldMountSlides] = useState(true); // ||-------> build each slide, passing down the reducers that will act on validation & next clicks
357
+
358
+ const builtStackedSlides = useMemo(() => {
359
+ const StackedSlides = []; // eslint-disable-next-line fp/no-loops
360
+
361
+ for (let slideNumber = 0; slideNumber < TOTAL_SLIDES_STACK; slideNumber++) {
362
+ StackedSlides.push(buildSlide(slideNumber, slidesState, updateSlides, primarySkinColor, validate, correctionPopinProps, updateStepItems, finishedSlides, updateFinishedSlides, updateReviewState, updateShouldMountSlides));
363
+ }
364
+
365
+ return StackedSlides;
366
+ }, [slidesState, primarySkinColor, validate, correctionPopinProps, finishedSlides]); // ||-------> transform the step items state (Map structure) to an Array
367
+
368
+ const stepItemsArray = useMemo(() => {
369
+ // eslint-disable-next-line unicorn/prefer-spread
370
+ return Array.from(stepItemsState.values());
371
+ }, [stepItemsState]);
372
+
373
+ const _headerProps = _extends(_extends({}, headerProps), {}, {
374
+ steps: stepItemsArray,
375
+ key: 'review-header',
376
+ hiddenSteps: reviewState !== 'ongoing'
377
+ });
378
+
379
+ return /*#__PURE__*/React.createElement("div", {
380
+ key: "slides-revision-container",
381
+ "data-name": "slides-revision-container",
382
+ className: style.slidesRevisionContainer
383
+ }, /*#__PURE__*/React.createElement("div", {
384
+ key: "player-background-container",
385
+ className: style.playerBackground
386
+ }, /*#__PURE__*/React.createElement(ReviewBackground, {
387
+ "aria-label": reviewBackgroundAriaLabel
388
+ })), /*#__PURE__*/React.createElement(ReviewHeader, _headerProps), shouldMountSlides ? /*#__PURE__*/React.createElement("div", {
389
+ key: "stacked-slides-container",
390
+ "data-name": "stacked-slides-container",
391
+ className: style.stackedSlidesContainer
392
+ }, builtStackedSlides) : null, reviewState === 'finished' ? /*#__PURE__*/React.createElement("div", {
393
+ className: style.congrats
394
+ }, /*#__PURE__*/React.createElement(ReviewCongrats, congratsProps)) : null);
395
+ };
396
+
397
+ SlidesReview.propTypes = process.env.NODE_ENV !== "production" ? {
398
+ headerProps: PropTypes.shape(omit(['steps', ''], ReviewHeader.propTypes)),
399
+ reviewBackgroundAriaLabel: ReviewBackground.propTypes['aria-label'],
400
+ validate: PropTypes.shape({
401
+ label: PropTypes.string,
402
+ onClick: PropTypes.func
403
+ }),
404
+ firstSlide: PropTypes.shape({
405
+ question: PropTypes.string,
406
+ answer: PropTypes.shape(Answer.propTypes)
407
+ }),
408
+ correctionPopinProps: PropTypes.shape({
409
+ klf: ReviewCorrectionPopin.propTypes.klf,
410
+ information: ReviewCorrectionPopin.propTypes.information,
411
+ next: PropTypes.shape({
412
+ label: PropTypes.string,
413
+ 'aria-label': PropTypes.string
414
+ }),
415
+ successLabel: ReviewCorrectionPopin.propTypes.resultLabel,
416
+ failureLabel: ReviewCorrectionPopin.propTypes.resultLabel
417
+ }),
418
+ congratsProps: PropTypes.shape(ReviewCongrats.propTypes)
419
+ } : {};
420
+ export default SlidesReview;
421
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/template/slides-review/index.js"],"names":["React","useState","useReducer","useMemo","PropTypes","classnames","getOr","omit","isNil","ReviewBackground","ICON_VALUES","ReviewCongrats","ReviewHeader","ReviewCorrectionPopin","Answer","ButtonLink","style","stylesByPosition","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","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","stackedSlidesContainer","congrats","propTypes","shape","string","func"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,UAAzB,EAAqCC,OAArC,QAAmD,OAAnD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,gBAAP,MAA6B,8BAA7B;AACA,SAAQC,WAAR,QAA0B,oCAA1B;AACA,OAAOC,cAAP,MAA2B,gCAA3B;AACA,OAAOC,YAAP,MAAyB,8BAAzB;AACA,OAAOC,qBAAP,MAAkC,wCAAlC;AACA,OAAOC,MAAP,MAAmB,uBAAnB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,gBAAgB,GAAG;AACvB,KAAGD,KAAK,CAACE,SADc;AAEvB,KAAGF,KAAK,CAACG,SAFc;AAGvB,KAAGH,KAAK,CAACI,SAHc;AAIvB,KAAGJ,KAAK,CAACK,SAJc;AAKvB,KAAGL,KAAK,CAACM;AALc,CAAzB;AAQA,MAAMC,kBAAkB,GAAG,CAA3B;AACA,MAAMC,aAAa,GAAGD,kBAAkB,GAAG,CAA3C;;AAEA,MAAME,iBAAiB,GAAG,CAACC,MAAD,EAASC,QAAT,E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AAS,CAACsI,KAAV,CAAgB;AACpCtE,IAAAA,GAAG,EAAEvD,qBAAqB,CAAC4H,SAAtB,CAAgCrE,GADD;AAEpCC,IAAAA,WAAW,EAAExD,qBAAqB,CAAC4H,SAAtB,CAAgCpE,WAFT;AAGpCC,IAAAA,IAAI,EAAElE,SAAS,CAACsI,KAAV,CAAgB;AACpBvF,MAAAA,KAAK,EAAE/C,SAAS,CAACuI,MADG;AAEpB,oBAAcvI,SAAS,CAACuI;AAFJ,KAAhB,CAH8B;AAOpCpE,IAAAA,YAAY,EAAE1D,qBAAqB,CAAC4H,SAAtB,CAAgC5D,WAPV;AAQpCL,IAAAA,YAAY,EAAE3D,qBAAqB,CAAC4H,SAAtB,CAAgC5D;AARV,GAAhB,CAXC;AAqBvBmC,EAAAA,aAAa,EAAE5G,SAAS,CAACsI,KAAV,CAAgB/H,cAAc,CAAC8H,SAA/B;AArBQ,CAAzB;AAwBA,eAAe7B,YAAf","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 <ReviewHeader {..._headerProps} />\n\n {shouldMountSlides ? (\n <div\n key=\"stacked-slides-container\"\n data-name=\"stacked-slides-container\"\n className={style.stackedSlidesContainer}\n >\n {builtStackedSlides}\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"}