@coorpacademy/components 11.32.50 → 11.32.52-alpha.56

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 (63) hide show
  1. package/es/molecule/banner/index.d.ts +1 -0
  2. package/es/molecule/banner/index.d.ts.map +1 -1
  3. package/es/molecule/banner/index.js +12 -3
  4. package/es/molecule/banner/index.js.map +1 -1
  5. package/es/template/back-office/brand-update/index.d.ts +1 -0
  6. package/es/template/playlist-detail/index.d.ts +4 -1
  7. package/es/template/playlist-detail/index.d.ts.map +1 -1
  8. package/es/template/playlist-detail/index.js +14 -3
  9. package/es/template/playlist-detail/index.js.map +1 -1
  10. package/es/template/skill-detail/all-courses.d.ts +5 -1
  11. package/es/template/skill-detail/all-courses.d.ts.map +1 -1
  12. package/es/template/skill-detail/all-courses.js +18 -7
  13. package/es/template/skill-detail/all-courses.js.map +1 -1
  14. package/es/template/skill-detail/index.d.ts +4 -1
  15. package/es/template/skill-detail/index.d.ts.map +1 -1
  16. package/es/template/skill-detail/index.js +14 -3
  17. package/es/template/skill-detail/index.js.map +1 -1
  18. package/lib/molecule/banner/index.d.ts +1 -0
  19. package/lib/molecule/banner/index.d.ts.map +1 -1
  20. package/lib/molecule/banner/index.js +13 -3
  21. package/lib/molecule/banner/index.js.map +1 -1
  22. package/lib/template/back-office/brand-update/index.d.ts +1 -0
  23. package/lib/template/playlist-detail/index.d.ts +4 -1
  24. package/lib/template/playlist-detail/index.d.ts.map +1 -1
  25. package/lib/template/playlist-detail/index.js +14 -3
  26. package/lib/template/playlist-detail/index.js.map +1 -1
  27. package/lib/template/skill-detail/all-courses.d.ts +5 -1
  28. package/lib/template/skill-detail/all-courses.d.ts.map +1 -1
  29. package/lib/template/skill-detail/all-courses.js +19 -7
  30. package/lib/template/skill-detail/all-courses.js.map +1 -1
  31. package/lib/template/skill-detail/index.d.ts +4 -1
  32. package/lib/template/skill-detail/index.d.ts.map +1 -1
  33. package/lib/template/skill-detail/index.js +14 -3
  34. package/lib/template/skill-detail/index.js.map +1 -1
  35. package/locales/bs/global.json +8 -7
  36. package/locales/cs/global.json +5 -4
  37. package/locales/de/global.json +5 -4
  38. package/locales/en/global.json +1 -0
  39. package/locales/es/global.json +5 -4
  40. package/locales/et/global.json +5 -4
  41. package/locales/fi/global.json +5 -4
  42. package/locales/fr/global.json +5 -4
  43. package/locales/hr/global.json +8 -7
  44. package/locales/hu/global.json +5 -4
  45. package/locales/hy/global.json +8 -7
  46. package/locales/it/global.json +5 -4
  47. package/locales/ja/global.json +5 -4
  48. package/locales/ko/global.json +5 -4
  49. package/locales/nl/global.json +5 -4
  50. package/locales/pl/global.json +5 -4
  51. package/locales/pt/global.json +5 -4
  52. package/locales/ro/global.json +5 -4
  53. package/locales/ru/global.json +5 -4
  54. package/locales/sk/global.json +5 -4
  55. package/locales/sl/global.json +5 -4
  56. package/locales/sv/global.json +5 -4
  57. package/locales/tl/global.json +8 -7
  58. package/locales/tr/global.json +5 -4
  59. package/locales/uk/global.json +5 -4
  60. package/locales/vi/global.json +8 -7
  61. package/locales/zh/global.json +5 -4
  62. package/locales/zh_TW/global.json +8 -7
  63. package/package.json +2 -2
@@ -9,6 +9,7 @@ declare namespace Banner {
9
9
  label: PropTypes.Requireable<string>;
10
10
  type: PropTypes.Requireable<string>;
11
11
  action: PropTypes.Requireable<(...args: any[]) => any>;
12
+ oldSwitchValue: PropTypes.Requireable<boolean>;
12
13
  }> | null | undefined)[]>;
13
14
  const temporary: PropTypes.Requireable<boolean>;
14
15
  const onEnd: PropTypes.Requireable<(...args: any[]) => any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/banner/index.js"],"names":[],"mappings":";AA0BA,iDAmFC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/banner/index.js"],"names":[],"mappings":";AA0BA,iDAoFC"}
@@ -1,3 +1,6 @@
1
+ import _get from "lodash/fp/get";
2
+ import _find from "lodash/fp/find";
3
+ import _pipe from "lodash/fp/pipe";
1
4
  import _size from "lodash/fp/size";
2
5
  import _map from "lodash/fp/map";
3
6
  import _isEmpty from "lodash/fp/isEmpty";
@@ -38,7 +41,12 @@ const Banner = props => {
38
41
  bannerKey,
39
42
  onEnd
40
43
  } = props;
41
- const [switchValue, setSwitchValue] = useState(false);
44
+
45
+ const oldSwitchValue = _pipe(_find({
46
+ type: 'switch'
47
+ }), _get('oldSwitchValue'))(cta);
48
+
49
+ const [switchValue, setSwitchValue] = useState(oldSwitchValue || false);
42
50
  const ButtonSeparator = /*#__PURE__*/React.createElement("div", {
43
51
  className: classnames(style.buttonsBar, STYLES[type])
44
52
  });
