diff --git a/lms/static/js/apiClient/.eslintrc.js b/lms/static/js/apiClient/.eslintrc.js deleted file mode 100644 index 838b853a82..0000000000 --- a/lms/static/js/apiClient/.eslintrc.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - extends: 'eslint-config-edx', - root: true, - settings: { - 'import/resolver': { - webpack: { - config: 'webpack.dev.config.js', - }, - }, - }, -}; diff --git a/lms/static/js/apiClient/index.js b/lms/static/js/apiClient/index.js deleted file mode 100644 index fd1208b356..0000000000 --- a/lms/static/js/apiClient/index.js +++ /dev/null @@ -1,16 +0,0 @@ -import { getAuthenticatedApiClient } from '@edx/frontend-auth'; -import { NewRelicLoggingService } from '@edx/frontend-logging'; - -const apiClient = getAuthenticatedApiClient({ - appBaseUrl: process.env.LMS_ROOT_URL, - authBaseUrl: process.env.LMS_ROOT_URL, - loginUrl: `${process.env.LMS_ROOT_URL}/login`, - logoutUrl: `${process.env.LMS_ROOT_URL}/logout`, - csrfTokenApiPath: '/csrf/api/v1/token', - refreshAccessTokenEndpoint: `${process.env.LMS_ROOT_URL}/login_refresh`, - accessTokenCookieName: process.env.JWT_AUTH_COOKIE_HEADER_PAYLOAD, - userInfoCookieName: process.env.EDXMKTG_USER_INFO_COOKIE_NAME, - loggingService: NewRelicLoggingService, -}); - -export default apiClient; diff --git a/lms/static/js/custom_user_menu_links/.eslintrc.js b/lms/static/js/custom_user_menu_links/.eslintrc.js deleted file mode 100644 index 838b853a82..0000000000 --- a/lms/static/js/custom_user_menu_links/.eslintrc.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - extends: 'eslint-config-edx', - root: true, - settings: { - 'import/resolver': { - webpack: { - config: 'webpack.dev.config.js', - }, - }, - }, -}; diff --git a/lms/static/js/custom_user_menu_links/CustomUserMenuLinks.js b/lms/static/js/custom_user_menu_links/CustomUserMenuLinks.js deleted file mode 100644 index f4f068d580..0000000000 --- a/lms/static/js/custom_user_menu_links/CustomUserMenuLinks.js +++ /dev/null @@ -1,22 +0,0 @@ -import { getAuthenticatedUser } from '@edx/frontend-auth'; -import { getLearnerPortalLinks } from '@edx/frontend-enterprise'; - -import apiClient from '../apiClient'; - -function CustomUserMenuLinks() { - const authenticatedUser = getAuthenticatedUser(); - // Inject enterprise learner portal links - getLearnerPortalLinks(apiClient, authenticatedUser).then((learnerPortalLinks) => { - const $dashboardLink = $('#user-menu .dashboard'); - const classNames = 'mobile-nav-item dropdown-item dropdown-nav-item'; - for (let i = 0; i < learnerPortalLinks.length; i += 1) { - const link = learnerPortalLinks[i]; - - $dashboardLink.after( // xss-lint: disable=javascript-jquery-insertion - `
${link.title} Dashboard
`, - ); - } - }); -} - -export { CustomUserMenuLinks }; // eslint-disable-line import/prefer-default-export diff --git a/lms/static/js/learner_dashboard/EnterpriseLearnerPortalBanner.jsx b/lms/static/js/learner_dashboard/EnterpriseLearnerPortalBanner.jsx deleted file mode 100644 index 3ee56f856a..0000000000 --- a/lms/static/js/learner_dashboard/EnterpriseLearnerPortalBanner.jsx +++ /dev/null @@ -1,80 +0,0 @@ -import React, { Component } from 'react'; -import { getAuthenticatedUser } from '@edx/frontend-auth'; -import { getLearnerPortalLinks } from '@edx/frontend-enterprise'; -import { StatusAlert } from '@edx/paragon'; - -import apiClient from '../apiClient'; - -const LOCAL_STORAGE_KEY = 'has-viewed-enterprise-learner-portal-banner'; - -function getAlertHtml(learnerPortalLinks) { - let html = ''; - for (let i = 0; i < learnerPortalLinks.length; i += 1) { - const link = learnerPortalLinks[i]; - html += `
- ${link.title} has a dedicated page where you can see all of your sponsored courses. - Go to your learner portal. -
`; - } - return html; -} - -function setViewedBanner() { - window.localStorage.setItem(LOCAL_STORAGE_KEY, true); -} - -function hasViewedBanner() { - return window.localStorage.getItem(LOCAL_STORAGE_KEY) != null; -} - -class EnterpriseLearnerPortalBanner extends Component { - constructor(props) { - super(props); - - this.onClose = this.onClose.bind(this); - - this.state = { - open: false, - alertHtml: '', - }; - } - - componentDidMount() { - if (!hasViewedBanner()) { - const authenticatedUser = getAuthenticatedUser(); - getLearnerPortalLinks(apiClient, authenticatedUser).then((learnerPortalLinks) => { - this.setState({ - open: true, - alertHtml: getAlertHtml(learnerPortalLinks), - }); - }); - } - } - - onClose() { - this.setState({ open: false }); - setViewedBanner(); - } - - render() { - const { alertHtml, open } = this.state; - - if (open && alertHtml) { - return ( -
- )} - onClose={this.onClose} - /> -
- ); - } - - return null; - } -} - -export { EnterpriseLearnerPortalBanner }; // eslint-disable-line import/prefer-default-export diff --git a/lms/static/sass/_build-lms-v1.scss b/lms/static/sass/_build-lms-v1.scss index 566228e986..cfac8d84f6 100644 --- a/lms/static/sass/_build-lms-v1.scss +++ b/lms/static/sass/_build-lms-v1.scss @@ -73,7 +73,6 @@ @import 'features/_unsupported-browser-alert'; @import 'features/content-type-gating'; @import 'features/course-duration-limits'; -@import 'features/enterprise-learner-portal-banner'; @import 'features/first-purchase-banner'; @import 'features/next-up-banner'; diff --git a/lms/static/sass/_build-lms-v2.scss b/lms/static/sass/_build-lms-v2.scss index 1dc6e8ed4b..124f3a8544 100644 --- a/lms/static/sass/_build-lms-v2.scss +++ b/lms/static/sass/_build-lms-v2.scss @@ -33,7 +33,6 @@ @import 'features/course-sock'; @import 'features/course-upgrade-message'; @import 'features/content-type-gating'; -@import 'features/enterprise-learner-portal-banner'; // Responsive Design diff --git a/lms/static/sass/bootstrap/lms-main.scss b/lms/static/sass/bootstrap/lms-main.scss index 4553e51b33..73ecf5820e 100644 --- a/lms/static/sass/bootstrap/lms-main.scss +++ b/lms/static/sass/bootstrap/lms-main.scss @@ -28,7 +28,6 @@ $static-path: '../..'; @import 'features/course-sock'; @import 'features/course-upgrade-message'; @import 'features/course-duration-limits'; -@import 'features/enterprise-learner-portal-banner'; @import 'features/first-purchase-banner'; @import 'features/next-up-banner'; diff --git a/lms/static/sass/features/_enterprise-learner-portal-banner.scss b/lms/static/sass/features/_enterprise-learner-portal-banner.scss deleted file mode 100644 index 19f8067f57..0000000000 --- a/lms/static/sass/features/_enterprise-learner-portal-banner.scss +++ /dev/null @@ -1,102 +0,0 @@ -$enterprise-learner-portal-banner-background-color: #d9edf7 !default; -$enterprise-learner-portal-banner-text-color: #000000 !default; -$enterprise-learner-portal-banner-cta-base: #0075b4 !default; -$enterprise-learner-portal-banner-cta-hover: #075683 !default; -$enterprise-learner-portal-banner-btn-color: #000000 !default; - -.edx-enterprise-learner-portal-banner-wrapper { - background: $enterprise-learner-portal-banner-background-color; - box-sizing: border-box; - - /** Base Styles - start **/ - text-align: left; - line-height: 1.5; - margin-bottom: 5px; - font: { - family: 'Open Sans', "Helvetica Neue", Helvetica, Arial, sans-serif; - size: 1rem; - weight: 400; - } - - .alert { - position: relative; - padding: 0.75rem 1.25rem; - } - - .alert-dismissible { - .close { - position: absolute; - top: 0; - right: 0; - padding: 0.75rem 1.25rem; - background: transparent; - border: 0; - text-shadow: 0 1px 0 #fff; - opacity: 1; - float: right; - line-height: 1; - font: { - size: 1.5rem; - weight: 700; - } - } - - .btn { - display: inline-block; - text-align: center; - white-space: nowrap; - vertical-align: middle; - box-shadow: none; - } - } - /** Base Styles - end **/ - - - .edx-enterprise-learner-portal-banner { - box-sizing: border-box; - display: flex; - justify-content: space-between; - max-width: none !important; - min-width: 0; - margin: 0 auto; - background: inherit; - border: none; - padding: 20px 20px 20px 40px; - - .policy-link { - color: $enterprise-learner-portal-banner-cta-base; - text-decoration: underline; - - &:focus, - &:hover { - color: $enterprise-learner-portal-banner-cta-hover; - border: none; - } - } - - .copy-content { - font-size: 0.875rem; - line-height: 1.4; - color: $enterprise-learner-portal-banner-text-color; - } - - .alert-dialog { - margin-right: 30px; - color: $enterprise-learner-portal-banner-text-color; - max-width: 1180px; - margin: 0 auto; - width: 100%; - } - - .btn.close { - color: $enterprise-learner-portal-banner-btn-color; - text-shadow: 0 0 1px $enterprise-learner-portal-banner-btn-color; - bottom: 0; - - &:focus, - &:hover { - cursor: pointer; - } - } - } -} diff --git a/lms/templates/header/user_dropdown.html b/lms/templates/header/user_dropdown.html index 0f18b836bc..29288047c8 100644 --- a/lms/templates/header/user_dropdown.html +++ b/lms/templates/header/user_dropdown.html @@ -1,6 +1,6 @@ ## mako <%page expression_filter="h"/> -<%namespace name='static' file='../static_content.html'/> +<%namespace name='static' file='static_content.html'/> <%! from django.conf import settings @@ -22,12 +22,6 @@ resume_block = retrieve_last_sitewide_block_completed(self.real_user) displayname = get_enterprise_learner_generic_name(request) or username %> -<%static:webpack entry="CustomUserMenuLinks"> - $(document).ready(function() { - CustomUserMenuLinks(); - }); - - %endif - - ${static.renderReact( - component="EnterpriseLearnerPortalBanner", - id="enterprise-learner-portal-banner", - props={} - )}
diff --git a/webpack.common.config.js b/webpack.common.config.js index 565a102d0e..1dae57f447 100644 --- a/webpack.common.config.js +++ b/webpack.common.config.js @@ -58,7 +58,7 @@ var workerConfig = function() { extensions: ['.js'] } } - } + }; } catch (err) { return null; } @@ -92,8 +92,6 @@ module.exports = Merge.smart({ StudentAccountDeletion: './lms/static/js/student_account/components/StudentAccountDeletion.jsx', StudentAccountDeletionInitializer: './lms/static/js/student_account/StudentAccountDeletionInitializer.js', ProblemBrowser: './lms/djangoapps/instructor/static/instructor/ProblemBrowser/index.jsx', - CustomUserMenuLinks: './lms/static/js/custom_user_menu_links/CustomUserMenuLinks.js', - EnterpriseLearnerPortalBanner: './lms/static/js/learner_dashboard/EnterpriseLearnerPortalBanner.jsx', // Learner Dashboard EntitlementFactory: './lms/static/js/learner_dashboard/course_entitlement_factory.js', diff --git a/webpack.dev.config.js b/webpack.dev.config.js index c560486dd3..913d773cac 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -20,10 +20,7 @@ module.exports = _.values(Merge.smart(commonConfig, { debug: true }), new webpack.DefinePlugin({ - 'process.env.NODE_ENV': JSON.stringify('development'), - 'process.env.LMS_ROOT_URL': JSON.stringify('https://localhost:18000'), - 'process.env.JWT_AUTH_COOKIE_HEADER_PAYLOAD': JSON.stringify('edx-jwt-cookie-header-payload'), - 'process.env.EDXMKTG_USER_INFO_COOKIE_NAME': JSON.stringify('edx-user-info') + 'process.env.NODE_ENV': JSON.stringify('development') }) ], module: { diff --git a/webpack.prod.config.js b/webpack.prod.config.js index 23c87f8ecd..360ab56d4d 100644 --- a/webpack.prod.config.js +++ b/webpack.prod.config.js @@ -17,10 +17,7 @@ var optimizedConfig = Merge.smart(commonConfig, { devtool: false, plugins: [ new webpack.DefinePlugin({ - 'process.env.NODE_ENV': JSON.stringify('production'), - 'process.env.LMS_ROOT_URL': JSON.stringify(process.env.LMS_ROOT_URL), - 'process.env.JWT_AUTH_COOKIE_HEADER_PAYLOAD': JSON.stringify(process.env.JWT_AUTH_COOKIE_HEADER_PAYLOAD), - 'process.env.EDXMKTG_USER_INFO_COOKIE_NAME': JSON.stringify(process.env.EDXMKTG_USER_INFO_COOKIE_NAME) + 'process.env.NODE_ENV': JSON.stringify('production') }), new webpack.LoaderOptionsPlugin({ // This may not be needed; legacy option for loaders written for webpack 1 minimize: true