diff --git a/lms/static/js/student_account/StudentAccountDeletionInitializer.js b/lms/static/js/student_account/StudentAccountDeletionInitializer.js new file mode 100644 index 0000000000..730a212138 --- /dev/null +++ b/lms/static/js/student_account/StudentAccountDeletionInitializer.js @@ -0,0 +1,27 @@ +/* eslint-disable no-new */ +import { ReactRenderer } from 'ReactRenderer'; +import { StudentAccountDeletion } from './components/StudentAccountDeletion'; + +const maxWait = 60000; +const interval = 50; +const accountDeletionWrapperId = 'account-deletion-container'; +let currentWait = 0; + +const wrapperRendered = setInterval(() => { + const wrapper = document.getElementById(accountDeletionWrapperId); + + if (wrapper) { + clearInterval(wrapperRendered); + new ReactRenderer({ + component: StudentAccountDeletion, + selector: `#${accountDeletionWrapperId}`, + componentName: 'StudentAccountDeletion', + }); + } + + currentWait += interval; + + if (currentWait >= maxWait) { + clearInterval(wrapperRendered); + } +}, interval); diff --git a/lms/static/js/student_account/components/StudentAccountDeletion.jsx b/lms/static/js/student_account/components/StudentAccountDeletion.jsx new file mode 100644 index 0000000000..7ac9e22d90 --- /dev/null +++ b/lms/static/js/student_account/components/StudentAccountDeletion.jsx @@ -0,0 +1,56 @@ +/* globals gettext */ +/* eslint-disable react/no-danger, import/prefer-default-export */ +import React from 'react'; +import { Button } from '@edx/paragon/static'; +import StringUtils from 'edx-ui-toolkit/js/utils/string-utils'; +import StudentAccountDeletionModal from './StudentAccountDeletionModal'; + +export class StudentAccountDeletion extends React.Component { + constructor(props) { + super(props); + this.closeDeletionModal = this.closeDeletionModal.bind(this); + this.loadDeletionModal = this.loadDeletionModal.bind(this); + this.state = { deletionModalOpen: false }; + } + + closeDeletionModal() { + this.setState({ deletionModalOpen: false }); + this.modalTrigger.focus(); + } + + loadDeletionModal() { + this.setState({ deletionModalOpen: true }); + } + + render() { + const { deletionModalOpen } = this.state; + const loseAccessText = StringUtils.interpolate( + gettext('You may also lose access to verified certificates and other program credentials like MicroMasters certificates. If you want to make a copy of these for your records before proceeding with deletion, follow the instructions for {htmlStart}printing or downloading a certificate{htmlEnd}.'), + { + htmlStart: '', + htmlEnd: '', + }, + ); + + return ( +
{ gettext('We’re sorry to see you go!') }
+{ gettext('Please note: Deletion of your account and personal data is permanent and cannot be undone. EdX will not be able to recover your account or the data that is deleted.') }
+{ gettext('Once your account is deleted, you cannot use it to take courses on the edX app, edx.org, or any other site hosted by edX. This includes access to edx.org from your employer’s or university’s system and access to private sites offered by MIT Open Learning, Wharton Executive Education, and Harvard Medical School.') }
+ + +{ validationErrorDetails }
+{ gettext('If you proceed, you will be unable to use this account to take courses on the edX app, edx.org, or any other site hosted by edX. This includes access to edx.org from your employer’s or university’s system and access to private sites offered by MIT Open Learning, Wharton Executive Education, and Harvard Medical School.') }
+ +{ gettext('If you still wish to continue and delete your account, please enter your account password:') }
+