@@ -61,7 +69,7 @@ const Banner = props => {
61
69
  className: commonStyle
62
70
  }, /*#__PURE__*/React.createElement(InputSwitch, {
63
71
  id: "show-microlearning-switch",
64
- theme: "coorpmanager",
72
+ theme: "default",
65
73
  title: label,
66
74
  value: switchValue,
67
75
  onChange: handleSwitchToggle(action),
@@ -117,7 +125,8 @@ const Banner = props => {
117
125
  const ctaPropTypes = process.env.NODE_ENV !== "production" ? PropTypes.shape({
118
126
  label: PropTypes.string,
119
127
  type: PropTypes.oneOf(['button', 'switch']),
120
- action: PropTypes.func
128
+ action: PropTypes.func,
129
+ oldSwitchValue: PropTypes.bool
121
130
  }) : {};
122
131
  Banner.propTypes = process.env.NODE_ENV !== "production" ? {
123
132
  bannerKey: PropTypes.string,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useState","useCallback","PropTypes","classnames","COLORS","ButtonLink","Icon","InputSwitch","style","uncappedMap","convert","cap","TYPES","success","cm_positive_200","error","cm_negative_200","warning","cm_yellow_400","info","cm_grey_500","STYLES","Banner","props","type","message","cta","temporary","bannerKey","onEnd","switchValue","setSwitchValue","ButtonSeparator","buttonsBar","handleSwitchToggle","action","e","newSwitchValue","buildButton","buttonType","label","commonStyle","button","padding","buildCta","ctaOptions","options","i","ctaWrapper","iconName","iconColor","banner","temporaryBanner","icon","temporaryIcon","ctaPropTypes","shape","string","oneOf","func","propTypes","isRequired","arrayOf","bool"],"sources":["../../../src/molecule/banner/index.js"],"sourcesContent":["import React, {useState, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {keys, noop, isEmpty, map, size} from 'lodash/fp';\nimport {COLORS} from '../../variables/colors';\nimport ButtonLink from '../../atom/button-link';\nimport Icon from '../../atom/icon';\nimport InputSwitch from '../../atom/input-switch';\nimport style from './style.css';\n\nconst uncappedMap = map.convert({cap: false});\n\nconst TYPES = {\n success: ['circle-check', COLORS.cm_positive_200],\n error: ['triangle-exclamation', COLORS.cm_negative_200],\n warning: ['circle-exclamation', COLORS.cm_yellow_400],\n info: ['circle-info', COLORS.cm_grey_500]\n};\n\nconst STYLES = {\n success: style.success,\n error: style.error,\n warning: style.warning,\n info: style.info\n};\n\nconst Banner = props => {\n const {type, message, cta = [], temporary, bannerKey, onEnd} = props;\n const [switchValue, setSwitchValue] = useState(false);\n\n const ButtonSeparator = <div className={classnames(style.buttonsBar, STYLES[type])} />;\n\n const handleSwitchToggle = useCallback(\n action => e => {\n const newSwitchValue = !switchValue;\n setSwitchValue(newSwitchValue);\n action(newSwitchValue);\n },\n [switchValue]\n );\n\n const buildButton = ({type: buttonType = 'button', label, action = noop}) => {\n const commonStyle = classnames(style.button, STYLES[type]);\n\n switch (buttonType) {\n case 'switch':\n return (\n <div className={commonStyle}>\n <InputSwitch\n id=\"show-microlearning-switch\"\n theme=\"coorpmanager\"\n title={label}\n value={switchValue}\n onChange={handleSwitchToggle(action)}\n data-name={`banner-switch-cta`}\n aria-label={label}\n />\n </div>\n );\n default:\n return (\n <div className={commonStyle}>\n <ButtonLink\n data-name=\"banner-button-cta\"\n aria-label={label}\n label={label}\n onClick={action}\n type=\"text\"\n customStyle={{padding: 0}}\n />\n </div>\n );\n }\n };\n\n const buildCta = ctaOptions => {\n return uncappedMap((options, i) => {\n if (isEmpty(options)) return null;\n\n return (\n <div className={style.ctaWrapper} key={i}>\n {i > 0 && i <= size(options) ? ButtonSeparator : null}\n {buildButton(options)}\n </div>\n );\n }, ctaOptions);\n };\n\n const [iconName, iconColor] = TYPES[type];\n\n return (\n <div\n key={bannerKey}\n className={classnames(style.banner, STYLES[type], temporary && style.temporaryBanner)}\n onAnimationEnd={onEnd}\n title={message}\n >\n <div data-name={`${type}-banner-message`} className={style.message}>\n <Icon\n iconName={iconName}\n iconColor={iconColor}\n className={classnames(style.icon, temporary && style.temporaryIcon)}\n customStyle={{padding: 0}}\n />\n {message}\n </div>\n {buildCta(cta)}\n </div>\n );\n};\n\nconst ctaPropTypes = PropTypes.shape({\n label: PropTypes.string,\n type: PropTypes.oneOf(['button', 'switch']),\n action: PropTypes.func\n});\n\nBanner.propTypes = {\n bannerKey: PropTypes.string,\n type: PropTypes.oneOf(keys(TYPES)),\n message: PropTypes.string.isRequired,\n cta: PropTypes.arrayOf(ctaPropTypes),\n temporary: PropTypes.bool,\n onEnd: PropTypes.func\n};\n\nexport default Banner;\n"],"mappings":";;;;;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,WAAzB,QAA2C,OAA3C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SAAQC,MAAR,QAAqB,wBAArB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,WAAW,GAAG,KAAIC,OAAJ,CAAY;EAACC,GAAG,EAAE;AAAN,CAAZ,CAApB;;AAEA,MAAMC,KAAK,GAAG;EACZC,OAAO,EAAE,CAAC,cAAD,EAAiBT,MAAM,CAACU,eAAxB,CADG;EAEZC,KAAK,EAAE,CAAC,sBAAD,EAAyBX,MAAM,CAACY,eAAhC,CAFK;EAGZC,OAAO,EAAE,CAAC,oBAAD,EAAuB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EC,SAFb;IAGE,SAAS,EAAE/C,UAAU,CAACK,KAAK,CAAC6C,IAAP,EAAa1B,SAAS,IAAInB,KAAK,CAAC8C,aAAhC,CAHvB;IAIE,WAAW,EAAE;MAACX,OAAO,EAAE;IAAV;EAJf,EADF,EAOGlB,OAPH,CANF,EAeGmB,QAAQ,CAAClB,GAAD,CAfX,CADF;AAmBD,CAnFD;;AAqFA,MAAM6B,YAAN,2CAAqBrD,SAAS,CAACsD,KAAV,CAAgB;EACnChB,KAAK,EAAEtC,SAAS,CAACuD,MADkB;EAEnCjC,IAAI,EAAEtB,SAAS,CAACwD,KAAV,CAAgB,CAAC,QAAD,EAAW,QAAX,CAAhB,CAF6B;EAGnCvB,MAAM,EAAEjC,SAAS,CAACyD;AAHiB,CAAhB,CAArB;AAMArC,MAAM,CAACsC,SAAP,2CAAmB;EACjBhC,SAAS,EAAE1B,SAAS,CAACuD,MADJ;EAEjBjC,IAAI,EAAEtB,SAAS,CAACwD,KAAV,CAAgB,MAAK9C,KAAL,CAAhB,CAFW;EAGjBa,OAAO,EAAEvB,SAAS,CAACuD,MAAV,CAAiBI,UAHT;EAIjBnC,GAAG,EAAExB,SAAS,CAAC4D,OAAV,CAAkBP,YAAlB,CAJY;EAKjB5B,SAAS,EAAEzB,SAAS,CAAC6D,IALJ;EAMjBlC,KAAK,EAAE3B,SAAS,CAACyD;AANA,CAAnB;AASA,eAAerC,MAAf"}
1
+ {"version":3,"file":"index.js","names":["React","useState","useCallback","PropTypes","classnames","COLORS","ButtonLink","Icon","InputSwitch","style","uncappedMap","convert","cap","TYPES","success","cm_positive_200","error","cm_negative_200","warning","cm_yellow_400","info","cm_grey_500","STYLES","Banner","props","type","message","cta","temporary","bannerKey","onEnd","oldSwitchValue","switchValue","setSwitchValue","ButtonSeparator","buttonsBar","handleSwitchToggle","action","e","newSwitchValue","buildButton","buttonType","label","commonStyle","button","padding","buildCta","ctaOptions","options","i","ctaWrapper","iconName","iconColor","banner","temporaryBanner","icon","temporaryIcon","ctaPropTypes","shape","string","oneOf","func","bool","propTypes","isRequired","arrayOf"],"sources":["../../../src/molecule/banner/index.js"],"sourcesContent":["import React, {useState, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {keys, noop, isEmpty, map, size, pipe, find, get} from 'lodash/fp';\nimport {COLORS} from '../../variables/colors';\nimport ButtonLink from '../../atom/button-link';\nimport Icon from '../../atom/icon';\nimport InputSwitch from '../../atom/input-switch';\nimport style from './style.css';\n\nconst uncappedMap = map.convert({cap: false});\n\nconst TYPES = {\n success: ['circle-check', COLORS.cm_positive_200],\n error: ['triangle-exclamation', COLORS.cm_negative_200],\n warning: ['circle-exclamation', COLORS.cm_yellow_400],\n info: ['circle-info', COLORS.cm_grey_500]\n};\n\nconst STYLES = {\n success: style.success,\n error: style.error,\n warning: style.warning,\n info: style.info\n};\n\nconst Banner = props => {\n const {type, message, cta = [], temporary, bannerKey, onEnd} = props;\n const oldSwitchValue = pipe(find({type: 'switch'}), get('oldSwitchValue'))(cta);\n const [switchValue, setSwitchValue] = useState(oldSwitchValue || false);\n\n const ButtonSeparator = <div className={classnames(style.buttonsBar, STYLES[type])} />;\n\n const handleSwitchToggle = useCallback(\n action => e => {\n const newSwitchValue = !switchValue;\n setSwitchValue(newSwitchValue);\n action(newSwitchValue);\n },\n [switchValue]\n );\n\n const buildButton = ({type: buttonType = 'button', label, action = noop}) => {\n const commonStyle = classnames(style.button, STYLES[type]);\n\n switch (buttonType) {\n case 'switch':\n return (\n <div className={commonStyle}>\n <InputSwitch\n id=\"show-microlearning-switch\"\n theme=\"default\"\n title={label}\n value={switchValue}\n onChange={handleSwitchToggle(action)}\n data-name={`banner-switch-cta`}\n aria-label={label}\n />\n </div>\n );\n default:\n return (\n <div className={commonStyle}>\n <ButtonLink\n data-name=\"banner-button-cta\"\n aria-label={label}\n label={label}\n onClick={action}\n type=\"text\"\n customStyle={{padding: 0}}\n />\n </div>\n );\n }\n };\n\n const buildCta = ctaOptions => {\n return uncappedMap((options, i) => {\n if (isEmpty(options)) return null;\n\n return (\n <div className={style.ctaWrapper} key={i}>\n {i > 0 && i <= size(options) ? ButtonSeparator : null}\n {buildButton(options)}\n </div>\n );\n }, ctaOptions);\n };\n\n const [iconName, iconColor] = TYPES[type];\n\n return (\n <div\n key={bannerKey}\n className={classnames(style.banner, STYLES[type], temporary && style.temporaryBanner)}\n onAnimationEnd={onEnd}\n title={message}\n >\n <div data-name={`${type}-banner-message`} className={style.message}>\n <Icon\n iconName={iconName}\n iconColor={iconColor}\n className={classnames(style.icon, temporary && style.temporaryIcon)}\n customStyle={{padding: 0}}\n />\n {message}\n </div>\n {buildCta(cta)}\n </div>\n );\n};\n\nconst ctaPropTypes = PropTypes.shape({\n label: PropTypes.string,\n type: PropTypes.oneOf(['button', 'switch']),\n action: PropTypes.func,\n oldSwitchValue: PropTypes.bool\n});\n\nBanner.propTypes = {\n bannerKey: PropTypes.string,\n type: PropTypes.oneOf(keys(TYPES)),\n message: PropTypes.string.isRequired,\n cta: PropTypes.arrayOf(ctaPropTypes),\n temporary: PropTypes.bool,\n onEnd: PropTypes.func\n};\n\nexport default Banner;\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,WAAzB,QAA2C,OAA3C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SAAQC,MAAR,QAAqB,wBAArB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,WAAW,GAAG,KAAIC,OAAJ,CAAY;EAACC,GAAG,EAAE;AAAN,CAAZ,CAApB;;AAEA,MAAMC,KAAK,GAAG;EACZC,OAAO,EAAE,CAAC,cAAD,EAAiBT,MAAM,CAACU,eAAxB,CADG;EAEZC,KAAK,EAAE,CAAC,sBAAD,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C,eAAhD,CAFvB;IAGE,cAAc,EAAExB,KAHlB;IAIE,KAAK,EAAEJ;EAJT,gBAME;IAAK,aAAY,GAAED,IAAK,iBAAxB;IAA0C,SAAS,EAAEhB,KAAK,CAACiB;EAA3D,gBACE,oBAAC,IAAD;IACE,QAAQ,EAAEyB,QADZ;IAEE,SAAS,EAAEC,SAFb;IAGE,SAAS,EAAEhD,UAAU,CAACK,KAAK,CAAC8C,IAAP,EAAa3B,SAAS,IAAInB,KAAK,CAAC+C,aAAhC,CAHvB;IAIE,WAAW,EAAE;MAACX,OAAO,EAAE;IAAV;EAJf,EADF,EAOGnB,OAPH,CANF,EAeGoB,QAAQ,CAACnB,GAAD,CAfX,CADF;AAmBD,CApFD;;AAsFA,MAAM8B,YAAN,2CAAqBtD,SAAS,CAACuD,KAAV,CAAgB;EACnChB,KAAK,EAAEvC,SAAS,CAACwD,MADkB;EAEnClC,IAAI,EAAEtB,SAAS,CAACyD,KAAV,CAAgB,CAAC,QAAD,EAAW,QAAX,CAAhB,CAF6B;EAGnCvB,MAAM,EAAElC,SAAS,CAAC0D,IAHiB;EAInC9B,cAAc,EAAE5B,SAAS,CAAC2D;AAJS,CAAhB,CAArB;AAOAvC,MAAM,CAACwC,SAAP,2CAAmB;EACjBlC,SAAS,EAAE1B,SAAS,CAACwD,MADJ;EAEjBlC,IAAI,EAAEtB,SAAS,CAACyD,KAAV,CAAgB,MAAK/C,KAAL,CAAhB,CAFW;EAGjBa,OAAO,EAAEvB,SAAS,CAACwD,MAAV,CAAiBK,UAHT;EAIjBrC,GAAG,EAAExB,SAAS,CAAC8D,OAAV,CAAkBR,YAAlB,CAJY;EAKjB7B,SAAS,EAAEzB,SAAS,CAAC2D,IALJ;EAMjBhC,KAAK,EAAE3B,SAAS,CAAC0D;AANA,CAAnB;AASA,eAAetC,MAAf"}
@@ -13,6 +13,7 @@ declare namespace BrandUpdate {
13
13
  label: PropTypes.Requireable<string>;
14
14
  type: PropTypes.Requireable<string>;
15
15
  action: PropTypes.Requireable<(...args: any[]) => any>;
16
+ oldSwitchValue: PropTypes.Requireable<boolean>;
16
17
  }> | null | undefined)[]>;
17
18
  temporary: PropTypes.Requireable<boolean>;
18
19
  onEnd: PropTypes.Requireable<(...args: any[]) => any>;
@@ -83,7 +83,10 @@ declare namespace PlaylistDetail {
83
83
  }>>;
84
84
  const onBackClick: PropTypes.Requireable<(...args: any[]) => any>;
85
85
  const onContinueLearningClick: PropTypes.Requireable<(...args: any[]) => any>;
86
- const bannerMicrolearningRuleAction: PropTypes.Requireable<(...args: any[]) => any>;
86
+ namespace bannerMicrolearning {
87
+ const action: PropTypes.Requireable<(...args: any[]) => any>;
88
+ const oldSwitchValue: PropTypes.Requireable<boolean>;
89
+ }
87
90
  }
88
91
  }
89
92
  import PropTypes from "prop-types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/playlist-detail/index.js"],"names":[],"mappings":";AAgBA,uEA2FC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/playlist-detail/index.js"],"names":[],"mappings":";AAgBA,uEAgGC"}
@@ -26,12 +26,16 @@ const PlaylistDetail = (props, context) => {
26
26
  sorting,
27
27
  onBackClick,
28
28
  onContinueLearningClick,
29
- bannerMicrolearningRuleAction = null
29
+ bannerMicrolearning = {}
30
30
  } = props;
31
31
  const descriptionRef = useRef(null);
32
32
  const {
33
33
  translate
34
34
  } = context;
35
+ const {
36
+ action: bannerMicrolearningAction,
37
+ oldSwitchValue
38
+ } = bannerMicrolearning;
35
39
  const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);
36
40
  const [showMore, setShowMore] = useState(false);
37
41
  const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);
