From b243b8d369a4f3a8fb3a30ea6d07907208590a47 Mon Sep 17 00:00:00 2001 From: Justin Hynes Date: Tue, 16 Jul 2024 08:23:29 -0400 Subject: [PATCH] chore: Remove Demographics frontend components from edx-platform (#35121) [APER-2823] Removes React compoents and functionality tied to a private 2U/edx.org-specific Demographics IDA from edx-platform. This PR attempts to remove everything added from this PR: https://github.com/openedx/edx-platform/pull/24956/. This includes the React components created to collect and transmit Demographics data, as well as functionality for managing JWT and CSRF tokens copied from `frontend-platform` to edx-platform when originally implementing the CTA and modal components. --- .../DemographicsCollectionBanner.jsx | 99 ---- .../DemographicsCollectionModal.jsx | 517 ------------------ .../MultiselectDropdown.jsx | 176 ------ .../SelectWithInput.jsx | 53 -- .../js/demographics_collection/Wizard.jsx | 134 ----- lms/static/js/jwt_auth/.eslintrc.js | 18 - .../js/jwt_auth/AxiosCsrfTokenService.js | 64 --- .../js/jwt_auth/AxiosJwtTokenService.js | 126 ----- lms/static/js/jwt_auth/README.rst | 14 - .../interceptors/createRetryInterceptor.js | 78 --- lms/static/js/jwt_auth/utils.js | 111 ---- package-lock.json | 39 +- package.json | 3 - webpack.common.config.js | 3 - 14 files changed, 1 insertion(+), 1434 deletions(-) delete mode 100644 lms/static/js/demographics_collection/DemographicsCollectionBanner.jsx delete mode 100644 lms/static/js/demographics_collection/DemographicsCollectionModal.jsx delete mode 100644 lms/static/js/demographics_collection/MultiselectDropdown.jsx delete mode 100644 lms/static/js/demographics_collection/SelectWithInput.jsx delete mode 100644 lms/static/js/demographics_collection/Wizard.jsx delete mode 100644 lms/static/js/jwt_auth/.eslintrc.js delete mode 100644 lms/static/js/jwt_auth/AxiosCsrfTokenService.js delete mode 100644 lms/static/js/jwt_auth/AxiosJwtTokenService.js delete mode 100644 lms/static/js/jwt_auth/README.rst delete mode 100644 lms/static/js/jwt_auth/interceptors/createRetryInterceptor.js delete mode 100644 lms/static/js/jwt_auth/utils.js diff --git a/lms/static/js/demographics_collection/DemographicsCollectionBanner.jsx b/lms/static/js/demographics_collection/DemographicsCollectionBanner.jsx deleted file mode 100644 index d914d7fb03..0000000000 --- a/lms/static/js/demographics_collection/DemographicsCollectionBanner.jsx +++ /dev/null @@ -1,99 +0,0 @@ -/* global gettext */ -import React from 'react'; -import Cookies from 'js-cookie'; -import {DemographicsCollectionModal} from './DemographicsCollectionModal'; - -// eslint-disable-next-line import/prefer-default-export -export class DemographicsCollectionBanner extends React.Component { - constructor(props) { - super(props); - this.state = { - modalOpen: false, - hideBanner: false - }; - - this.dismissBanner = this.dismissBanner.bind(this); - } - - /** - * Utility function that controls hiding the CTA from the Course Dashboard where appropriate. - * This can be called one of two ways - when a user clicks the "dismiss" button on the CTA - * itself, or when the learner completes all of the questions within the modal. - * - * The dismiss button itself is nested inside of an , so we need to call stopPropagation() - * here to prevent the Modal from _also_ opening when the Dismiss button is clicked. - */ - async dismissBanner(e) { - // Since this function also doubles as a callback in the Modal, we check if e is null/undefined - // before calling stopPropagation() - if (e) { - e.stopPropagation(); - } - - const requestOptions = { - method: 'PATCH', - credentials: 'include', - headers: { - 'Content-Type': 'application/json', - 'X-CSRFTOKEN': Cookies.get('csrftoken'), - }, - body: JSON.stringify({ - show_call_to_action: false, - }) - }; - - await fetch(`${this.props.lmsRootUrl}/api/demographics/v1/demographics/status/`, requestOptions); - // No matter what the response is from the API call we always allow the learner to dismiss the - // banner when clicking the dismiss button - this.setState({hideBanner: true}); - } - - render() { - if (!(this.state.hideBanner)) { - return ( -
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */} - this.setState({modalOpen: true})}> -
-
- -
- {gettext('Want to make edX better for everyone?')} -
- {/* eslint-disable-next-line react/button-has-type */} - -
-
-