From aeaf41756ae45ca7e750b16778e09f1011b251ff Mon Sep 17 00:00:00 2001 From: Diana Catalina Olarte Date: Mon, 1 Jul 2024 10:43:00 +1000 Subject: [PATCH] temp: add dist for testign purposes --- .gitignore | 1 - dist/Avatar.js | 43 ++ dist/Avatar.js.map | 1 + dist/DesktopHeader.js | 247 ++++++++++ dist/DesktopHeader.js.map | 1 + dist/Header.js | 82 ++++ dist/Header.js.map | 1 + dist/Header.messages.js | 115 +++++ dist/Header.messages.js.map | 1 + dist/Header.test.jsx | 104 ++++ dist/Icons.js | 52 ++ dist/Icons.js.map | 1 + dist/Logo.js | 41 ++ dist/Logo.js.map | 1 + dist/Menu/Menu.js | 323 +++++++++++++ dist/Menu/Menu.js.map | 1 + dist/Menu/index.js | 3 + dist/Menu/index.js.map | 1 + dist/Menu/menu.scss | 45 ++ dist/MobileHeader.js | 224 +++++++++ dist/MobileHeader.js.map | 1 + dist/__snapshots__/Header.test.jsx.snap | 443 ++++++++++++++++++ dist/generic/messages.js | 15 + dist/generic/messages.js.map | 1 + dist/i18n/index.js | 28 ++ dist/i18n/index.js.map | 1 + dist/i18n/messages/ar.json | 36 ++ dist/i18n/messages/de.json | 36 ++ dist/i18n/messages/es_419.json | 36 ++ dist/i18n/messages/fr.json | 36 ++ dist/i18n/messages/fr_CA.json | 36 ++ dist/i18n/messages/hi.json | 36 ++ dist/i18n/messages/it.json | 36 ++ dist/i18n/messages/pt.json | 36 ++ dist/i18n/messages/ru.json | 36 ++ dist/i18n/messages/uk.json | 36 ++ dist/i18n/messages/zh_CN.json | 36 ++ dist/index.js | 7 + dist/index.js.map | 1 + dist/index.scss | 121 +++++ dist/learning-header/AnonymousUserMenu.js | 22 + dist/learning-header/AnonymousUserMenu.js.map | 1 + .../AuthenticatedUserDropdown.js | 46 ++ .../AuthenticatedUserDropdown.js.map | 1 + dist/learning-header/LearningHeader.js | 101 ++++ dist/learning-header/LearningHeader.js.map | 1 + dist/learning-header/_header.scss | 10 + dist/learning-header/data/api.js | 45 ++ dist/learning-header/data/api.js.map | 1 + dist/learning-header/data/api.test.js | 166 +++++++ dist/learning-header/data/api.test.js.map | 1 + dist/learning-header/messages.js | 40 ++ dist/learning-header/messages.js.map | 1 + dist/setupTest.js | 125 +++++ dist/studio-header/BrandNav.js | 21 + dist/studio-header/BrandNav.js.map | 1 + dist/studio-header/CourseLockUp.js | 45 ++ dist/studio-header/CourseLockUp.js.map | 1 + dist/studio-header/HeaderBody.js | 120 +++++ dist/studio-header/HeaderBody.js.map | 1 + dist/studio-header/MobileHeader.js | 79 ++++ dist/studio-header/MobileHeader.js.map | 1 + dist/studio-header/MobileMenu.js | 45 ++ dist/studio-header/MobileMenu.js.map | 1 + dist/studio-header/NavDropdownMenu.js | 30 ++ dist/studio-header/NavDropdownMenu.js.map | 1 + dist/studio-header/StudioHeader.js | 68 +++ dist/studio-header/StudioHeader.js.map | 1 + dist/studio-header/StudioHeader.scss | 49 ++ dist/studio-header/UserMenu.js | 55 +++ dist/studio-header/UserMenu.js.map | 1 + dist/studio-header/index.js | 3 + dist/studio-header/index.js.map | 1 + dist/studio-header/messages.js | 55 +++ dist/studio-header/messages.js.map | 1 + dist/studio-header/utils.js | 29 ++ dist/studio-header/utils.js.map | 1 + dist/test-utils.js | 26 + dist/test-utils.js.map | 1 + src/learning-header/LearningHeader.jsx | 3 +- 80 files changed, 3500 insertions(+), 3 deletions(-) create mode 100644 dist/Avatar.js create mode 100644 dist/Avatar.js.map create mode 100644 dist/DesktopHeader.js create mode 100644 dist/DesktopHeader.js.map create mode 100644 dist/Header.js create mode 100644 dist/Header.js.map create mode 100644 dist/Header.messages.js create mode 100644 dist/Header.messages.js.map create mode 100644 dist/Header.test.jsx create mode 100644 dist/Icons.js create mode 100644 dist/Icons.js.map create mode 100644 dist/Logo.js create mode 100644 dist/Logo.js.map create mode 100644 dist/Menu/Menu.js create mode 100644 dist/Menu/Menu.js.map create mode 100644 dist/Menu/index.js create mode 100644 dist/Menu/index.js.map create mode 100644 dist/Menu/menu.scss create mode 100644 dist/MobileHeader.js create mode 100644 dist/MobileHeader.js.map create mode 100644 dist/__snapshots__/Header.test.jsx.snap create mode 100644 dist/generic/messages.js create mode 100644 dist/generic/messages.js.map create mode 100644 dist/i18n/index.js create mode 100644 dist/i18n/index.js.map create mode 100644 dist/i18n/messages/ar.json create mode 100644 dist/i18n/messages/de.json create mode 100644 dist/i18n/messages/es_419.json create mode 100644 dist/i18n/messages/fr.json create mode 100644 dist/i18n/messages/fr_CA.json create mode 100644 dist/i18n/messages/hi.json create mode 100644 dist/i18n/messages/it.json create mode 100644 dist/i18n/messages/pt.json create mode 100644 dist/i18n/messages/ru.json create mode 100644 dist/i18n/messages/uk.json create mode 100644 dist/i18n/messages/zh_CN.json create mode 100644 dist/index.js create mode 100644 dist/index.js.map create mode 100644 dist/index.scss create mode 100644 dist/learning-header/AnonymousUserMenu.js create mode 100644 dist/learning-header/AnonymousUserMenu.js.map create mode 100644 dist/learning-header/AuthenticatedUserDropdown.js create mode 100644 dist/learning-header/AuthenticatedUserDropdown.js.map create mode 100644 dist/learning-header/LearningHeader.js create mode 100644 dist/learning-header/LearningHeader.js.map create mode 100644 dist/learning-header/_header.scss create mode 100644 dist/learning-header/data/api.js create mode 100644 dist/learning-header/data/api.js.map create mode 100644 dist/learning-header/data/api.test.js create mode 100644 dist/learning-header/data/api.test.js.map create mode 100644 dist/learning-header/messages.js create mode 100644 dist/learning-header/messages.js.map create mode 100644 dist/setupTest.js create mode 100644 dist/studio-header/BrandNav.js create mode 100644 dist/studio-header/BrandNav.js.map create mode 100644 dist/studio-header/CourseLockUp.js create mode 100644 dist/studio-header/CourseLockUp.js.map create mode 100644 dist/studio-header/HeaderBody.js create mode 100644 dist/studio-header/HeaderBody.js.map create mode 100644 dist/studio-header/MobileHeader.js create mode 100644 dist/studio-header/MobileHeader.js.map create mode 100644 dist/studio-header/MobileMenu.js create mode 100644 dist/studio-header/MobileMenu.js.map create mode 100644 dist/studio-header/NavDropdownMenu.js create mode 100644 dist/studio-header/NavDropdownMenu.js.map create mode 100644 dist/studio-header/StudioHeader.js create mode 100644 dist/studio-header/StudioHeader.js.map create mode 100644 dist/studio-header/StudioHeader.scss create mode 100644 dist/studio-header/UserMenu.js create mode 100644 dist/studio-header/UserMenu.js.map create mode 100644 dist/studio-header/index.js create mode 100644 dist/studio-header/index.js.map create mode 100644 dist/studio-header/messages.js create mode 100644 dist/studio-header/messages.js.map create mode 100644 dist/studio-header/utils.js create mode 100644 dist/studio-header/utils.js.map create mode 100644 dist/test-utils.js create mode 100644 dist/test-utils.js.map diff --git a/.gitignore b/.gitignore index 39369bc292..07575002e1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ .cache .DS_Store coverage -dist node_modules temp src/i18n/transifex_input.json diff --git a/dist/Avatar.js b/dist/Avatar.js new file mode 100644 index 0000000000..eecef41913 --- /dev/null +++ b/dist/Avatar.js @@ -0,0 +1,43 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { AvatarIcon } from './Icons'; +var Avatar = function Avatar(_ref) { + var size = _ref.size, + src = _ref.src, + alt = _ref.alt, + className = _ref.className; + var avatar = src ? /*#__PURE__*/React.createElement("img", { + className: "d-block w-100 h-100", + src: src, + alt: alt + }) : /*#__PURE__*/React.createElement(AvatarIcon, { + style: { + width: size, + height: size + }, + role: "img", + "aria-hidden": true, + focusable: "false" + }); + return /*#__PURE__*/React.createElement("span", { + style: { + height: size, + width: size + }, + className: "avatar overflow-hidden d-inline-flex rounded-circle ".concat(className) + }, avatar); +}; +Avatar.propTypes = { + src: PropTypes.string, + size: PropTypes.string, + alt: PropTypes.string, + className: PropTypes.string +}; +Avatar.defaultProps = { + src: null, + size: '2rem', + alt: null, + className: null +}; +export default Avatar; +//# sourceMappingURL=Avatar.js.map \ No newline at end of file diff --git a/dist/Avatar.js.map b/dist/Avatar.js.map new file mode 100644 index 0000000000..583d84f5d4 --- /dev/null +++ b/dist/Avatar.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Avatar.js","names":["React","PropTypes","AvatarIcon","Avatar","_ref","size","src","alt","className","avatar","createElement","style","width","height","role","focusable","concat","propTypes","string","defaultProps"],"sources":["../src/Avatar.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { AvatarIcon } from './Icons';\n\nconst Avatar = ({\n size,\n src,\n alt,\n className,\n}) => {\n const avatar = src ? (\n {alt}\n ) : (\n \n );\n\n return (\n \n {avatar}\n \n );\n};\n\nAvatar.propTypes = {\n src: PropTypes.string,\n size: PropTypes.string,\n alt: PropTypes.string,\n className: PropTypes.string,\n};\n\nAvatar.defaultProps = {\n src: null,\n size: '2rem',\n alt: null,\n className: null,\n};\n\nexport default Avatar;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,SAASC,UAAU,QAAQ,SAAS;AAEpC,IAAMC,MAAM,GAAG,SAATA,MAAMA,CAAAC,IAAA,EAKN;EAAA,IAJJC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IACHC,GAAG,GAAAH,IAAA,CAAHG,GAAG;IACHC,SAAS,GAAAJ,IAAA,CAATI,SAAS;EAET,IAAMC,MAAM,GAAGH,GAAG,gBAChBN,KAAA,CAAAU,aAAA;IAAKF,SAAS,EAAC,qBAAqB;IAACF,GAAG,EAAEA,GAAI;IAACC,GAAG,EAAEA;EAAI,CAAE,CAAC,gBAE3DP,KAAA,CAAAU,aAAA,CAACR,UAAU;IAACS,KAAK,EAAE;MAAEC,KAAK,EAAEP,IAAI;MAAEQ,MAAM,EAAER;IAAK,CAAE;IAACS,IAAI,EAAC,KAAK;IAAC,mBAAW;IAACC,SAAS,EAAC;EAAO,CAAE,CAC7F;EAED,oBACEf,KAAA,CAAAU,aAAA;IACEC,KAAK,EAAE;MAAEE,MAAM,EAAER,IAAI;MAAEO,KAAK,EAAEP;IAAK,CAAE;IACrCG,SAAS,yDAAAQ,MAAA,CAAyDR,SAAS;EAAG,GAE7EC,MACG,CAAC;AAEX,CAAC;AAEDN,MAAM,CAACc,SAAS,GAAG;EACjBX,GAAG,EAAEL,SAAS,CAACiB,MAAM;EACrBb,IAAI,EAAEJ,SAAS,CAACiB,MAAM;EACtBX,GAAG,EAAEN,SAAS,CAACiB,MAAM;EACrBV,SAAS,EAAEP,SAAS,CAACiB;AACvB,CAAC;AAEDf,MAAM,CAACgB,YAAY,GAAG;EACpBb,GAAG,EAAE,IAAI;EACTD,IAAI,EAAE,MAAM;EACZE,GAAG,EAAE,IAAI;EACTC,SAAS,EAAE;AACb,CAAC;AAED,eAAeL,MAAM"} \ No newline at end of file diff --git a/dist/DesktopHeader.js b/dist/DesktopHeader.js new file mode 100644 index 0000000000..b5d0ab7636 --- /dev/null +++ b/dist/DesktopHeader.js @@ -0,0 +1,247 @@ +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import React from 'react'; +import PropTypes from 'prop-types'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { getConfig } from '@edx/frontend-platform'; + +// Local Components +import { Menu, MenuTrigger, MenuContent } from './Menu'; +import Avatar from './Avatar'; +import { LinkedLogo, Logo } from './Logo'; + +// i18n +import messages from './Header.messages'; + +// Assets +import { CaretIcon } from './Icons'; +var DesktopHeader = /*#__PURE__*/function (_React$Component) { + _inherits(DesktopHeader, _React$Component); + var _super = _createSuper(DesktopHeader); + function DesktopHeader(props) { + _classCallCheck(this, DesktopHeader); + // eslint-disable-line no-useless-constructor + return _super.call(this, props); + } + _createClass(DesktopHeader, [{ + key: "renderMainMenu", + value: function renderMainMenu() { + var mainMenu = this.props.mainMenu; + + // Nodes are accepted as a prop + if (!Array.isArray(mainMenu)) { + return mainMenu; + } + return mainMenu.map(function (menuItem) { + var type = menuItem.type, + href = menuItem.href, + content = menuItem.content, + submenuContent = menuItem.submenuContent; + if (type === 'item') { + return /*#__PURE__*/React.createElement("a", { + key: "".concat(type, "-").concat(content), + className: "nav-link", + href: href + }, content); + } + return /*#__PURE__*/React.createElement(Menu, { + key: "".concat(type, "-").concat(content), + tag: "div", + className: "nav-item", + respondToPointerEvents: true + }, /*#__PURE__*/React.createElement(MenuTrigger, { + tag: "a", + className: "nav-link d-inline-flex align-items-center", + href: href + }, content, " ", /*#__PURE__*/React.createElement(CaretIcon, { + role: "img", + "aria-hidden": true, + focusable: "false" + })), /*#__PURE__*/React.createElement(MenuContent, { + className: "pin-left pin-right shadow py-2" + }, submenuContent)); + }); + } + + // Renders an optional App Menu for + }, { + key: "renderAppMenu", + value: function renderAppMenu() { + var appMenu = this.props.appMenu; + var appMenuContent = appMenu.content, + menuItems = appMenu.menuItems; + return /*#__PURE__*/React.createElement(Menu, { + transitionClassName: "menu-dropdown", + transitionTimeout: 250 + }, /*#__PURE__*/React.createElement(MenuTrigger, { + tag: "a", + className: "nav-link d-inline-flex align-items-center" + }, appMenuContent, " ", /*#__PURE__*/React.createElement(CaretIcon, { + role: "img", + "aria-hidden": true, + focusable: "false" + })), /*#__PURE__*/React.createElement(MenuContent, { + className: "mb-0 dropdown-menu show dropdown-menu-right pin-right shadow py-2" + }, menuItems.map(function (_ref) { + var type = _ref.type, + href = _ref.href, + content = _ref.content; + return /*#__PURE__*/React.createElement("a", { + className: "dropdown-".concat(type), + key: "".concat(type, "-").concat(content), + href: href + }, content); + }))); + } + }, { + key: "renderUserMenu", + value: function renderUserMenu() { + var _this$props = this.props, + userMenu = _this$props.userMenu, + avatar = _this$props.avatar, + username = _this$props.username, + intl = _this$props.intl; + return /*#__PURE__*/React.createElement(Menu, { + transitionClassName: "menu-dropdown", + transitionTimeout: 250 + }, /*#__PURE__*/React.createElement(MenuTrigger, { + tag: "button", + "aria-label": intl.formatMessage(messages['header.label.account.menu.for'], { + username: username + }), + className: "btn btn-outline-primary d-inline-flex align-items-center pl-2 pr-3" + }, /*#__PURE__*/React.createElement(Avatar, { + size: "1.5em", + src: avatar, + alt: "", + className: "mr-2" + }), username, " ", /*#__PURE__*/React.createElement(CaretIcon, { + role: "img", + "aria-hidden": true, + focusable: "false" + })), /*#__PURE__*/React.createElement(MenuContent, { + className: "mb-0 dropdown-menu show dropdown-menu-right pin-right shadow py-2" + }, userMenu.map(function (_ref2) { + var type = _ref2.type, + href = _ref2.href, + content = _ref2.content; + return /*#__PURE__*/React.createElement("a", { + className: "dropdown-".concat(type), + key: "".concat(type, "-").concat(content), + href: href + }, content); + }))); + } + }, { + key: "renderLoggedOutItems", + value: function renderLoggedOutItems() { + var loggedOutItems = this.props.loggedOutItems; + return loggedOutItems.map(function (item, i, arr) { + return /*#__PURE__*/React.createElement("a", { + key: "".concat(item.type, "-").concat(item.content), + className: i < arr.length - 1 ? 'btn mr-2 btn-link' : 'btn mr-2 btn-outline-primary', + href: item.href + }, item.content); + }); + } + }, { + key: "render", + value: function render() { + var _this$props2 = this.props, + logo = _this$props2.logo, + logoAltText = _this$props2.logoAltText, + logoDestination = _this$props2.logoDestination, + loggedIn = _this$props2.loggedIn, + intl = _this$props2.intl, + appMenu = _this$props2.appMenu; + var logoProps = { + src: logo, + alt: logoAltText, + href: logoDestination + }; + var logoClasses = getConfig().AUTHN_MINIMAL_HEADER ? 'mw-100' : null; + return /*#__PURE__*/React.createElement("header", { + className: "site-header-desktop" + }, /*#__PURE__*/React.createElement("a", { + className: "nav-skip sr-only sr-only-focusable", + href: "#main" + }, intl.formatMessage(messages['header.label.skip.nav'])), /*#__PURE__*/React.createElement("div", { + className: "container-fluid ".concat(logoClasses) + }, /*#__PURE__*/React.createElement("div", { + className: "nav-container position-relative d-flex align-items-center" + }, logoDestination === null ? /*#__PURE__*/React.createElement(Logo, { + className: "logo", + src: logo, + alt: logoAltText + }) : /*#__PURE__*/React.createElement(LinkedLogo, _extends({ + className: "logo" + }, logoProps)), /*#__PURE__*/React.createElement("nav", { + "aria-label": intl.formatMessage(messages['header.label.main.nav']), + className: "nav main-nav" + }, this.renderMainMenu()), appMenu ? /*#__PURE__*/React.createElement("nav", { + "aria-label": intl.formatMessage(messages['header.label.app.nav']), + className: "nav app-nav" + }, this.renderAppMenu()) : null, /*#__PURE__*/React.createElement("nav", { + "aria-label": intl.formatMessage(messages['header.label.secondary.nav']), + className: "nav secondary-menu-container align-items-center ml-auto" + }, loggedIn ? this.renderUserMenu() : this.renderLoggedOutItems())))); + } + }]); + return DesktopHeader; +}(React.Component); +DesktopHeader.propTypes = { + mainMenu: PropTypes.oneOfType([PropTypes.node, PropTypes.array]), + userMenu: PropTypes.arrayOf(PropTypes.shape({ + type: PropTypes.oneOf(['item', 'menu']), + href: PropTypes.string, + content: PropTypes.string + })), + loggedOutItems: PropTypes.arrayOf(PropTypes.shape({ + type: PropTypes.oneOf(['item', 'menu']), + href: PropTypes.string, + content: PropTypes.string + })), + logo: PropTypes.string, + logoAltText: PropTypes.string, + logoDestination: PropTypes.string, + avatar: PropTypes.string, + username: PropTypes.string, + loggedIn: PropTypes.bool, + // i18n + intl: intlShape.isRequired, + // appMenu + appMenu: PropTypes.shape({ + content: PropTypes.string, + menuItems: PropTypes.arrayOf(PropTypes.shape({ + type: PropTypes.string, + href: PropTypes.string, + content: PropTypes.string + })) + }) +}; +DesktopHeader.defaultProps = { + mainMenu: [], + userMenu: [], + loggedOutItems: [], + logo: null, + logoAltText: null, + logoDestination: null, + avatar: null, + username: null, + loggedIn: false, + appMenu: null +}; +export default injectIntl(DesktopHeader); +//# sourceMappingURL=DesktopHeader.js.map \ No newline at end of file diff --git a/dist/DesktopHeader.js.map b/dist/DesktopHeader.js.map new file mode 100644 index 0000000000..465e2ef308 --- /dev/null +++ b/dist/DesktopHeader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DesktopHeader.js","names":["React","PropTypes","injectIntl","intlShape","getConfig","Menu","MenuTrigger","MenuContent","Avatar","LinkedLogo","Logo","messages","CaretIcon","DesktopHeader","_React$Component","_inherits","_super","_createSuper","props","_classCallCheck","call","_createClass","key","value","renderMainMenu","mainMenu","Array","isArray","map","menuItem","type","href","content","submenuContent","createElement","concat","className","tag","respondToPointerEvents","role","focusable","renderAppMenu","appMenu","appMenuContent","menuItems","transitionClassName","transitionTimeout","_ref","renderUserMenu","_this$props","userMenu","avatar","username","intl","formatMessage","size","src","alt","_ref2","renderLoggedOutItems","loggedOutItems","item","i","arr","length","render","_this$props2","logo","logoAltText","logoDestination","loggedIn","logoProps","logoClasses","AUTHN_MINIMAL_HEADER","_extends","Component","propTypes","oneOfType","node","array","arrayOf","shape","oneOf","string","bool","isRequired","defaultProps"],"sources":["../src/DesktopHeader.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { injectIntl, intlShape } from '@edx/frontend-platform/i18n';\nimport { getConfig } from '@edx/frontend-platform';\n\n// Local Components\nimport { Menu, MenuTrigger, MenuContent } from './Menu';\nimport Avatar from './Avatar';\nimport { LinkedLogo, Logo } from './Logo';\n\n// i18n\nimport messages from './Header.messages';\n\n// Assets\nimport { CaretIcon } from './Icons';\n\nclass DesktopHeader extends React.Component {\n constructor(props) { // eslint-disable-line no-useless-constructor\n super(props);\n }\n\n renderMainMenu() {\n const { mainMenu } = this.props;\n\n // Nodes are accepted as a prop\n if (!Array.isArray(mainMenu)) {\n return mainMenu;\n }\n\n return mainMenu.map((menuItem) => {\n const {\n type,\n href,\n content,\n submenuContent,\n } = menuItem;\n\n if (type === 'item') {\n return (\n {content}\n );\n }\n\n return (\n \n \n {content} \n \n \n {submenuContent}\n \n \n );\n });\n }\n\n // Renders an optional App Menu for\n renderAppMenu() {\n const { appMenu } = this.props;\n const { content: appMenuContent, menuItems } = appMenu;\n return (\n \n \n {appMenuContent} \n \n \n {menuItems.map(({ type, href, content }) => (\n {content}\n ))}\n \n \n );\n }\n\n renderUserMenu() {\n const {\n userMenu,\n avatar,\n username,\n intl,\n } = this.props;\n\n return (\n \n \n \n {username} \n \n \n {userMenu.map(({ type, href, content }) => (\n {content}\n ))}\n \n \n );\n }\n\n renderLoggedOutItems() {\n const { loggedOutItems } = this.props;\n\n return loggedOutItems.map((item, i, arr) => (\n \n {item.content}\n \n ));\n }\n\n render() {\n const {\n logo,\n logoAltText,\n logoDestination,\n loggedIn,\n intl,\n appMenu,\n } = this.props;\n const logoProps = { src: logo, alt: logoAltText, href: logoDestination };\n const logoClasses = getConfig().AUTHN_MINIMAL_HEADER ? 'mw-100' : null;\n\n return (\n
\n {intl.formatMessage(messages['header.label.skip.nav'])}\n
\n
\n {logoDestination === null ? : }\n \n {this.renderMainMenu()}\n \n {appMenu ? (\n \n {this.renderAppMenu()}\n \n ) : null}\n \n {loggedIn ? this.renderUserMenu() : this.renderLoggedOutItems()}\n \n
\n
\n
\n );\n }\n}\n\nDesktopHeader.propTypes = {\n mainMenu: PropTypes.oneOfType([\n PropTypes.node,\n PropTypes.array,\n ]),\n userMenu: PropTypes.arrayOf(PropTypes.shape({\n type: PropTypes.oneOf(['item', 'menu']),\n href: PropTypes.string,\n content: PropTypes.string,\n })),\n loggedOutItems: PropTypes.arrayOf(PropTypes.shape({\n type: PropTypes.oneOf(['item', 'menu']),\n href: PropTypes.string,\n content: PropTypes.string,\n })),\n logo: PropTypes.string,\n logoAltText: PropTypes.string,\n logoDestination: PropTypes.string,\n avatar: PropTypes.string,\n username: PropTypes.string,\n loggedIn: PropTypes.bool,\n\n // i18n\n intl: intlShape.isRequired,\n\n // appMenu\n appMenu: PropTypes.shape(\n {\n content: PropTypes.string,\n menuItems: PropTypes.arrayOf(\n PropTypes.shape({\n type: PropTypes.string,\n href: PropTypes.string,\n content: PropTypes.string,\n }),\n ),\n },\n ),\n};\n\nDesktopHeader.defaultProps = {\n mainMenu: [],\n userMenu: [],\n loggedOutItems: [],\n logo: null,\n logoAltText: null,\n logoDestination: null,\n avatar: null,\n username: null,\n loggedIn: false,\n appMenu: null,\n};\n\nexport default injectIntl(DesktopHeader);\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,EAAEC,SAAS,QAAQ,6BAA6B;AACnE,SAASC,SAAS,QAAQ,wBAAwB;;AAElD;AACA,SAASC,IAAI,EAAEC,WAAW,EAAEC,WAAW,QAAQ,QAAQ;AACvD,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,UAAU,EAAEC,IAAI,QAAQ,QAAQ;;AAEzC;AACA,OAAOC,QAAQ,MAAM,mBAAmB;;AAExC;AACA,SAASC,SAAS,QAAQ,SAAS;AAAC,IAE9BC,aAAa,0BAAAC,gBAAA;EAAAC,SAAA,CAAAF,aAAA,EAAAC,gBAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,aAAA;EACjB,SAAAA,cAAYK,KAAK,EAAE;IAAAC,eAAA,OAAAN,aAAA;IAAE;IAAA,OAAAG,MAAA,CAAAI,IAAA,OACbF,KAAK;EACb;EAACG,YAAA,CAAAR,aAAA;IAAAS,GAAA;IAAAC,KAA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E,EAAE;EACZU,cAAc,EAAE,EAAE;EAClBO,IAAI,EAAE,IAAI;EACVC,WAAW,EAAE,IAAI;EACjBC,eAAe,EAAE,IAAI;EACrBlB,MAAM,EAAE,IAAI;EACZC,QAAQ,EAAE,IAAI;EACdkB,QAAQ,EAAE,KAAK;EACf5B,OAAO,EAAE;AACX,CAAC;AAED,eAAexC,UAAU,CAACW,aAAa,CAAC"} \ No newline at end of file diff --git a/dist/Header.js b/dist/Header.js new file mode 100644 index 0000000000..aa00654a5b --- /dev/null +++ b/dist/Header.js @@ -0,0 +1,82 @@ +import React, { useContext } from 'react'; +import Responsive from 'react-responsive'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { AppContext } from '@edx/frontend-platform/react'; +import { APP_CONFIG_INITIALIZED, ensureConfig, mergeConfig, getConfig, subscribe } from '@edx/frontend-platform'; +import DesktopHeader from './DesktopHeader'; +import MobileHeader from './MobileHeader'; +import messages from './Header.messages'; +ensureConfig(['LMS_BASE_URL', 'LOGOUT_URL', 'LOGIN_URL', 'SITE_NAME', 'LOGO_URL', 'ORDER_HISTORY_URL'], 'Header component'); +subscribe(APP_CONFIG_INITIALIZED, function () { + mergeConfig({ + AUTHN_MINIMAL_HEADER: !!process.env.AUTHN_MINIMAL_HEADER + }, 'Header additional config'); +}); +var Header = function Header(_ref) { + var intl = _ref.intl; + var _useContext = useContext(AppContext), + authenticatedUser = _useContext.authenticatedUser, + config = _useContext.config; + var mainMenu = [{ + type: 'item', + href: "".concat(config.LMS_BASE_URL, "/dashboard"), + content: intl.formatMessage(messages['header.links.courses']) + }]; + var orderHistoryItem = { + type: 'item', + href: config.ORDER_HISTORY_URL, + content: intl.formatMessage(messages['header.user.menu.order.history']) + }; + var userMenu = authenticatedUser === null ? [] : [{ + type: 'item', + href: "".concat(config.LMS_BASE_URL, "/dashboard"), + content: intl.formatMessage(messages['header.user.menu.dashboard']) + }, { + type: 'item', + href: "".concat(config.ACCOUNT_PROFILE_URL, "/u/").concat(authenticatedUser.username), + content: intl.formatMessage(messages['header.user.menu.profile']) + }, { + type: 'item', + href: config.ACCOUNT_SETTINGS_URL, + content: intl.formatMessage(messages['header.user.menu.account.settings']) + }, { + type: 'item', + href: config.LOGOUT_URL, + content: intl.formatMessage(messages['header.user.menu.logout']) + }]; + + // Users should only see Order History if have a ORDER_HISTORY_URL define in the environment. + if (config.ORDER_HISTORY_URL) { + userMenu.splice(-1, 0, orderHistoryItem); + } + var loggedOutItems = [{ + type: 'item', + href: config.LOGIN_URL, + content: intl.formatMessage(messages['header.user.menu.login']) + }, { + type: 'item', + href: "".concat(config.LMS_BASE_URL, "/register"), + content: intl.formatMessage(messages['header.user.menu.register']) + }]; + var props = { + logo: config.LOGO_URL, + logoAltText: config.SITE_NAME, + logoDestination: "".concat(config.LMS_BASE_URL, "/dashboard"), + loggedIn: authenticatedUser !== null, + username: authenticatedUser !== null ? authenticatedUser.username : null, + avatar: authenticatedUser !== null ? authenticatedUser.avatar : null, + mainMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : mainMenu, + userMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : userMenu, + loggedOutItems: getConfig().AUTHN_MINIMAL_HEADER ? [] : loggedOutItems + }; + return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Responsive, { + maxWidth: 768 + }, /*#__PURE__*/React.createElement(MobileHeader, props)), /*#__PURE__*/React.createElement(Responsive, { + minWidth: 769 + }, /*#__PURE__*/React.createElement(DesktopHeader, props))); +}; +Header.propTypes = { + intl: intlShape.isRequired +}; +export default injectIntl(Header); +//# sourceMappingURL=Header.js.map \ No newline at end of file diff --git a/dist/Header.js.map b/dist/Header.js.map new file mode 100644 index 0000000000..34762696a2 --- /dev/null +++ b/dist/Header.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Header.js","names":["React","useContext","Responsive","injectIntl","intlShape","AppContext","APP_CONFIG_INITIALIZED","ensureConfig","mergeConfig","getConfig","subscribe","DesktopHeader","MobileHeader","messages","AUTHN_MINIMAL_HEADER","process","env","Header","_ref","intl","_useContext","authenticatedUser","config","mainMenu","type","href","concat","LMS_BASE_URL","content","formatMessage","orderHistoryItem","ORDER_HISTORY_URL","userMenu","ACCOUNT_PROFILE_URL","username","ACCOUNT_SETTINGS_URL","LOGOUT_URL","splice","loggedOutItems","LOGIN_URL","props","logo","LOGO_URL","logoAltText","SITE_NAME","logoDestination","loggedIn","avatar","createElement","Fragment","maxWidth","minWidth","propTypes","isRequired"],"sources":["../src/Header.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport Responsive from 'react-responsive';\nimport { injectIntl, intlShape } from '@edx/frontend-platform/i18n';\nimport { AppContext } from '@edx/frontend-platform/react';\nimport {\n APP_CONFIG_INITIALIZED,\n ensureConfig,\n mergeConfig,\n getConfig,\n subscribe,\n} from '@edx/frontend-platform';\n\nimport DesktopHeader from './DesktopHeader';\nimport MobileHeader from './MobileHeader';\n\nimport messages from './Header.messages';\n\nensureConfig([\n 'LMS_BASE_URL',\n 'LOGOUT_URL',\n 'LOGIN_URL',\n 'SITE_NAME',\n 'LOGO_URL',\n 'ORDER_HISTORY_URL',\n], 'Header component');\n\nsubscribe(APP_CONFIG_INITIALIZED, () => {\n mergeConfig({\n AUTHN_MINIMAL_HEADER: !!process.env.AUTHN_MINIMAL_HEADER,\n }, 'Header additional config');\n});\n\nconst Header = ({ intl }) => {\n const { authenticatedUser, config } = useContext(AppContext);\n\n const mainMenu = [\n {\n type: 'item',\n href: `${config.LMS_BASE_URL}/dashboard`,\n content: intl.formatMessage(messages['header.links.courses']),\n },\n ];\n\n const orderHistoryItem = {\n type: 'item',\n href: config.ORDER_HISTORY_URL,\n content: intl.formatMessage(messages['header.user.menu.order.history']),\n };\n\n const userMenu = authenticatedUser === null ? [] : [\n {\n type: 'item',\n href: `${config.LMS_BASE_URL}/dashboard`,\n content: intl.formatMessage(messages['header.user.menu.dashboard']),\n },\n {\n type: 'item',\n href: `${config.ACCOUNT_PROFILE_URL}/u/${authenticatedUser.username}`,\n content: intl.formatMessage(messages['header.user.menu.profile']),\n },\n {\n type: 'item',\n href: config.ACCOUNT_SETTINGS_URL,\n content: intl.formatMessage(messages['header.user.menu.account.settings']),\n },\n {\n type: 'item',\n href: config.LOGOUT_URL,\n content: intl.formatMessage(messages['header.user.menu.logout']),\n },\n ];\n\n // Users should only see Order History if have a ORDER_HISTORY_URL define in the environment.\n if (config.ORDER_HISTORY_URL) {\n userMenu.splice(-1, 0, orderHistoryItem);\n }\n\n const loggedOutItems = [\n {\n type: 'item',\n href: config.LOGIN_URL,\n content: intl.formatMessage(messages['header.user.menu.login']),\n },\n {\n type: 'item',\n href: `${config.LMS_BASE_URL}/register`,\n content: intl.formatMessage(messages['header.user.menu.register']),\n },\n ];\n\n const props = {\n logo: config.LOGO_URL,\n logoAltText: config.SITE_NAME,\n logoDestination: `${config.LMS_BASE_URL}/dashboard`,\n loggedIn: authenticatedUser !== null,\n username: authenticatedUser !== null ? authenticatedUser.username : null,\n avatar: authenticatedUser !== null ? authenticatedUser.avatar : null,\n mainMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : mainMenu,\n userMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : userMenu,\n loggedOutItems: getConfig().AUTHN_MINIMAL_HEADER ? [] : loggedOutItems,\n };\n\n return (\n <>\n \n \n \n \n \n \n \n );\n};\n\nHeader.propTypes = {\n intl: intlShape.isRequired,\n};\n\nexport default injectIntl(Header);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,kBAAkB;AACzC,SAASC,UAAU,EAAEC,SAAS,QAAQ,6BAA6B;AACnE,SAASC,UAAU,QAAQ,8BAA8B;AACzD,SACEC,sBAAsB,EACtBC,YAAY,EACZC,WAAW,EACXC,SAAS,EACTC,SAAS,QACJ,wBAAwB;AAE/B,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,YAAY,MAAM,gBAAgB;AAE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QAAQ,GAAG,IAAI;IACxEa,MAAM,EAAE1B,iBAAiB,KAAK,IAAI,GAAGA,iBAAiB,CAAC0B,MAAM,GAAG,IAAI;IACpExB,QAAQ,EAAEd,SAAS,CAAC,CAAC,CAACK,oBAAoB,GAAG,EAAE,GAAGS,QAAQ;IAC1DS,QAAQ,EAAEvB,SAAS,CAAC,CAAC,CAACK,oBAAoB,GAAG,EAAE,GAAGkB,QAAQ;IAC1DM,cAAc,EAAE7B,SAAS,CAAC,CAAC,CAACK,oBAAoB,GAAG,EAAE,GAAGwB;EAC1D,CAAC;EAED,oBACEtC,KAAA,CAAAgD,aAAA,CAAAhD,KAAA,CAAAiD,QAAA,qBACEjD,KAAA,CAAAgD,aAAA,CAAC9C,UAAU;IAACgD,QAAQ,EAAE;EAAI,gBACxBlD,KAAA,CAAAgD,aAAA,CAACpC,YAAY,EAAK4B,KAAQ,CAChB,CAAC,eACbxC,KAAA,CAAAgD,aAAA,CAAC9C,UAAU;IAACiD,QAAQ,EAAE;EAAI,gBACxBnD,KAAA,CAAAgD,aAAA,CAACrC,aAAa,EAAK6B,KAAQ,CACjB,CACZ,CAAC;AAEP,CAAC;AAEDvB,MAAM,CAACmC,SAAS,GAAG;EACjBjC,IAAI,EAAEf,SAAS,CAACiD;AAClB,CAAC;AAED,eAAelD,UAAU,CAACc,MAAM,CAAC"} \ No newline at end of file diff --git a/dist/Header.messages.js b/dist/Header.messages.js new file mode 100644 index 0000000000..4aac3e8fd2 --- /dev/null +++ b/dist/Header.messages.js @@ -0,0 +1,115 @@ +import { defineMessages } from '@edx/frontend-platform/i18n'; +var messages = defineMessages({ + 'header.links.courses': { + id: 'header.links.courses', + defaultMessage: 'Courses', + description: 'Link to the learner course dashboard' + }, + 'header.links.programs': { + id: 'header.links.programs', + defaultMessage: 'Programs', + description: 'Link to the learner program dashboard' + }, + 'header.links.content.search': { + id: 'header.links.content.search', + defaultMessage: 'Discover New', + description: 'Link to the content search page' + }, + 'header.links.schools': { + id: 'header.links.schools', + defaultMessage: 'Schools & Partners', + description: 'Link to the schools and partners landing page' + }, + 'header.user.menu.dashboard': { + id: 'header.user.menu.dashboard', + defaultMessage: 'Dashboard', + description: 'Link to the user dashboard' + }, + 'header.user.menu.profile': { + id: 'header.user.menu.profile', + defaultMessage: 'Profile', + description: 'Link to the user profile' + }, + 'header.user.menu.account.settings': { + id: 'header.user.menu.account.settings', + defaultMessage: 'Account', + description: 'Link to account settings' + }, + 'header.user.menu.order.history': { + id: 'header.user.menu.order.history', + defaultMessage: 'Order History', + description: 'Link to order history' + }, + 'header.user.menu.logout': { + id: 'header.user.menu.logout', + defaultMessage: 'Logout', + description: 'Logout link' + }, + 'header.user.menu.login': { + id: 'header.user.menu.login', + defaultMessage: 'Login', + description: 'Login link' + }, + 'header.user.menu.register': { + id: 'header.user.menu.register', + defaultMessage: 'Sign Up', + description: 'Link to registration' + }, + 'header.user.menu.studio.home': { + id: 'header.user.menu.studio.home', + defaultMessage: 'Studio Home', + description: 'Link to the Studio Home' + }, + 'header.user.menu.studio.maintenance': { + id: 'header.user.menu.studio.maintenance', + defaultMessage: 'Maintenance', + description: 'Link to the Studio Maintenance' + }, + 'header.label.account.nav': { + id: 'header.label.account.nav', + defaultMessage: 'Account', + description: 'The aria label for the account menu nav' + }, + 'header.label.account.menu': { + id: 'header.label.account.menu', + defaultMessage: 'Account Menu', + description: 'The aria label for the account menu trigger' + }, + 'header.label.account.menu.for': { + id: 'header.label.account.menu.for', + defaultMessage: 'Account menu for {username}', + description: 'The aria label for the account menu trigger when the username is displayed in it' + }, + 'header.label.main.nav': { + id: 'header.label.main.nav', + defaultMessage: 'Main', + description: 'The aria label for the main menu nav' + }, + 'header.label.main.menu': { + id: 'header.label.main.menu', + defaultMessage: 'Main Menu', + description: 'The aria label for the main menu trigger' + }, + 'header.label.main.header': { + id: 'header.label.main.header', + defaultMessage: 'Main', + description: 'The aria label for the main header' + }, + 'header.label.secondary.nav': { + id: 'header.label.secondary.nav', + defaultMessage: 'Secondary', + description: 'The aria label for the seconary nav' + }, + 'header.label.skip.nav': { + id: 'header.label.skip.nav', + defaultMessage: 'Skip to main content', + description: 'A link used by screen readers to allow users to skip to the main content of the page.' + }, + 'header.label.app.nav': { + id: 'header.label.app.nav', + defaultMessage: 'App', + description: 'The aria label for the app Nav' + } +}); +export default messages; +//# sourceMappingURL=Header.messages.js.map \ No newline at end of file diff --git a/dist/Header.messages.js.map b/dist/Header.messages.js.map new file mode 100644 index 0000000000..c51c547895 --- /dev/null +++ b/dist/Header.messages.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Header.messages.js","names":["defineMessages","messages","id","defaultMessage","description"],"sources":["../src/Header.messages.jsx"],"sourcesContent":["import { defineMessages } from '@edx/frontend-platform/i18n';\n\nconst messages = defineMessages({\n 'header.links.courses': {\n id: 'header.links.courses',\n defaultMessage: 'Courses',\n description: 'Link to the learner course dashboard',\n },\n 'header.links.programs': {\n id: 'header.links.programs',\n defaultMessage: 'Programs',\n description: 'Link to the learner program dashboard',\n },\n 'header.links.content.search': {\n id: 'header.links.content.search',\n defaultMessage: 'Discover New',\n description: 'Link to the content search page',\n },\n 'header.links.schools': {\n id: 'header.links.schools',\n defaultMessage: 'Schools & Partners',\n description: 'Link to the schools and partners landing page',\n },\n 'header.user.menu.dashboard': {\n id: 'header.user.menu.dashboard',\n defaultMessage: 'Dashboard',\n description: 'Link to the user dashboard',\n },\n 'header.user.menu.profile': {\n id: 'header.user.menu.profile',\n defaultMessage: 'Profile',\n description: 'Link to the user profile',\n },\n 'header.user.menu.account.settings': {\n id: 'header.user.menu.account.settings',\n defaultMessage: 'Account',\n description: 'Link to account settings',\n },\n 'header.user.menu.order.history': {\n id: 'header.user.menu.order.history',\n defaultMessage: 'Order History',\n description: 'Link to order history',\n },\n 'header.user.menu.logout': {\n id: 'header.user.menu.logout',\n defaultMessage: 'Logout',\n description: 'Logout link',\n },\n 'header.user.menu.login': {\n id: 'header.user.menu.login',\n defaultMessage: 'Login',\n description: 'Login link',\n },\n 'header.user.menu.register': {\n id: 'header.user.menu.register',\n defaultMessage: 'Sign Up',\n description: 'Link to registration',\n },\n 'header.user.menu.studio.home': {\n id: 'header.user.menu.studio.home',\n defaultMessage: 'Studio Home',\n description: 'Link to the Studio Home',\n },\n 'header.user.menu.studio.maintenance': {\n id: 'header.user.menu.studio.maintenance',\n defaultMessage: 'Maintenance',\n description: 'Link to the Studio Maintenance',\n },\n 'header.label.account.nav': {\n id: 'header.label.account.nav',\n defaultMessage: 'Account',\n description: 'The aria label for the account menu nav',\n },\n 'header.label.account.menu': {\n id: 'header.label.account.menu',\n defaultMessage: 'Account Menu',\n description: 'The aria label for the account menu trigger',\n },\n 'header.label.account.menu.for': {\n id: 'header.label.account.menu.for',\n defaultMessage: 'Account menu for {username}',\n description: 'The aria label for the account menu trigger when the username is displayed in it',\n },\n 'header.label.main.nav': {\n id: 'header.label.main.nav',\n defaultMessage: 'Main',\n description: 'The aria label for the main menu nav',\n },\n 'header.label.main.menu': {\n id: 'header.label.main.menu',\n defaultMessage: 'Main Menu',\n description: 'The aria label for the main menu trigger',\n },\n 'header.label.main.header': {\n id: 'header.label.main.header',\n defaultMessage: 'Main',\n description: 'The aria label for the main header',\n },\n 'header.label.secondary.nav': {\n id: 'header.label.secondary.nav',\n defaultMessage: 'Secondary',\n description: 'The aria label for the seconary nav',\n },\n 'header.label.skip.nav': {\n id: 'header.label.skip.nav',\n defaultMessage: 'Skip to main content',\n description: 'A link used by screen readers to allow users to skip to the main content of the page.',\n },\n 'header.label.app.nav': {\n id: 'header.label.app.nav',\n defaultMessage: 'App',\n description: 'The aria label for the app Nav',\n },\n});\n\nexport default messages;\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,6BAA6B;AAE5D,IAAMC,QAAQ,GAAGD,cAAc,CAAC;EAC9B,sBAAsB,EAAE;IACtBE,EAAE,EAAE,sBAAsB;IAC1BC,cAAc,EAAE,SAAS;IACzBC,WAAW,EAAE;EACf,CAAC;EACD,uBAAuB,EAAE;IACv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,0BAA0B,EAAE;IAC1BF,EAAE,EAAE,0BAA0B;IAC9BC,cAAc,EAAE,SAAS;IACzBC,WAAW,EAAE;EACf,CAAC;EACD,2BAA2B,EAAE;IAC3BF,EAAE,EAAE,2BAA2B;IAC/BC,cAAc,EAAE,cAAc;IAC9BC,WAAW,EAAE;EACf,CAAC;EACD,+BAA+B,EAAE;IAC/BF,EAAE,EAAE,+BAA+B;IACnCC,cAAc,EAAE,6BAA6B;IAC7CC,WAAW,EAAE;EACf,CAAC;EACD,uBAAuB,EAAE;IACvBF,EAAE,EAAE,uBAAuB;IAC3BC,cAAc,EAAE,MAAM;IACtBC,WAAW,EAAE;EACf,CAAC;EACD,wBAAwB,EAAE;IACxBF,EAAE,EAAE,wBAAwB;IAC5BC,cAAc,EAAE,WAAW;IAC3BC,WAAW,EAAE;EACf,CAAC;EACD,0BAA0B,EAAE;IAC1BF,EAAE,EAAE,0BAA0B;IAC9BC,cAAc,EAAE,MAAM;IACtBC,WAAW,EAAE;EACf,CAAC;EACD,4BAA4B,EAAE;IAC5BF,EAAE,EAAE,4BAA4B;IAChCC,cAAc,EAAE,WAAW;IAC3BC,WAAW,EAAE;EACf,CAAC;EACD,uBAAuB,EAAE;IACvBF,EAAE,EAAE,uBAAuB;IAC3BC,cAAc,EAAE,sBAAsB;IACtCC,WAAW,EAAE;EACf,CAAC;EACD,sBAAsB,EAAE;IACtBF,EAAE,EAAE,sBAAsB;IAC1BC,cAAc,EAAE,KAAK;IACrBC,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAEF,eAAeH,QAAQ"} \ No newline at end of file diff --git a/dist/Header.test.jsx b/dist/Header.test.jsx new file mode 100644 index 0000000000..51fef2089c --- /dev/null +++ b/dist/Header.test.jsx @@ -0,0 +1,104 @@ +/* eslint-disable react/prop-types */ +import React from 'react'; +import { IntlProvider } from '@edx/frontend-platform/i18n'; +import TestRenderer from 'react-test-renderer'; +import { AppContext } from '@edx/frontend-platform/react'; +import { Context as ResponsiveContext } from 'react-responsive'; + +import Header from './index'; + +const HeaderComponent = ({ width, contextValue }) => ( + + + +
+ + + +); + +describe('
', () => { + it('renders correctly for anonymous desktop', () => { + const contextValue = { + authenticatedUser: null, + config: { + LMS_BASE_URL: process.env.LMS_BASE_URL, + SITE_NAME: process.env.SITE_NAME, + LOGIN_URL: process.env.LOGIN_URL, + LOGOUT_URL: process.env.LOGOUT_URL, + LOGO_URL: process.env.LOGO_URL, + }, + }; + const component = ; + + const wrapper = TestRenderer.create(component); + + expect(wrapper.toJSON()).toMatchSnapshot(); + }); + + it('renders correctly for authenticated desktop', () => { + const contextValue = { + authenticatedUser: { + userId: 'abc123', + username: 'edX', + roles: [], + administrator: false, + }, + config: { + LMS_BASE_URL: process.env.LMS_BASE_URL, + SITE_NAME: process.env.SITE_NAME, + LOGIN_URL: process.env.LOGIN_URL, + LOGOUT_URL: process.env.LOGOUT_URL, + LOGO_URL: process.env.LOGO_URL, + }, + }; + const component = ; + + const wrapper = TestRenderer.create(component); + + expect(wrapper.toJSON()).toMatchSnapshot(); + }); + + it('renders correctly for anonymous mobile', () => { + const contextValue = { + authenticatedUser: null, + config: { + LMS_BASE_URL: process.env.LMS_BASE_URL, + SITE_NAME: process.env.SITE_NAME, + LOGIN_URL: process.env.LOGIN_URL, + LOGOUT_URL: process.env.LOGOUT_URL, + LOGO_URL: process.env.LOGO_URL, + }, + }; + const component = ; + + const wrapper = TestRenderer.create(component); + + expect(wrapper.toJSON()).toMatchSnapshot(); + }); + + it('renders correctly for authenticated mobile', () => { + const contextValue = { + authenticatedUser: { + userId: 'abc123', + username: 'edX', + roles: [], + administrator: false, + }, + config: { + LMS_BASE_URL: process.env.LMS_BASE_URL, + SITE_NAME: process.env.SITE_NAME, + LOGIN_URL: process.env.LOGIN_URL, + LOGOUT_URL: process.env.LOGOUT_URL, + LOGO_URL: process.env.LOGO_URL, + }, + }; + const component = ; + + const wrapper = TestRenderer.create(component); + + expect(wrapper.toJSON()).toMatchSnapshot(); + }); +}); diff --git a/dist/Icons.js b/dist/Icons.js new file mode 100644 index 0000000000..876eb1fb51 --- /dev/null +++ b/dist/Icons.js @@ -0,0 +1,52 @@ +function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); } +import React from 'react'; +export var MenuIcon = function MenuIcon(props) { + return /*#__PURE__*/React.createElement("svg", _extends({ + width: "24px", + height: "24px", + viewBox: "0 0 24 24", + version: "1.1" + }, props), /*#__PURE__*/React.createElement("rect", { + fill: "currentColor", + x: "2", + y: "5", + width: "20", + height: "2" + }), /*#__PURE__*/React.createElement("rect", { + fill: "currentColor", + x: "2", + y: "11", + width: "20", + height: "2" + }), /*#__PURE__*/React.createElement("rect", { + fill: "currentColor", + x: "2", + y: "17", + width: "20", + height: "2" + })); +}; +export var AvatarIcon = function AvatarIcon(props) { + return /*#__PURE__*/React.createElement("svg", _extends({ + width: "24px", + height: "24px", + viewBox: "0 0 24 24", + version: "1.1" + }, props), /*#__PURE__*/React.createElement("path", { + d: "M4.10255106,18.1351061 C4.7170266,16.0581859 8.01891846,14.4720277 12,14.4720277 C15.9810815,14.4720277 19.2829734,16.0581859 19.8974489,18.1351061 C21.215206,16.4412566 22,14.3122775 22,12 C22,6.4771525 17.5228475,2 12,2 C6.4771525,2 2,6.4771525 2,12 C2,14.3122775 2.78479405,16.4412566 4.10255106,18.1351061 Z M12,24 C5.372583,24 0,18.627417 0,12 C0,5.372583 5.372583,0 12,0 C18.627417,0 24,5.372583 24,12 C24,18.627417 18.627417,24 12,24 Z M12,13 C9.790861,13 8,11.209139 8,9 C8,6.790861 9.790861,5 12,5 C14.209139,5 16,6.790861 16,9 C16,11.209139 14.209139,13 12,13 Z", + fill: "currentColor" + })); +}; +export var CaretIcon = function CaretIcon(props) { + return /*#__PURE__*/React.createElement("svg", _extends({ + width: "16px", + height: "16px", + viewBox: "0 0 16 16", + version: "1.1" + }, props), /*#__PURE__*/React.createElement("path", { + d: "M7,4 L7,8 L11,8 L11,10 L5,10 L5,4 L7,4 Z", + fill: "currentColor", + transform: "translate(8.000000, 7.000000) rotate(-45.000000) translate(-8.000000, -7.000000) " + })); +}; +//# sourceMappingURL=Icons.js.map \ No newline at end of file diff --git a/dist/Icons.js.map b/dist/Icons.js.map new file mode 100644 index 0000000000..b0204c65fb --- /dev/null +++ b/dist/Icons.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Icons.js","names":["React","MenuIcon","props","createElement","_extends","width","height","viewBox","version","fill","x","y","AvatarIcon","d","CaretIcon","transform"],"sources":["../src/Icons.jsx"],"sourcesContent":["import React from 'react';\n\nexport const MenuIcon = (props) => (\n \n \n \n \n \n);\n\nexport const AvatarIcon = (props) => (\n \n \n \n);\n\nexport const CaretIcon = (props) => (\n \n \n \n);\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAO,IAAMC,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,KAAK;EAAA,oBAC5BF,KAAA,CAAAG,aAAA,QAAAC,QAAA;IACEC,KAAK,EAAC,MAAM;IACZC,MAAM,EAAC,MAAM;IACbC,OAAO,EAAC,WAAW;IACnBC,OAAO,EAAC;EAAK,GACTN,KAAK,gBAETF,KAAA,CAAAG,aAAA;IAAMM,IAAI,EAAC,cAAc;IAACC,CAAC,EAAC,GAAG;IAACC,CAAC,EAAC,GAAG;IAACN,KAAK,EAAC,IAAI;IAACC,MAAM,EAAC;EAAG,CAAE,CAAC,eAC9DN,KAAA,CAAAG,aAAA;IAAMM,IAAI,EAAC,cAAc;IAACC,CAAC,EAAC,GAAG;IAACC,CAAC,EAAC,IAAI;IAACN,KAAK,EAAC,IAAI;IAACC,MAAM,EAAC;EAAG,CAAE,CAAC,eAC/DN,KAAA,CAAAG,aAAA;IAAMM,IAAI,EAAC,cAAc;IAACC,CAAC,EAAC,GAAG;IAACC,CAAC,EAAC,IAAI;IAACN,KAAK,EAAC,IAAI;IAACC,MAAM,EAAC;EAAG,CAAE,CAC3D,CAAC;AAAA,CACP;AAED,OAAO,IAAMM,UAAU,GAAG,SAAbA,UAAUA,CAAIV,KAAK;EAAA,oBAC9BF,KAAA,CAAAG,aAAA,QAAAC,QAAA;IACEC,KAAK,EAAC,MAAM;IACZC,MAAM,EAAC,MAAM;IACbC,OAAO,EAAC,WAAW;IACnBC,OAAO,EAAC;EAAK,GACTN,KAAK,gBAETF,KAAA,CAAAG,aAAA;IACEU,CAAC,EAAC,6jBAA6jB;IAC/jBJ,IAAI,EAAC;EAAc,CACpB,CACE,CAAC;AAAA,CACP;AAED,OAAO,IAAMK,SAAS,GAAG,SAAZA,SAASA,CAAIZ,KAAK;EAAA,oBAC7BF,KAAA,CAAAG,aAAA,QAAAC,QAAA;IACEC,KAAK,EAAC,MAAM;IACZC,MAAM,EAAC,MAAM;IACbC,OAAO,EAAC,WAAW;IACnBC,OAAO,EAAC;EAAK,GACTN,KAAK,gBAETF,KAAA,CAAAG,aAAA;IACEU,CAAC,EAAC,0CAA0C;IAC5CJ,IAAI,EAAC,cAAc;IACnBM,SAAS,EAAC;EAAmF,CAC9F,CACE,CAAC;AAAA,CACP"} \ No newline at end of file diff --git a/dist/Logo.js b/dist/Logo.js new file mode 100644 index 0000000000..5bff15329d --- /dev/null +++ b/dist/Logo.js @@ -0,0 +1,41 @@ +var _excluded = ["src", "alt"], + _excluded2 = ["href", "src", "alt"]; +function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); } +function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } +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; } +import React from 'react'; +import PropTypes from 'prop-types'; +var Logo = function Logo(_ref) { + var src = _ref.src, + alt = _ref.alt, + attributes = _objectWithoutProperties(_ref, _excluded); + return /*#__PURE__*/React.createElement("img", _extends({ + src: src, + alt: alt + }, attributes)); +}; +Logo.propTypes = { + src: PropTypes.string.isRequired, + alt: PropTypes.string.isRequired +}; +var LinkedLogo = function LinkedLogo(_ref2) { + var href = _ref2.href, + src = _ref2.src, + alt = _ref2.alt, + attributes = _objectWithoutProperties(_ref2, _excluded2); + return /*#__PURE__*/React.createElement("a", _extends({ + href: href + }, attributes), /*#__PURE__*/React.createElement("img", { + className: "d-block", + src: src, + alt: alt + })); +}; +LinkedLogo.propTypes = { + href: PropTypes.string.isRequired, + src: PropTypes.string.isRequired, + alt: PropTypes.string.isRequired +}; +export { LinkedLogo, Logo }; +export default Logo; +//# sourceMappingURL=Logo.js.map \ No newline at end of file diff --git a/dist/Logo.js.map b/dist/Logo.js.map new file mode 100644 index 0000000000..6c1423e209 --- /dev/null +++ b/dist/Logo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Logo.js","names":["React","PropTypes","Logo","_ref","src","alt","attributes","_objectWithoutProperties","_excluded","createElement","_extends","propTypes","string","isRequired","LinkedLogo","_ref2","href","_excluded2","className"],"sources":["../src/Logo.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst Logo = ({ src, alt, ...attributes }) => (\n {alt}\n);\n\nLogo.propTypes = {\n src: PropTypes.string.isRequired,\n alt: PropTypes.string.isRequired,\n};\n\nconst LinkedLogo = ({\n href,\n src,\n alt,\n ...attributes\n}) => (\n \n {alt}\n \n);\n\nLinkedLogo.propTypes = {\n href: PropTypes.string.isRequired,\n src: PropTypes.string.isRequired,\n alt: PropTypes.string.isRequired,\n};\n\nexport { LinkedLogo, Logo };\nexport default Logo;\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,IAAMC,IAAI,GAAG,SAAPA,IAAIA,CAAAC,IAAA;EAAA,IAAMC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IAAKC,UAAU,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAAA,oBACrCR,KAAA,CAAAS,aAAA,QAAAC,QAAA;IAAKN,GAAG,EAAEA,GAAI;IAACC,GAAG,EAAEA;EAAI,GAAKC,UAAU,CAAG,CAAC;AAAA,CAC5C;AAEDJ,IAAI,CAACS,SAAS,GAAG;EACfP,GAAG,EAAEH,SAAS,CAACW,MAAM,CAACC,UAAU;EAChCR,GAAG,EAAEJ,SAAS,CAACW,MAAM,CAACC;AACxB,CAAC;AAED,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAAC,KAAA;EAAA,IACdC,IAAI,GAAAD,KAAA,CAAJC,IAAI;IACJZ,GAAG,GAAAW,KAAA,CAAHX,GAAG;IACHC,GAAG,GAAAU,KAAA,CAAHV,GAAG;IACAC,UAAU,GAAAC,wBAAA,CAAAQ,KAAA,EAAAE,UAAA;EAAA,oBAEbjB,KAAA,CAAAS,aAAA,MAAAC,QAAA;IAAGM,IAAI,EAAEA;EAAK,GAAKV,UAAU,gBAC3BN,KAAA,CAAAS,aAAA;IAAKS,SAAS,EAAC,SAAS;IAACd,GAAG,EAAEA,GAAI;IAACC,GAAG,EAAEA;EAAI,CAAE,CAC7C,CAAC;AAAA,CACL;AAEDS,UAAU,CAACH,SAAS,GAAG;EACrBK,IAAI,EAAEf,SAAS,CAACW,MAAM,CAACC,UAAU;EACjCT,GAAG,EAAEH,SAAS,CAACW,MAAM,CAACC,UAAU;EAChCR,GAAG,EAAEJ,SAAS,CAACW,MAAM,CAACC;AACxB,CAAC;AAED,SAASC,UAAU,EAAEZ,IAAI;AACzB,eAAeA,IAAI"} \ No newline at end of file diff --git a/dist/Menu/Menu.js b/dist/Menu/Menu.js new file mode 100644 index 0000000000..bde982ee1d --- /dev/null +++ b/dist/Menu/Menu.js @@ -0,0 +1,323 @@ +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +var _excluded = ["tag", "className"], + _excluded2 = ["tag", "className"]; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } +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; } +import React from 'react'; +import { CSSTransition } from 'react-transition-group'; +import PropTypes from 'prop-types'; +var MenuTrigger = function MenuTrigger(_ref) { + var tag = _ref.tag, + className = _ref.className, + attributes = _objectWithoutProperties(_ref, _excluded); + return /*#__PURE__*/React.createElement(tag, _objectSpread({ + className: "menu-trigger ".concat(className) + }, attributes)); +}; +MenuTrigger.propTypes = { + tag: PropTypes.string, + className: PropTypes.string +}; +MenuTrigger.defaultProps = { + tag: 'div', + className: null +}; +var MenuTriggerComp = /*#__PURE__*/React.createElement(MenuTrigger, null); +var MenuTriggerType = MenuTriggerComp.type; +var MenuContent = function MenuContent(_ref2) { + var tag = _ref2.tag, + className = _ref2.className, + attributes = _objectWithoutProperties(_ref2, _excluded2); + return /*#__PURE__*/React.createElement(tag, _objectSpread({ + className: ['menu-content', className].join(' ') + }, attributes)); +}; +MenuContent.propTypes = { + tag: PropTypes.string, + className: PropTypes.string +}; +MenuContent.defaultProps = { + tag: 'div', + className: null +}; +var menuPropTypes = { + tag: PropTypes.string, + onClose: PropTypes.func, + onOpen: PropTypes.func, + closeOnDocumentClick: PropTypes.bool, + respondToPointerEvents: PropTypes.bool, + className: PropTypes.string, + transitionTimeout: PropTypes.number, + transitionClassName: PropTypes.string, + children: PropTypes.arrayOf(PropTypes.node).isRequired +}; +var Menu = /*#__PURE__*/function (_React$Component) { + _inherits(Menu, _React$Component); + var _super = _createSuper(Menu); + function Menu(props) { + var _this; + _classCallCheck(this, Menu); + _this = _super.call(this, props); + _this.menu = /*#__PURE__*/React.createRef(); + _this.state = { + expanded: false + }; + _this.onTriggerClick = _this.onTriggerClick.bind(_assertThisInitialized(_this)); + _this.onCloseClick = _this.onCloseClick.bind(_assertThisInitialized(_this)); + _this.onKeyDown = _this.onKeyDown.bind(_assertThisInitialized(_this)); + _this.onDocumentClick = _this.onDocumentClick.bind(_assertThisInitialized(_this)); + _this.onMouseEnter = _this.onMouseEnter.bind(_assertThisInitialized(_this)); + _this.onMouseLeave = _this.onMouseLeave.bind(_assertThisInitialized(_this)); + return _this; + } + + // Lifecycle Events + _createClass(Menu, [{ + key: "componentWillUnmount", + value: function componentWillUnmount() { + document.removeEventListener('touchend', this.onDocumentClick, true); + document.removeEventListener('click', this.onDocumentClick, true); + + // Call onClose callback when unmounting and open + if (this.state.expanded && this.props.onClose) { + this.props.onClose(); + } + } + + // Event handlers + }, { + key: "onDocumentClick", + value: function onDocumentClick(e) { + if (!this.props.closeOnDocumentClick) { + return; + } + var clickIsInMenu = this.menu.current === e.target || this.menu.current.contains(e.target); + if (clickIsInMenu) { + return; + } + this.close(); + } + }, { + key: "onTriggerClick", + value: function onTriggerClick(e) { + // Let the browser follow the link of the trigger if the menu + // is already expanded and the trigger has an href attribute + if (this.state.expanded && e.target.getAttribute('href')) { + return; + } + e.preventDefault(); + this.toggle(); + } + }, { + key: "onCloseClick", + value: function onCloseClick() { + this.getFocusableElements()[0].focus(); + this.close(); + } + }, { + key: "onKeyDown", + value: function onKeyDown(e) { + if (!this.state.expanded) { + return; + } + switch (e.key) { + case 'Escape': + { + e.preventDefault(); + e.stopPropagation(); + this.getFocusableElements()[0].focus(); + this.close(); + break; + } + case 'Enter': + { + // Using focusable elements instead of a ref to the trigger + // because Hyperlink and Button can handle refs as functional components + if (document.activeElement === this.getFocusableElements()[0]) { + e.preventDefault(); + this.toggle(); + } + break; + } + case 'Tab': + { + e.preventDefault(); + if (e.shiftKey) { + this.focusPrevious(); + } else { + this.focusNext(); + } + break; + } + case 'ArrowDown': + { + e.preventDefault(); + this.focusNext(); + break; + } + case 'ArrowUp': + { + e.preventDefault(); + this.focusPrevious(); + break; + } + default: + } + } + }, { + key: "onMouseEnter", + value: function onMouseEnter() { + if (!this.props.respondToPointerEvents) { + return; + } + this.open(); + } + }, { + key: "onMouseLeave", + value: function onMouseLeave() { + if (!this.props.respondToPointerEvents) { + return; + } + this.close(); + } + + // Internal functions + }, { + key: "getFocusableElements", + value: function getFocusableElements() { + return this.menu.current.querySelectorAll('button:not([disabled]), [href]:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])'); + } + }, { + key: "getAttributesFromProps", + value: function getAttributesFromProps() { + var _this2 = this; + // Any extra props are attributes for the menu + var attributes = {}; + Object.keys(this.props).filter(function (property) { + return menuPropTypes[property] === undefined; + }).forEach(function (property) { + attributes[property] = _this2.props[property]; + }); + return attributes; + } + }, { + key: "focusNext", + value: function focusNext() { + var focusableElements = Array.from(this.getFocusableElements()); + var activeIndex = focusableElements.indexOf(document.activeElement); + var nextIndex = (activeIndex + 1) % focusableElements.length; + focusableElements[nextIndex].focus(); + } + }, { + key: "focusPrevious", + value: function focusPrevious() { + var focusableElements = Array.from(this.getFocusableElements()); + var activeIndex = focusableElements.indexOf(document.activeElement); + var previousIndex = (activeIndex || focusableElements.length) - 1; + focusableElements[previousIndex].focus(); + } + }, { + key: "open", + value: function open() { + if (this.props.onOpen) { + this.props.onOpen(); + } + this.setState({ + expanded: true + }); + // Listen to touchend and click events to ensure the menu + // can be closed on mobile, pointer, and mixed input devices + document.addEventListener('touchend', this.onDocumentClick, true); + document.addEventListener('click', this.onDocumentClick, true); + } + }, { + key: "close", + value: function close() { + if (this.props.onClose) { + this.props.onClose(); + } + this.setState({ + expanded: false + }); + document.removeEventListener('touchend', this.onDocumentClick, true); + document.removeEventListener('click', this.onDocumentClick, true); + } + }, { + key: "toggle", + value: function toggle() { + if (this.state.expanded) { + this.close(); + } else { + this.open(); + } + } + }, { + key: "renderTrigger", + value: function renderTrigger(node) { + return /*#__PURE__*/React.cloneElement(node, { + onClick: this.onTriggerClick, + 'aria-haspopup': 'menu', + 'aria-expanded': this.state.expanded + }); + } + }, { + key: "renderMenuContent", + value: function renderMenuContent(node) { + return /*#__PURE__*/React.createElement(CSSTransition, { + "in": this.state.expanded, + timeout: this.props.transitionTimeout, + classNames: this.props.transitionClassName, + unmountOnExit: true + }, node); + } + }, { + key: "render", + value: function render() { + var _this3 = this; + var className = this.props.className; + var wrappedChildren = React.Children.map(this.props.children, function (child) { + if (child.type === MenuTriggerType) { + return _this3.renderTrigger(child); + } + return _this3.renderMenuContent(child); + }); + var rootClassName = this.state.expanded ? 'menu expanded' : 'menu'; + return /*#__PURE__*/React.createElement(this.props.tag, _objectSpread({ + className: "".concat(rootClassName, " ").concat(className), + ref: this.menu, + onKeyDown: this.onKeyDown, + onMouseEnter: this.onMouseEnter, + onMouseLeave: this.onMouseLeave + }, this.getAttributesFromProps()), wrappedChildren); + } + }]); + return Menu; +}(React.Component); +Menu.propTypes = menuPropTypes; +Menu.defaultProps = { + tag: 'div', + className: null, + onClose: null, + onOpen: null, + respondToPointerEvents: false, + closeOnDocumentClick: true, + transitionTimeout: 250, + transitionClassName: 'menu-content' +}; +export { Menu, MenuTrigger, MenuContent }; +//# sourceMappingURL=Menu.js.map \ No newline at end of file diff --git a/dist/Menu/Menu.js.map b/dist/Menu/Menu.js.map new file mode 100644 index 0000000000..daff9d3396 --- /dev/null +++ b/dist/Menu/Menu.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Menu.js","names":["React","CSSTransition","PropTypes","MenuTrigger","_ref","tag","className","attributes","_objectWithoutProperties","_excluded","createElement","_objectSpread","concat","propTypes","string","defaultProps","MenuTriggerComp","MenuTriggerType","type","MenuContent","_ref2","_excluded2","join","menuPropTypes","onClose","func","onOpen","closeOnDocumentClick","bool","respondToPointerEvents","transitionTimeout","number","transitionClassName","children","arrayOf","node","isRequired","Menu","_React$Component","_inherits","_super","_createSuper","props","_this","_classCallCheck","call","menu","createRef","state","expanded","onTriggerClick","bind","_assertThisInitialized","onCloseClick","onKeyDown","onDocumentClick","onMouseEnter","onMouseLeave","_createClass","key","value","componentWillUnmount","document","removeEventListener","e","clickIsInMenu","current","target","contains","close","getAttribute","preventDefault","toggle","getFocusableElements","focus","stopPropagation","activeElement","shiftKey","focusPrevious","focusNext","open","querySelectorAll","getAttributesFromProps","_this2","Object","keys","filter","property","undefined","forEach","focusableElements","Array","from","activeIndex","indexOf","nextIndex","length","previousIndex","setState","addEventListener","renderTrigger","cloneElement","onClick","renderMenuContent","timeout","classNames","unmountOnExit","render","_this3","wrappedChildren","Children","map","child","rootClassName","ref","Component"],"sources":["../../src/Menu/Menu.jsx"],"sourcesContent":["import React from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport PropTypes from 'prop-types';\n\nconst MenuTrigger = ({ tag, className, ...attributes }) => React.createElement(tag, {\n className: `menu-trigger ${className}`,\n ...attributes,\n});\nMenuTrigger.propTypes = {\n tag: PropTypes.string,\n className: PropTypes.string,\n};\nMenuTrigger.defaultProps = {\n tag: 'div',\n className: null,\n};\nconst MenuTriggerComp = ;\nconst MenuTriggerType = MenuTriggerComp.type;\n\nconst MenuContent = ({ tag, className, ...attributes }) => React.createElement(tag, {\n className: ['menu-content', className].join(' '),\n ...attributes,\n});\nMenuContent.propTypes = {\n tag: PropTypes.string,\n className: PropTypes.string,\n};\nMenuContent.defaultProps = {\n tag: 'div',\n className: null,\n};\n\nconst menuPropTypes = {\n tag: PropTypes.string,\n onClose: PropTypes.func,\n onOpen: PropTypes.func,\n closeOnDocumentClick: PropTypes.bool,\n respondToPointerEvents: PropTypes.bool,\n className: PropTypes.string,\n transitionTimeout: PropTypes.number,\n transitionClassName: PropTypes.string,\n children: PropTypes.arrayOf(PropTypes.node).isRequired,\n};\n\nclass Menu extends React.Component {\n constructor(props) {\n super(props);\n\n this.menu = React.createRef();\n this.state = {\n expanded: false,\n };\n\n this.onTriggerClick = this.onTriggerClick.bind(this);\n this.onCloseClick = this.onCloseClick.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n this.onDocumentClick = this.onDocumentClick.bind(this);\n this.onMouseEnter = this.onMouseEnter.bind(this);\n this.onMouseLeave = this.onMouseLeave.bind(this);\n }\n\n // Lifecycle Events\n componentWillUnmount() {\n document.removeEventListener('touchend', this.onDocumentClick, true);\n document.removeEventListener('click', this.onDocumentClick, true);\n\n // Call onClose callback when unmounting and open\n if (this.state.expanded && this.props.onClose) {\n this.props.onClose();\n }\n }\n\n // Event handlers\n onDocumentClick(e) {\n if (!this.props.closeOnDocumentClick) {\n return;\n }\n\n const clickIsInMenu = this.menu.current === e.target || this.menu.current.contains(e.target);\n if (clickIsInMenu) {\n return;\n }\n\n this.close();\n }\n\n onTriggerClick(e) {\n // Let the browser follow the link of the trigger if the menu\n // is already expanded and the trigger has an href attribute\n if (this.state.expanded && e.target.getAttribute('href')) {\n return;\n }\n\n e.preventDefault();\n this.toggle();\n }\n\n onCloseClick() {\n this.getFocusableElements()[0].focus();\n this.close();\n }\n\n onKeyDown(e) {\n if (!this.state.expanded) {\n return;\n }\n switch (e.key) {\n case 'Escape': {\n e.preventDefault();\n e.stopPropagation();\n this.getFocusableElements()[0].focus();\n this.close();\n break;\n }\n case 'Enter': {\n // Using focusable elements instead of a ref to the trigger\n // because Hyperlink and Button can handle refs as functional components\n if (document.activeElement === this.getFocusableElements()[0]) {\n e.preventDefault();\n this.toggle();\n }\n break;\n }\n case 'Tab': {\n e.preventDefault();\n if (e.shiftKey) {\n this.focusPrevious();\n } else {\n this.focusNext();\n }\n break;\n }\n case 'ArrowDown': {\n e.preventDefault();\n this.focusNext();\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n this.focusPrevious();\n break;\n }\n default:\n }\n }\n\n onMouseEnter() {\n if (!this.props.respondToPointerEvents) {\n return;\n }\n this.open();\n }\n\n onMouseLeave() {\n if (!this.props.respondToPointerEvents) {\n return;\n }\n this.close();\n }\n\n // Internal functions\n\n getFocusableElements() {\n return this.menu.current.querySelectorAll('button:not([disabled]), [href]:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled])');\n }\n\n getAttributesFromProps() {\n // Any extra props are attributes for the menu\n const attributes = {};\n Object.keys(this.props)\n .filter(property => menuPropTypes[property] === undefined)\n .forEach((property) => {\n attributes[property] = this.props[property];\n });\n return attributes;\n }\n\n focusNext() {\n const focusableElements = Array.from(this.getFocusableElements());\n const activeIndex = focusableElements.indexOf(document.activeElement);\n const nextIndex = (activeIndex + 1) % focusableElements.length;\n focusableElements[nextIndex].focus();\n }\n\n focusPrevious() {\n const focusableElements = Array.from(this.getFocusableElements());\n const activeIndex = focusableElements.indexOf(document.activeElement);\n const previousIndex = (activeIndex || focusableElements.length) - 1;\n focusableElements[previousIndex].focus();\n }\n\n open() {\n if (this.props.onOpen) {\n this.props.onOpen();\n }\n this.setState({ expanded: true });\n // Listen to touchend and click events to ensure the menu\n // can be closed on mobile, pointer, and mixed input devices\n document.addEventListener('touchend', this.onDocumentClick, true);\n document.addEventListener('click', this.onDocumentClick, true);\n }\n\n close() {\n if (this.props.onClose) {\n this.props.onClose();\n }\n this.setState({ expanded: false });\n document.removeEventListener('touchend', this.onDocumentClick, true);\n document.removeEventListener('click', this.onDocumentClick, true);\n }\n\n toggle() {\n if (this.state.expanded) {\n this.close();\n } else {\n this.open();\n }\n }\n\n renderTrigger(node) {\n return React.cloneElement(node, {\n onClick: this.onTriggerClick,\n 'aria-haspopup': 'menu',\n 'aria-expanded': this.state.expanded,\n });\n }\n\n renderMenuContent(node) {\n return (\n \n {node}\n \n );\n }\n\n render() {\n const { className } = this.props;\n\n const wrappedChildren = React.Children.map(this.props.children, (child) => {\n if (child.type === MenuTriggerType) {\n return this.renderTrigger(child);\n }\n return this.renderMenuContent(child);\n });\n\n const rootClassName = this.state.expanded ? 'menu expanded' : 'menu';\n\n return React.createElement(this.props.tag, {\n className: `${rootClassName} ${className}`,\n ref: this.menu,\n onKeyDown: this.onKeyDown,\n onMouseEnter: this.onMouseEnter,\n onMouseLeave: this.onMouseLeave,\n ...this.getAttributesFromProps(),\n }, wrappedChildren);\n }\n}\n\nMenu.propTypes = menuPropTypes;\nMenu.defaultProps = {\n tag: 'div',\n className: null,\n onClose: null,\n onOpen: null,\n respondToPointerEvents: false,\n closeOnDocumentClick: true,\n transitionTimeout: 250,\n transitionClassName: 'menu-content',\n};\n\nexport { Menu, MenuTrigger, MenuContent };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAQ,wBAAwB;AACtD,OAAOC,SAAS,MAAM,YAAY;AAElC,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA;EAAA,IAAMC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;IAAKC,UAAU,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAAA,oBAAOT,KAAK,CAACU,aAAa,CAACL,GAAG,EAAAM,aAAA;IAChFL,SAAS,kBAAAM,MAAA,CAAkBN,SAAS;EAAE,GACnCC,UAAU,CACd,CAAC;AAAA;AACFJ,WAAW,CAACU,SAAS,GAAG;EACtBR,GAAG,EAAEH,SAAS,CAACY,MAAM;EACrBR,SAAS,EAAEJ,SAAS,CAACY;AACvB,CAAC;AACDX,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AI,CAACA,YAAY;QAC/BC,YAAY,EAAE,IAAI,CAACA;MAAY,GAC5B,IAAI,CAACyB,sBAAsB,CAAC,CAAC,GAC/B2B,eAAe,CAAC;IACrB;EAAC;EAAA,OAAAxE,IAAA;AAAA,EAxNgBrC,KAAK,CAACmH,SAAS;AA2NlC9E,IAAI,CAACxB,SAAS,GAAGU,aAAa;AAC9Bc,IAAI,CAACtB,YAAY,GAAG;EAClBV,GAAG,EAAE,KAAK;EACVC,SAAS,EAAE,IAAI;EACfkB,OAAO,EAAE,IAAI;EACbE,MAAM,EAAE,IAAI;EACZG,sBAAsB,EAAE,KAAK;EAC7BF,oBAAoB,EAAE,IAAI;EAC1BG,iBAAiB,EAAE,GAAG;EACtBE,mBAAmB,EAAE;AACvB,CAAC;AAED,SAASK,IAAI,EAAElC,WAAW,EAAEgB,WAAW"} \ No newline at end of file diff --git a/dist/Menu/index.js b/dist/Menu/index.js new file mode 100644 index 0000000000..c2cc885ff8 --- /dev/null +++ b/dist/Menu/index.js @@ -0,0 +1,3 @@ +import { Menu, MenuTrigger, MenuContent } from './Menu'; +export { Menu, MenuTrigger, MenuContent }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/Menu/index.js.map b/dist/Menu/index.js.map new file mode 100644 index 0000000000..2a1ab484e3 --- /dev/null +++ b/dist/Menu/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","names":["Menu","MenuTrigger","MenuContent"],"sources":["../../src/Menu/index.jsx"],"sourcesContent":["import { Menu, MenuTrigger, MenuContent } from './Menu';\n\nexport { Menu, MenuTrigger, MenuContent };\n"],"mappings":"AAAA,SAASA,IAAI,EAAEC,WAAW,EAAEC,WAAW,QAAQ,QAAQ;AAEvD,SAASF,IAAI,EAAEC,WAAW,EAAEC,WAAW"} \ No newline at end of file diff --git a/dist/Menu/menu.scss b/dist/Menu/menu.scss new file mode 100644 index 0000000000..8fa6656164 --- /dev/null +++ b/dist/Menu/menu.scss @@ -0,0 +1,45 @@ +.menu { + position: relative; +} +.menu-content { + position: absolute; + top: 100%; + z-index: 10; + background: #fff; + min-width: 10rem; + &.pin-left { + left: 0; + } + &.pin-right { + right: 0; + } +} + + +.menu-dropdown-enter { + opacity: 0; + transform-origin: 75% 0; + transform: scale3d(0.8, 0.8, 1); +} +.menu-dropdown-enter-active { + transform-origin: 75% 0; + transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1); + transform: scale3d(1, 1, 1); + opacity: 1; +} +.menu-dropdown-enter-done { +} + +.menu-dropdown-exit { + transform-origin: 75% 0; + transform: scale3d(1, 1, 1); + opacity: 1; +} +.menu-dropdown-exit-active { + transform-origin: 75% 0; + transform: scale3d(0.8, 0.8, 1); + transition: all 250ms cubic-bezier(0.8, 0, 0.6, 1); + opacity: 0; +} +.menu-dropdown-exit-done { +} diff --git a/dist/MobileHeader.js b/dist/MobileHeader.js new file mode 100644 index 0000000000..b1a416779a --- /dev/null +++ b/dist/MobileHeader.js @@ -0,0 +1,224 @@ +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import React from 'react'; +import PropTypes from 'prop-types'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { getConfig } from '@edx/frontend-platform'; + +// Local Components +import { Menu, MenuTrigger, MenuContent } from './Menu'; +import Avatar from './Avatar'; +import { LinkedLogo, Logo } from './Logo'; + +// i18n +import messages from './Header.messages'; + +// Assets +import { MenuIcon } from './Icons'; +var MobileHeader = /*#__PURE__*/function (_React$Component) { + _inherits(MobileHeader, _React$Component); + var _super = _createSuper(MobileHeader); + function MobileHeader(props) { + _classCallCheck(this, MobileHeader); + // eslint-disable-line no-useless-constructor + return _super.call(this, props); + } + _createClass(MobileHeader, [{ + key: "renderMainMenu", + value: function renderMainMenu() { + var mainMenu = this.props.mainMenu; + + // Nodes are accepted as a prop + if (!Array.isArray(mainMenu)) { + return mainMenu; + } + return mainMenu.map(function (menuItem) { + var type = menuItem.type, + href = menuItem.href, + content = menuItem.content, + submenuContent = menuItem.submenuContent; + if (type === 'item') { + return /*#__PURE__*/React.createElement("a", { + key: "".concat(type, "-").concat(content), + className: "nav-link", + href: href + }, content); + } + return /*#__PURE__*/React.createElement(Menu, { + key: "".concat(type, "-").concat(content), + tag: "div", + className: "nav-item" + }, /*#__PURE__*/React.createElement(MenuTrigger, { + tag: "a", + role: "button", + tabIndex: "0", + className: "nav-link" + }, content), /*#__PURE__*/React.createElement(MenuContent, { + className: "position-static pin-left pin-right py-2" + }, submenuContent)); + }); + } + }, { + key: "renderUserMenuItems", + value: function renderUserMenuItems() { + var userMenu = this.props.userMenu; + return userMenu.map(function (_ref) { + var type = _ref.type, + href = _ref.href, + content = _ref.content; + return /*#__PURE__*/React.createElement("li", { + className: "nav-item", + key: "".concat(type, "-").concat(content) + }, /*#__PURE__*/React.createElement("a", { + className: "nav-link", + href: href + }, content)); + }); + } + }, { + key: "renderLoggedOutItems", + value: function renderLoggedOutItems() { + var loggedOutItems = this.props.loggedOutItems; + return loggedOutItems.map(function (_ref2, i, arr) { + var type = _ref2.type, + href = _ref2.href, + content = _ref2.content; + return /*#__PURE__*/React.createElement("li", { + className: "nav-item px-3 my-2", + key: "".concat(type, "-").concat(content) + }, /*#__PURE__*/React.createElement("a", { + className: i < arr.length - 1 ? 'btn btn-block btn-outline-primary' : 'btn btn-block btn-primary', + href: href + }, content)); + }); + } + }, { + key: "render", + value: function render() { + var _this$props = this.props, + logo = _this$props.logo, + logoAltText = _this$props.logoAltText, + logoDestination = _this$props.logoDestination, + loggedIn = _this$props.loggedIn, + avatar = _this$props.avatar, + username = _this$props.username, + stickyOnMobile = _this$props.stickyOnMobile, + intl = _this$props.intl, + mainMenu = _this$props.mainMenu, + userMenu = _this$props.userMenu, + loggedOutItems = _this$props.loggedOutItems; + var logoProps = { + src: logo, + alt: logoAltText, + href: logoDestination + }; + var stickyClassName = stickyOnMobile ? 'sticky-top' : ''; + var logoClasses = getConfig().AUTHN_MINIMAL_HEADER ? 'justify-content-left pl-3' : 'justify-content-center'; + return /*#__PURE__*/React.createElement("header", { + "aria-label": intl.formatMessage(messages['header.label.main.header']), + className: "site-header-mobile d-flex justify-content-between align-items-center shadow ".concat(stickyClassName) + }, /*#__PURE__*/React.createElement("a", { + className: "nav-skip sr-only sr-only-focusable", + href: "#main" + }, intl.formatMessage(messages['header.label.skip.nav'])), mainMenu.length > 0 ? /*#__PURE__*/React.createElement("div", { + className: "w-100 d-flex justify-content-start" + }, /*#__PURE__*/React.createElement(Menu, { + className: "position-static" + }, /*#__PURE__*/React.createElement(MenuTrigger, { + tag: "button", + className: "icon-button", + "aria-label": intl.formatMessage(messages['header.label.main.menu']), + title: intl.formatMessage(messages['header.label.main.menu']) + }, /*#__PURE__*/React.createElement(MenuIcon, { + role: "img", + "aria-hidden": true, + focusable: "false", + style: { + width: '1.5rem', + height: '1.5rem' + } + })), /*#__PURE__*/React.createElement(MenuContent, { + tag: "nav", + "aria-label": intl.formatMessage(messages['header.label.main.nav']), + className: "nav flex-column pin-left pin-right border-top shadow py-2" + }, this.renderMainMenu()))) : null, /*#__PURE__*/React.createElement("div", { + className: "w-100 d-flex ".concat(logoClasses) + }, logoDestination === null ? /*#__PURE__*/React.createElement(Logo, { + className: "logo", + src: logo, + alt: logoAltText + }) : /*#__PURE__*/React.createElement(LinkedLogo, _extends({ + className: "logo" + }, logoProps, { + itemType: "http://schema.org/Organization" + }))), userMenu.length > 0 || loggedOutItems.length > 0 ? /*#__PURE__*/React.createElement("div", { + className: "w-100 d-flex justify-content-end align-items-center" + }, /*#__PURE__*/React.createElement(Menu, { + tag: "nav", + "aria-label": intl.formatMessage(messages['header.label.secondary.nav']), + className: "position-static" + }, /*#__PURE__*/React.createElement(MenuTrigger, { + tag: "button", + className: "icon-button", + "aria-label": intl.formatMessage(messages['header.label.account.menu']), + title: intl.formatMessage(messages['header.label.account.menu']) + }, /*#__PURE__*/React.createElement(Avatar, { + size: "1.5rem", + src: avatar, + alt: username + })), /*#__PURE__*/React.createElement(MenuContent, { + tag: "ul", + className: "nav flex-column pin-left pin-right border-top shadow py-2" + }, loggedIn ? this.renderUserMenuItems() : this.renderLoggedOutItems()))) : null); + } + }]); + return MobileHeader; +}(React.Component); +MobileHeader.propTypes = { + mainMenu: PropTypes.oneOfType([PropTypes.node, PropTypes.array]), + userMenu: PropTypes.arrayOf(PropTypes.shape({ + type: PropTypes.oneOf(['item', 'menu']), + href: PropTypes.string, + content: PropTypes.string + })), + loggedOutItems: PropTypes.arrayOf(PropTypes.shape({ + type: PropTypes.oneOf(['item', 'menu']), + href: PropTypes.string, + content: PropTypes.string + })), + logo: PropTypes.string, + logoAltText: PropTypes.string, + logoDestination: PropTypes.string, + avatar: PropTypes.string, + username: PropTypes.string, + loggedIn: PropTypes.bool, + stickyOnMobile: PropTypes.bool, + // i18n + intl: intlShape.isRequired +}; +MobileHeader.defaultProps = { + mainMenu: [], + userMenu: [], + loggedOutItems: [], + logo: null, + logoAltText: null, + logoDestination: null, + avatar: null, + username: null, + loggedIn: false, + stickyOnMobile: true +}; +export default injectIntl(MobileHeader); +//# sourceMappingURL=MobileHeader.js.map \ No newline at end of file diff --git a/dist/MobileHeader.js.map b/dist/MobileHeader.js.map new file mode 100644 index 0000000000..59bcabb611 --- /dev/null +++ b/dist/MobileHeader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MobileHeader.js","names":["React","PropTypes","injectIntl","intlShape","getConfig","Menu","MenuTrigger","MenuContent","Avatar","LinkedLogo","Logo","messages","MenuIcon","MobileHeader","_React$Component","_inherits","_super","_createSuper","props","_classCallCheck","call","_createClass","key","value","renderMainMenu","mainMenu","Array","isArray","map","menuItem","type","href","content","submenuContent","createElement","concat","className","tag","role","tabIndex","renderUserMenuItems","userMenu","_ref","renderLoggedOutItems","loggedOutItems","_ref2","i","arr","length","render","_this$props","logo","logoAltText","logoDestination","loggedIn","avatar","username","stickyOnMobile","intl","logoProps","src","alt","stickyClassName","logoClasses","AUTHN_MINIMAL_HEADER","formatMessage","title","focusable","style","width","height","_extends","itemType","size","Component","propTypes","oneOfType","node","array","arrayOf","shape","oneOf","string","bool","isRequired","defaultProps"],"sources":["../src/MobileHeader.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { injectIntl, intlShape } from '@edx/frontend-platform/i18n';\nimport { getConfig } from '@edx/frontend-platform';\n\n// Local Components\nimport { Menu, MenuTrigger, MenuContent } from './Menu';\nimport Avatar from './Avatar';\nimport { LinkedLogo, Logo } from './Logo';\n\n// i18n\nimport messages from './Header.messages';\n\n// Assets\nimport { MenuIcon } from './Icons';\n\nclass MobileHeader extends React.Component {\n constructor(props) { // eslint-disable-line no-useless-constructor\n super(props);\n }\n\n renderMainMenu() {\n const { mainMenu } = this.props;\n\n // Nodes are accepted as a prop\n if (!Array.isArray(mainMenu)) {\n return mainMenu;\n }\n\n return mainMenu.map((menuItem) => {\n const {\n type,\n href,\n content,\n submenuContent,\n } = menuItem;\n\n if (type === 'item') {\n return (\n \n {content}\n \n );\n }\n\n return (\n \n \n {content}\n \n \n {submenuContent}\n \n \n );\n });\n }\n\n renderUserMenuItems() {\n const { userMenu } = this.props;\n\n return userMenu.map(({ type, href, content }) => (\n
  • \n {content}\n
  • \n ));\n }\n\n renderLoggedOutItems() {\n const { loggedOutItems } = this.props;\n\n return loggedOutItems.map(({ type, href, content }, i, arr) => (\n
  • \n \n {content}\n \n
  • \n ));\n }\n\n render() {\n const {\n logo,\n logoAltText,\n logoDestination,\n loggedIn,\n avatar,\n username,\n stickyOnMobile,\n intl,\n mainMenu,\n userMenu,\n loggedOutItems,\n } = this.props;\n const logoProps = { src: logo, alt: logoAltText, href: logoDestination };\n const stickyClassName = stickyOnMobile ? 'sticky-top' : '';\n const logoClasses = getConfig().AUTHN_MINIMAL_HEADER ? 'justify-content-left pl-3' : 'justify-content-center';\n\n return (\n \n {intl.formatMessage(messages['header.label.skip.nav'])}\n {mainMenu.length > 0 ? (\n
    \n\n \n \n \n \n \n {this.renderMainMenu()}\n \n \n
    \n ) : null}\n
    \n { logoDestination === null ? : }\n
    \n {userMenu.length > 0 || loggedOutItems.length > 0 ? (\n
    \n \n \n \n \n \n {loggedIn ? this.renderUserMenuItems() : this.renderLoggedOutItems()}\n \n \n
    \n ) : null}\n
    \n );\n }\n}\n\nMobileHeader.propTypes = {\n mainMenu: PropTypes.oneOfType([\n PropTypes.node,\n PropTypes.array,\n ]),\n\n userMenu: PropTypes.arrayOf(PropTypes.shape({\n type: PropTypes.oneOf(['item', 'menu']),\n href: PropTypes.string,\n content: PropTypes.string,\n })),\n loggedOutItems: PropTypes.arrayOf(PropTypes.shape({\n type: PropTypes.oneOf(['item', 'menu']),\n href: PropTypes.string,\n content: PropTypes.string,\n })),\n logo: PropTypes.string,\n logoAltText: PropTypes.string,\n logoDestination: PropTypes.string,\n avatar: PropTypes.string,\n username: PropTypes.string,\n loggedIn: PropTypes.bool,\n stickyOnMobile: PropTypes.bool,\n\n // i18n\n intl: intlShape.isRequired,\n};\n\nMobileHeader.defaultProps = {\n mainMenu: [],\n userMenu: [],\n loggedOutItems: [],\n logo: null,\n logoAltText: null,\n logoDestination: null,\n avatar: null,\n username: null,\n loggedIn: false,\n stickyOnMobile: true,\n\n};\n\nexport default injectIntl(MobileHeader);\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,EAAEC,SAAS,QAAQ,6BAA6B;AACnE,SAASC,SAAS,QAAQ,wBAAwB;;AAElD;AACA,SAASC,IAAI,EAAEC,WAAW,EAAEC,WAAW,QAAQ,QAAQ;AACvD,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,UAAU,EAAEC,IAAI,QAAQ,QAAQ;;AAEzC;AACA,OAAOC,QAAQ,MAAM,mBAAmB;;AAExC;AACA,SAASC,QAAQ,QAAQ,SAAS;AAAC,IAE7BC,YAAY,0BAAAC,gBAAA;EAAAC,SAAA,CAAAF,YAAA,EAAAC,gBAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,YAAA;EAChB,SAAAA,aAAYK,KAAK,EAAE;IAAAC,eAAA,OAAAN,YAAA;IAAE;IAAA,OAAAG,MAAA,CAAAI,IAAA,OACbF,KAAK;EACb;EAACG,YAAA,CAAAR,YAAA;IAAAS,GAAA;IAAAC,KAAA,EAED,SAAAC,eAAA,EAAiB;MACf,IAAQC,QAAQ,GAAK,IAAI,CAACP,KAAK,CAAvBO,QAAQ;;MAEhB;MACA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,QAAQ,CAAC,EAAE;QAC5B,OAAOA,QAAQ;MACjB;MAEA,OAAOA,QAAQ,CAACG,GAAG,CAAC,UAACC,QAAQ,EAAK;QAChC,IACEC,IAAI,GAIFD,QAAQ,CAJVC,IAAI;UACJC,IAAI,GAGFF,QAAQ,CAHVE,IAAI;UACJC,OAAO,GAELH,QAAQ,CAFVG,OAAO;UACP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1B5B,QAAQ,EAAErD,SAAS,CAACkF,IAAI;EACxB1B,cAAc,EAAExD,SAAS,CAACkF,IAAI;EAE9B;EACAzB,IAAI,EAAEvD,SAAS,CAACiF;AAClB,CAAC;AAEDvE,YAAY,CAACwE,YAAY,GAAG;EAC1B5D,QAAQ,EAAE,EAAE;EACZgB,QAAQ,EAAE,EAAE;EACZG,cAAc,EAAE,EAAE;EAClBO,IAAI,EAAE,IAAI;EACVC,WAAW,EAAE,IAAI;EACjBC,eAAe,EAAE,IAAI;EACrBE,MAAM,EAAE,IAAI;EACZC,QAAQ,EAAE,IAAI;EACdF,QAAQ,EAAE,KAAK;EACfG,cAAc,EAAE;AAElB,CAAC;AAED,eAAevD,UAAU,CAACW,YAAY,CAAC"} \ No newline at end of file diff --git a/dist/__snapshots__/Header.test.jsx.snap b/dist/__snapshots__/Header.test.jsx.snap new file mode 100644 index 0000000000..f83161b154 --- /dev/null +++ b/dist/__snapshots__/Header.test.jsx.snap @@ -0,0 +1,443 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`
    renders correctly for anonymous desktop 1`] = ` +
    + + Skip to main content + + +
    +`; + +exports[`
    renders correctly for anonymous mobile 1`] = ` +
    + + Skip to main content + +
    +
    + +
    +
    +
    + + edX + +
    +
    + +
    +
    +`; + +exports[`
    renders correctly for authenticated desktop 1`] = ` +
    + + Skip to main content + +
    +
    + + edX + + + +
    +
    +
    +`; + +exports[`
    renders correctly for authenticated mobile 1`] = ` +
    + + Skip to main content + +
    +
    + +
    +
    +
    + + edX + +
    +
    + +
    +
    +`; diff --git a/dist/generic/messages.js b/dist/generic/messages.js new file mode 100644 index 0000000000..c64807d2ea --- /dev/null +++ b/dist/generic/messages.js @@ -0,0 +1,15 @@ +import { defineMessages } from '@edx/frontend-platform/i18n'; +var messages = defineMessages({ + registerSentenceCase: { + id: 'general.register.sentenceCase', + defaultMessage: 'Register', + description: 'Text in a button, prompting the user to register.' + }, + signInSentenceCase: { + id: 'general.signIn.sentenceCase', + defaultMessage: 'Sign in', + description: 'Text in a button, prompting the user to log in.' + } +}); +export default messages; +//# sourceMappingURL=messages.js.map \ No newline at end of file diff --git a/dist/generic/messages.js.map b/dist/generic/messages.js.map new file mode 100644 index 0000000000..eb422d6436 --- /dev/null +++ b/dist/generic/messages.js.map @@ -0,0 +1 @@ +{"version":3,"file":"messages.js","names":["defineMessages","messages","registerSentenceCase","id","defaultMessage","description","signInSentenceCase"],"sources":["../../src/generic/messages.js"],"sourcesContent":["import { defineMessages } from '@edx/frontend-platform/i18n';\n\nconst messages = defineMessages({\n registerSentenceCase: {\n id: 'general.register.sentenceCase',\n defaultMessage: 'Register',\n description: 'Text in a button, prompting the user to register.',\n },\n signInSentenceCase: {\n id: 'general.signIn.sentenceCase',\n defaultMessage: 'Sign in',\n description: 'Text in a button, prompting the user to log in.',\n },\n});\n\nexport default messages;\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,6BAA6B;AAE5D,IAAMC,QAAQ,GAAGD,cAAc,CAAC;EAC9BE,oBAAoB,EAAE;IACpBC,EAAE,EAAE,+BAA+B;IACnCC,cAAc,EAAE,UAAU;IAC1BC,WAAW,EAAE;EACf,CAAC;EACDC,kBAAkB,EAAE;IAClBH,EAAE,EAAE,6BAA6B;IACjCC,cAAc,EAAE,SAAS;IACzBC,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAEF,eAAeJ,QAAQ"} \ No newline at end of file diff --git a/dist/i18n/index.js b/dist/i18n/index.js new file mode 100644 index 0000000000..2321996290 --- /dev/null +++ b/dist/i18n/index.js @@ -0,0 +1,28 @@ +import arMessages from './messages/ar.json'; +import frMessages from './messages/fr.json'; +import es419Messages from './messages/es_419.json'; +import zhcnMessages from './messages/zh_CN.json'; +import ptMessages from './messages/pt.json'; +import itMessages from './messages/it.json'; +import ukMessages from './messages/uk.json'; +import deMessages from './messages/de.json'; +import ruMessages from './messages/ru.json'; +import hiMessages from './messages/hi.json'; +import frCAMessages from './messages/fr_CA.json'; +// no need to import en messages-- they are in the defaultMessage field + +var messages = { + ar: arMessages, + 'es-419': es419Messages, + fr: frMessages, + 'zh-cn': zhcnMessages, + pt: ptMessages, + it: itMessages, + de: deMessages, + hi: hiMessages, + 'fr-ca': frCAMessages, + ru: ruMessages, + uk: ukMessages +}; +export default messages; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/i18n/index.js.map b/dist/i18n/index.js.map new file mode 100644 index 0000000000..c9da37aa7a --- /dev/null +++ b/dist/i18n/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","names":["arMessages","frMessages","es419Messages","zhcnMessages","ptMessages","itMessages","ukMessages","deMessages","ruMessages","hiMessages","frCAMessages","messages","ar","fr","pt","it","de","hi","ru","uk"],"sources":["../../src/i18n/index.js"],"sourcesContent":["import arMessages from './messages/ar.json';\nimport frMessages from './messages/fr.json';\nimport es419Messages from './messages/es_419.json';\nimport zhcnMessages from './messages/zh_CN.json';\nimport ptMessages from './messages/pt.json';\nimport itMessages from './messages/it.json';\nimport ukMessages from './messages/uk.json';\nimport deMessages from './messages/de.json';\nimport ruMessages from './messages/ru.json';\nimport hiMessages from './messages/hi.json';\nimport frCAMessages from './messages/fr_CA.json';\n// no need to import en messages-- they are in the defaultMessage field\n\nconst messages = {\n ar: arMessages,\n 'es-419': es419Messages,\n fr: frMessages,\n 'zh-cn': zhcnMessages,\n pt: ptMessages,\n it: itMessages,\n de: deMessages,\n hi: hiMessages,\n 'fr-ca': frCAMessages,\n ru: ruMessages,\n uk: ukMessages,\n};\n\nexport default messages;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,oBAAoB;AAC3C,OAAOC,UAAU,MAAM,oBAAoB;AAC3C,OAAOC,aAAa,MAAM,wBAAwB;AAClD,OAAOC,YAAY,MAAM,uBAAuB;AAChD,OAAOC,UAAU,MAAM,oBAAoB;AAC3C,OAAOC,UAAU,MAAM,oBAAoB;AAC3C,OAAOC,UAAU,MAAM,oBAAoB;AAC3C,OAAOC,UAAU,MAAM,oBAAoB;AAC3C,OAAOC,UAAU,MAAM,oBAAoB;AAC3C,OAAOC,UAAU,MAAM,oBAAoB;AAC3C,OAAOC,YAAY,MAAM,uBAAuB;AAChD;;AAEA,IAAMC,QAAQ,GAAG;EACfC,EAAE,EAAEZ,UAAU;EACd,QAAQ,EAAEE,aAAa;EACvBW,EAAE,EAAEZ,UAAU;EACd,OAAO,EAAEE,YAAY;EACrBW,EAAE,EAAEV,UAAU;EACdW,EAAE,EAAEV,UAAU;EACdW,EAAE,EAAET,UAAU;EACdU,EAAE,EAAER,UAAU;EACd,OAAO,EAAEC,YAAY;EACrBQ,EAAE,EAAEV,UAAU;EACdW,EAAE,EAAEb;AACN,CAAC;AAED,eAAeK,QAAQ"} \ No newline at end of file diff --git a/dist/i18n/messages/ar.json b/dist/i18n/messages/ar.json new file mode 100644 index 0000000000..636d70c0d7 --- /dev/null +++ b/dist/i18n/messages/ar.json @@ -0,0 +1,36 @@ +{ + "header.links.courses": "المساقات", + "header.links.programs": "البرامج", + "header.links.content.search": "اكتشف الجديد", + "header.links.schools": "المدارس و الشركاء", + "header.user.menu.dashboard": "لوحة المعلومات", + "header.user.menu.profile": "الملف الشخصي", + "header.user.menu.account.settings": "الحساب", + "header.user.menu.order.history": "سجل الطلبيات", + "header.user.menu.logout": "تسجيل الخروج", + "header.user.menu.login": "تسجيل الدخول", + "header.user.menu.register": "التسجيل", + "header.user.menu.studio.home": "صفحة الاستوديو الرئيسية", + "header.user.menu.studio.maintenance": "الصيانة", + "header.label.account.nav": "الحساب", + "header.label.account.menu": "قائمة الحساب", + "header.label.account.menu.for": "قائمة حساب المستخدم {username}", + "header.label.main.nav": "القا|مة الرئيسية", + "header.label.main.menu": "القائمة الرئيسية", + "header.label.main.header": "الرئيسية", + "header.label.secondary.nav": "القائمة الثانوية", + "header.label.skip.nav": "التخطي إلى المحتوى الرئيسي", + "header.label.app.nav": "تطبيق", + "general.register.sentenceCase": "التسجيل", + "general.signIn.sentenceCase": "تسجيل الدخول", + "header.menu.dashboard.label": "لوحة المعلومات", + "header.help.label": "المساعدة", + "header.menu.profile.label": "الملف الشخصي", + "header.menu.account.label": "الحساب", + "header.menu.orderHistory.label": "سجل الطلبيات", + "header.navigation.skipNavLink": "التخطي إلى المحتوى الرئيسي", + "header.menu.signOut.label": "تسجيل الخروج", + "header.user.menu.studio": "Studio Home", + "header.user.menu.maintenance": "Maintenance", + "header.label.courseOutline": "Back to course outline in Studio" +} \ No newline at end of file diff --git a/dist/i18n/messages/de.json b/dist/i18n/messages/de.json new file mode 100644 index 0000000000..7ffb78799c --- /dev/null +++ b/dist/i18n/messages/de.json @@ -0,0 +1,36 @@ +{ + "header.links.courses": "Courses", + "header.links.programs": "Programs", + "header.links.content.search": "Discover New", + "header.links.schools": "Schools & Partners", + "header.user.menu.dashboard": "Dashboard", + "header.user.menu.profile": "Profile", + "header.user.menu.account.settings": "Account", + "header.user.menu.order.history": "Order History", + "header.user.menu.logout": "Logout", + "header.user.menu.login": "Login", + "header.user.menu.register": "Sign Up", + "header.user.menu.studio.home": "Studio Home", + "header.user.menu.studio.maintenance": "Maintenance", + "header.label.account.nav": "Account", + "header.label.account.menu": "Account Menu", + "header.label.account.menu.for": "Account menu for {username}", + "header.label.main.nav": "Main", + "header.label.main.menu": "Main Menu", + "header.label.main.header": "Main", + "header.label.secondary.nav": "Secondary", + "header.label.skip.nav": "Skip to main content", + "header.label.app.nav": "App", + "general.register.sentenceCase": "Register", + "general.signIn.sentenceCase": "Sign in", + "header.menu.dashboard.label": "Dashboard", + "header.help.label": "Help", + "header.menu.profile.label": "Profile", + "header.menu.account.label": "Account", + "header.menu.orderHistory.label": "Order History", + "header.navigation.skipNavLink": "Skip to main content.", + "header.menu.signOut.label": "Sign Out", + "header.user.menu.studio": "Studio Home", + "header.user.menu.maintenance": "Maintenance", + "header.label.courseOutline": "Back to course outline in Studio" +} \ No newline at end of file diff --git a/dist/i18n/messages/es_419.json b/dist/i18n/messages/es_419.json new file mode 100644 index 0000000000..0ea15defc0 --- /dev/null +++ b/dist/i18n/messages/es_419.json @@ -0,0 +1,36 @@ +{ + "header.links.courses": "Cursos", + "header.links.programs": "Programas", + "header.links.content.search": "Encontrar nuevo", + "header.links.schools": "Escuelas y Socios", + "header.user.menu.dashboard": "Panel de Control", + "header.user.menu.profile": "Perfil", + "header.user.menu.account.settings": "Cuenta", + "header.user.menu.order.history": "Historial de órdenes", + "header.user.menu.logout": "Cerrar sesión", + "header.user.menu.login": "Login", + "header.user.menu.register": "Registrarse", + "header.user.menu.studio.home": "Inicio Studio", + "header.user.menu.studio.maintenance": "Mantenimiento", + "header.label.account.nav": "Cuenta", + "header.label.account.menu": "Menú de la cuenta", + "header.label.account.menu.for": "Menú de la cuenta para {username}", + "header.label.main.nav": "Principal", + "header.label.main.menu": "Menú Principal", + "header.label.main.header": "Principal", + "header.label.secondary.nav": "Secondary", + "header.label.skip.nav": "Ir al contenido principal", + "header.label.app.nav": "Aplicación", + "general.register.sentenceCase": "Registrarse", + "general.signIn.sentenceCase": "Iniciar sesión", + "header.menu.dashboard.label": "Panel de Control", + "header.help.label": "Ayuda", + "header.menu.profile.label": "Perfil", + "header.menu.account.label": "Cuenta", + "header.menu.orderHistory.label": "Historial de órdenes", + "header.navigation.skipNavLink": "Dirígete al contenido principal.", + "header.menu.signOut.label": "Cerrar sesión", + "header.user.menu.studio": "Inicio Studio", + "header.user.menu.maintenance": "Mantenimiento", + "header.label.courseOutline": "Volver al esquema del curso en Studio" +} \ No newline at end of file diff --git a/dist/i18n/messages/fr.json b/dist/i18n/messages/fr.json new file mode 100644 index 0000000000..a62a600aa3 --- /dev/null +++ b/dist/i18n/messages/fr.json @@ -0,0 +1,36 @@ +{ + "header.links.courses": "Cours", + "header.links.programs": "Programmes", + "header.links.content.search": "Explorer les cours", + "header.links.schools": "Écoles et partenaires", + "header.user.menu.dashboard": "Tableau de bord", + "header.user.menu.profile": "Profil", + "header.user.menu.account.settings": "Compte", + "header.user.menu.order.history": "Historique des commandes", + "header.user.menu.logout": "Déconnexion", + "header.user.menu.login": "Connexion", + "header.user.menu.register": "S'inscrire", + "header.user.menu.studio.home": "Accueil Studio", + "header.user.menu.studio.maintenance": "Maintenance", + "header.label.account.nav": "Compte", + "header.label.account.menu": "Menu du compte", + "header.label.account.menu.for": "Menu du compte pour {username}", + "header.label.main.nav": "Principal", + "header.label.main.menu": "Menu Principal", + "header.label.main.header": "Principal", + "header.label.secondary.nav": "Secondaire", + "header.label.skip.nav": "Passer au contenu principal", + "header.label.app.nav": "Application", + "general.register.sentenceCase": "S'inscrire", + "general.signIn.sentenceCase": "Connectez-vous", + "header.menu.dashboard.label": "Tableau de bord", + "header.help.label": "Aide", + "header.menu.profile.label": "Profil", + "header.menu.account.label": "Compte", + "header.menu.orderHistory.label": "Historique des commandes", + "header.navigation.skipNavLink": "Passer au contenu principal", + "header.menu.signOut.label": "Se déconnecter", + "header.user.menu.studio": "Studio Home", + "header.user.menu.maintenance": "Maintenance", + "header.label.courseOutline": "Back to course outline in Studio" +} \ No newline at end of file diff --git a/dist/i18n/messages/fr_CA.json b/dist/i18n/messages/fr_CA.json new file mode 100644 index 0000000000..b4b01d4526 --- /dev/null +++ b/dist/i18n/messages/fr_CA.json @@ -0,0 +1,36 @@ +{ + "header.links.courses": "Cours", + "header.links.programs": "Programmes", + "header.links.content.search": "Découvrir les nouveautés", + "header.links.schools": "Écoles et Partenaires", + "header.user.menu.dashboard": "Tableau de bord", + "header.user.menu.profile": "Profil", + "header.user.menu.account.settings": "Compte", + "header.user.menu.order.history": "Historique des commandes", + "header.user.menu.logout": "Déconnexion", + "header.user.menu.login": "Connexion", + "header.user.menu.register": "S'inscrire", + "header.user.menu.studio.home": "Accueil Studio", + "header.user.menu.studio.maintenance": "Entretien", + "header.label.account.nav": "Compte", + "header.label.account.menu": "Menu de compte", + "header.label.account.menu.for": "Menu de compte pour {username}", + "header.label.main.nav": "Principal", + "header.label.main.menu": "Menu principal", + "header.label.main.header": "Principal", + "header.label.secondary.nav": "Secondaire", + "header.label.skip.nav": "Passer au contenu de cette vue", + "header.label.app.nav": "Application", + "general.register.sentenceCase": "Inscription", + "general.signIn.sentenceCase": "Connexion", + "header.menu.dashboard.label": "Tableau de bord", + "header.help.label": "Aide", + "header.menu.profile.label": "Profil", + "header.menu.account.label": "Compte", + "header.menu.orderHistory.label": "Historique des commandes", + "header.navigation.skipNavLink": "Passer au contenu principal.", + "header.menu.signOut.label": "Se déconnecter", + "header.user.menu.studio": "Accueil Studio", + "header.user.menu.maintenance": "Entretien", + "header.label.courseOutline": "Retour au plan de cours dans Studio" +} \ No newline at end of file diff --git a/dist/i18n/messages/hi.json b/dist/i18n/messages/hi.json new file mode 100644 index 0000000000..012c9df0a1 --- /dev/null +++ b/dist/i18n/messages/hi.json @@ -0,0 +1,36 @@ +{ + "header.links.courses": "पाठ्यक्रम", + "header.links.programs": "कार्यक्रमों", + "header.links.content.search": "नया खोजें", + "header.links.schools": "स्कूलों और भागीदारों", + "header.user.menu.dashboard": "डैशबोर्ड", + "header.user.menu.profile": "प्रोफ़ाइल", + "header.user.menu.account.settings": "खाता", + "header.user.menu.order.history": "ऑर्डर इतिहास", + "header.user.menu.logout": "लॉग आउट", + "header.user.menu.login": "लॉगिन", + "header.user.menu.register": "साइन अप", + "header.user.menu.studio.home": "स्टूडियो होम", + "header.user.menu.studio.maintenance": "अनुरक्षण करना", + "header.label.account.nav": "खाता", + "header.label.account.menu": "खाता मेनू", + "header.label.account.menu.for": "{username} के लिए खाता मेनू", + "header.label.main.nav": "मुख्य", + "header.label.main.menu": "मुख्य मेनू", + "header.label.main.header": "मुख्य", + "header.label.secondary.nav": "माध्यमिक", + "header.label.skip.nav": "मुख्य विषयवस्तु में जाएं", + "header.label.app.nav": "ऐप", + "general.register.sentenceCase": "रजिस्टर करें", + "general.signIn.sentenceCase": "साइन इन करें", + "header.menu.dashboard.label": "डैशबोर्ड", + "header.help.label": "मदद", + "header.menu.profile.label": "प्रोफ़ाइल", + "header.menu.account.label": "खाता", + "header.menu.orderHistory.label": "ऑर्डर इतिहास", + "header.navigation.skipNavLink": "मुख्य सामग्री पर जाएँ।", + "header.menu.signOut.label": "साइन आउट करें", + "header.user.menu.studio": "स्टूडियो होम", + "header.user.menu.maintenance": "अनुरक्षण करना", + "header.label.courseOutline": "स्टूडियो में पाठ्यक्रम की रूपरेखा पर वापस जाएँ" +} \ No newline at end of file diff --git a/dist/i18n/messages/it.json b/dist/i18n/messages/it.json new file mode 100644 index 0000000000..7ffb78799c --- /dev/null +++ b/dist/i18n/messages/it.json @@ -0,0 +1,36 @@ +{ + "header.links.courses": "Courses", + "header.links.programs": "Programs", + "header.links.content.search": "Discover New", + "header.links.schools": "Schools & Partners", + "header.user.menu.dashboard": "Dashboard", + "header.user.menu.profile": "Profile", + "header.user.menu.account.settings": "Account", + "header.user.menu.order.history": "Order History", + "header.user.menu.logout": "Logout", + "header.user.menu.login": "Login", + "header.user.menu.register": "Sign Up", + "header.user.menu.studio.home": "Studio Home", + "header.user.menu.studio.maintenance": "Maintenance", + "header.label.account.nav": "Account", + "header.label.account.menu": "Account Menu", + "header.label.account.menu.for": "Account menu for {username}", + "header.label.main.nav": "Main", + "header.label.main.menu": "Main Menu", + "header.label.main.header": "Main", + "header.label.secondary.nav": "Secondary", + "header.label.skip.nav": "Skip to main content", + "header.label.app.nav": "App", + "general.register.sentenceCase": "Register", + "general.signIn.sentenceCase": "Sign in", + "header.menu.dashboard.label": "Dashboard", + "header.help.label": "Help", + "header.menu.profile.label": "Profile", + "header.menu.account.label": "Account", + "header.menu.orderHistory.label": "Order History", + "header.navigation.skipNavLink": "Skip to main content.", + "header.menu.signOut.label": "Sign Out", + "header.user.menu.studio": "Studio Home", + "header.user.menu.maintenance": "Maintenance", + "header.label.courseOutline": "Back to course outline in Studio" +} \ No newline at end of file diff --git a/dist/i18n/messages/pt.json b/dist/i18n/messages/pt.json new file mode 100644 index 0000000000..7ffb78799c --- /dev/null +++ b/dist/i18n/messages/pt.json @@ -0,0 +1,36 @@ +{ + "header.links.courses": "Courses", + "header.links.programs": "Programs", + "header.links.content.search": "Discover New", + "header.links.schools": "Schools & Partners", + "header.user.menu.dashboard": "Dashboard", + "header.user.menu.profile": "Profile", + "header.user.menu.account.settings": "Account", + "header.user.menu.order.history": "Order History", + "header.user.menu.logout": "Logout", + "header.user.menu.login": "Login", + "header.user.menu.register": "Sign Up", + "header.user.menu.studio.home": "Studio Home", + "header.user.menu.studio.maintenance": "Maintenance", + "header.label.account.nav": "Account", + "header.label.account.menu": "Account Menu", + "header.label.account.menu.for": "Account menu for {username}", + "header.label.main.nav": "Main", + "header.label.main.menu": "Main Menu", + "header.label.main.header": "Main", + "header.label.secondary.nav": "Secondary", + "header.label.skip.nav": "Skip to main content", + "header.label.app.nav": "App", + "general.register.sentenceCase": "Register", + "general.signIn.sentenceCase": "Sign in", + "header.menu.dashboard.label": "Dashboard", + "header.help.label": "Help", + "header.menu.profile.label": "Profile", + "header.menu.account.label": "Account", + "header.menu.orderHistory.label": "Order History", + "header.navigation.skipNavLink": "Skip to main content.", + "header.menu.signOut.label": "Sign Out", + "header.user.menu.studio": "Studio Home", + "header.user.menu.maintenance": "Maintenance", + "header.label.courseOutline": "Back to course outline in Studio" +} \ No newline at end of file diff --git a/dist/i18n/messages/ru.json b/dist/i18n/messages/ru.json new file mode 100644 index 0000000000..7ffb78799c --- /dev/null +++ b/dist/i18n/messages/ru.json @@ -0,0 +1,36 @@ +{ + "header.links.courses": "Courses", + "header.links.programs": "Programs", + "header.links.content.search": "Discover New", + "header.links.schools": "Schools & Partners", + "header.user.menu.dashboard": "Dashboard", + "header.user.menu.profile": "Profile", + "header.user.menu.account.settings": "Account", + "header.user.menu.order.history": "Order History", + "header.user.menu.logout": "Logout", + "header.user.menu.login": "Login", + "header.user.menu.register": "Sign Up", + "header.user.menu.studio.home": "Studio Home", + "header.user.menu.studio.maintenance": "Maintenance", + "header.label.account.nav": "Account", + "header.label.account.menu": "Account Menu", + "header.label.account.menu.for": "Account menu for {username}", + "header.label.main.nav": "Main", + "header.label.main.menu": "Main Menu", + "header.label.main.header": "Main", + "header.label.secondary.nav": "Secondary", + "header.label.skip.nav": "Skip to main content", + "header.label.app.nav": "App", + "general.register.sentenceCase": "Register", + "general.signIn.sentenceCase": "Sign in", + "header.menu.dashboard.label": "Dashboard", + "header.help.label": "Help", + "header.menu.profile.label": "Profile", + "header.menu.account.label": "Account", + "header.menu.orderHistory.label": "Order History", + "header.navigation.skipNavLink": "Skip to main content.", + "header.menu.signOut.label": "Sign Out", + "header.user.menu.studio": "Studio Home", + "header.user.menu.maintenance": "Maintenance", + "header.label.courseOutline": "Back to course outline in Studio" +} \ No newline at end of file diff --git a/dist/i18n/messages/uk.json b/dist/i18n/messages/uk.json new file mode 100644 index 0000000000..575f3c80fb --- /dev/null +++ b/dist/i18n/messages/uk.json @@ -0,0 +1,36 @@ +{ + "header.links.courses": "Курси", + "header.links.programs": "Програми", + "header.links.content.search": "Discover New", + "header.links.schools": "Schools & Partners", + "header.user.menu.dashboard": "Dashboard", + "header.user.menu.profile": "Profile", + "header.user.menu.account.settings": "Account", + "header.user.menu.order.history": "Order History", + "header.user.menu.logout": "Logout", + "header.user.menu.login": "Login", + "header.user.menu.register": "Sign Up", + "header.user.menu.studio.home": "Studio Home", + "header.user.menu.studio.maintenance": "Maintenance", + "header.label.account.nav": "Account", + "header.label.account.menu": "Меню облікового запису", + "header.label.account.menu.for": "Меню облікового запису для {username}", + "header.label.main.nav": "Main", + "header.label.main.menu": "Main Menu", + "header.label.main.header": "Main", + "header.label.secondary.nav": "Secondary", + "header.label.skip.nav": "Перейти до головного змісту", + "header.label.app.nav": "App", + "general.register.sentenceCase": "Register", + "general.signIn.sentenceCase": "Увійти", + "header.menu.dashboard.label": "Dashboard", + "header.help.label": "Help", + "header.menu.profile.label": "Profile", + "header.menu.account.label": "Account", + "header.menu.orderHistory.label": "Order History", + "header.navigation.skipNavLink": "Перейти до головного змісту.", + "header.menu.signOut.label": "Sign Out", + "header.user.menu.studio": "Studio Home", + "header.user.menu.maintenance": "Maintenance", + "header.label.courseOutline": "Back to course outline in Studio" +} \ No newline at end of file diff --git a/dist/i18n/messages/zh_CN.json b/dist/i18n/messages/zh_CN.json new file mode 100644 index 0000000000..7ffb78799c --- /dev/null +++ b/dist/i18n/messages/zh_CN.json @@ -0,0 +1,36 @@ +{ + "header.links.courses": "Courses", + "header.links.programs": "Programs", + "header.links.content.search": "Discover New", + "header.links.schools": "Schools & Partners", + "header.user.menu.dashboard": "Dashboard", + "header.user.menu.profile": "Profile", + "header.user.menu.account.settings": "Account", + "header.user.menu.order.history": "Order History", + "header.user.menu.logout": "Logout", + "header.user.menu.login": "Login", + "header.user.menu.register": "Sign Up", + "header.user.menu.studio.home": "Studio Home", + "header.user.menu.studio.maintenance": "Maintenance", + "header.label.account.nav": "Account", + "header.label.account.menu": "Account Menu", + "header.label.account.menu.for": "Account menu for {username}", + "header.label.main.nav": "Main", + "header.label.main.menu": "Main Menu", + "header.label.main.header": "Main", + "header.label.secondary.nav": "Secondary", + "header.label.skip.nav": "Skip to main content", + "header.label.app.nav": "App", + "general.register.sentenceCase": "Register", + "general.signIn.sentenceCase": "Sign in", + "header.menu.dashboard.label": "Dashboard", + "header.help.label": "Help", + "header.menu.profile.label": "Profile", + "header.menu.account.label": "Account", + "header.menu.orderHistory.label": "Order History", + "header.navigation.skipNavLink": "Skip to main content.", + "header.menu.signOut.label": "Sign Out", + "header.user.menu.studio": "Studio Home", + "header.user.menu.maintenance": "Maintenance", + "header.label.courseOutline": "Back to course outline in Studio" +} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000000..d392a8f7d7 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,7 @@ +import Header from './Header'; +import LearningHeader from './learning-header/LearningHeader'; +import messages from './i18n/index'; +import StudioHeader from './studio-header'; +export { LearningHeader, messages, StudioHeader }; +export default Header; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000000..211b64a02c --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","names":["Header","LearningHeader","messages","StudioHeader"],"sources":["../src/index.jsx"],"sourcesContent":["import Header from './Header';\nimport LearningHeader from './learning-header/LearningHeader';\nimport messages from './i18n/index';\nimport StudioHeader from './studio-header';\n\nexport { LearningHeader, messages, StudioHeader };\n\nexport default Header;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,UAAU;AAC7B,OAAOC,cAAc,MAAM,kCAAkC;AAC7D,OAAOC,QAAQ,MAAM,cAAc;AACnC,OAAOC,YAAY,MAAM,iBAAiB;AAE1C,SAASF,cAAc,EAAEC,QAAQ,EAAEC,YAAY;AAE/C,eAAeH,MAAM"} \ No newline at end of file diff --git a/dist/index.scss b/dist/index.scss new file mode 100644 index 0000000000..3ef8f24d2c --- /dev/null +++ b/dist/index.scss @@ -0,0 +1,121 @@ +$spacer: 1rem; +$blue: #007db8; +$white: #fff; + +@import './Menu/menu.scss'; +@import './studio-header/StudioHeader.scss'; + +.dropdown-item a { + text-decoration: none; +} + +.icon-button { + display: inline-flex; + line-height: 3rem; + background: transparent; + vertical-align: middle; + text-align: center; + border: none; + height: 3rem; + width: 3rem; + padding: .75rem; + justify-content: center; + align-items:center; + &:hover, &:focus { + background: rgba(0,0,0,.1); + } +} + +.learning-header { + min-width: 0; + + .course-title-lockup { + min-width: 0; + + span { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + padding-bottom: 0.1rem; + } + } + + .user-dropdown { + .btn { + height: 3rem; + @media (map-get($grid-breakpoints, "sm")) { + padding: 0 0.5rem; + } + } + } +} + +.site-header-mobile, +.site-header-desktop { + position: relative; + z-index: 1000; +} + +.site-header-mobile { + height: 3rem; + + .nav-link { + text-decoration: none; + cursor: pointer; + } + img { + height: 1.5rem; + } +} + + +.site-header-desktop { + box-shadow: 0 1px 0 0 rgba(0,0,0,.1); + background: $white; + .nav-link { + text-decoration: none; + } + .logo { + display: block; + box-sizing: content-box; + position: relative; + top: -.05em; + height: 1.75rem; + padding: 1rem 0; + margin-right: 1rem; + img { + display: block; + height: 100%; + } + } + .main-nav { + .nav-link { + padding: 1.125rem 1rem; + text-decoration: none; + font-weight: 500; + letter-spacing: .01em; + } + .nav-link:hover, + .nav-link:focus, + .nav-link.active, + .expanded .nav-link { + background: $component-active-bg; + color: $component-active-color; + } + .menu { + position: static; + .menu-content { + border-top: solid 2px $component-active-bg; + left: 0; + right: 0; + box-shadow: 0 1px 2px rgba(0,0,0,.25); + border-bottom-left-radius: 2px; + border-bottom-right-radius: 2px; + padding: 1rem; + } + } + } + .search-input { + border-radius: $rounded-pill; + } +} diff --git a/dist/learning-header/AnonymousUserMenu.js b/dist/learning-header/AnonymousUserMenu.js new file mode 100644 index 0000000000..a4a1ad0e19 --- /dev/null +++ b/dist/learning-header/AnonymousUserMenu.js @@ -0,0 +1,22 @@ +import React from 'react'; +import { getConfig } from '@edx/frontend-platform'; +import { getLoginRedirectUrl } from '@edx/frontend-platform/auth'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { Button } from '@openedx/paragon'; +import genericMessages from '../generic/messages'; +var AnonymousUserMenu = function AnonymousUserMenu(_ref) { + var intl = _ref.intl; + return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, { + className: "mr-3", + variant: "outline-primary", + href: "".concat(getConfig().LMS_BASE_URL, "/register?next=").concat(encodeURIComponent(global.location.href)) + }, intl.formatMessage(genericMessages.registerSentenceCase)), /*#__PURE__*/React.createElement(Button, { + variant: "primary", + href: "".concat(getLoginRedirectUrl(global.location.href)) + }, intl.formatMessage(genericMessages.signInSentenceCase))); +}; +AnonymousUserMenu.propTypes = { + intl: intlShape.isRequired +}; +export default injectIntl(AnonymousUserMenu); +//# sourceMappingURL=AnonymousUserMenu.js.map \ No newline at end of file diff --git a/dist/learning-header/AnonymousUserMenu.js.map b/dist/learning-header/AnonymousUserMenu.js.map new file mode 100644 index 0000000000..8e189f2627 --- /dev/null +++ b/dist/learning-header/AnonymousUserMenu.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AnonymousUserMenu.js","names":["React","getConfig","getLoginRedirectUrl","injectIntl","intlShape","Button","genericMessages","AnonymousUserMenu","_ref","intl","createElement","className","variant","href","concat","LMS_BASE_URL","encodeURIComponent","global","location","formatMessage","registerSentenceCase","signInSentenceCase","propTypes","isRequired"],"sources":["../../src/learning-header/AnonymousUserMenu.jsx"],"sourcesContent":["import React from 'react';\n\nimport { getConfig } from '@edx/frontend-platform';\nimport { getLoginRedirectUrl } from '@edx/frontend-platform/auth';\nimport { injectIntl, intlShape } from '@edx/frontend-platform/i18n';\nimport { Button } from '@openedx/paragon';\n\nimport genericMessages from '../generic/messages';\n\nconst AnonymousUserMenu = ({ intl }) => (\n
    \n \n {intl.formatMessage(genericMessages.registerSentenceCase)}\n \n \n {intl.formatMessage(genericMessages.signInSentenceCase)}\n \n
    \n);\n\nAnonymousUserMenu.propTypes = {\n intl: intlShape.isRequired,\n};\n\nexport default injectIntl(AnonymousUserMenu);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,mBAAmB,QAAQ,6BAA6B;AACjE,SAASC,UAAU,EAAEC,SAAS,QAAQ,6BAA6B;AACnE,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,OAAOC,eAAe,MAAM,qBAAqB;AAEjD,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA;EAAA,IAAMC,IAAI,GAAAD,IAAA,CAAJC,IAAI;EAAA,oBAC/BT,KAAA,CAAAU,aAAA,2BACEV,KAAA,CAAAU,aAAA,CAACL,MAAM;IACLM,SAAS,EAAC,MAAM;IAChBC,OAAO,EAAC,iBAAiB;IACzBC,IAAI,KAAAC,MAAA,CAAKb,SAAS,CAAC,CAAC,CAACc,YAAY,qBAAAD,MAAA,CAAkBE,kBAAkB,CAACC,MAAM,CAACC,QAAQ,CAACL,IAAI,CAAC;EAAG,GAE7FJ,IAAI,CAACU,aAAa,CAACb,eAAe,CAACc,oBAAoB,CAClD,CAAC,eACTpB,KAAA,CAAAU,aAAA,CAACL,MAAM;IACLO,OAAO,EAAC,SAAS;IACjBC,IAAI,KAAAC,MAAA,CAAKZ,mBAAmB,CAACe,MAAM,CAACC,QAAQ,CAACL,IAAI,CAAC;EAAG,GAEpDJ,IAAI,CAACU,aAAa,CAACb,eAAe,CAACe,kBAAkB,CAChD,CACL,CAAC;AAAA,CACP;AAEDd,iBAAiB,CAACe,SAAS,GAAG;EAC5Bb,IAAI,EAAEL,SAAS,CAACmB;AAClB,CAAC;AAED,eAAepB,UAAU,CAACI,iBAAiB,CAAC"} \ No newline at end of file diff --git a/dist/learning-header/AuthenticatedUserDropdown.js b/dist/learning-header/AuthenticatedUserDropdown.js new file mode 100644 index 0000000000..a3ab0bc33f --- /dev/null +++ b/dist/learning-header/AuthenticatedUserDropdown.js @@ -0,0 +1,46 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faUserCircle } from '@fortawesome/free-solid-svg-icons'; +import { getConfig } from '@edx/frontend-platform'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { Dropdown } from '@openedx/paragon'; +import messages from './messages'; +var AuthenticatedUserDropdown = function AuthenticatedUserDropdown(_ref) { + var intl = _ref.intl, + username = _ref.username; + var dashboardMenuItem = /*#__PURE__*/React.createElement(Dropdown.Item, { + href: "".concat(getConfig().LMS_BASE_URL, "/dashboard") + }, intl.formatMessage(messages.dashboard)); + return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", { + className: "text-gray-700", + href: "".concat(getConfig().SUPPORT_URL) + }, intl.formatMessage(messages.help)), /*#__PURE__*/React.createElement(Dropdown, { + className: "user-dropdown ml-3" + }, /*#__PURE__*/React.createElement(Dropdown.Toggle, { + variant: "outline-primary" + }, /*#__PURE__*/React.createElement(FontAwesomeIcon, { + icon: faUserCircle, + className: "d-md-none", + size: "lg" + }), /*#__PURE__*/React.createElement("span", { + "data-hj-suppress": true, + className: "d-none d-md-inline" + }, username)), /*#__PURE__*/React.createElement(Dropdown.Menu, { + className: "dropdown-menu-right" + }, dashboardMenuItem, /*#__PURE__*/React.createElement(Dropdown.Item, { + href: "".concat(getConfig().ACCOUNT_PROFILE_URL, "/u/").concat(username) + }, intl.formatMessage(messages.profile)), /*#__PURE__*/React.createElement(Dropdown.Item, { + href: getConfig().ACCOUNT_SETTINGS_URL + }, intl.formatMessage(messages.account)), getConfig().ORDER_HISTORY_URL && /*#__PURE__*/React.createElement(Dropdown.Item, { + href: getConfig().ORDER_HISTORY_URL + }, intl.formatMessage(messages.orderHistory)), /*#__PURE__*/React.createElement(Dropdown.Item, { + href: getConfig().LOGOUT_URL + }, intl.formatMessage(messages.signOut))))); +}; +AuthenticatedUserDropdown.propTypes = { + intl: intlShape.isRequired, + username: PropTypes.string.isRequired +}; +export default injectIntl(AuthenticatedUserDropdown); +//# sourceMappingURL=AuthenticatedUserDropdown.js.map \ No newline at end of file diff --git a/dist/learning-header/AuthenticatedUserDropdown.js.map b/dist/learning-header/AuthenticatedUserDropdown.js.map new file mode 100644 index 0000000000..0fc5c1ba9e --- /dev/null +++ b/dist/learning-header/AuthenticatedUserDropdown.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AuthenticatedUserDropdown.js","names":["React","PropTypes","FontAwesomeIcon","faUserCircle","getConfig","injectIntl","intlShape","Dropdown","messages","AuthenticatedUserDropdown","_ref","intl","username","dashboardMenuItem","createElement","Item","href","concat","LMS_BASE_URL","formatMessage","dashboard","Fragment","className","SUPPORT_URL","help","Toggle","variant","icon","size","Menu","ACCOUNT_PROFILE_URL","profile","ACCOUNT_SETTINGS_URL","account","ORDER_HISTORY_URL","orderHistory","LOGOUT_URL","signOut","propTypes","isRequired","string"],"sources":["../../src/learning-header/AuthenticatedUserDropdown.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { faUserCircle } from '@fortawesome/free-solid-svg-icons';\nimport { getConfig } from '@edx/frontend-platform';\nimport { injectIntl, intlShape } from '@edx/frontend-platform/i18n';\nimport { Dropdown } from '@openedx/paragon';\n\nimport messages from './messages';\n\nconst AuthenticatedUserDropdown = ({ intl, username }) => {\n const dashboardMenuItem = (\n \n {intl.formatMessage(messages.dashboard)}\n \n );\n\n return (\n <>\n {intl.formatMessage(messages.help)}\n \n \n \n \n {username}\n \n \n \n {dashboardMenuItem}\n \n {intl.formatMessage(messages.profile)}\n \n \n {intl.formatMessage(messages.account)}\n \n { getConfig().ORDER_HISTORY_URL && (\n \n {intl.formatMessage(messages.orderHistory)}\n \n )}\n \n {intl.formatMessage(messages.signOut)}\n \n \n \n \n );\n};\n\nAuthenticatedUserDropdown.propTypes = {\n intl: intlShape.isRequired,\n username: PropTypes.string.isRequired,\n};\n\nexport default injectIntl(AuthenticatedUserDropdown);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,YAAY,QAAQ,mCAAmC;AAChE,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,UAAU,EAAEC,SAAS,QAAQ,6BAA6B;AACnE,SAASC,QAAQ,QAAQ,kBAAkB;AAE3C,OAAOC,QAAQ,MAAM,YAAY;AAEjC,IAAMC,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAAC,IAAA,EAA2B;EAAA,IAArBC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EACjD,IAAMC,iBAAiB,gBACrBb,KAAA,CAAAc,aAAA,CAACP,QAAQ,CAACQ,IAAI;IAACC,IAAI,KAAAC,MAAA,CAAKb,SAAS,CAAC,CAAC,CAAC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BlC,KAAA,CAAAc,aAAA,CAACP,QAAQ,CAACQ,IAAI;IAACC,IAAI,EAAEZ,SAAS,CAAC,CAAC,CAAC8B;EAAkB,GAChDvB,IAAI,CAACQ,aAAa,CAACX,QAAQ,CAAC2B,YAAY,CAC5B,CAChB,eACDnC,KAAA,CAAAc,aAAA,CAACP,QAAQ,CAACQ,IAAI;IAACC,IAAI,EAAEZ,SAAS,CAAC,CAAC,CAACgC;EAAW,GACzCzB,IAAI,CAACQ,aAAa,CAACX,QAAQ,CAAC6B,OAAO,CACvB,CACF,CACP,CACV,CAAC;AAEP,CAAC;AAED5B,yBAAyB,CAAC6B,SAAS,GAAG;EACpC3B,IAAI,EAAEL,SAAS,CAACiC,UAAU;EAC1B3B,QAAQ,EAAEX,SAAS,CAACuC,MAAM,CAACD;AAC7B,CAAC;AAED,eAAelC,UAAU,CAACI,yBAAyB,CAAC"} \ No newline at end of file diff --git a/dist/learning-header/LearningHeader.js b/dist/learning-header/LearningHeader.js new file mode 100644 index 0000000000..b3df159133 --- /dev/null +++ b/dist/learning-header/LearningHeader.js @@ -0,0 +1,101 @@ +var _excluded = ["href", "src", "alt"]; +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } +function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); } +function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } +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; } +import React, { useContext, useEffect, useState } from 'react'; +import PropTypes from 'prop-types'; +import { getConfig } from '@edx/frontend-platform'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { AppContext } from '@edx/frontend-platform/react'; +import AnonymousUserMenu from './AnonymousUserMenu'; +import AuthenticatedUserDropdown from './AuthenticatedUserDropdown'; +import messages from './messages'; +import getCourseLogoOrg from './data/api'; +var LinkedLogo = function LinkedLogo(_ref) { + var href = _ref.href, + src = _ref.src, + alt = _ref.alt, + attributes = _objectWithoutProperties(_ref, _excluded); + return /*#__PURE__*/React.createElement("a", _extends({ + href: href + }, attributes), /*#__PURE__*/React.createElement("img", { + className: "d-block", + src: src, + alt: alt + })); +}; +LinkedLogo.propTypes = { + href: PropTypes.string.isRequired, + src: PropTypes.string.isRequired, + alt: PropTypes.string.isRequired +}; +var enabledOrgLogo = getConfig().ENABLED_ORG_LOGO; +var LearningHeader = function LearningHeader(_ref2) { + var courseOrg = _ref2.courseOrg, + courseTitle = _ref2.courseTitle, + intl = _ref2.intl, + showUserDropdown = _ref2.showUserDropdown; + var _useContext = useContext(AppContext), + authenticatedUser = _useContext.authenticatedUser; + var _useState = useState(null), + _useState2 = _slicedToArray(_useState, 2), + logoOrg = _useState2[0], + setLogoOrg = _useState2[1]; + useEffect(function () { + if (courseOrg) { + getCourseLogoOrg().then(function (logoOrgUrl) { + setLogoOrg(logoOrgUrl); + }); + } + }); + var headerLogo = /*#__PURE__*/React.createElement(LinkedLogo, { + className: "logo", + href: "".concat(getConfig().LMS_BASE_URL, "/dashboard"), + src: getConfig().LOGO_URL, + alt: getConfig().SITE_NAME + }); + return /*#__PURE__*/React.createElement("header", { + className: "learning-header" + }, /*#__PURE__*/React.createElement("a", { + className: "sr-only sr-only-focusable", + href: "#main-content" + }, intl.formatMessage(messages.skipNavLink)), /*#__PURE__*/React.createElement("div", { + className: "container-xl py-2 d-flex align-items-center" + }, headerLogo, /*#__PURE__*/React.createElement("div", { + className: "d-none d-md-block flex-grow-1 course-title-lockup" + }, /*#__PURE__*/React.createElement("div", { + className: "d-md-flex ".concat(enabledOrgLogo && 'align-items-center justify-content-center', " w-100") + }, enabledOrgLogo ? courseOrg && logoOrg && /*#__PURE__*/React.createElement("img", { + src: logoOrg, + alt: "".concat(courseOrg, " logo"), + style: { + maxHeight: '45px' + } + }) : null, /*#__PURE__*/React.createElement("span", { + className: "d-inline-block course-title font-weight-semibold ml-3 text-truncate text-left w-25", + style: { + fontSize: '0.85rem' + } + }, courseTitle))), showUserDropdown && authenticatedUser && /*#__PURE__*/React.createElement(AuthenticatedUserDropdown, { + username: authenticatedUser.username + }), showUserDropdown && !authenticatedUser && /*#__PURE__*/React.createElement(AnonymousUserMenu, null))); +}; +LearningHeader.propTypes = { + courseOrg: PropTypes.string, + courseTitle: PropTypes.string, + intl: intlShape.isRequired, + showUserDropdown: PropTypes.bool +}; +LearningHeader.defaultProps = { + courseOrg: null, + courseTitle: null, + showUserDropdown: true +}; +export default injectIntl(LearningHeader); +//# sourceMappingURL=LearningHeader.js.map \ No newline at end of file diff --git a/dist/learning-header/LearningHeader.js.map b/dist/learning-header/LearningHeader.js.map new file mode 100644 index 0000000000..1e6acd597b --- /dev/null +++ b/dist/learning-header/LearningHeader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LearningHeader.js","names":["React","useContext","useEffect","useState","PropTypes","getConfig","injectIntl","intlShape","AppContext","AnonymousUserMenu","AuthenticatedUserDropdown","messages","getCourseLogoOrg","LinkedLogo","_ref","href","src","alt","attributes","_objectWithoutProperties","_excluded","createElement","_extends","className","propTypes","string","isRequired","enabledOrgLogo","ENABLED_ORG_LOGO","LearningHeader","_ref2","courseOrg","courseTitle","intl","showUserDropdown","_useContext","authenticatedUser","_useState","_useState2","_slicedToArray","logoOrg","setLogoOrg","then","logoOrgUrl","headerLogo","concat","LMS_BASE_URL","LOGO_URL","SITE_NAME","formatMessage","skipNavLink","style","maxHeight","fontSize","username","bool","defaultProps"],"sources":["../../src/learning-header/LearningHeader.jsx"],"sourcesContent":["import React, { useContext, useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { getConfig } from '@edx/frontend-platform';\nimport { injectIntl, intlShape } from '@edx/frontend-platform/i18n';\nimport { AppContext } from '@edx/frontend-platform/react';\n\nimport AnonymousUserMenu from './AnonymousUserMenu';\nimport AuthenticatedUserDropdown from './AuthenticatedUserDropdown';\nimport messages from './messages';\nimport getCourseLogoOrg from './data/api';\n\nconst LinkedLogo = ({\n href,\n src,\n alt,\n ...attributes\n}) => (\n \n {alt}\n \n);\n\nLinkedLogo.propTypes = {\n href: PropTypes.string.isRequired,\n src: PropTypes.string.isRequired,\n alt: PropTypes.string.isRequired,\n};\n\nconst enabledOrgLogo = getConfig().ENABLED_ORG_LOGO;\n\nconst LearningHeader = ({\n courseOrg, courseTitle, intl, showUserDropdown,\n}) => {\n const { authenticatedUser } = useContext(AppContext);\n const [logoOrg, setLogoOrg] = useState(null);\n\n useEffect(() => {\n if (courseOrg) {\n getCourseLogoOrg().then((logoOrgUrl) => { setLogoOrg(logoOrgUrl); });\n }\n });\n\n const headerLogo = (\n \n );\n\n return (\n
    \n {intl.formatMessage(messages.skipNavLink)}\n
    \n {headerLogo}\n
    \n
    \n {enabledOrgLogo ? (\n (courseOrg && logoOrg)\n && {`${courseOrg}\n ) : null}\n \n {courseTitle}\n \n
    \n
    \n {showUserDropdown && authenticatedUser && (\n \n )}\n {showUserDropdown && !authenticatedUser && (\n \n )}\n
    \n
    \n );\n};\n\nLearningHeader.propTypes = {\n courseOrg: PropTypes.string,\n courseTitle: PropTypes.string,\n intl: intlShape.isRequired,\n showUserDropdown: PropTypes.bool,\n};\n\nLearningHeader.defaultProps = {\n courseOrg: null,\n courseTitle: null,\n showUserDropdown: true,\n};\n\nexport default injectIntl(LearningHeader);\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC9D,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,UAAU,EAAEC,SAAS,QAAQ,6BAA6B;AACnE,SAASC,UAAU,QAAQ,8BAA8B;AAEzD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,gBAAgB,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LE,gBAAgB,IAAIE,iBAAiB,iBACpCpC,KAAA,CAAAqB,aAAA,CAACX,yBAAyB;IACxB4C,QAAQ,EAAElB,iBAAiB,CAACkB;EAAS,CACtC,CACF,EACApB,gBAAgB,IAAI,CAACE,iBAAiB,iBACrCpC,KAAA,CAAAqB,aAAA,CAACZ,iBAAiB,MAAE,CAEnB,CACC,CAAC;AAEb,CAAC;AAEDoB,cAAc,CAACL,SAAS,GAAG;EACzBO,SAAS,EAAE3B,SAAS,CAACqB,MAAM;EAC3BO,WAAW,EAAE5B,SAAS,CAACqB,MAAM;EAC7BQ,IAAI,EAAE1B,SAAS,CAACmB,UAAU;EAC1BQ,gBAAgB,EAAE9B,SAAS,CAACmD;AAC9B,CAAC;AAED1B,cAAc,CAAC2B,YAAY,GAAG;EAC5BzB,SAAS,EAAE,IAAI;EACfC,WAAW,EAAE,IAAI;EACjBE,gBAAgB,EAAE;AACpB,CAAC;AAED,eAAe5B,UAAU,CAACuB,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/learning-header/_header.scss b/dist/learning-header/_header.scss new file mode 100644 index 0000000000..357cc6b3a9 --- /dev/null +++ b/dist/learning-header/_header.scss @@ -0,0 +1,10 @@ +@import "../../node_modules/bootstrap/scss/bootstrap-grid"; +@import "../../node_modules/bootstrap/scss/mixins/breakpoints"; + +.logo { + img { + @include media-breakpoint-down(sm) { + max-width: 85% !important; + } + } +} \ No newline at end of file diff --git a/dist/learning-header/data/api.js b/dist/learning-header/data/api.js new file mode 100644 index 0000000000..2f92a33313 --- /dev/null +++ b/dist/learning-header/data/api.js @@ -0,0 +1,45 @@ +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +import { getConfig } from '@edx/frontend-platform'; +import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; +var getCourseLogoOrg = /*#__PURE__*/function () { + var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { + var orgId, _yield$getAuthenticat, data, _ref2, httpErrorStatus; + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + _context.prev = 0; + orgId = window.location.pathname.match(/course-(.*?):([^+]+)/)[2]; + _context.next = 4; + return getAuthenticatedHttpClient().get("".concat(getConfig().LMS_BASE_URL, "/api/organizations/v0/organizations/").concat(orgId, "/"), { + useCache: true + }); + case 4: + _yield$getAuthenticat = _context.sent; + data = _yield$getAuthenticat.data; + return _context.abrupt("return", data.logo); + case 9: + _context.prev = 9; + _context.t0 = _context["catch"](0); + _ref2 = _context.t0 && _context.t0.customAttributes, httpErrorStatus = _ref2.httpErrorStatus; + if (!(httpErrorStatus === 404)) { + _context.next = 14; + break; + } + return _context.abrupt("return", null); + case 14: + throw _context.t0; + case 15: + case "end": + return _context.stop(); + } + }, _callee, null, [[0, 9]]); + })); + return function getCourseLogoOrg() { + return _ref.apply(this, arguments); + }; +}(); +export default getCourseLogoOrg; +//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/dist/learning-header/data/api.js.map b/dist/learning-header/data/api.js.map new file mode 100644 index 0000000000..80e3a22a92 --- /dev/null +++ b/dist/learning-header/data/api.js.map @@ -0,0 +1 @@ +{"version":3,"file":"api.js","names":["_regeneratorRuntime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","defineProperty","obj","key","desc","value","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","makeInvokeMethod","tryCatch","fn","arg","type","call","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","method","_invoke","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","_typeof","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","done","methodName","undefined","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","val","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","_catch","thrown","delegateYield","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","arguments","apply","getConfig","getAuthenticatedHttpClient","getCourseLogoOrg","_ref","_callee","orgId","_yield$getAuthenticat","data","_ref2","httpErrorStatus","_callee$","_context","window","location","pathname","match","get","concat","LMS_BASE_URL","useCache","logo","t0","customAttributes"],"sources":["../../../src/learning-header/data/api.js"],"sourcesContent":["import { getConfig } from '@edx/frontend-platform';\nimport { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';\n\nconst getCourseLogoOrg = async () => {\n try {\n const orgId = window.location.pathname.match(/course-(.*?):([^+]+)/)[2];\n const { data } = await getAuthenticatedHttpClient()\n .get(\n `${getConfig().LMS_BASE_URL}/api/organizations/v0/organizations/${orgId}/`,\n { useCache: true },\n );\n return data.logo;\n } catch (error) {\n const { httpErrorStatus } = error && error.customAttributes;\n if (httpErrorStatus === 404) {\n return null;\n }\n throw error;\n }\n};\n\nexport default getCourseLogoOrg;\n"],"mappings":";+CACA,qJAAAA,mBAAA,YAAAA,o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J,mBAAA,GAAAyB,IAAA,UAAAsI,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAArC,IAAA,GAAAqC,QAAA,CAAA3E,IAAA;QAAA;UAAA2E,QAAA,CAAArC,IAAA;UAEf+B,KAAK,GAAGO,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAACC,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;UAAAJ,QAAA,CAAA3E,IAAA;UAAA,OAChDiE,0BAA0B,CAAC,CAAC,CAChDe,GAAG,IAAAC,MAAA,CACCjB,SAAS,CAAC,CAAC,CAACkB,YAAY,0CAAAD,MAAA,CAAuCZ,KAAK,QACvE;YAAEc,QAAQ,EAAE;UAAK,CACnB,CAAC;QAAA;UAAAb,qBAAA,GAAAK,QAAA,CAAArF,IAAA;UAJKiF,IAAI,GAAAD,qBAAA,CAAJC,IAAI;UAAA,OAAAI,QAAA,CAAAlF,MAAA,WAKL8E,IAAI,CAACa,IAAI;QAAA;UAAAT,QAAA,CAAArC,IAAA;UAAAqC,QAAA,CAAAU,EAAA,GAAAV,QAAA;UAAAH,KAAA,GAEYG,QAAA,CAAAU,EAAA,IAASV,QAAA,CAAAU,EAAA,CAAMC,gBAAgB,EAAnDb,eAAe,GAAAD,KAAA,CAAfC,eAAe;UAAA,MACnBA,eAAe,KAAK,GAAG;YAAAE,QAAA,CAAA3E,IAAA;YAAA;UAAA;UAAA,OAAA2E,QAAA,CAAAlF,MAAA,WAClB,IAAI;QAAA;UAAA,MAAAkF,QAAA,CAAAU,EAAA;QAAA;QAAA;UAAA,OAAAV,QAAA,CAAAlC,IAAA;MAAA;IAAA,GAAA2B,OAAA;EAAA,CAIhB;EAAA,gBAhBKF,gBAAgBA,CAAA;IAAA,OAAAC,IAAA,CAAAJ,KAAA,OAAAD,SAAA;EAAA;AAAA,GAgBrB;AAED,eAAeI,gBAAgB"} \ No newline at end of file diff --git a/dist/learning-header/data/api.test.js b/dist/learning-header/data/api.test.js new file mode 100644 index 0000000000..f9eacbee9c --- /dev/null +++ b/dist/learning-header/data/api.test.js @@ -0,0 +1,166 @@ +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } +function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } +function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } +function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +import { getConfig } from '@edx/frontend-platform'; +import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; +import getCourseLogoOrg from './api'; +import { initializeMockApp } from '../../setupTest'; +jest.mock('@edx/frontend-platform/auth'); +var CustomError = /*#__PURE__*/function (_Error) { + _inherits(CustomError, _Error); + var _super = _createSuper(CustomError); + function CustomError(httpErrorStatus) { + var _this; + _classCallCheck(this, CustomError); + _this = _super.call(this); + _this.customAttributes = { + httpErrorStatus: httpErrorStatus + }; + return _this; + } + return _createClass(CustomError); +}( /*#__PURE__*/_wrapNativeSuper(Error)); +describe('getCourseLogoOrg', function () { + beforeEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return initializeMockApp(); + case 2: + delete window.location; + getAuthenticatedHttpClient.mockReset(); + case 4: + case "end": + return _context.stop(); + } + }, _callee); + }))); + it('should return the organization logo when the URL is valid', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { + var logoOrg; + return _regeneratorRuntime().wrap(function _callee3$(_context3) { + while (1) switch (_context3.prev = _context3.next) { + case 0: + window.location = new URL("".concat(getConfig().BASE_URL, "/learning/course/course-v1:edX+DemoX+Demo_Course/home")); + getAuthenticatedHttpClient.mockReturnValue({ + get: function () { + var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { + return _regeneratorRuntime().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + return _context2.abrupt("return", Promise.resolve({ + data: { + logo: 'https://example.com/logo.svg' + } + })); + case 1: + case "end": + return _context2.stop(); + } + }, _callee2); + })); + function get() { + return _get.apply(this, arguments); + } + return get; + }() + }); + _context3.next = 4; + return getCourseLogoOrg(); + case 4: + logoOrg = _context3.sent; + expect(logoOrg).toBe('https://example.com/logo.svg'); + case 6: + case "end": + return _context3.stop(); + } + }, _callee3); + }))); + it('should return null when the organization logo is not found', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() { + var logoOrg; + return _regeneratorRuntime().wrap(function _callee5$(_context5) { + while (1) switch (_context5.prev = _context5.next) { + case 0: + window.location = new URL("".concat(getConfig().BASE_URL, "/learning/course/course-v1:edX+DemoX+Nonexistent_Course/home")); + getAuthenticatedHttpClient.mockReturnValue({ + get: function () { + var _get2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() { + return _regeneratorRuntime().wrap(function _callee4$(_context4) { + while (1) switch (_context4.prev = _context4.next) { + case 0: + throw new CustomError(404); + case 1: + case "end": + return _context4.stop(); + } + }, _callee4); + })); + function get() { + return _get2.apply(this, arguments); + } + return get; + }() + }); + _context5.next = 4; + return getCourseLogoOrg(); + case 4: + logoOrg = _context5.sent; + expect(logoOrg).toBeNull(); + case 6: + case "end": + return _context5.stop(); + } + }, _callee5); + }))); + it('should throw an error when an unexpected error occurs', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() { + var customError; + return _regeneratorRuntime().wrap(function _callee7$(_context7) { + while (1) switch (_context7.prev = _context7.next) { + case 0: + customError = new CustomError(500); + window.location = new URL("".concat(getConfig().BASE_URL, "/learning/course/course-v1:edX+DemoX+Demo_Course/home")); + getAuthenticatedHttpClient.mockReturnValue({ + get: function () { + var _get3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() { + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + throw customError; + case 1: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + function get() { + return _get3.apply(this, arguments); + } + return get; + }() + }); + _context7.next = 5; + return expect(getCourseLogoOrg()).rejects.toThrow(customError); + case 5: + case "end": + return _context7.stop(); + } + }, _callee7); + }))); +}); +//# sourceMappingURL=api.test.js.map \ No newline at end of file diff --git a/dist/learning-header/data/api.test.js.map b/dist/learning-header/data/api.test.js.map new file mode 100644 index 0000000000..fd6cbd037b --- /dev/null +++ b/dist/learning-header/data/api.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"api.test.js","names":["_regeneratorRuntime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","defineProperty","obj","key","desc","value","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","makeInvokeMethod","tryCatch","fn","arg","type","call","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","method","_invoke","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","_typeof","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","done","methodName","undefined","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","val","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","_catch","thrown","delegateYield","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","arguments","apply","_defineProperties","target","props","descriptor","_toPropertyKey","_createClass","Constructor","protoProps","staticProps","_toPrimitive","String","input","hint","prim","toPrimitive","res","Number","_classCallCheck","instance","_inherits","subClass","superClass","_setPrototypeOf","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf","NewTarget","Reflect","construct","_possibleConstructorReturn","_assertThisInitialized","ReferenceError","_wrapNativeSuper","Class","_cache","Map","_isNativeFunction","has","get","set","Wrapper","_construct","Parent","bind","a","Function","sham","Proxy","Boolean","valueOf","e","toString","indexOf","o","p","getConfig","getAuthenticatedHttpClient","getCourseLogoOrg","initializeMockApp","jest","mock","CustomError","_Error","_super","httpErrorStatus","_this","customAttributes","describe","beforeEach","_callee","_callee$","_context","window","location","mockReset","it","_callee3","logoOrg","_callee3$","_context3","URL","concat","BASE_URL","mockReturnValue","_get","_callee2","_callee2$","_context2","data","logo","expect","toBe","_callee5","_callee5$","_context5","_get2","_callee4","_callee4$","_context4","toBeNull","_callee7","customError","_callee7$","_context7","_get3","_callee6","_callee6$","_context6","rejects","toThrow"],"sources":["../../../src/learning-header/data/api.test.js"],"sourcesContent":["import { getConfig } from '@edx/frontend-platform';\nimport { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';\nimport getCourseLogoOrg from './api';\nimport { initializeMockApp } from '../../setupTest';\n\njest.mock('@edx/frontend-platform/auth');\n\nclass CustomError extends Error {\n constructor(httpErrorStatus) {\n super();\n this.customAttributes = {\n httpErrorStatus,\n };\n }\n}\n\ndescribe('getCourseLogoOrg', () => {\n beforeEach(async () => {\n // We need to mock AuthService to implicitly use `getAuthenticatedHttpClient` within `AppContext.Provider`.\n await initializeMockApp();\n delete window.location;\n getAuthenticatedHttpClient.mockReset();\n });\n\n it('should return the organization logo when the URL is valid', async () => {\n window.location = new URL(`${getConfig().BASE_URL}/learning/course/course-v1:edX+DemoX+Demo_Course/home`);\n getAuthenticatedHttpClient.mockReturnValue({\n get: async () => Promise.resolve({\n data: {\n logo: 'https://example.com/logo.svg',\n },\n }),\n });\n const logoOrg = await getCourseLogoOrg();\n expect(logoOrg).toBe('https://example.com/logo.svg');\n });\n\n it('should return null when the organization logo is not found', async () => {\n window.location = new URL(`${getConfig().BASE_URL}/learning/course/course-v1:edX+DemoX+Nonexistent_Course/home`);\n getAuthenticatedHttpClient.mockReturnValue({\n get: async () => {\n throw new CustomError(404);\n },\n });\n const logoOrg = await getCourseLogoOrg();\n expect(logoOrg).toBeNull();\n });\n\n it('should throw an error when an unexpected error occurs', async () => {\n const customError = new CustomError(500);\n window.location = new URL(`${getConfig().BASE_URL}/learning/course/course-v1:edX+DemoX+Demo_Course/home`);\n getAuthenticatedHttpClient.mockReturnValue({\n get: async () => {\n throw customError;\n },\n });\n await expect(getCourseLogoOrg()).rejects.toThrow(customError);\n });\n});\n"],"mappings":";+CACA,qJAAAA,mBAAA,YAAAA,oBAAA,WAAAC,OAAA,SAAAA,OAAA,OAAAC,EAAA,GAAAC,MAAA,CAAAC,SAAA,EAAAC,MAAA,GAAAH,EAAA,CAAAI,cAAA,EAAAC,cAAA,GAAAJ,MAAA,CAAAI,cAAA,cAAAC,GAAA,EAAAC,GAAA,EAAAC,IAAA,IAAAF,GAAA,CAAAC,GAAA,IAAAC,IAAA,CAAAC,KAAA,KAAAC,OAAA,wBAAAC,MAAA,GAAAA,MAAA,OAAAC,cAAA,GAAAF,OAAA,CAAAG,QAAA,kBAAAC,mBAAA,GAAAJ,OAAA,CAAAK,aAAA,uBAAAC,iBAAA,GAAAN,OAAA,CAAAO,WAAA,8BAAAC,OAAAZ,GAAA,EAAAC,GAAA,EAAAE,KAAA,WAAAR,MAAA,CAAAI,cAAA,CAAAC,GAAA,EAAAC,GAAA,IAAAE,KAAA,EAAAA,KAAA,EAAAU,UAAA,MAAAC,YAAA,MAAAC,QAAA,SAAAf,GAAA,CAAAC,GAAA,WAAAW,MAAA,mBAAAI,GAAA,IAAAJ,MAAA,YAAAA,OAAAZ,GAAA,EAAAC,GAAA,EAAAE,KAAA,WAAAH,GAAA,CAAAC,GAAA,IAAAE,KAAA,gBAAAc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yK,WAAW;oBAAA;oBAAA;sBAAA,OAAAM,SAAA,CAAAtI,IAAA;kBAAA;gBAAA,GAAAoI,QAAA;cAAA,CAClB;cAAA,SAAAnE,IAAA;gBAAA,OAAAkE,KAAA,CAAA7G,KAAA,OAAAD,SAAA;cAAA;cAAA,OAAA4C,GAAA;YAAA;UACH,CAAC,CAAC;UAACiE,SAAA,CAAA3K,IAAA;UAAA,OACG8J,MAAM,CAACjC,gBAAgB,CAAC,CAAC,CAAC,CAACmD,OAAO,CAACC,OAAO,CAACR,WAAW,CAAC;QAAA;QAAA;UAAA,OAAAE,SAAA,CAAAlI,IAAA;MAAA;IAAA,GAAA+H,QAAA;EAAA,CAC9D,GAAC;AACJ,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/learning-header/messages.js b/dist/learning-header/messages.js new file mode 100644 index 0000000000..f9b0d5e061 --- /dev/null +++ b/dist/learning-header/messages.js @@ -0,0 +1,40 @@ +import { defineMessages } from '@edx/frontend-platform/i18n'; +var messages = defineMessages({ + dashboard: { + id: 'header.menu.dashboard.label', + defaultMessage: 'Dashboard', + description: 'The text for the user menu Dashboard navigation link.' + }, + help: { + id: 'header.help.label', + defaultMessage: 'Help', + description: 'The text for the link to the Help Center' + }, + profile: { + id: 'header.menu.profile.label', + defaultMessage: 'Profile', + description: 'The text for the user menu Profile navigation link.' + }, + account: { + id: 'header.menu.account.label', + defaultMessage: 'Account', + description: 'The text for the user menu Account navigation link.' + }, + orderHistory: { + id: 'header.menu.orderHistory.label', + defaultMessage: 'Order History', + description: 'The text for the user menu Order History navigation link.' + }, + skipNavLink: { + id: 'header.navigation.skipNavLink', + defaultMessage: 'Skip to main content.', + description: 'A link used by screen readers to allow users to skip to the main content of the page.' + }, + signOut: { + id: 'header.menu.signOut.label', + defaultMessage: 'Sign Out', + description: 'The label for the user menu Sign Out action.' + } +}); +export default messages; +//# sourceMappingURL=messages.js.map \ No newline at end of file diff --git a/dist/learning-header/messages.js.map b/dist/learning-header/messages.js.map new file mode 100644 index 0000000000..4fd0e2ea74 --- /dev/null +++ b/dist/learning-header/messages.js.map @@ -0,0 +1 @@ +{"version":3,"file":"messages.js","names":["defineMessages","messages","dashboard","id","defaultMessage","description","help","profile","account","orderHistory","skipNavLink","signOut"],"sources":["../../src/learning-header/messages.js"],"sourcesContent":["import { defineMessages } from '@edx/frontend-platform/i18n';\n\nconst messages = defineMessages({\n dashboard: {\n id: 'header.menu.dashboard.label',\n defaultMessage: 'Dashboard',\n description: 'The text for the user menu Dashboard navigation link.',\n },\n help: {\n id: 'header.help.label',\n defaultMessage: 'Help',\n description: 'The text for the link to the Help Center',\n },\n profile: {\n id: 'header.menu.profile.label',\n defaultMessage: 'Profile',\n description: 'The text for the user menu Profile navigation link.',\n },\n account: {\n id: 'header.menu.account.label',\n defaultMessage: 'Account',\n description: 'The text for the user menu Account navigation link.',\n },\n orderHistory: {\n id: 'header.menu.orderHistory.label',\n defaultMessage: 'Order History',\n description: 'The text for the user menu Order History navigation link.',\n },\n skipNavLink: {\n id: 'header.navigation.skipNavLink',\n defaultMessage: 'Skip to main content.',\n description: 'A link used by screen readers to allow users to skip to the main content of the page.',\n },\n signOut: {\n id: 'header.menu.signOut.label',\n defaultMessage: 'Sign Out',\n description: 'The label for the user menu Sign Out action.',\n },\n});\n\nexport default messages;\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,6BAA6B;AAE5D,IAAMC,QAAQ,GAAGD,cAAc,CAAC;EAC9BE,SAAS,EAAE;IACTC,EAAE,EAAE,6BAA6B;IACjCC,cAAc,EAAE,WAAW;IAC3BC,WAAW,EAAE;EACf,CAAC;EACDC,IAAI,EAAE;IACJH,EAAE,EAAE,mBAAmB;IACvBC,cAAc,EAAE,MAAM;IACtBC,WAAW,EAAE;EACf,CAAC;EACDE,OAAO,EAAE;IACPJ,EAAE,EAAE,2BAA2B;IAC/BC,cAAc,EAAE,SAAS;IACzBC,WAAW,EAAE;EACf,CAAC;EACDG,OAAO,EAAE;IACPL,EAAE,EAAE,2BAA2B;IAC/BC,cAAc,EAAE,SAAS;IACzBC,WAAW,EAAE;EACf,CAAC;EACDI,YAAY,EAAE;IACZN,EAAE,EAAE,gCAAgC;IACpCC,cAAc,EAAE,eAAe;IAC/BC,WAAW,EAAE;EACf,CAAC;EACDK,WAAW,EAAE;IACXP,EAAE,EAAE,+BAA+B;IACnCC,cAAc,EAAE,uBAAuB;IACvCC,WAAW,EAAE;EACf,CAAC;EACDM,OAAO,EAAE;IACPR,EAAE,EAAE,2BAA2B;IAC/BC,cAAc,EAAE,UAAU;IAC1BC,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAEF,eAAeJ,QAAQ"} \ No newline at end of file diff --git a/dist/setupTest.js b/dist/setupTest.js new file mode 100644 index 0000000000..95e0e5866d --- /dev/null +++ b/dist/setupTest.js @@ -0,0 +1,125 @@ +/* eslint-disable import/no-extraneous-dependencies */ + +import React from 'react'; +import PropTypes from 'prop-types'; +import '@testing-library/jest-dom'; +import '@testing-library/jest-dom/extend-expect'; +import 'babel-polyfill'; +import 'jest-chain'; +import { getConfig, mergeConfig } from '@edx/frontend-platform'; +import { configure as configureLogging } from '@edx/frontend-platform/logging'; +import { configure as configureI18n } from '@edx/frontend-platform/i18n'; +import { configure as configureAuth, MockAuthService } from '@edx/frontend-platform/auth'; +import { render as rtlRender } from '@testing-library/react'; +import { IntlProvider } from 'react-intl'; +import AppProvider from '@edx/frontend-platform/react/AppProvider'; +import appMessages from './i18n'; + +// These configuration values are usually set in webpack's EnvironmentPlugin however +// Jest does not use webpack so we need to set these so for testing +process.env.ACCESS_TOKEN_COOKIE_NAME = 'edx-jwt-cookie-header-payload'; +process.env.ACCOUNT_PROFILE_URL = 'http://localhost:1995'; +process.env.ACCOUNT_SETTINGS_URL = 'http://localhost:1997'; +process.env.BASE_URL = 'localhost:1995'; +process.env.CREDENTIALS_BASE_URL = 'http://localhost:18150'; +process.env.CSRF_TOKEN_API_PATH = '/csrf/api/v1/token'; +process.env.ECOMMERCE_BASE_URL = 'http://localhost:18130'; +process.env.LANGUAGE_PREFERENCE_COOKIE_NAME = 'openedx-language-preference'; +process.env.LMS_BASE_URL = 'http://localhost:18000'; +process.env.LOGIN_URL = 'http://localhost:18000/login'; +process.env.LOGOUT_URL = 'http://localhost:18000/logout'; +process.env.MARKETING_SITE_BASE_URL = 'http://localhost:18000'; +process.env.ORDER_HISTORY_URL = 'localhost:1996/orders'; +process.env.REFRESH_ACCESS_TOKEN_ENDPOINT = 'http://localhost:18000/login_refresh'; +process.env.SEGMENT_KEY = 'segment_whoa'; +process.env.SITE_NAME = 'edX'; +process.env.USER_INFO_COOKIE_NAME = 'edx-user-info'; +process.env.LOGO_URL = 'https://edx-cdn.org/v3/default/logo.svg'; +process.env.LOGO_TRADEMARK_URL = 'https://edx-cdn.org/v3/default/logo-trademark.svg'; +process.env.LOGO_WHITE_URL = 'https://edx-cdn.org/v3/default/logo-white.svg'; +process.env.FAVICON_URL = 'https://edx-cdn.org/v3/default/favicon.ico'; + +class MockLoggingService { + logInfo = jest.fn(); + + logError = jest.fn(); +} + +export const authenticatedUser = { + userId: 'abc123', + username: 'Mock User', + roles: [], + administrator: false, +}; + +export function initializeMockApp() { + mergeConfig({ + INSIGHTS_BASE_URL: process.env.INSIGHTS_BASE_URL || null, + STUDIO_BASE_URL: process.env.STUDIO_BASE_URL || null, + TWITTER_URL: process.env.TWITTER_URL || null, + BASE_URL: process.env.BASE_URL || null, + LMS_BASE_URL: process.env.LMS_BASE_URL || null, + LOGIN_URL: process.env.LOGIN_URL || null, + LOGOUT_URL: process.env.LOGOUT_URL || null, + REFRESH_ACCESS_TOKEN_ENDPOINT: process.env.REFRESH_ACCESS_TOKEN_ENDPOINT || null, + ACCESS_TOKEN_COOKIE_NAME: process.env.ACCESS_TOKEN_COOKIE_NAME || null, + CSRF_TOKEN_API_PATH: process.env.CSRF_TOKEN_API_PATH || null, + LOGO_URL: process.env.LOGO_URL || null, + SITE_NAME: process.env.SITE_NAME || null, + + authenticatedUser: { + userId: 'abc123', + username: 'Mock User', + roles: [], + administrator: false, + }, + }); + + const loggingService = configureLogging(MockLoggingService, { + config: getConfig(), + }); + const authService = configureAuth(MockAuthService, { + config: getConfig(), + loggingService, + }); + + // i18n doesn't have a service class to return. + configureI18n({ + config: getConfig(), + loggingService, + messages: [appMessages], + }); + + return { loggingService, authService }; +} + +function render( + ui, + { + store = null, + ...renderOptions + } = {}, +) { + const Wrapper = ({ children }) => ( + // eslint-disable-next-line react/jsx-filename-extension + + + {children} + + + ); + + Wrapper.propTypes = { + children: PropTypes.node.isRequired, + }; + + return rtlRender(ui, { wrapper: Wrapper, ...renderOptions }); +} + +// Re-export everything. +export * from '@testing-library/react'; + +// Override `render` method. +export { + render, +}; diff --git a/dist/studio-header/BrandNav.js b/dist/studio-header/BrandNav.js new file mode 100644 index 0000000000..14cb1cce66 --- /dev/null +++ b/dist/studio-header/BrandNav.js @@ -0,0 +1,21 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +var BrandNav = function BrandNav(_ref) { + var studioBaseUrl = _ref.studioBaseUrl, + logo = _ref.logo, + logoAltText = _ref.logoAltText; + return /*#__PURE__*/React.createElement("a", { + href: studioBaseUrl + }, /*#__PURE__*/React.createElement("img", { + src: logo, + alt: logoAltText, + className: "d-block logo" + })); +}; +BrandNav.propTypes = { + studioBaseUrl: PropTypes.string.isRequired, + logo: PropTypes.string.isRequired, + logoAltText: PropTypes.string.isRequired +}; +export default BrandNav; +//# sourceMappingURL=BrandNav.js.map \ No newline at end of file diff --git a/dist/studio-header/BrandNav.js.map b/dist/studio-header/BrandNav.js.map new file mode 100644 index 0000000000..10cbbedc32 --- /dev/null +++ b/dist/studio-header/BrandNav.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BrandNav.js","names":["React","PropTypes","BrandNav","_ref","studioBaseUrl","logo","logoAltText","createElement","href","src","alt","className","propTypes","string","isRequired"],"sources":["../../src/studio-header/BrandNav.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst BrandNav = ({\n studioBaseUrl,\n logo,\n logoAltText,\n}) => (\n \n \n \n);\n\nBrandNav.propTypes = {\n studioBaseUrl: PropTypes.string.isRequired,\n logo: PropTypes.string.isRequired,\n logoAltText: PropTypes.string.isRequired,\n};\n\nexport default BrandNav;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,IAAMC,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA;EAAA,IACZC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IACbC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,WAAW,GAAAH,IAAA,CAAXG,WAAW;EAAA,oBAEXN,KAAA,CAAAO,aAAA;IAAGC,IAAI,EAAEJ;EAAc,gBACrBJ,KAAA,CAAAO,aAAA;IACEE,GAAG,EAAEJ,IAAK;IACVK,GAAG,EAAEJ,WAAY;IACjBK,SAAS,EAAC;EAAc,CACzB,CACA,CAAC;AAAA,CACL;AAEDT,QAAQ,CAACU,SAAS,GAAG;EACnBR,aAAa,EAAEH,SAAS,CAACY,MAAM,CAACC,UAAU;EAC1CT,IAAI,EAAEJ,SAAS,CAACY,MAAM,CAACC,UAAU;EACjCR,WAAW,EAAEL,SAAS,CAACY,MAAM,CAACC;AAChC,CAAC;AAED,eAAeZ,QAAQ"} \ No newline at end of file diff --git a/dist/studio-header/CourseLockUp.js b/dist/studio-header/CourseLockUp.js new file mode 100644 index 0000000000..0cc10f1e38 --- /dev/null +++ b/dist/studio-header/CourseLockUp.js @@ -0,0 +1,45 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { OverlayTrigger, Tooltip } from '@openedx/paragon'; +import messages from './messages'; +var CourseLockUp = function CourseLockUp(_ref) { + var outlineLink = _ref.outlineLink, + org = _ref.org, + number = _ref.number, + title = _ref.title, + intl = _ref.intl; + return /*#__PURE__*/React.createElement(OverlayTrigger, { + placement: "bottom", + overlay: /*#__PURE__*/React.createElement(Tooltip, { + id: "course-lock-up" + }, title) + }, /*#__PURE__*/React.createElement("a", { + className: "course-title-lockup mr-2", + href: outlineLink, + "aria-label": intl.formatMessage(messages['header.label.courseOutline']), + "data-testid": "course-lock-up-block" + }, /*#__PURE__*/React.createElement("span", { + className: "d-block small m-0 text-gray-800", + "data-testid": "course-org-number" + }, org, " ", number), /*#__PURE__*/React.createElement("span", { + className: "d-block m-0 font-weight-bold text-gray-800", + "data-testid": "course-title" + }, title))); +}; +CourseLockUp.propTypes = { + number: PropTypes.string, + org: PropTypes.string, + title: PropTypes.string, + outlineLink: PropTypes.string, + // injected + intl: intlShape.isRequired +}; +CourseLockUp.defaultProps = { + number: null, + org: null, + title: null, + outlineLink: null +}; +export default injectIntl(CourseLockUp); +//# sourceMappingURL=CourseLockUp.js.map \ No newline at end of file diff --git a/dist/studio-header/CourseLockUp.js.map b/dist/studio-header/CourseLockUp.js.map new file mode 100644 index 0000000000..ff1fd63270 --- /dev/null +++ b/dist/studio-header/CourseLockUp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CourseLockUp.js","names":["React","PropTypes","injectIntl","intlShape","OverlayTrigger","Tooltip","messages","CourseLockUp","_ref","outlineLink","org","number","title","intl","createElement","placement","overlay","id","className","href","formatMessage","propTypes","string","isRequired","defaultProps"],"sources":["../../src/studio-header/CourseLockUp.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { injectIntl, intlShape } from '@edx/frontend-platform/i18n';\nimport {\n OverlayTrigger,\n Tooltip,\n} from '@openedx/paragon';\nimport messages from './messages';\n\nconst CourseLockUp = ({\n outlineLink,\n org,\n number,\n title,\n // injected\n intl,\n}) => (\n \n {title}\n \n )}\n >\n \n {org} {number}\n {title}\n \n \n);\n\nCourseLockUp.propTypes = {\n number: PropTypes.string,\n org: PropTypes.string,\n title: PropTypes.string,\n outlineLink: PropTypes.string,\n // injected\n intl: intlShape.isRequired,\n};\n\nCourseLockUp.defaultProps = {\n number: null,\n org: null,\n title: null,\n outlineLink: null,\n};\n\nexport default injectIntl(CourseLockUp);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,EAAEC,SAAS,QAAQ,6BAA6B;AACnE,SACEC,cAAc,EACdC,OAAO,QACF,kBAAkB;AACzB,OAAOC,QAAQ,MAAM,YAAY;AAEjC,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA;EAAA,IAChBC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IACHC,MAAM,GAAAH,IAAA,CAANG,MAAM;IACNC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IAELC,IAAI,GAAAL,IAAA,CAAJK,IAAI;EAAA,oBAEJb,KAAA,CAAAc,aAAA,CAACV,cAAc;IACbW,SAAS,EAAC,QAAQ;IAClBC,OAAO,eACLhB,KAAA,CAAAc,aAAA,CAACT,OAAO;MAACY,EAAE,EAAC;IAAgB,GACzBL,KACM;EACT,gBAEFZ,KAAA,CAAAc,aAAA;IACEI,SAAS,EAAC,0BAA0B;IACpCC,IAAI,EAAEV,WAAY;IAClB,cAAYI,IAAI,CAACO,aAAa,CAACd,QAAQ,CAAC,4BAA4B,CAAC,CAAE;IACvE,eAAY;EAAsB,gBAElCN,KAAA,CAAAc,aAAA;IAAMI,SAAS,EAAC,iCAAiC;IAAC,eAAY;EAAmB,GAAER,GAAG,EAAC,GAAC,EAACC,MAAa,CAAC,eACvGX,KAAA,CAAAc,aAAA;IAAMI,SAAS,EAAC,4CAA4C;IAAC,eAAY;EAAc,GAAEN,KAAY,CACpG,CACW,CAAC;AAAA,CAClB;AAEDL,YAAY,CAACc,SAAS,GAAG;EACvBV,MAAM,EAAEV,SAAS,CAACqB,MAAM;EACxBZ,GAAG,EAAET,SAAS,CAACqB,MAAM;EACrBV,KAAK,EAAEX,SAAS,CAACqB,MAAM;EACvBb,WAAW,EAAER,SAAS,CAACqB,MAAM;EAC7B;EACAT,IAAI,EAAEV,SAAS,CAACoB;AAClB,CAAC;AAEDhB,YAAY,CAACiB,YAAY,GAAG;EAC1Bb,MAAM,EAAE,IAAI;EACZD,GAAG,EAAE,IAAI;EACTE,KAAK,EAAE,IAAI;EACXH,WAAW,EAAE;AACf,CAAC;AAED,eAAeP,UAAU,CAACK,YAAY,CAAC"} \ No newline at end of file diff --git a/dist/studio-header/HeaderBody.js b/dist/studio-header/HeaderBody.js new file mode 100644 index 0000000000..b9cb584ff1 --- /dev/null +++ b/dist/studio-header/HeaderBody.js @@ -0,0 +1,120 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { ActionRow, Button, Container, Nav, Row } from '@openedx/paragon'; +import { Close, MenuIcon } from '@openedx/paragon/icons'; +import CourseLockUp from './CourseLockUp'; +import UserMenu from './UserMenu'; +import BrandNav from './BrandNav'; +import NavDropdownMenu from './NavDropdownMenu'; +var HeaderBody = function HeaderBody(_ref) { + var logo = _ref.logo, + logoAltText = _ref.logoAltText, + number = _ref.number, + org = _ref.org, + title = _ref.title, + username = _ref.username, + isAdmin = _ref.isAdmin, + studioBaseUrl = _ref.studioBaseUrl, + logoutUrl = _ref.logoutUrl, + authenticatedUserAvatar = _ref.authenticatedUserAvatar, + isMobile = _ref.isMobile, + setModalPopupTarget = _ref.setModalPopupTarget, + toggleModalPopup = _ref.toggleModalPopup, + isModalPopupOpen = _ref.isModalPopupOpen, + isHiddenMainMenu = _ref.isHiddenMainMenu, + mainMenuDropdowns = _ref.mainMenuDropdowns, + outlineLink = _ref.outlineLink; + var renderBrandNav = /*#__PURE__*/React.createElement(BrandNav, { + studioBaseUrl: studioBaseUrl, + logo: logo, + logoAltText: logoAltText + }); + return /*#__PURE__*/React.createElement(Container, { + size: "xl", + className: "px-2.5" + }, /*#__PURE__*/React.createElement(ActionRow, { + as: "header" + }, isHiddenMainMenu ? /*#__PURE__*/React.createElement(Row, { + className: "flex-nowrap ml-4" + }, renderBrandNav) : /*#__PURE__*/React.createElement(React.Fragment, null, isMobile ? /*#__PURE__*/React.createElement(Button, { + ref: setModalPopupTarget, + className: "d-inline-flex align-items-center", + variant: "tertiary", + onClick: toggleModalPopup, + iconBefore: isModalPopupOpen ? Close : MenuIcon, + "data-testid": "mobile-menu-button" + }, "Menu") : /*#__PURE__*/React.createElement("div", { + className: "w-25" + }, /*#__PURE__*/React.createElement(Row, { + className: "m-0 flex-nowrap" + }, renderBrandNav, /*#__PURE__*/React.createElement(CourseLockUp, { + outlineLink: outlineLink, + number: number, + org: org, + title: title + }))), isMobile ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ActionRow.Spacer, null), renderBrandNav) : /*#__PURE__*/React.createElement(Nav, { + "data-testid": "desktop-menu", + className: "ml-2" + }, mainMenuDropdowns.map(function (dropdown) { + var id = dropdown.id, + buttonTitle = dropdown.buttonTitle, + items = dropdown.items; + return /*#__PURE__*/React.createElement(NavDropdownMenu, { + key: id, + id: id, + buttonTitle: buttonTitle, + items: items + }); + }))), /*#__PURE__*/React.createElement(ActionRow.Spacer, null), /*#__PURE__*/React.createElement(Nav, null, /*#__PURE__*/React.createElement(UserMenu, { + username: username, + studioBaseUrl: studioBaseUrl, + logoutUrl: logoutUrl, + authenticatedUserAvatar: authenticatedUserAvatar, + isAdmin: isAdmin + })))); +}; +HeaderBody.propTypes = { + studioBaseUrl: PropTypes.string.isRequired, + logoutUrl: PropTypes.string.isRequired, + setModalPopupTarget: PropTypes.func, + toggleModalPopup: PropTypes.func, + isModalPopupOpen: PropTypes.bool, + number: PropTypes.string, + org: PropTypes.string, + title: PropTypes.string, + logo: PropTypes.string, + logoAltText: PropTypes.string, + authenticatedUserAvatar: PropTypes.string, + username: PropTypes.string, + isAdmin: PropTypes.bool, + isMobile: PropTypes.bool, + isHiddenMainMenu: PropTypes.bool, + mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({ + id: PropTypes.string, + buttonTitle: PropTypes.string, + items: PropTypes.arrayOf(PropTypes.shape({ + href: PropTypes.string, + title: PropTypes.string + })) + })), + outlineLink: PropTypes.string +}; +HeaderBody.defaultProps = { + setModalPopupTarget: null, + toggleModalPopup: null, + isModalPopupOpen: false, + logo: null, + logoAltText: null, + number: '', + org: '', + title: '', + authenticatedUserAvatar: null, + username: null, + isAdmin: false, + isMobile: false, + isHiddenMainMenu: false, + mainMenuDropdowns: [], + outlineLink: null +}; +export default HeaderBody; +//# sourceMappingURL=HeaderBody.js.map \ No newline at end of file diff --git a/dist/studio-header/HeaderBody.js.map b/dist/studio-header/HeaderBody.js.map new file mode 100644 index 0000000000..8eb5d68e63 --- /dev/null +++ b/dist/studio-header/HeaderBody.js.map @@ -0,0 +1 @@ +{"version":3,"file":"HeaderBody.js","names":["React","PropTypes","ActionRow","Button","Container","Nav","Row","Close","MenuIcon","CourseLockUp","UserMenu","BrandNav","NavDropdownMenu","HeaderBody","_ref","logo","logoAltText","number","org","title","username","isAdmin","studioBaseUrl","logoutUrl","authenticatedUserAvatar","isMobile","setModalPopupTarget","toggleModalPopup","isModalPopupOpen","isHiddenMainMenu","mainMenuDropdowns","outlineLink","renderBrandNav","createElement","size","className","as","Fragment","ref","variant","onClick","iconBefore","Spacer","map","dropdown","id","buttonTitle","items","key","propTypes","string","isRequired","func","bool","arrayOf","shape","href","defaultProps"],"sources":["../../src/studio-header/HeaderBody.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n ActionRow,\n Button,\n Container,\n Nav,\n Row,\n} from '@openedx/paragon';\nimport { Close, MenuIcon } from '@openedx/paragon/icons';\n\nimport CourseLockUp from './CourseLockUp';\nimport UserMenu from './UserMenu';\nimport BrandNav from './BrandNav';\nimport NavDropdownMenu from './NavDropdownMenu';\n\nconst HeaderBody = ({\n logo,\n logoAltText,\n number,\n org,\n title,\n username,\n isAdmin,\n studioBaseUrl,\n logoutUrl,\n authenticatedUserAvatar,\n isMobile,\n setModalPopupTarget,\n toggleModalPopup,\n isModalPopupOpen,\n isHiddenMainMenu,\n mainMenuDropdowns,\n outlineLink,\n}) => {\n const renderBrandNav = (\n \n );\n\n return (\n \n \n {isHiddenMainMenu ? (\n \n {renderBrandNav}\n \n ) : (\n <>\n {isMobile ? (\n \n Menu\n \n ) : (\n
    \n \n {renderBrandNav}\n \n \n
    \n )}\n {isMobile ? (\n <>\n \n {renderBrandNav}\n \n ) : (\n \n )}\n \n )}\n \n \n
    \n
    \n );\n};\n\nHeaderBody.propTypes = {\n studioBaseUrl: PropTypes.string.isRequired,\n logoutUrl: PropTypes.string.isRequired,\n setModalPopupTarget: PropTypes.func,\n toggleModalPopup: PropTypes.func,\n isModalPopupOpen: PropTypes.bool,\n number: PropTypes.string,\n org: PropTypes.string,\n title: PropTypes.string,\n logo: PropTypes.string,\n logoAltText: PropTypes.string,\n authenticatedUserAvatar: PropTypes.string,\n username: PropTypes.string,\n isAdmin: PropTypes.bool,\n isMobile: PropTypes.bool,\n isHiddenMainMenu: PropTypes.bool,\n mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({\n id: PropTypes.string,\n buttonTitle: PropTypes.string,\n items: PropTypes.arrayOf(PropTypes.shape({\n href: PropTypes.string,\n title: PropTypes.string,\n })),\n })),\n outlineLink: PropTypes.string,\n};\n\nHeaderBody.defaultProps = {\n setModalPopupTarget: null,\n toggleModalPopup: null,\n isModalPopupOpen: false,\n logo: null,\n logoAltText: null,\n number: '',\n org: '',\n title: '',\n authenticatedUserAvatar: null,\n username: null,\n isAdmin: false,\n isMobile: false,\n isHiddenMainMenu: false,\n mainMenuDropdowns: [],\n outlineLink: null,\n};\n\nexport default HeaderBody;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SACEC,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,GAAG,EACHC,GAAG,QACE,kBAAkB;AACzB,SAASC,KAAK,EAAEC,QAAQ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KAAK,CAAC;IACnDV,EAAE,EAAE5C,SAAS,CAACiD,MAAM;IACpBJ,WAAW,EAAE7C,SAAS,CAACiD,MAAM;IAC7BH,KAAK,EAAE9C,SAAS,CAACqD,OAAO,CAACrD,SAAS,CAACsD,KAAK,CAAC;MACvCC,IAAI,EAAEvD,SAAS,CAACiD,MAAM;MACtB/B,KAAK,EAAElB,SAAS,CAACiD;IACnB,CAAC,CAAC;EACJ,CAAC,CAAC,CAAC;EACHnB,WAAW,EAAE9B,SAAS,CAACiD;AACzB,CAAC;AAEDrC,UAAU,CAAC4C,YAAY,GAAG;EACxB/B,mBAAmB,EAAE,IAAI;EACzBC,gBAAgB,EAAE,IAAI;EACtBC,gBAAgB,EAAE,KAAK;EACvBb,IAAI,EAAE,IAAI;EACVC,WAAW,EAAE,IAAI;EACjBC,MAAM,EAAE,EAAE;EACVC,GAAG,EAAE,EAAE;EACPC,KAAK,EAAE,EAAE;EACTK,uBAAuB,EAAE,IAAI;EAC7BJ,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAE,KAAK;EACdI,QAAQ,EAAE,KAAK;EACfI,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,EAAE;EACrBC,WAAW,EAAE;AACf,CAAC;AAED,eAAelB,UAAU"} \ No newline at end of file diff --git a/dist/studio-header/MobileHeader.js b/dist/studio-header/MobileHeader.js new file mode 100644 index 0000000000..7872ab1df7 --- /dev/null +++ b/dist/studio-header/MobileHeader.js @@ -0,0 +1,79 @@ +var _excluded = ["mainMenuDropdowns"]; +function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); } +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } +function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } +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; } +import React, { useState } from 'react'; +import PropTypes from 'prop-types'; +import { useToggle, ModalPopup } from '@openedx/paragon'; +import HeaderBody from './HeaderBody'; +import MobileMenu from './MobileMenu'; +var MobileHeader = function MobileHeader(_ref) { + var mainMenuDropdowns = _ref.mainMenuDropdowns, + props = _objectWithoutProperties(_ref, _excluded); + var _useToggle = useToggle(false), + _useToggle2 = _slicedToArray(_useToggle, 4), + isOpen = _useToggle2[0], + close = _useToggle2[2], + toggle = _useToggle2[3]; + var _useState = useState(null), + _useState2 = _slicedToArray(_useState, 2), + target = _useState2[0], + setTarget = _useState2[1]; + return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HeaderBody, _extends({}, props, { + isMobile: true, + setModalPopupTarget: setTarget, + toggleModalPopup: toggle, + isModalPopupOpen: isOpen + })), /*#__PURE__*/React.createElement(ModalPopup, { + hasArrow: true, + placement: "bottom", + positionRef: target, + isOpen: isOpen, + onClose: close, + onEscapeKey: close, + className: "mobile-menu-container" + }, /*#__PURE__*/React.createElement(MobileMenu, { + mainMenuDropdowns: mainMenuDropdowns + }))); +}; +MobileHeader.propTypes = { + studioBaseUrl: PropTypes.string.isRequired, + logoutUrl: PropTypes.string.isRequired, + number: PropTypes.string, + org: PropTypes.string, + title: PropTypes.string, + logo: PropTypes.string, + logoAltText: PropTypes.string, + authenticatedUserAvatar: PropTypes.string, + username: PropTypes.string, + isAdmin: PropTypes.bool, + mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({ + id: PropTypes.string, + buttonTitle: PropTypes.string, + items: PropTypes.arrayOf(PropTypes.shape({ + href: PropTypes.string, + title: PropTypes.string + })) + })), + outlineLink: PropTypes.string +}; +MobileHeader.defaultProps = { + logo: null, + logoAltText: null, + number: null, + org: null, + title: null, + authenticatedUserAvatar: null, + username: null, + isAdmin: false, + mainMenuDropdowns: [], + outlineLink: null +}; +export default MobileHeader; +//# sourceMappingURL=MobileHeader.js.map \ No newline at end of file diff --git a/dist/studio-header/MobileHeader.js.map b/dist/studio-header/MobileHeader.js.map new file mode 100644 index 0000000000..5b326b8ef0 --- /dev/null +++ b/dist/studio-header/MobileHeader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MobileHeader.js","names":["React","useState","PropTypes","useToggle","ModalPopup","HeaderBody","MobileMenu","MobileHeader","_ref","mainMenuDropdowns","props","_objectWithoutProperties","_excluded","_useToggle","_useToggle2","_slicedToArray","isOpen","close","toggle","_useState","_useState2","target","setTarget","createElement","Fragment","_extends","isMobile","setModalPopupTarget","toggleModalPopup","isModalPopupOpen","hasArrow","placement","positionRef","onClose","onEscapeKey","className","propTypes","studioBaseUrl","string","isRequired","logoutUrl","number","org","title","logo","logoAltText","authenticatedUserAvatar","username","isAdmin","bool","arrayOf","shape","id","buttonTitle","items","href","outlineLink","defaultProps"],"sources":["../../src/studio-header/MobileHeader.jsx"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useToggle, ModalPopup } from '@openedx/paragon';\nimport HeaderBody from './HeaderBody';\nimport MobileMenu from './MobileMenu';\n\nconst MobileHeader = ({\n mainMenuDropdowns,\n ...props\n}) => {\n const [isOpen, , close, toggle] = useToggle(false);\n const [target, setTarget] = useState(null);\n\n return (\n <>\n \n \n \n \n \n );\n};\n\nMobileHeader.propTypes = {\n studioBaseUrl: PropTypes.string.isRequired,\n logoutUrl: PropTypes.string.isRequired,\n number: PropTypes.string,\n org: PropTypes.string,\n title: PropTypes.string,\n logo: PropTypes.string,\n logoAltText: PropTypes.string,\n authenticatedUserAvatar: PropTypes.string,\n username: PropTypes.string,\n isAdmin: PropTypes.bool,\n mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({\n id: PropTypes.string,\n buttonTitle: PropTypes.string,\n items: PropTypes.arrayOf(PropTypes.shape({\n href: PropTypes.string,\n title: PropTypes.string,\n })),\n })),\n outlineLink: PropTypes.string,\n};\n\nMobileHeader.defaultProps = {\n logo: null,\n logoAltText: null,\n number: null,\n org: null,\n title: null,\n authenticatedUser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C,iBAAiB,EAAE,EAAE;EACrB+C,WAAW,EAAE;AACf,CAAC;AAED,eAAejD,YAAY"} \ No newline at end of file diff --git a/dist/studio-header/MobileMenu.js b/dist/studio-header/MobileMenu.js new file mode 100644 index 0000000000..a1f618c13a --- /dev/null +++ b/dist/studio-header/MobileMenu.js @@ -0,0 +1,45 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Collapsible } from '@openedx/paragon'; +var MobileMenu = function MobileMenu(_ref) { + var mainMenuDropdowns = _ref.mainMenuDropdowns; + return /*#__PURE__*/React.createElement("div", { + className: "ml-4 p-2 bg-light-100 border border-gray-200 small rounded", + "data-testid": "mobile-menu" + }, /*#__PURE__*/React.createElement("div", null, mainMenuDropdowns.map(function (dropdown) { + var id = dropdown.id, + buttonTitle = dropdown.buttonTitle, + items = dropdown.items; + return /*#__PURE__*/React.createElement(Collapsible, { + className: "border-light-100", + title: buttonTitle, + key: id + }, /*#__PURE__*/React.createElement("ul", { + className: "p-0", + style: { + listStyleType: 'none' + } + }, items.map(function (item) { + return /*#__PURE__*/React.createElement("li", { + className: "mobile-menu-item" + }, /*#__PURE__*/React.createElement("a", { + href: item.href + }, item.title)); + }))); + }))); +}; +MobileMenu.propTypes = { + mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({ + id: PropTypes.string, + buttonTitle: PropTypes.string, + items: PropTypes.arrayOf(PropTypes.shape({ + href: PropTypes.string, + title: PropTypes.string + })) + })) +}; +MobileMenu.defaultProps = { + mainMenuDropdowns: [] +}; +export default MobileMenu; +//# sourceMappingURL=MobileMenu.js.map \ No newline at end of file diff --git a/dist/studio-header/MobileMenu.js.map b/dist/studio-header/MobileMenu.js.map new file mode 100644 index 0000000000..009ab8c39c --- /dev/null +++ b/dist/studio-header/MobileMenu.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MobileMenu.js","names":["React","PropTypes","Collapsible","MobileMenu","_ref","mainMenuDropdowns","createElement","className","map","dropdown","id","buttonTitle","items","title","key","style","listStyleType","item","href","propTypes","arrayOf","shape","string","defaultProps"],"sources":["../../src/studio-header/MobileMenu.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Collapsible } from '@openedx/paragon';\n\nconst MobileMenu = ({\n mainMenuDropdowns,\n}) => (\n \n
    \n {mainMenuDropdowns.map(dropdown => {\n const { id, buttonTitle, items } = dropdown;\n return (\n \n \n \n );\n })}\n
    \n \n);\n\nMobileMenu.propTypes = {\n mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({\n id: PropTypes.string,\n buttonTitle: PropTypes.string,\n items: PropTypes.arrayOf(PropTypes.shape({\n href: PropTypes.string,\n title: PropTypes.string,\n })),\n })),\n};\nMobileMenu.defaultProps = {\n mainMenuDropdowns: [],\n};\n\nexport default MobileMenu;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAAC,IAAA;EAAA,IACdC,iBAAiB,GAAAD,IAAA,CAAjBC,iBAAiB;EAAA,oBAEjBL,KAAA,CAAAM,aAAA;IACEC,SAAS,EAAC,4DAA4D;IACtE,eAAY;EAAa,gBAEzBP,KAAA,CAAAM,aAAA,cACGD,iBAAiB,CAACG,GAAG,CAAC,UAAAC,QAAQ,EAAI;IACjC,IAAQC,EAAE,GAAyBD,QAAQ,CAAnCC,EAAE;MAAEC,WAAW,GAAYF,QAAQ,CAA/BE,WAAW;MAAEC,KAAK,GAAKH,QAAQ,CAAlBG,KAAK;IAC9B,oBACEZ,KAAA,CAAAM,aAAA,CAACJ,WAAW;MACVK,SAAS,EAAC,kBAAkB;MAC5BM,KAAK,EAAEF,WAAY;MACnBG,GAAG,EAAEJ;IAAG,gBAERV,KAAA,CAAAM,aAAA;MAAIC,SAAS,EAAC,KAAK;MAACQ,KAAK,EAAE;QAAEC,aAAa,EAAE;MAAO;IAAE,GAClDJ,KAAK,CAACJ,GAAG,CAAC,UAAAS,IAAI;MAAA,oBACbjB,KAAA,CAAAM,aAAA;QAAIC,SAAS,EAAC;MAAkB,gBAC9BP,KAAA,CAAAM,aAAA;QAAGY,IAAI,EAAED,IAAI,CAACC;MAAK,GAChBD,IAAI,CAACJ,KACL,CACD,CAAC;IAAA,CACN,CACC,CACO,CAAC;EAElB,CAAC,CACE,CACF,CAAC;AAAA,CACP;AAEDV,UAAU,CAACgB,SAAS,GAAG;EACrBd,iBAAiB,EAAEJ,SAAS,CAACmB,OAAO,CAACnB,SAAS,CAACoB,KAAK,CAAC;IACnDX,EAAE,EAAET,SAAS,CAACqB,MAAM;IACpBX,WAAW,EAAEV,SAAS,CAACqB,MAAM;IAC7BV,KAAK,EAAEX,SAAS,CAACmB,OAAO,CAACnB,SAAS,CAACoB,KAAK,CAAC;MACvCH,IAAI,EAAEjB,SAAS,CAACqB,MAAM;MACtBT,KAAK,EAAEZ,SAAS,CAACqB;IACnB,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC;AACDnB,UAAU,CAACoB,YAAY,GAAG;EACxBlB,iBAAiB,EAAE;AACrB,CAAC;AAED,eAAeF,UAAU"} \ No newline at end of file diff --git a/dist/studio-header/NavDropdownMenu.js b/dist/studio-header/NavDropdownMenu.js new file mode 100644 index 0000000000..0367ada5a7 --- /dev/null +++ b/dist/studio-header/NavDropdownMenu.js @@ -0,0 +1,30 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Dropdown, DropdownButton } from '@openedx/paragon'; +var NavDropdownMenu = function NavDropdownMenu(_ref) { + var id = _ref.id, + buttonTitle = _ref.buttonTitle, + items = _ref.items; + return /*#__PURE__*/React.createElement(DropdownButton, { + id: id, + title: buttonTitle, + variant: "outline-primary", + className: "mr-2" + }, items.map(function (item) { + return /*#__PURE__*/React.createElement(Dropdown.Item, { + key: "".concat(item.title, "-dropdown-item"), + href: item.href, + className: "small" + }, item.title); + })); +}; +NavDropdownMenu.propTypes = { + id: PropTypes.string.isRequired, + buttonTitle: PropTypes.string.isRequired, + items: PropTypes.arrayOf(PropTypes.shape({ + href: PropTypes.string, + title: PropTypes.string + })).isRequired +}; +export default NavDropdownMenu; +//# sourceMappingURL=NavDropdownMenu.js.map \ No newline at end of file diff --git a/dist/studio-header/NavDropdownMenu.js.map b/dist/studio-header/NavDropdownMenu.js.map new file mode 100644 index 0000000000..668295d4ab --- /dev/null +++ b/dist/studio-header/NavDropdownMenu.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NavDropdownMenu.js","names":["React","PropTypes","Dropdown","DropdownButton","NavDropdownMenu","_ref","id","buttonTitle","items","createElement","title","variant","className","map","item","Item","key","concat","href","propTypes","string","isRequired","arrayOf","shape"],"sources":["../../src/studio-header/NavDropdownMenu.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n Dropdown,\n DropdownButton,\n} from '@openedx/paragon';\n\nconst NavDropdownMenu = ({\n id,\n buttonTitle,\n items,\n}) => (\n \n {items.map(item => (\n \n {item.title}\n \n ))}\n \n);\n\nNavDropdownMenu.propTypes = {\n id: PropTypes.string.isRequired,\n buttonTitle: PropTypes.string.isRequired,\n items: PropTypes.arrayOf(PropTypes.shape({\n href: PropTypes.string,\n title: PropTypes.string,\n })).isRequired,\n};\n\nexport default NavDropdownMenu;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SACEC,QAAQ,EACRC,cAAc,QACT,kBAAkB;AAEzB,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA;EAAA,IACnBC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IACFC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IACXC,KAAK,GAAAH,IAAA,CAALG,KAAK;EAAA,oBAELR,KAAA,CAAAS,aAAA,CAACN,cAAc;IACbG,EAAE,EAAEA,EAAG;IACPI,KAAK,EAAEH,WAAY;IACnBI,OAAO,EAAC,iBAAiB;IACzBC,SAAS,EAAC;EAAM,GAEfJ,KAAK,CAACK,GAAG,CAAC,UAAAC,IAAI;IAAA,oBACbd,KAAA,CAAAS,aAAA,CAACP,QAAQ,CAACa,IAAI;MACZC,GAAG,KAAAC,MAAA,CAAKH,IAAI,CAACJ,KAAK,mBAAiB;MACnCQ,IAAI,EAAEJ,IAAI,CAACI,IAAK;MAChBN,SAAS,EAAC;IAAO,GAEhBE,IAAI,CAACJ,KACO,CAAC;EAAA,CACjB,CACa,CAAC;AAAA,CAClB;AAEDN,eAAe,CAACe,SAAS,GAAG;EAC1Bb,EAAE,EAAEL,SAAS,CAACmB,MAAM,CAACC,UAAU;EAC/Bd,WAAW,EAAEN,SAAS,CAACmB,MAAM,CAACC,UAAU;EACxCb,KAAK,EAAEP,SAAS,CAACqB,OAAO,CAACrB,SAAS,CAACsB,KAAK,CAAC;IACvCL,IAAI,EAAEjB,SAAS,CAACmB,MAAM;IACtBV,KAAK,EAAET,SAAS,CAACmB;EACnB,CAAC,CAAC,CAAC,CAACC;AACN,CAAC;AAED,eAAejB,eAAe"} \ No newline at end of file diff --git a/dist/studio-header/StudioHeader.js b/dist/studio-header/StudioHeader.js new file mode 100644 index 0000000000..54b37d366b --- /dev/null +++ b/dist/studio-header/StudioHeader.js @@ -0,0 +1,68 @@ +import React, { useContext } from 'react'; +import PropTypes from 'prop-types'; +import Responsive from 'react-responsive'; +import { AppContext } from '@edx/frontend-platform/react'; +import { ensureConfig } from '@edx/frontend-platform'; +import MobileHeader from './MobileHeader'; +import HeaderBody from './HeaderBody'; +ensureConfig(['STUDIO_BASE_URL', 'SITE_NAME', 'LOGOUT_URL', 'LOGIN_URL', 'LOGO_URL'], 'Studio Header component'); +var StudioHeader = function StudioHeader(_ref) { + var number = _ref.number, + org = _ref.org, + title = _ref.title, + isHiddenMainMenu = _ref.isHiddenMainMenu, + mainMenuDropdowns = _ref.mainMenuDropdowns, + outlineLink = _ref.outlineLink; + var _useContext = useContext(AppContext), + authenticatedUser = _useContext.authenticatedUser, + config = _useContext.config; + var props = { + logo: config.LOGO_URL, + logoAltText: "Studio ".concat(config.SITE_NAME), + number: number, + org: org, + title: title, + username: authenticatedUser === null || authenticatedUser === void 0 ? void 0 : authenticatedUser.username, + isAdmin: authenticatedUser === null || authenticatedUser === void 0 ? void 0 : authenticatedUser.administrator, + authenticatedUserAvatar: authenticatedUser === null || authenticatedUser === void 0 ? void 0 : authenticatedUser.avatar, + studioBaseUrl: config.STUDIO_BASE_URL, + logoutUrl: config.LOGOUT_URL, + isHiddenMainMenu: isHiddenMainMenu, + mainMenuDropdowns: mainMenuDropdowns, + outlineLink: outlineLink + }; + return /*#__PURE__*/React.createElement("div", { + className: "studio-header" + }, /*#__PURE__*/React.createElement("a", { + className: "nav-skip sr-only sr-only-focusable", + href: "#main" + }, "Skip to content"), /*#__PURE__*/React.createElement(Responsive, { + maxWidth: 841 + }, /*#__PURE__*/React.createElement(MobileHeader, props)), /*#__PURE__*/React.createElement(Responsive, { + minWidth: 842 + }, /*#__PURE__*/React.createElement(HeaderBody, props))); +}; +StudioHeader.propTypes = { + number: PropTypes.string, + org: PropTypes.string, + title: PropTypes.string.isRequired, + isHiddenMainMenu: PropTypes.bool, + mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({ + id: PropTypes.string, + buttonTitle: PropTypes.string, + items: PropTypes.arrayOf(PropTypes.shape({ + href: PropTypes.string, + title: PropTypes.string + })) + })), + outlineLink: PropTypes.string +}; +StudioHeader.defaultProps = { + number: '', + org: '', + isHiddenMainMenu: false, + mainMenuDropdowns: [], + outlineLink: null +}; +export default StudioHeader; +//# sourceMappingURL=StudioHeader.js.map \ No newline at end of file diff --git a/dist/studio-header/StudioHeader.js.map b/dist/studio-header/StudioHeader.js.map new file mode 100644 index 0000000000..2d088514d1 --- /dev/null +++ b/dist/studio-header/StudioHeader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"StudioHeader.js","names":["React","useContext","PropTypes","Responsive","AppContext","ensureConfig","MobileHeader","HeaderBody","StudioHeader","_ref","number","org","title","isHiddenMainMenu","mainMenuDropdowns","outlineLink","_useContext","authenticatedUser","config","props","logo","LOGO_URL","logoAltText","concat","SITE_NAME","username","isAdmin","administrator","authenticatedUserAvatar","avatar","studioBaseUrl","STUDIO_BASE_URL","logoutUrl","LOGOUT_URL","createElement","className","href","maxWidth","minWidth","propTypes","string","isRequired","bool","arrayOf","shape","id","buttonTitle","items","defaultProps"],"sources":["../../src/studio-header/StudioHeader.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport Responsive from 'react-responsive';\nimport { AppContext } from '@edx/frontend-platform/react';\nimport { ensureConfig } from '@edx/frontend-platform';\n\nimport MobileHeader from './MobileHeader';\nimport HeaderBody from './HeaderBody';\n\nensureConfig([\n 'STUDIO_BASE_URL',\n 'SITE_NAME',\n 'LOGOUT_URL',\n 'LOGIN_URL',\n 'LOGO_URL',\n], 'Studio Header component');\n\nconst StudioHeader = ({\n number, org, title, isHiddenMainMenu, mainMenuDropdowns, outlineLink,\n}) => {\n const { authenticatedUser, config } = useContext(AppContext);\n const props = {\n logo: config.LOGO_URL,\n logoAltText: `Studio ${config.SITE_NAME}`,\n number,\n org,\n title,\n username: authenticatedUser?.username,\n isAdmin: authenticatedUser?.administrator,\n authenticatedUserAvatar: authenticatedUser?.avatar,\n studioBaseUrl: config.STUDIO_BASE_URL,\n logoutUrl: config.LOGOUT_URL,\n isHiddenMainMenu,\n mainMenuDropdowns,\n outlineLink,\n };\n\n return (\n
    \n Skip to content\n \n \n \n \n \n \n
    \n );\n};\n\nStudioHeader.propTypes = {\n number: PropTypes.string,\n org: PropTypes.string,\n title: PropTypes.string.isRequired,\n isHiddenMainMenu: PropTypes.bool,\n mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({\n id: PropTypes.string,\n buttonTitle: PropTypes.string,\n items: PropTypes.arrayOf(PropTypes.shape({\n href: PropTypes.string,\n title: PropTypes.string,\n })),\n })),\n outlineLink: PropTypes.string,\n};\n\nStudioHeader.defaultProps = {\n number: '',\n org: '',\n isHiddenMainMenu: false,\n mainMenuDropdowns: [],\n outlineLink: null,\n};\n\nexport default StudioHeader;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,kBAAkB;AACzC,SAASC,UAAU,QAAQ,8BAA8B;AACzD,SAASC,YAAY,QAAQ,wBAAwB;AAErD,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,UAAU,MAAM,cAAc;AAErCF,YAAY,CAAC,CACX,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,CACX,EAAE,yBAAyB,CAAC;AAE7B,IAAMG,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAEZ;EAAA,IADJC,MAAM,GAAAD,IAAA,CAANC,MAAM;IAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;IAAEC,gBAAgB,GAAAJ,IAAA,CAAhBI,gBAAgB;IAAEC,iBAAiB,GAAAL,IAAA,CAAjBK,iBAAiB;IAAEC,WAAW,GAAAN,IAAA,CAAXM,WAAW;EAEpE,IAAAC,WAAA,GAAsCf,UAAU,CAACG,UAAU,CAAC;IAApDa,iBAAiB,GAAAD,WAAA,CAAjBC,iBAAiB;IAAEC,MAAM,GAAAF,WAAA,CAANE,MAAM;EACjC,IAAMC,KAAK,GAAG;IACZC,IAAI,EAAEF,MAAM,CAACG,QAAQ;IACrBC,WAAW,YAAAC,MAAA,CAAYL,MAAM,CAACM,SAAS,CAAE;IACzCd,MAAM,EAANA,MAAM;IACNC,GAAG,EAAHA,GAAG;IACHC,KAAK,EAALA,KAAK;IACLa,QAAQ,EAAER,iBAAiB,aAAjBA,iBAAiB,uBAAjBA,iBAAiB,CAAEQ,QAAQ;IACrCC,OAAO,EAAET,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ElC,SAAS,CAACsC,MAAM;MACtB5B,KAAK,EAAEV,SAAS,CAACsC;IACnB,CAAC,CAAC;EACJ,CAAC,CAAC,CAAC;EACHzB,WAAW,EAAEb,SAAS,CAACsC;AACzB,CAAC;AAEDhC,YAAY,CAACwC,YAAY,GAAG;EAC1BtC,MAAM,EAAE,EAAE;EACVC,GAAG,EAAE,EAAE;EACPE,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,EAAE;EACrBC,WAAW,EAAE;AACf,CAAC;AAED,eAAeP,YAAY"} \ No newline at end of file diff --git a/dist/studio-header/StudioHeader.scss b/dist/studio-header/StudioHeader.scss new file mode 100644 index 0000000000..92465f006e --- /dev/null +++ b/dist/studio-header/StudioHeader.scss @@ -0,0 +1,49 @@ +$spacer: 1rem; +$white: #FFFFFF; + +.studio-header { + position: relative; + z-index: 1000; + + height: 3.75rem; + box-shadow: 0 1px 0 0 rgb(0 0 0 / .1); + background: $white; + + .btn-outline-primary { + border-color: $white; + } + + .logo { + display: block; + box-sizing: content-box; + position: relative; + top: -.05em; + height: 1.75rem; + padding: $spacer 0; + margin-right: $spacer; + + img { + display: block; + height: 100%; + } + } + + .course-title-lockup { + @media only screen and (min-width: 769px) { + padding: .5rem; + padding-right: $spacer; + border-right: 1px solid #E5E5E5; + width: 70%; + } + + overflow: hidden; + + span { + color: #333333; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + line-height: 1.375rem; + } + } +} diff --git a/dist/studio-header/UserMenu.js b/dist/studio-header/UserMenu.js new file mode 100644 index 0000000000..e439b972c7 --- /dev/null +++ b/dist/studio-header/UserMenu.js @@ -0,0 +1,55 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { Avatar } from '@openedx/paragon'; +import NavDropdownMenu from './NavDropdownMenu'; +import getUserMenuItems from './utils'; +var UserMenu = function UserMenu(_ref) { + var username = _ref.username, + studioBaseUrl = _ref.studioBaseUrl, + logoutUrl = _ref.logoutUrl, + authenticatedUserAvatar = _ref.authenticatedUserAvatar, + isMobile = _ref.isMobile, + isAdmin = _ref.isAdmin, + intl = _ref.intl; + var avatar = authenticatedUserAvatar ? /*#__PURE__*/React.createElement("img", { + className: "d-block w-100 h-100", + src: authenticatedUserAvatar, + alt: username, + "data-testid": "avatar-image" + }) : /*#__PURE__*/React.createElement(Avatar, { + size: "sm", + className: "mr-2", + alt: username, + "data-testid": "avatar-icon" + }); + var title = isMobile ? avatar : /*#__PURE__*/React.createElement(React.Fragment, null, avatar, username); + return /*#__PURE__*/React.createElement(NavDropdownMenu, { + buttonTitle: title, + id: "user-dropdown-menu", + items: getUserMenuItems({ + studioBaseUrl: studioBaseUrl, + logoutUrl: logoutUrl, + intl: intl, + isAdmin: isAdmin + }) + }); +}; +UserMenu.propTypes = { + username: PropTypes.string, + studioBaseUrl: PropTypes.string.isRequired, + logoutUrl: PropTypes.string.isRequired, + authenticatedUserAvatar: PropTypes.string, + isMobile: PropTypes.bool, + isAdmin: PropTypes.bool, + // injected + intl: intlShape.isRequired +}; +UserMenu.defaultProps = { + isMobile: false, + isAdmin: false, + authenticatedUserAvatar: null, + username: null +}; +export default injectIntl(UserMenu); +//# sourceMappingURL=UserMenu.js.map \ No newline at end of file diff --git a/dist/studio-header/UserMenu.js.map b/dist/studio-header/UserMenu.js.map new file mode 100644 index 0000000000..1b6deb248c --- /dev/null +++ b/dist/studio-header/UserMenu.js.map @@ -0,0 +1 @@ +{"version":3,"file":"UserMenu.js","names":["React","PropTypes","injectIntl","intlShape","Avatar","NavDropdownMenu","getUserMenuItems","UserMenu","_ref","username","studioBaseUrl","logoutUrl","authenticatedUserAvatar","isMobile","isAdmin","intl","avatar","createElement","className","src","alt","size","title","Fragment","buttonTitle","id","items","propTypes","string","isRequired","bool","defaultProps"],"sources":["../../src/studio-header/UserMenu.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { injectIntl, intlShape } from '@edx/frontend-platform/i18n';\nimport {\n Avatar,\n} from '@openedx/paragon';\nimport NavDropdownMenu from './NavDropdownMenu';\nimport getUserMenuItems from './utils';\n\nconst UserMenu = ({\n username,\n studioBaseUrl,\n logoutUrl,\n authenticatedUserAvatar,\n isMobile,\n isAdmin,\n // injected\n intl,\n}) => {\n const avatar = authenticatedUserAvatar ? (\n \n ) : (\n \n );\n const title = isMobile ? avatar : <>{avatar}{username};\n\n return (\n \n );\n};\n\nUserMenu.propTypes = {\n username: PropTypes.string,\n studioBaseUrl: PropTypes.string.isRequired,\n logoutUrl: PropTypes.string.isRequired,\n authenticatedUserAvatar: PropTypes.string,\n isMobile: PropTypes.bool,\n isAdmin: PropTypes.bool,\n // injected\n intl: intlShape.isRequired,\n};\n\nUserMenu.defaultProps = {\n isMobile: false,\n isAdmin: false,\n authenticatedUserAvatar: null,\n username: null,\n};\n\nexport default injectIntl(UserMenu);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,EAAEC,SAAS,QAAQ,6BAA6B;AACnE,SACEC,MAAM,QACD,kBAAkB;AACzB,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,gBAAgB,MAAM,SAAS;AAEtC,IAAMC,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EASR;EAAA,IARJC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,aAAa,GAAAF,IAAA,CAAbE,aAAa;IACbC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,uBAAuB,GAAAJ,IAAA,CAAvBI,uBAAuB;IACvBC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,OAAO,GAAAN,IAAA,CAAPM,OAAO;IAEPC,IAAI,GAAAP,IAAA,CAAJO,IAAI;EAEJ,IAAMC,MAAM,GAAGJ,uBAAuB,gBACpCZ,KAAA,CAAAiB,aAAA;IACEC,SAAS,EAAC,qBAAqB;IAC/BC,GAAG,EAAEP,u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index 0000000000..29914496ad --- /dev/null +++ b/dist/studio-header/index.js @@ -0,0 +1,3 @@ +import StudioHeader from './StudioHeader'; +export default StudioHeader; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/studio-header/index.js.map b/dist/studio-header/index.js.map new file mode 100644 index 0000000000..5add64cce1 --- /dev/null +++ b/dist/studio-header/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","names":["StudioHeader"],"sources":["../../src/studio-header/index.js"],"sourcesContent":["import StudioHeader from './StudioHeader';\n\nexport default StudioHeader;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,gBAAgB;AAEzC,eAAeA,YAAY"} \ No newline at end of file diff --git a/dist/studio-header/messages.js b/dist/studio-header/messages.js new file mode 100644 index 0000000000..cf7aefbef2 --- /dev/null +++ b/dist/studio-header/messages.js @@ -0,0 +1,55 @@ +import { defineMessages } from '@edx/frontend-platform/i18n'; +var messages = defineMessages({ + 'header.user.menu.studio': { + id: 'header.user.menu.studio', + defaultMessage: 'Studio Home', + description: 'Link to Studio Home' + }, + 'header.user.menu.maintenance': { + id: 'header.user.menu.maintenance', + defaultMessage: 'Maintenance', + description: 'Link to the Studio maintenance page' + }, + 'header.user.menu.logout': { + id: 'header.user.menu.logout', + defaultMessage: 'Logout', + description: 'Logout link' + }, + 'header.label.account.menu': { + id: 'header.label.account.menu', + defaultMessage: 'Account Menu', + description: 'The aria label for the account menu trigger' + }, + 'header.label.account.menu.for': { + id: 'header.label.account.menu.for', + defaultMessage: 'Account menu for {username}', + description: 'The aria label for the account menu trigger when the username is displayed in it' + }, + 'header.label.main.nav': { + id: 'header.label.main.nav', + defaultMessage: 'Main', + description: 'The aria label for the main menu nav' + }, + 'header.label.main.menu': { + id: 'header.label.main.menu', + defaultMessage: 'Main Menu', + description: 'The aria label for the main menu trigger' + }, + 'header.label.main.header': { + id: 'header.label.main.header', + defaultMessage: 'Main', + description: 'The aria label for the main header' + }, + 'header.label.secondary.nav': { + id: 'header.label.secondary.nav', + defaultMessage: 'Secondary', + description: 'The aria label for the seconary nav' + }, + 'header.label.courseOutline': { + id: 'header.label.courseOutline', + defaultMessage: 'Back to course outline in Studio', + description: 'The aria label for the link back to the Studio Course Outline' + } +}); +export default messages; +//# sourceMappingURL=messages.js.map \ No newline at end of file diff --git a/dist/studio-header/messages.js.map b/dist/studio-header/messages.js.map new file mode 100644 index 0000000000..2a3bb7f185 --- /dev/null +++ b/dist/studio-header/messages.js.map @@ -0,0 +1 @@ +{"version":3,"file":"messages.js","names":["defineMessages","messages","id","defaultMessage","description"],"sources":["../../src/studio-header/messages.js"],"sourcesContent":["import { defineMessages } from '@edx/frontend-platform/i18n';\n\nconst messages = defineMessages({\n 'header.user.menu.studio': {\n id: 'header.user.menu.studio',\n defaultMessage: 'Studio Home',\n description: 'Link to Studio Home',\n },\n 'header.user.menu.maintenance': {\n id: 'header.user.menu.maintenance',\n defaultMessage: 'Maintenance',\n description: 'Link to the Studio maintenance page',\n },\n 'header.user.menu.logout': {\n id: 'header.user.menu.logout',\n defaultMessage: 'Logout',\n description: 'Logout link',\n },\n 'header.label.account.menu': {\n id: 'header.label.account.menu',\n defaultMessage: 'Account Menu',\n description: 'The aria label for the account menu trigger',\n },\n 'header.label.account.menu.for': {\n id: 'header.label.account.menu.for',\n defaultMessage: 'Account menu for {username}',\n description: 'The aria label for the account menu trigger when the username is displayed in it',\n },\n 'header.label.main.nav': {\n id: 'header.label.main.nav',\n defaultMessage: 'Main',\n description: 'The aria label for the main menu nav',\n },\n 'header.label.main.menu': {\n id: 'header.label.main.menu',\n defaultMessage: 'Main Menu',\n description: 'The aria label for the main menu trigger',\n },\n 'header.label.main.header': {\n id: 'header.label.main.header',\n defaultMessage: 'Main',\n description: 'The aria label for the main header',\n },\n 'header.label.secondary.nav': {\n id: 'header.label.secondary.nav',\n defaultMessage: 'Secondary',\n description: 'The aria label for the seconary nav',\n },\n 'header.label.courseOutline': {\n id: 'header.label.courseOutline',\n defaultMessage: 'Back to course outline in Studio',\n description: 'The aria label for the link back to the Studio Course Outline',\n },\n});\n\nexport default messages;\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,6BAA6B;AAE5D,IAAMC,QAAQ,GAAGD,cAAc,CAAC;EAC9B,yBAAyB,EAAE;IACzBE,EAAE,EAAE,yBAAyB;IAC7BC,cAAc,EAAE,aAAa;IAC7BC,WAAW,EAAE;EACf,CAAC;EACD,8BAA8B,EAAE;IAC9BF,EAAE,EAAE,8BAA8B;IAClCC,cAAc,EAAE,aAAa;IAC7BC,WAAW,EAAE;EACf,CAAC;EACD,yBAAyB,EAAE;IACzBF,EAAE,EAAE,yBAAyB;IAC7BC,cAAc,EAAE,QAAQ;IACxBC,WAAW,EAAE;EACf,CAAC;EACD,2BAA2B,EAAE;IAC3BF,EAAE,EAAE,2BAA2B;IAC/BC,cAAc,EAAE,cAAc;IAC9BC,WAAW,EAAE;EACf,CAAC;EACD,+BAA+B,EAAE;IAC/BF,EAAE,EAAE,+BAA+B;IACnCC,cAAc,EAAE,6BAA6B;IAC7CC,WAAW,EAAE;EACf,CAAC;EACD,uBAAuB,EAAE;IACvBF,EAAE,EAAE,uBAAuB;IAC3BC,cAAc,EAAE,MAAM;IACtBC,WAAW,EAAE;EACf,CAAC;EACD,wBAAwB,EAAE;IACxBF,EAAE,EAAE,wBAAwB;IAC5BC,cAAc,EAAE,WAAW;IAC3BC,WAAW,EAAE;EACf,CAAC;EACD,0BAA0B,EAAE;IAC1BF,EAAE,EAAE,0BAA0B;IAC9BC,cAAc,EAAE,MAAM;IACtBC,WAAW,EAAE;EACf,CAAC;EACD,4BAA4B,EAAE;IAC5BF,EAAE,EAAE,4BAA4B;IAChCC,cAAc,EAAE,WAAW;IAC3BC,WAAW,EAAE;EACf,CAAC;EACD,4BAA4B,EAAE;IAC5BF,EAAE,EAAE,4BAA4B;IAChCC,cAAc,EAAE,kCAAkC;IAClDC,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAEF,eAAeH,QAAQ"} \ No newline at end of file diff --git a/dist/studio-header/utils.js b/dist/studio-header/utils.js new file mode 100644 index 0000000000..1abaf7aba4 --- /dev/null +++ b/dist/studio-header/utils.js @@ -0,0 +1,29 @@ +import messages from './messages'; +var getUserMenuItems = function getUserMenuItems(_ref) { + var studioBaseUrl = _ref.studioBaseUrl, + logoutUrl = _ref.logoutUrl, + intl = _ref.intl, + isAdmin = _ref.isAdmin; + var items = [{ + href: "".concat(studioBaseUrl), + title: intl.formatMessage(messages['header.user.menu.studio']) + }, { + href: "".concat(logoutUrl), + title: intl.formatMessage(messages['header.user.menu.logout']) + }]; + if (isAdmin) { + items = [{ + href: "".concat(studioBaseUrl), + title: intl.formatMessage(messages['header.user.menu.studio']) + }, { + href: "".concat(studioBaseUrl, "/maintenance"), + title: intl.formatMessage(messages['header.user.menu.maintenance']) + }, { + href: "".concat(logoutUrl), + title: intl.formatMessage(messages['header.user.menu.logout']) + }]; + } + return items; +}; +export default getUserMenuItems; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/dist/studio-header/utils.js.map b/dist/studio-header/utils.js.map new file mode 100644 index 0000000000..0f50bc3ebb --- /dev/null +++ b/dist/studio-header/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","names":["messages","getUserMenuItems","_ref","studioBaseUrl","logoutUrl","intl","isAdmin","items","href","concat","title","formatMessage"],"sources":["../../src/studio-header/utils.js"],"sourcesContent":["import messages from './messages';\n\nconst getUserMenuItems = ({\n studioBaseUrl,\n logoutUrl,\n intl,\n isAdmin,\n}) => {\n let items = [\n {\n href: `${studioBaseUrl}`,\n title: intl.formatMessage(messages['header.user.menu.studio']),\n }, {\n href: `${logoutUrl}`,\n title: intl.formatMessage(messages['header.user.menu.logout']),\n },\n ];\n if (isAdmin) {\n items = [\n {\n href: `${studioBaseUrl}`,\n title: intl.formatMessage(messages['header.user.menu.studio']),\n }, {\n href: `${studioBaseUrl}/maintenance`,\n title: intl.formatMessage(messages['header.user.menu.maintenance']),\n }, {\n href: `${logoutUrl}`,\n title: intl.formatMessage(messages['header.user.menu.logout']),\n },\n ];\n }\n\n return items;\n};\n\nexport default getUserMenuItems;\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,YAAY;AAEjC,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAKhB;EAAA,IAJJC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IACbC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IACJC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;EAEP,IAAIC,KAAK,GAAG,CACV;IACEC,IAAI,KAAAC,MAAA,CAAKN,aAAa,CAAE;IACxBO,KAAK,EAAEL,IAAI,CAACM,aAAa,CAACX,QAAQ,CAAC,yBAAyB,CAAC;EAC/D,CAAC,EAAE;IACDQ,IAAI,KAAAC,MAAA,CAAKL,SAAS,CAAE;IACpBM,KAAK,EAAEL,IAAI,CAACM,aAAa,CAACX,QAAQ,CAAC,yBAAyB,CAAC;EAC/D,CAAC,CACF;EACD,IAAIM,OAAO,EAAE;IACXC,KAAK,GAAG,CACN;MACEC,IAAI,KAAAC,MAAA,CAAKN,aAAa,CAAE;MACxBO,KAAK,EAAEL,IAAI,CAACM,aAAa,CAACX,QAAQ,CAAC,yBAAyB,CAAC;IAC/D,CAAC,EAAE;MACDQ,IAAI,KAAAC,MAAA,CAAKN,aAAa,iBAAc;MACpCO,KAAK,EAAEL,IAAI,CAACM,aAAa,CAACX,QAAQ,CAAC,8BAA8B,CAAC;IACpE,CAAC,EAAE;MACDQ,IAAI,KAAAC,MAAA,CAAKL,SAAS,CAAE;MACpBM,KAAK,EAAEL,IAAI,CAACM,aAAa,CAACX,QAAQ,CAAC,yBAAyB,CAAC;IAC/D,CAAC,CACF;EACH;EAEA,OAAOO,KAAK;AACd,CAAC;AAED,eAAeN,gBAAgB"} \ No newline at end of file diff --git a/dist/test-utils.js b/dist/test-utils.js new file mode 100644 index 0000000000..494dc990b1 --- /dev/null +++ b/dist/test-utils.js @@ -0,0 +1,26 @@ +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +var executeThunk = /*#__PURE__*/function () { + var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(thunk, dispatch, getState) { + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return thunk(dispatch, getState); + case 2: + _context.next = 4; + return new Promise(setImmediate); + case 4: + case "end": + return _context.stop(); + } + }, _callee); + })); + return function executeThunk(_x, _x2, _x3) { + return _ref.apply(this, arguments); + }; +}(); +export default executeThunk; +//# sourceMappingURL=test-utils.js.map \ No newline at end of file diff --git a/dist/test-utils.js.map b/dist/test-utils.js.map new file mode 100644 index 0000000000..13b20131d6 --- /dev/null +++ b/dist/test-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-utils.js","names":["_regeneratorRuntime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","defineProperty","obj","key","desc","value","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","makeInvokeMethod","tryCatch","fn","arg","type","call","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","method","_invoke","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","_typeof","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","done","methodName","undefined","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","val","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","_catch","thrown","delegateYield","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","arguments","apply","executeThunk","_ref","_callee","thunk","dispatch","getState","_callee$","_context","setImmediate","_x","_x2","_x3"],"sources":["../src/test-utils.js"],"sourcesContent":["const executeThunk = async (thunk, dispatch, getState) => {\n await thunk(dispatch, getState);\n await new Promise(setImmediate);\n};\n\nexport default executeThunk;\n"],"mappings":";+CACA,qJAAAA,mBAAA,YAAAA,oBAAA,WAAAC,OAAA,SAAAA,OAAA,OAAAC,EAAA,GAAAC,MAAA,CAAAC,SAAA,EAAAC,MAAA,GAAAH,EAAA,CAAAI,cAAA,EAAAC,cAAA,GAAAJ,MAAA,CAAAI,cAAA,cAAAC,GAAA,EAAAC,GAAA,EAAAC,IAAA,IAAAF,GAAA,CAAAC,GAAA,IAAAC,IAAA,CAAAC,KAAA,KAAAC,OAAA,wBAAAC,MAAA,GAAAA,MAAA,OAAAC,cAAA,GAAAF,OAAA,CAAAG,QAAA,kBAAAC,mBAAA,GAAAJ,OAAA,CAAAK,aAAA,uBAAAC,iBAAA,GAAAN,OAAA,CAAAO,WAAA,8BAAAC,OAAAZ,GAAA,EAAAC,GAAA,EAAAE,KAAA,WAAAR,MAAA,CAAAI,cAAA,CAAAC,GAAA,EAAAC,GAAA,IAAAE,KAAA,EAA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,kBAAA3G,EAAA,6BAAAV,IAAA,SAAAsH,IAAA,GAAAC,SAAA,aAAAhC,OAAA,WAAAzD,OAAA,EAAAC,MAAA,QAAAmF,GAAA,GAAAxG,EAAA,CAAA8G,KAAA,CAAAxH,IAAA,EAAAsH,IAAA,YAAAH,MAAApI,KAAA,IAAAkI,kBAAA,CAAAC,GAAA,EAAApF,OAAA,EAAAC,MAAA,EAAAoF,KAAA,EAAAC,MAAA,UAAArI,KAAA,cAAAqI,OAAAxH,GAAA,IAAAqH,kBAAA,CAAAC,GAAA,EAAApF,OAAA,EAAAC,MAAA,EAAAoF,KAAA,EAAAC,MAAA,WAAAxH,GAAA,KAAAuH,KAAA,CAAA9D,SAAA;AADA,IAAMoE,YAAY;EAAA,IAAAC,IAAA,GAAAL,iBAAA,eAAAjJ,mBAAA,GAAA8G,IAAA,CAAG,SAAAyC,QAAOC,KAAK,EAAEC,QAAQ,EAAEC,QAAQ;IAAA,OAAA1J,mBAAA,GAAAyB,IAAA,UAAAkI,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAjC,IAAA,GAAAiC,QAAA,CAAAvE,IAAA;QAAA;UAAAuE,QAAA,CAAAvE,IAAA;UAAA,OAC7CmE,KAAK,CAACC,QAAQ,EAAEC,QAAQ,CAAC;QAAA;UAAAE,QAAA,CAAAvE,IAAA;UAAA,OACzB,IAAI8B,OAAO,CAAC0C,YAAY,CAAC;QAAA;QAAA;UAAA,OAAAD,QAAA,CAAA9B,IAAA;MAAA;IAAA,GAAAyB,OAAA;EAAA,CAChC;EAAA,gBAHKF,YAAYA,CAAAS,EAAA,EAAAC,GAAA,EAAAC,GAAA;IAAA,OAAAV,IAAA,CAAAF,KAAA,OAAAD,SAAA;EAAA;AAAA,GAGjB;AAED,eAAeE,YAAY"} \ No newline at end of file diff --git a/src/learning-header/LearningHeader.jsx b/src/learning-header/LearningHeader.jsx index 5e5c7d870b..4887a5a97f 100644 --- a/src/learning-header/LearningHeader.jsx +++ b/src/learning-header/LearningHeader.jsx @@ -26,8 +26,7 @@ LinkedLogo.propTypes = { alt: PropTypes.string.isRequired, }; -// this feature flag is not included on the frontend-platform, we have to get it directly from ENV -const enabledOrgLogo = process.env.ENABLED_ORG_LOGO || false; +const enabledOrgLogo = getConfig().ENABLED_ORG_LOGO; const LearningHeader = ({ courseOrg, courseTitle, intl, showUserDropdown,