@@ -90,7 +94,11 @@ const PlaylistDetail = (props, context) => {
90
94
  content: playlistCourses,
91
95
  filters: filters,
92
96
  sorting: sorting,
93
- bannerMicrolearningRuleAction: bannerMicrolearningRuleAction
97
+ bannerMicrolearning: {
98
+ type: 'playlist',
99
+ action: bannerMicrolearningAction,
100
+ oldSwitchValue
101
+ }
94
102
  })));
95
103
  };
96
104
 
@@ -112,7 +120,10 @@ PlaylistDetail.propTypes = process.env.NODE_ENV !== "production" ? {
112
120
  sorting: PropTypes.shape(Select.propTypes),
113
121
  onBackClick: PropTypes.func,
114
122
  onContinueLearningClick: PropTypes.func,
115
- bannerMicrolearningRuleAction: PropTypes.func
123
+ bannerMicrolearning: {
124
+ action: PropTypes.func,
125
+ oldSwitchValue: PropTypes.bool
126
+ }
116
127
  } : {};
117
128
  export default PlaylistDetail;
118
129
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","useState","useEffect","useRef","PropTypes","classnames","Markdown","Provider","Tag","Select","SelectOptionPropTypes","ButtonLinkIcon","Icon","CardsGrid","AllCourses","PlaylistDetailCover","ContinueLearningButton","style","PlaylistDetail","props","context","title","coverImages","playlistRef","description","ongoingCoursesAvailable","playlistCourses","filters","sorting","onBackClick","onContinueLearningClick","bannerMicrolearningRuleAction","descriptionRef","translate","isDescriptionTruncated","setIsDescriptionTruncated","showMore","setShowMore","handleShowMore","current","clientHeight","scrollHeight","Description","truncate","backgroundContainer","container","backButton","ctaContainer","coverWrapper","showMoreWrapper","faSize","wrapperSize","continueLearningButton","contextTypes","skin","childContextTypes","propTypes","string","isRequired","images","bool","shape","onChange","func","options","arrayOf"],"sources":["../../../src/template/playlist-detail/index.js"],"sourcesContent":["import React, {useCallback, useState, useEffect, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Tag from '../../atom/tag';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport AllCourses from '../skill-detail/all-courses';\nimport PlaylistDetailCover from '../../molecule/playlist-detail-cover';\nimport {ContinueLearningButton} from '../skill-detail';\nimport style from './style.css';\n\nconst PlaylistDetail = (props, context) => {\n const {\n title,\n coverImages,\n playlistRef,\n description,\n ongoingCoursesAvailable,\n playlistCourses,\n filters,\n sorting,\n onBackClick,\n onContinueLearningClick,\n bannerMicrolearningRuleAction = null\n } = props;\n const descriptionRef = useRef(null);\n const {translate} = context;\n\n const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n useEffect(() => {\n if (descriptionRef.current) {\n const {clientHeight = 0, scrollHeight = 0} = descriptionRef.current;\n setIsDescriptionTruncated(scrollHeight > clientHeight);\n }\n }, [description]);\n\n const Description = useCallback(() => {\n return (\n <div\n ref={descriptionRef}\n className={classnames(style.description, !showMore && style.truncate)}\n >\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={playlistRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label={translate('back')}\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div className={style.coverWrapper}>\n <PlaylistDetailCover images={coverImages} />\n </div>\n <div>\n <Tag label={translate('playlist')} />\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {isDescriptionTruncated ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {translate(showMore ? 'Show less' : 'Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{faSize: 14, wrapperSize: 16}}\n />\n </div>\n ) : null}\n </>\n ) : null}\n <div className={style.continueLearningButton}>\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n </div>\n <AllCourses\n content={playlistCourses}\n filters={filters}\n sorting={sorting}\n bannerMicrolearningRuleAction={bannerMicrolearningRuleAction}\n />\n </div>\n </div>\n );\n};\n\nPlaylistDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nPlaylistDetail.propTypes = {\n title: PropTypes.string.isRequired,\n coverImages: PlaylistDetailCover.propTypes.images,\n playlistRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n ongoingCoursesAvailable: PropTypes.bool,\n playlistCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func,\n bannerMicrolearningRuleAction: PropTypes.func\n};\n\nexport default PlaylistDetail;\n"],"mappings":";AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,EAAsCC,SAAtC,EAAiDC,MAAjD,QAA8D,OAA9D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,UAAP,MAAuB,6BAAvB;AACA,OAAOC,mBAAP,MAAgC,sCAAhC;AACA,SAAQC,sBAAR,QAAqC,iBAArC;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,cAAc,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACzC,MAAM;IACJC,KADI;IAEJC,WAFI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/C,QAAQ,CAACgD,iBAAT,CAA2BD,IADL;EAE5BrB,SAAS,EAAE1B,QAAQ,CAACgD,iBAAT,CAA2BtB;AAFV,CAA9B;AAKAf,cAAc,CAACsC,SAAf,2CAA2B;EACzBnC,KAAK,EAAEjB,SAAS,CAACqD,MAAV,CAAiBC,UADC;EAEzBpC,WAAW,EAAEP,mBAAmB,CAACyC,SAApB,CAA8BG,MAFlB;EAGzBpC,WAAW,EAAEnB,SAAS,CAACqD,MAAV,CAAiBC,UAHL;EAIzBlC,WAAW,EAAEpB,SAAS,CAACqD,MAJE;EAKzBhC,uBAAuB,EAAErB,SAAS,CAACwD,IALV;EAMzBlC,eAAe,EAAEtB,SAAS,CAACyD,KAAV,CAAgBhD,SAAS,CAAC2C,SAA1B,CANQ;EAOzB7B,OAAO,EAAEvB,SAAS,CAACyD,KAAV,CAAgB;IACvBC,QAAQ,EAAE1D,SAAS,CAAC2D,IADG;IAEvBC,OAAO,EAAE5D,SAAS,CAAC6D,OAAV,CAAkB7D,SAAS,CAACyD,KAAV,CAAgBnD,qBAAhB,CAAlB;EAFc,CAAhB,CAPgB;EAWzBkB,OAAO,EAAExB,SAAS,CAACyD,KAAV,CAAgBpD,MAAM,CAAC+C,SAAvB,CAXgB;EAYzB3B,WAAW,EAAEzB,SAAS,CAAC2D,IAZE;EAazBjC,uBAAuB,EAAE1B,SAAS,CAAC2D,IAbV;EAczBhC,6BAA6B,EAAE3B,SAAS,CAAC2D;AAdhB,CAA3B;AAiBA,eAAe7C,cAAf"}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useState","useEffect","useRef","PropTypes","classnames","Markdown","Provider","Tag","Select","SelectOptionPropTypes","ButtonLinkIcon","Icon","CardsGrid","AllCourses","PlaylistDetailCover","ContinueLearningButton","style","PlaylistDetail","props","context","title","coverImages","playlistRef","description","ongoingCoursesAvailable","playlistCourses","filters","sorting","onBackClick","onContinueLearningClick","bannerMicrolearning","descriptionRef","translate","action","bannerMicrolearningAction","oldSwitchValue","isDescriptionTruncated","setIsDescriptionTruncated","showMore","setShowMore","handleShowMore","current","clientHeight","scrollHeight","Description","truncate","backgroundContainer","container","backButton","ctaContainer","coverWrapper","showMoreWrapper","faSize","wrapperSize","continueLearningButton","type","contextTypes","skin","childContextTypes","propTypes","string","isRequired","images","bool","shape","onChange","func","options","arrayOf"],"sources":["../../../src/template/playlist-detail/index.js"],"sourcesContent":["import React, {useCallback, useState, useEffect, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Tag from '../../atom/tag';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport AllCourses from '../skill-detail/all-courses';\nimport PlaylistDetailCover from '../../molecule/playlist-detail-cover';\nimport {ContinueLearningButton} from '../skill-detail';\nimport style from './style.css';\n\nconst PlaylistDetail = (props, context) => {\n const {\n title,\n coverImages,\n playlistRef,\n description,\n ongoingCoursesAvailable,\n playlistCourses,\n filters,\n sorting,\n onBackClick,\n onContinueLearningClick,\n bannerMicrolearning = {}\n } = props;\n const descriptionRef = useRef(null);\n const {translate} = context;\n const {action: bannerMicrolearningAction, oldSwitchValue} = bannerMicrolearning;\n\n const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n useEffect(() => {\n if (descriptionRef.current) {\n const {clientHeight = 0, scrollHeight = 0} = descriptionRef.current;\n setIsDescriptionTruncated(scrollHeight > clientHeight);\n }\n }, [description]);\n\n const Description = useCallback(() => {\n return (\n <div\n ref={descriptionRef}\n className={classnames(style.description, !showMore && style.truncate)}\n >\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={playlistRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label={translate('back')}\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div className={style.coverWrapper}>\n <PlaylistDetailCover images={coverImages} />\n </div>\n <div>\n <Tag label={translate('playlist')} />\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {isDescriptionTruncated ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {translate(showMore ? 'Show less' : 'Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{faSize: 14, wrapperSize: 16}}\n />\n </div>\n ) : null}\n </>\n ) : null}\n <div className={style.continueLearningButton}>\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n </div>\n <AllCourses\n content={playlistCourses}\n filters={filters}\n sorting={sorting}\n bannerMicrolearning={{\n type: 'playlist',\n action: bannerMicrolearningAction,\n oldSwitchValue\n }}\n />\n </div>\n </div>\n );\n};\n\nPlaylistDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nPlaylistDetail.propTypes = {\n title: PropTypes.string.isRequired,\n coverImages: PlaylistDetailCover.propTypes.images,\n playlistRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n ongoingCoursesAvailable: PropTypes.bool,\n playlistCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func,\n bannerMicrolearning: {\n action: PropTypes.func,\n oldSwitchValue: PropTypes.bool\n }\n};\n\nexport default PlaylistDetail;\n"],"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AgBpD,SAAS,CAAC+C,SAA1B,CANQ;EAOzBjC,OAAO,EAAEvB,SAAS,CAAC6D,KAAV,CAAgB;IACvBC,QAAQ,EAAE9D,SAAS,CAAC+D,IADG;IAEvBC,OAAO,EAAEhE,SAAS,CAACiE,OAAV,CAAkBjE,SAAS,CAAC6D,KAAV,CAAgBvD,qBAAhB,CAAlB;EAFc,CAAhB,CAPgB;EAWzBkB,OAAO,EAAExB,SAAS,CAAC6D,KAAV,CAAgBxD,MAAM,CAACmD,SAAvB,CAXgB;EAYzB/B,WAAW,EAAEzB,SAAS,CAAC+D,IAZE;EAazBrC,uBAAuB,EAAE1B,SAAS,CAAC+D,IAbV;EAczBpC,mBAAmB,EAAE;IACnBG,MAAM,EAAE9B,SAAS,CAAC+D,IADC;IAEnB/B,cAAc,EAAEhC,SAAS,CAAC4D;EAFP;AAdI,CAA3B;AAoBA,eAAe9C,cAAf"}
@@ -74,7 +74,11 @@ declare namespace AllCourses {
74
74
  'aria-label': PropTypes.Requireable<string>;
75
75
  'aria-labelledby': PropTypes.Requireable<string>;
76
76
  }>>;
77
- const bannerMicrolearningRuleAction: PropTypes.Requireable<(...args: any[]) => any>;
77
+ const bannerMicrolearning: PropTypes.Requireable<PropTypes.InferProps<{
78
+ type: PropTypes.Requireable<string>;
79
+ action: PropTypes.Requireable<(...args: any[]) => any>;
80
+ oldSwitchValue: PropTypes.Requireable<boolean>;
81
+ }>>;
78
82
  }
79
83
  }
80
84
  import PropTypes from "prop-types";
@@ -1 +1 @@
1
- {"version":3,"file":"all-courses.d.ts","sourceRoot":"","sources":["../../../src/template/skill-detail/all-courses.js"],"names":[],"mappings":";AAiDA,mEA0IC"}
1
+ {"version":3,"file":"all-courses.d.ts","sourceRoot":"","sources":["../../../src/template/skill-detail/all-courses.js"],"names":[],"mappings":";AAiDA,mEAgJC"}
@@ -1,3 +1,4 @@
1
+ import _isEmpty from "lodash/fp/isEmpty";
1
2
  import _isNil from "lodash/fp/isNil";
2
3
  import _size from "lodash/fp/size";
3
4
  import _map from "lodash/fp/map";
@@ -64,12 +65,15 @@ FilterButton.propTypes = process.env.NODE_ENV !== "production" ? {
64
65
  } : {};
65
66
 
66
67
  const AllCourses = (props, context) => {
68
+ const {
69
+ translate
70
+ } = context;
67
71
  const {
68
72
  content,
69
73
  filters,
70
74
  sorting,
71
75
  totalContents,
72
- bannerMicrolearningRuleAction
76
+ bannerMicrolearning = {}
73
77
  } = props;
74
78
  const {
75
79
  options,
@@ -80,8 +84,10 @@ const AllCourses = (props, context) => {
80
84
  loading
81
85
  } = content;
82
86
  const {
83
- translate
84
- } = context;
87
+ type: bannerMessageType,
88
+ action: bannerAction,
89
+ oldSwitchValue
90
+ } = bannerMicrolearning;
85
91
  const [showCompleted, setShowCompleted] = useState(true);
86
92
  const [searchValue, setSearchValue] = useState('');
87
93
  const sortView = sorting !== undefined ? /*#__PURE__*/React.createElement("div", {
@@ -134,15 +140,16 @@ const AllCourses = (props, context) => {
134
140
  onChange: handleShowCompletedToggle
135
141
  }), sortView ? /*#__PURE__*/React.createElement("div", {
136
142
  className: style.sortWrapper
137
- }, translate('sort_by'), sortView) : null)), bannerMicrolearningRuleAction ? /*#__PURE__*/React.createElement("div", {
143
+ }, translate('sort_by'), sortView) : null)), !_isEmpty(bannerMicrolearning) ? /*#__PURE__*/React.createElement("div", {
138
144
  className: style.bannerWrapper
139
145
  }, /*#__PURE__*/React.createElement(Banner, {
140
146
  type: "info",
141
- message: translate('banner_microlearning_rule_message'),
147
+ message: bannerMessageType === 'skill' ? translate('banner_microlearning_rule_message_skill') : translate('banner_microlearning_rule_message'),
142
148
  cta: [{
143
149
  type: 'switch',
144
150
  label: translate('banner_microlearning_rule_label'),
145
- action: bannerMicrolearningRuleAction
151
+ action: bannerAction,
152
+ oldSwitchValue
146
153
  }]
147
154
  })) : null, /*#__PURE__*/React.createElement("div", {
148
155
  className: style.filterWrapper
@@ -201,7 +208,11 @@ AllCourses.propTypes = process.env.NODE_ENV !== "production" ? {
201
208
  options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))
202
209
  }),
203
210
  sorting: PropTypes.shape(Select.propTypes),
204
- bannerMicrolearningRuleAction: PropTypes.func
211
+ bannerMicrolearning: PropTypes.shape({
212
+ type: PropTypes.oneOf(['skill', 'playlist']),
213
+ action: PropTypes.func,
214
+ oldSwitchValue: PropTypes.bool
215
+ })
205
216
  } : {};
206
217
  export default AllCourses;
207
218
  //# sourceMappingURL=all-courses.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"all-courses.js","names":["React","useState","useCallback","useMemo","PropTypes","Provider","Select","SelectOptionPropTypes","ButtonLink","SearchForm","CardsGrid","searchValueIncluded","InputSwitch","Banner","style","uncappedMap","convert","cap","FilterButton","props","context","dataName","ariaLabel","selected","label","onClick","skin","primarySkinColor","buttonProps","customStyle","backgroundColor","color","transition","width","contextTypes","childContextTypes","translate","propTypes","string","bool","func","AllCourses","content","filters","sorting","totalContents","bannerMicrolearningRuleAction","options","onChange","list","loading","showCompleted","setShowCompleted","searchValue","setSearchValue","sortView","undefined","filteredContent","course","progress","contentResult","skill","title","handleSearch","value","handleSearchReset","handleShowCompletedToggle","prevShowCompleted","continueLearningWrapper","continueLearningTitle","continueLearningNumber","searchAndSortSection","searchWrapper","placeholder","sortSection","sortWrapper","bannerWrapper","type","action","filterWrapper","filterProps","index","name","handleFilterChange","filterButtonWrapper","divider","justifyContent","emptySearchResultContainer","emptySearchResultTitle","emptySearchResultDescription","emptySearchResultClearSearch","shape","number","arrayOf"],"sources":["../../../src/template/skill-detail/all-courses.js"],"sourcesContent":["import React, {useState, useCallback, useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, filter, map, size, isNil} from 'lodash/fp';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport SearchForm from '../../molecule/search-form';\nimport CardsGrid from '../../organism/cards-grid';\nimport searchValueIncluded from '../../util/search-value-included';\nimport InputSwitch from '../../atom/input-switch';\nimport Banner from '../../molecule/banner';\nimport style from './all-courses.css';\n\nconst uncappedMap = map.convert({cap: false});\n\nconst FilterButton = (props, context) => {\n const {dataName, ariaLabel, selected, label, onClick} = props;\n const {skin} = context;\n const primarySkinColor = get('common.primary', skin);\n\n const buttonProps = {\n customStyle: {\n backgroundColor: selected ? primarySkinColor : '#E1E1E3',\n color: selected ? '#FFFFFF' : '#515161',\n transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out',\n width: 'fit-content'\n },\n label,\n onClick,\n 'data-name': dataName,\n 'aria-label': ariaLabel\n };\n\n return <ButtonLink {...buttonProps} />;\n};\n\nFilterButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nFilterButton.propTypes = {\n dataName: PropTypes.string,\n ariaLabel: PropTypes.string,\n selected: PropTypes.bool,\n label: PropTypes.string,\n onClick: PropTypes.func\n};\n\nconst AllCourses = (props, context) => {\n const {content, filters, sorting, totalContents, bannerMicrolearningRuleAction} = props;\n const {options, onChange} = filters;\n const {list, loading} = content;\n const {translate} = context;\n const [showCompleted, setShowCompleted] = useState(true);\n const [searchValue, setSearchValue] = useState('');\n\n const sortView =\n sorting !== undefined ? (\n <div data-name=\"choice\">\n <Select {...sorting} aria-label=\"All courses sort\" />\n </div>\n ) : null;\n\n const filteredContent = useMemo(() => {\n return showCompleted ? list : filter(course => course.progress < 1, list);\n }, [list, showCompleted]);\n\n const contentResult = useMemo(() => {\n return filter(skill => searchValueIncluded(skill.title, searchValue), filteredContent);\n }, [filteredContent, searchValue]);\n\n const handleSearch = useCallback(\n value => {\n setSearchValue(value);\n },\n [setSearchValue]\n );\n\n const handleSearchReset = useCallback(() => {\n setSearchValue('');\n }, [setSearchValue]);\n\n const handleShowCompletedToggle = useCallback(() => {\n setShowCompleted(prevShowCompleted => !prevShowCompleted);\n }, []);\n\n return (\n <>\n <div className={style.continueLearningWrapper}>\n <span className={style.continueLearningTitle}>{translate('all_content')}</span>\n <span className={style.continueLearningNumber}>\n {isNil(totalContents) ? size(contentResult) : totalContents}\n </span>\n </div>\n <div className={style.searchAndSortSection}>\n <div className={style.searchWrapper}>\n <SearchForm\n search={{\n placeholder: translate('search_place_holder'),\n value: searchValue,\n onChange: handleSearch\n }}\n onReset={handleSearchReset}\n dataTestId=\"all-courses-search-input\"\n />\n </div>\n <div className={style.sortSection}>\n <InputSwitch\n id={'show-completed-courses-switch'}\n type=\"switch\"\n name={translate('show_completed')}\n title={translate('show_completed')}\n aria-label={'Show completed courses aria label'}\n value={showCompleted}\n onChange={handleShowCompletedToggle}\n />\n {sortView ? (\n <div className={style.sortWrapper}>\n {translate('sort_by')}\n {sortView}\n </div>\n ) : null}\n </div>\n </div>\n {bannerMicrolearningRuleAction ? (\n <div className={style.bannerWrapper}>\n <Banner\n type=\"info\"\n message={translate('banner_microlearning_rule_message')}\n cta={[\n {\n type: 'switch',\n label: translate('banner_microlearning_rule_label'),\n action: bannerMicrolearningRuleAction\n }\n ]}\n />\n </div>\n ) : null}\n <div className={style.filterWrapper}>\n {size(options) > 2\n ? uncappedMap((filterProps, index) => {\n const {name, value, selected} = filterProps;\n\n function handleFilterChange() {\n onChange(value);\n }\n\n return (\n <div key={index} className={style.filterButtonWrapper}>\n <FilterButton\n dataName={`filter-button-${value}`}\n ariaLabel={`Filter by ${name}`}\n selected={selected}\n label={name}\n onClick={handleFilterChange}\n />\n {value === 'ALL' ? <div className={style.divider} /> : null}\n </div>\n );\n }, options)\n : null}\n </div>\n <div>\n {size(contentResult) ? (\n <CardsGrid\n list={contentResult}\n loading={loading}\n customStyle={{justifyContent: 'left'}}\n />\n ) : (\n <div className={style.emptySearchResultContainer}>\n <div className={style.emptySearchResultTitle}>\n {translate('empty_search_result_title', {searchValue})}\n </div>\n <div className={style.emptySearchResultDescription}>\n {translate('empty_search_result_description')}\n </div>\n <div className={style.emptySearchResultClearSearch} onClick={handleSearchReset}>\n {translate('empty_search_result_clear_search')}\n </div>\n </div>\n )}\n </div>\n </>\n );\n};\n\nAllCourses.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nAllCourses.propTypes = {\n content: PropTypes.shape(CardsGrid.propTypes),\n totalContents: PropTypes.number,\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n bannerMicrolearningRuleAction: PropTypes.func\n};\n\nexport default AllCourses;\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,WAAzB,EAAsCC,OAAtC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,UAAP,MAAuB,4BAAvB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,mBAAP,MAAgC,kCAAhC;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,MAAP,MAAmB,uBAAnB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;;AAEA,MAAMC,WAAW,GAAG,KAAIC,OAAJ,CAAY;EAACC,GAAG,EAAE;AAAN,CAAZ,CAApB;;AAEA,MAAMC,YAAY,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACvC,MAAM;IAACC,QAAD;IAAWC,SAAX;IAAsBC,QAAtB;IAAgCC,KAAhC;IAAuCC;EAAvC,IAAkDN,KAAxD;EACA,MAAM;IAACO;EAAD,IAASN,OAAf;;EACA,MAAMO,gBAAgB,GAAG,KAAI,gBAAJ,EAAsBD,IAAtB,CAAzB;;EAEA,MAAME,WAAW,GAAG;IAClBC,WAAW,EAAE;MACXC,eAAe,EAAEP,QAAQ,GAAGI,gBAAH,GAAsB,SADpC;MAEXI,KAAK,EAAER,QAA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OAAO,EAAEvC,SAAS,CAACuF,KAAV,CAAgB;IACvB3C,QAAQ,EAAE5C,SAAS,CAACoC,IADG;IAEvBO,OAAO,EAAE3C,SAAS,CAACyF,OAAV,CAAkBzF,SAAS,CAACuF,KAAV,CAAgBpF,qBAAhB,CAAlB;EAFc,CAAhB,CAHY;EAOrBqC,OAAO,EAAExC,SAAS,CAACuF,KAAV,CAAgBrF,MAAM,CAAC+B,SAAvB,CAPY;EAQrBS,6BAA6B,EAAE1C,SAAS,CAACoC;AARpB,CAAvB;AAWA,eAAeC,UAAf"}
1
+ {"version":3,"file":"all-courses.js","names":["React","useState","useCallback","useMemo","PropTypes","Provider","Select","SelectOptionPropTypes","ButtonLink","SearchForm","CardsGrid","searchValueIncluded","InputSwitch","Banner","style","uncappedMap","convert","cap","FilterButton","props","context","dataName","ariaLabel","selected","label","onClick","skin","primarySkinColor","buttonProps","customStyle","backgroundColor","color","transition","width","contextTypes","childContextTypes","translate","propTypes","string","bool","func","AllCourses","content","filters","sorting","totalContents","bannerMicrolearning","options","onChange","list","loading","type","bannerMessageType","action","bannerAction","oldSwitchValue","showCompleted","setShowCompleted","searchValue","setSearchValue","sortView","undefined","filteredContent","course","progress","contentResult","skill","title","handleSearch","value","handleSearchReset","handleShowCompletedToggle","prevShowCompleted","continueLearningWrapper","continueLearningTitle","continueLearningNumber","searchAndSortSection","searchWrapper","placeholder","sortSection","sortWrapper","bannerWrapper","filterWrapper","filterProps","index","name","handleFilterChange","filterButtonWrapper","divider","justifyContent","emptySearchResultContainer","emptySearchResultTitle","emptySearchResultDescription","emptySearchResultClearSearch","shape","number","arrayOf","oneOf"],"sources":["../../../src/template/skill-detail/all-courses.js"],"sourcesContent":["import React, {useState, useCallback, useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, filter, map, size, isNil, isEmpty} from 'lodash/fp';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport SearchForm from '../../molecule/search-form';\nimport CardsGrid from '../../organism/cards-grid';\nimport searchValueIncluded from '../../util/search-value-included';\nimport InputSwitch from '../../atom/input-switch';\nimport Banner from '../../molecule/banner';\nimport style from './all-courses.css';\n\nconst uncappedMap = map.convert({cap: false});\n\nconst FilterButton = (props, context) => {\n const {dataName, ariaLabel, selected, label, onClick} = props;\n const {skin} = context;\n const primarySkinColor = get('common.primary', skin);\n\n const buttonProps = {\n customStyle: {\n backgroundColor: selected ? primarySkinColor : '#E1E1E3',\n color: selected ? '#FFFFFF' : '#515161',\n transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out',\n width: 'fit-content'\n },\n label,\n onClick,\n 'data-name': dataName,\n 'aria-label': ariaLabel\n };\n\n return <ButtonLink {...buttonProps} />;\n};\n\nFilterButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nFilterButton.propTypes = {\n dataName: PropTypes.string,\n ariaLabel: PropTypes.string,\n selected: PropTypes.bool,\n label: PropTypes.string,\n onClick: PropTypes.func\n};\n\nconst AllCourses = (props, context) => {\n const {translate} = context;\n const {content, filters, sorting, totalContents, bannerMicrolearning = {}} = props;\n const {options, onChange} = filters;\n const {list, loading} = content;\n const {type: bannerMessageType, action: bannerAction, oldSwitchValue} = bannerMicrolearning;\n const [showCompleted, setShowCompleted] = useState(true);\n const [searchValue, setSearchValue] = useState('');\n\n const sortView =\n sorting !== undefined ? (\n <div data-name=\"choice\">\n <Select {...sorting} aria-label=\"All courses sort\" />\n </div>\n ) : null;\n\n const filteredContent = useMemo(() => {\n return showCompleted ? list : filter(course => course.progress < 1, list);\n }, [list, showCompleted]);\n\n const contentResult = useMemo(() => {\n return filter(skill => searchValueIncluded(skill.title, searchValue), filteredContent);\n }, [filteredContent, searchValue]);\n\n const handleSearch = useCallback(\n value => {\n setSearchValue(value);\n },\n [setSearchValue]\n );\n\n const handleSearchReset = useCallback(() => {\n setSearchValue('');\n }, [setSearchValue]);\n\n const handleShowCompletedToggle = useCallback(() => {\n setShowCompleted(prevShowCompleted => !prevShowCompleted);\n }, []);\n\n return (\n <>\n <div className={style.continueLearningWrapper}>\n <span className={style.continueLearningTitle}>{translate('all_content')}</span>\n <span className={style.continueLearningNumber}>\n {isNil(totalContents) ? size(contentResult) : totalContents}\n </span>\n </div>\n <div className={style.searchAndSortSection}>\n <div className={style.searchWrapper}>\n <SearchForm\n search={{\n placeholder: translate('search_place_holder'),\n value: searchValue,\n onChange: handleSearch\n }}\n onReset={handleSearchReset}\n dataTestId=\"all-courses-search-input\"\n />\n </div>\n <div className={style.sortSection}>\n <InputSwitch\n id={'show-completed-courses-switch'}\n type=\"switch\"\n name={translate('show_completed')}\n title={translate('show_completed')}\n aria-label={'Show completed courses aria label'}\n value={showCompleted}\n onChange={handleShowCompletedToggle}\n />\n {sortView ? (\n <div className={style.sortWrapper}>\n {translate('sort_by')}\n {sortView}\n </div>\n ) : null}\n </div>\n </div>\n {!isEmpty(bannerMicrolearning) ? (\n <div className={style.bannerWrapper}>\n <Banner\n type=\"info\"\n message={\n bannerMessageType === 'skill'\n ? translate('banner_microlearning_rule_message_skill')\n : translate('banner_microlearning_rule_message')\n }\n cta={[\n {\n type: 'switch',\n label: translate('banner_microlearning_rule_label'),\n action: bannerAction,\n oldSwitchValue\n }\n ]}\n />\n </div>\n ) : null}\n <div className={style.filterWrapper}>\n {size(options) > 2\n ? uncappedMap((filterProps, index) => {\n const {name, value, selected} = filterProps;\n\n function handleFilterChange() {\n onChange(value);\n }\n\n return (\n <div key={index} className={style.filterButtonWrapper}>\n <FilterButton\n dataName={`filter-button-${value}`}\n ariaLabel={`Filter by ${name}`}\n selected={selected}\n label={name}\n onClick={handleFilterChange}\n />\n {value === 'ALL' ? <div className={style.divider} /> : null}\n </div>\n );\n }, options)\n : null}\n </div>\n <div>\n {size(contentResult) ? (\n <CardsGrid\n list={contentResult}\n loading={loading}\n customStyle={{justifyContent: 'left'}}\n />\n ) : (\n <div className={style.emptySearchResultContainer}>\n <div className={style.emptySearchResultTitle}>\n {translate('empty_search_result_title', {searchValue})}\n </div>\n <div className={style.emptySearchResultDescription}>\n {translate('empty_search_result_description')}\n </div>\n <div className={style.emptySearchResultClearSearch} onClick={handleSearchReset}>\n {translate('empty_search_result_clear_search')}\n </div>\n </div>\n )}\n </div>\n </>\n );\n};\n\nAllCourses.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nAllCourses.propTypes = {\n content: PropTypes.shape(CardsGrid.propTypes),\n totalContents: PropTypes.number,\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n bannerMicrolearning: PropTypes.shape({\n type: PropTypes.oneOf(['skill', 'playlist']),\n action: PropTypes.func,\n oldSwitchValue: PropTypes.bool\n })\n};\n\nexport default AllCourses;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,WAAzB,EAAsCC,OAAtC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,UAAP,MAAuB,4BAAvB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,mBAAP,MAAgC,kCAAhC;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,MAAP,MAAmB,uBAAnB;AACA,OAAOC,KAAP,MAAkB,mBAAlB;;AAEA,MAAMC,WAAW,GAAG,KAAIC,OAAJ,CAAY;EAACC,GAAG,EAAE;AAAN,CAAZ,CAApB;;AAEA,MAAMC,YAAY,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACvC,MAAM;IAACC,QAAD;IAAWC,SAAX;IAAsBC,QAAtB;IAAgCC,KA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;IAAK,SAAS,EAAEtB,KAAK,CAAC+E,4BAAtB;IAAoD,OAAO,EAAEvB;EAA7D,GACGlC,SAAS,CAAC,kCAAD,CADZ,CAPF,CARJ,CAjFF,CADF;AAyGD,CAhJD;;AAkJAK,UAAU,CAACP,YAAX,GAA0B;EACxBR,IAAI,EAAErB,QAAQ,CAAC8B,iBAAT,CAA2BT,IADT;EAExBU,SAAS,EAAE/B,QAAQ,CAAC8B,iBAAT,CAA2BC;AAFd,CAA1B;AAKAK,UAAU,CAACJ,SAAX,2CAAuB;EACrBK,OAAO,EAAEtC,SAAS,CAAC0F,KAAV,CAAgBpF,SAAS,CAAC2B,SAA1B,CADY;EAErBQ,aAAa,EAAEzC,SAAS,CAAC2F,MAFJ;EAGrBpD,OAAO,EAAEvC,SAAS,CAAC0F,KAAV,CAAgB;IACvB9C,QAAQ,EAAE5C,SAAS,CAACoC,IADG;IAEvBO,OAAO,EAAE3C,SAAS,CAAC4F,OAAV,CAAkB5F,SAAS,CAAC0F,KAAV,CAAgBvF,qBAAhB,CAAlB;EAFc,CAAhB,CAHY;EAOrBqC,OAAO,EAAExC,SAAS,CAAC0F,KAAV,CAAgBxF,MAAM,CAAC+B,SAAvB,CAPY;EAQrBS,mBAAmB,EAAE1C,SAAS,CAAC0F,KAAV,CAAgB;IACnC3C,IAAI,EAAE/C,SAAS,CAAC6F,KAAV,CAAgB,CAAC,OAAD,EAAU,UAAV,CAAhB,CAD6B;IAEnC5C,MAAM,EAAEjD,SAAS,CAACoC,IAFiB;IAGnCe,cAAc,EAAEnD,SAAS,CAACmC;EAHS,CAAhB;AARA,CAAvB;AAeA,eAAeE,UAAf"}
@@ -123,7 +123,10 @@ declare namespace SkillDetail {
123
123
  export const onBackClick: PropTypes.Requireable<(...args: any[]) => any>;
124
124
  export const onReviewClick: PropTypes.Requireable<(...args: any[]) => any>;
125
125
  export const onContinueLearningClick: PropTypes.Requireable<(...args: any[]) => any>;
126
- export const bannerMicrolearningRuleAction: PropTypes.Requireable<(...args: any[]) => any>;
126
+ export namespace bannerMicrolearning {
127
+ const action: PropTypes.Requireable<(...args: any[]) => any>;
128
+ const oldSwitchValue: PropTypes.Requireable<boolean>;
129
+ }
127
130
  }
128
131
  export { propTypes_1 as propTypes };
129
132
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/skill-detail/index.js"],"names":[],"mappings":"AAeO,8EA+BN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYD,oEAqJC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/skill-detail/index.js"],"names":[],"mappings":"AAeO,8EA+BN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYD,oEA0JC"}
@@ -70,7 +70,7 @@ const SkillDetail = (props, context) => {
70
70
  onBackClick,
71
71
  onReviewClick,
72
72
  onContinueLearningClick,
73
- bannerMicrolearningRuleAction = null
73
+ bannerMicrolearning = {}
74
74
  } = props;
75
75
  const descriptionRef = useRef(null);
76
76
  const {
@@ -81,6 +81,10 @@ const SkillDetail = (props, context) => {
81
81
  const {
82
82
  translate
83
83
  } = context;
84
+ const {
85
+ action: bannerMicrolearningAction,
86
+ oldSwitchValue
87
+ } = bannerMicrolearning;
84
88
  const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);
85
89
  const [showMore, setShowMore] = useState(false);
86
90
  const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);
@@ -177,7 +181,11 @@ const SkillDetail = (props, context) => {
177
181
  filters: filters,
178
182
  sorting: sorting,
179
183
  totalContents: totalContents,
180
- bannerMicrolearningRuleAction: bannerMicrolearningRuleAction
184
+ bannerMicrolearning: {
185
+ type: 'skill',
186
+ action: bannerMicrolearningAction,
187
+ oldSwitchValue
188
+ }
181
189
  })));
182
190
  };
183
191
 
@@ -206,7 +214,10 @@ SkillDetail.propTypes = process.env.NODE_ENV !== "production" ? {
206
214
  onBackClick: PropTypes.func,
207
215
  onReviewClick: PropTypes.func,
208
216
  onContinueLearningClick: PropTypes.func,
209
- bannerMicrolearningRuleAction: PropTypes.func
217
+ bannerMicrolearning: {
218
+ action: PropTypes.func,
219
+ oldSwitchValue: PropTypes.bool
220
+ }
210
221
  } : {};
211
222
  export default SkillDetail;
212
223
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","useState","useRef","useEffect","PropTypes","convert","classnames","Markdown","Provider","Select","SelectOptionPropTypes","ButtonLink","ButtonLinkIcon","Icon","CardsGrid","style","AllCourses","ContinueLearningButton","props","context","ongoingCoursesAvailable","onClick","skin","translate","primarySkinColor","width","borderRadius","backgroundColor","position","faIcon","name","color","size","contextTypes","childContextTypes","propTypes","bool","func","SkillDetail","title","skillRef","description","metrics","focused","availableForReview","skillIncludedCourses","filters","sorting","onBackClick","onReviewClick","onContinueLearningClick","bannerMicrolearningRuleAction","descriptionRef","score","questionsToReview","totalContents","isDescriptionTruncated","setIsDescriptionTruncated","showMore","setShowMore","handleShowMore","current","clientHeight","scrollHeight","Description","truncate","ProgressBar","undefined","progressBarColor","inlineProgressValueStyle","progressBarWrapper","progress","backgroundContainer","container","backButton","ctaContainer","skillFocusBadge","faSize","wrapperSize","showMoreWrapper","ctaWrapper","skillInformation","skillInformationNumber","progressContainer","progressInformationNumber","toFixed","string","isRequired","shape","number","onChange","options","arrayOf"],"sources":["../../../src/template/skill-detail/index.js"],"sourcesContent":["import React, {useCallback, useState, useRef, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport {convert} from 'css-color-function';\nimport classnames from 'classnames';\nimport {get, isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport style from './style.css';\nimport AllCourses from './all-courses';\n\nexport const ContinueLearningButton = (props, context) => {\n const {ongoingCoursesAvailable, onClick} = props;\n const {skin, translate} = context;\n const primarySkinColor = get('common.primary', skin);\n\n return (\n <div>\n <ButtonLink\n label={\n ongoingCoursesAvailable ? translate('continue_learning') : translate('start_learning')\n }\n type=\"primary\"\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px',\n backgroundColor: primarySkinColor\n }}\n hoverBackgroundColor={convert(`hsl(from ${primarySkinColor} h s calc(l*(1 - 0.08)))`)}\n hoverColor=\"#FFFFFF\"\n icon={{\n position: 'left',\n faIcon: {\n name: 'play',\n color: '#FFFFFF',\n size: 16\n }\n }}\n onClick={onClick}\n />\n </div>\n );\n};\n\nContinueLearningButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContinueLearningButton.propTypes = {\n ongoingCoursesAvailable: PropTypes.bool,\n onClick: PropTypes.func\n};\n\nconst SkillDetail = (props, context) => {\n const {\n title,\n skillRef,\n description,\n metrics = {},\n focused,\n availableForReview,\n ongoingCoursesAvailable,\n skillIncludedCourses,\n filters,\n sorting,\n onBackClick,\n onReviewClick,\n onContinueLearningClick,\n bannerMicrolearningRuleAction = null\n } = props;\n const descriptionRef = useRef(null);\n const {score = 0, questionsToReview, totalContents} = metrics;\n const {translate} = context;\n\n const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n useEffect(() => {\n if (descriptionRef.current) {\n const {clientHeight = 0, scrollHeight = 0} = descriptionRef.current;\n setIsDescriptionTruncated(scrollHeight > clientHeight);\n }\n }, [description]);\n\n const Description = useCallback(() => {\n return (\n <div\n ref={descriptionRef}\n className={classnames(style.description, !showMore && style.truncate)}\n >\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n const ProgressBar = useCallback(() => {\n if (score === undefined) return null;\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${score}%`\n };\n\n return (\n <div className={style.progressBarWrapper}>\n <div\n data-name=\"progress\"\n className={style.progress}\n style={inlineProgressValueStyle}\n role=\"progressbar\"\n />\n </div>\n );\n }, [score]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={skillRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label={translate('back')}\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div>\n {focused ? (\n <div className={style.skillFocusBadge}>\n <Icon\n iconName=\"bullseye-arrow\"\n backgroundColor=\"#DDD1FF\"\n size={{\n faSize: 10,\n wrapperSize: 16\n }}\n />\n {translate('skill_focus')}\n </div>\n ) : null}\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {isDescriptionTruncated ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {showMore ? translate('Show less') : translate('Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{\n faSize: 14,\n wrapperSize: 16\n }}\n />\n </div>\n ) : null}\n </>\n ) : null}\n </div>\n\n <div className={style.ctaWrapper}>\n <ButtonLink\n type=\"secondary\"\n onClick={onReviewClick}\n label={translate('review_this_skill')}\n disabled={!availableForReview}\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px'\n }}\n />\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n {questionsToReview > 0 ? (\n <div className={style.skillInformation} data-name=\"skill-questions\">\n <span className={style.skillInformationNumber}>{questionsToReview}</span>\n &nbsp;{translate('skill_chart_side_panel_questions_to_review')}\n </div>\n ) : null}\n <div className={style.progressContainer}>\n <ProgressBar />\n <span className={style.progressInformationNumber}>{score.toFixed(1)}%</span>\n </div>\n <AllCourses\n content={skillIncludedCourses}\n filters={filters}\n sorting={sorting}\n totalContents={totalContents}\n bannerMicrolearningRuleAction={bannerMicrolearningRuleAction}\n />\n </div>\n </div>\n );\n};\n\nSkillDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nSkillDetail.propTypes = {\n title: PropTypes.string.isRequired,\n skillRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n metrics: PropTypes.shape({\n score: PropTypes.number,\n questionsToReview: PropTypes.number,\n totalContents: PropTypes.number\n }),\n focused: PropTypes.bool,\n availableForReview: PropTypes.bool,\n ongoingCoursesAvailable: PropTypes.bool,\n skillIncludedCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onReviewClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func,\n bannerMicrolearningRuleAction: PropTypes.func\n};\n\nexport default SkillDetail;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,EAAsCC,MAAtC,EAA8CC,SAA9C,QAA8D,OAA9D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAEA,OAAO,MAAMC,sBAAsB,GAAG,CA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AAf"}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useState","useRef","useEffect","PropTypes","convert","classnames","Markdown","Provider","Select","SelectOptionPropTypes","ButtonLink","ButtonLinkIcon","Icon","CardsGrid","style","AllCourses","ContinueLearningButton","props","context","ongoingCoursesAvailable","onClick","skin","translate","primarySkinColor","width","borderRadius","backgroundColor","position","faIcon","name","color","size","contextTypes","childContextTypes","propTypes","bool","func","SkillDetail","title","skillRef","description","metrics","focused","availableForReview","skillIncludedCourses","filters","sorting","onBackClick","onReviewClick","onContinueLearningClick","bannerMicrolearning","descriptionRef","score","questionsToReview","totalContents","action","bannerMicrolearningAction","oldSwitchValue","isDescriptionTruncated","setIsDescriptionTruncated","showMore","setShowMore","handleShowMore","current","clientHeight","scrollHeight","Description","truncate","ProgressBar","undefined","progressBarColor","inlineProgressValueStyle","progressBarWrapper","progress","backgroundContainer","container","backButton","ctaContainer","skillFocusBadge","faSize","wrapperSize","showMoreWrapper","ctaWrapper","skillInformation","skillInformationNumber","progressContainer","progressInformationNumber","toFixed","type","string","isRequired","shape","number","onChange","options","arrayOf"],"sources":["../../../src/template/skill-detail/index.js"],"sourcesContent":["import React, {useCallback, useState, useRef, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport {convert} from 'css-color-function';\nimport classnames from 'classnames';\nimport {get, isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport style from './style.css';\nimport AllCourses from './all-courses';\n\nexport const ContinueLearningButton = (props, context) => {\n const {ongoingCoursesAvailable, onClick} = props;\n const {skin, translate} = context;\n const primarySkinColor = get('common.primary', skin);\n\n return (\n <div>\n <ButtonLink\n label={\n ongoingCoursesAvailable ? translate('continue_learning') : translate('start_learning')\n }\n type=\"primary\"\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px',\n backgroundColor: primarySkinColor\n }}\n hoverBackgroundColor={convert(`hsl(from ${primarySkinColor} h s calc(l*(1 - 0.08)))`)}\n hoverColor=\"#FFFFFF\"\n icon={{\n position: 'left',\n faIcon: {\n name: 'play',\n color: '#FFFFFF',\n size: 16\n }\n }}\n onClick={onClick}\n />\n </div>\n );\n};\n\nContinueLearningButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContinueLearningButton.propTypes = {\n ongoingCoursesAvailable: PropTypes.bool,\n onClick: PropTypes.func\n};\n\nconst SkillDetail = (props, context) => {\n const {\n title,\n skillRef,\n description,\n metrics = {},\n focused,\n availableForReview,\n ongoingCoursesAvailable,\n skillIncludedCourses,\n filters,\n sorting,\n onBackClick,\n onReviewClick,\n onContinueLearningClick,\n bannerMicrolearning = {}\n } = props;\n const descriptionRef = useRef(null);\n const {score = 0, questionsToReview, totalContents} = metrics;\n const {translate} = context;\n const {action: bannerMicrolearningAction, oldSwitchValue} = bannerMicrolearning;\n\n const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n useEffect(() => {\n if (descriptionRef.current) {\n const {clientHeight = 0, scrollHeight = 0} = descriptionRef.current;\n setIsDescriptionTruncated(scrollHeight > clientHeight);\n }\n }, [description]);\n\n const Description = useCallback(() => {\n return (\n <div\n ref={descriptionRef}\n className={classnames(style.description, !showMore && style.truncate)}\n >\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n const ProgressBar = useCallback(() => {\n if (score === undefined) return null;\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${score}%`\n };\n\n return (\n <div className={style.progressBarWrapper}>\n <div\n data-name=\"progress\"\n className={style.progress}\n style={inlineProgressValueStyle}\n role=\"progressbar\"\n />\n </div>\n );\n }, [score]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={skillRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label={translate('back')}\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div>\n {focused ? (\n <div className={style.skillFocusBadge}>\n <Icon\n iconName=\"bullseye-arrow\"\n backgroundColor=\"#DDD1FF\"\n size={{\n faSize: 10,\n wrapperSize: 16\n }}\n />\n {translate('skill_focus')}\n </div>\n ) : null}\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {isDescriptionTruncated ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {showMore ? translate('Show less') : translate('Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{\n faSize: 14,\n wrapperSize: 16\n }}\n />\n </div>\n ) : null}\n </>\n ) : null}\n </div>\n\n <div className={style.ctaWrapper}>\n <ButtonLink\n type=\"secondary\"\n onClick={onReviewClick}\n label={translate('review_this_skill')}\n disabled={!availableForReview}\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px'\n }}\n />\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n {questionsToReview > 0 ? (\n <div className={style.skillInformation} data-name=\"skill-questions\">\n <span className={style.skillInformationNumber}>{questionsToReview}</span>\n &nbsp;{translate('skill_chart_side_panel_questions_to_review')}\n </div>\n ) : null}\n <div className={style.progressContainer}>\n <ProgressBar />\n <span className={style.progressInformationNumber}>{score.toFixed(1)}%</span>\n </div>\n <AllCourses\n content={skillIncludedCourses}\n filters={filters}\n sorting={sorting}\n totalContents={totalContents}\n bannerMicrolearning={{\n type: 'skill',\n action: bannerMicrolearningAction,\n oldSwitchValue\n }}\n />\n </div>\n </div>\n );\n};\n\nSkillDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nSkillDetail.propTypes = {\n title: PropTypes.string.isRequired,\n skillRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n metrics: PropTypes.shape({\n score: PropTypes.number,\n questionsToReview: PropTypes.number,\n totalContents: PropTypes.number\n }),\n focused: PropTypes.bool,\n availableForReview: PropTypes.bool,\n ongoingCoursesAvailable: PropTypes.bool,\n skillIncludedCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onReviewClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func,\n bannerMicrolearning: {\n action: PropTypes.func,\n oldSwitchValue: PropTypes.bool\n }\n};\n\nexport default SkillDetail;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,EAAsCC,MAAtC,EAA8CC,SAA9C,QAA8D,OAA9D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAEA,OAAO,MAAMC,sBAAsB,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACxD,MAAM;IAACC,uBAAD;IAA0BC;EAA1B,IAAqCH,KAA3C;EACA,MAAM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AE;IACnBK,MAAM,EAAEpD,SAAS,CAACiC,IADC;IAEnBqB,cAAc,EAAEtD,SAAS,CAACgC;EAFP;AArBC,CAAxB;AA2BA,eAAeE,WAAf"}
@@ -9,6 +9,7 @@ declare namespace Banner {
9
9
  label: PropTypes.Requireable<string>;
10
10
  type: PropTypes.Requireable<string>;
11
11
  action: PropTypes.Requireable<(...args: any[]) => any>;
12
+ oldSwitchValue: PropTypes.Requireable<boolean>;
12
13
  }> | null | undefined)[]>;
13
14
  const temporary: PropTypes.Requireable<boolean>;
14
15
  const onEnd: PropTypes.Requireable<(...args: any[]) => any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/banner/index.js"],"names":[],"mappings":";AA0BA,iDAmFC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/banner/index.js"],"names":[],"mappings":";AA0BA,iDAoFC"}
@@ -3,6 +3,12 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
5
 
6
+ var _get2 = _interopRequireDefault(require("lodash/fp/get"));
7
+
8
+ var _find2 = _interopRequireDefault(require("lodash/fp/find"));
9
+
10
+ var _pipe2 = _interopRequireDefault(require("lodash/fp/pipe"));
11
+
6
12
  var _size2 = _interopRequireDefault(require("lodash/fp/size"));
7
13
 
8
14
  var _map2 = _interopRequireDefault(require("lodash/fp/map"));
@@ -61,7 +67,10 @@ const Banner = props => {
61
67
  bannerKey,
62
68
  onEnd
63
69
  } = props;
64
- const [switchValue, setSwitchValue] = (0, _react.useState)(false);
70
+ const oldSwitchValue = (0, _pipe2.default)((0, _find2.default)({
71
+ type: 'switch'
72
+ }), (0, _get2.default)('oldSwitchValue'))(cta);
73
+ const [switchValue, setSwitchValue] = (0, _react.useState)(oldSwitchValue || false);
65
74
 
66
75
  const ButtonSeparator = /*#__PURE__*/_react.default.createElement("div", {
67
76
  className: (0, _classnames.default)(_style.default.buttonsBar, STYLES[type])
@@ -86,7 +95,7 @@ const Banner = props => {
86
95
  className: commonStyle
87
96
  }, /*#__PURE__*/_react.default.createElement(_inputSwitch.default, {
88
97
  id: "show-microlearning-switch",
89
- theme: "coorpmanager",
98
+ theme: "default",
90
99
  title: label,
91
100
  value: switchValue,
92
101
  onChange: handleSwitchToggle(action),
@@ -142,7 +151,8 @@ const Banner = props => {
142
151
  const ctaPropTypes = process.env.NODE_ENV !== "production" ? _propTypes.default.shape({
143
152
  label: _propTypes.default.string,
144
153
  type: _propTypes.default.oneOf(['button', 'switch']),
145
- action: _propTypes.default.func
154
+ action: _propTypes.default.func,
155
+ oldSwitchValue: _propTypes.default.bool
146
156
  }) : {};
147
157
  Banner.propTypes = process.env.NODE_ENV !== "production" ? {
148
158
  bannerKey: _propTypes.default.string,