Skip to content

Commit 8fe5fb6

Browse files
chore(deps): update dependency universal-cookie to v8 (#2512)
* fix(deps): update dependency universal-cookie to v8 * refactor: validate typing of universal-cookie usages --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Braden MacDonald <[email protected]>
1 parent 0315c05 commit 8fe5fb6

12 files changed

Lines changed: 40 additions & 32 deletions

File tree

package-lock.json

Lines changed: 28 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"redux-thunk": "^2.4.1",
9898
"reselect": "^4.1.5",
9999
"tinymce": "^5.10.4",
100-
"universal-cookie": "^4.0.4",
100+
"universal-cookie": "^8.0.0",
101101
"uuid": "^11.1.0",
102102
"xmlchecker": "^0.1.0",
103103
"yup": "0.32.11"
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { useEffect } from 'react';
2-
import PropTypes from 'prop-types';
32
import { useDispatch, useSelector } from 'react-redux';
43
import { useIntl } from '@edx/frontend-platform/i18n';
54
import {
@@ -27,7 +26,7 @@ import ExportModalError from './export-modal-error/ExportModalError';
2726
import ExportFooter from './export-footer/ExportFooter';
2827
import ExportStepper from './export-stepper/ExportStepper';
2928

30-
const CourseExportPage = ({ courseId }) => {
29+
const CourseExportPage = ({ courseId }: { courseId: string }) => {
3130
const intl = useIntl();
3231
const dispatch = useDispatch();
3332
const exportTriggered = useSelector(getExportTriggered);
@@ -128,8 +127,4 @@ const CourseExportPage = ({ courseId }) => {
128127
);
129128
};
130129

131-
CourseExportPage.propTypes = {
132-
courseId: PropTypes.string.isRequired,
133-
};
134-
135130
export default CourseExportPage;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function fetchExportStatus(courseId) {
8888

8989
dispatch(updateLoadingStatus({ status: RequestStatus.SUCCESSFUL }));
9090
return true;
91-
} catch (error) {
91+
} catch (error: any) {
9292
if (error.response && error.response.status === 403) {
9393
dispatch(updateLoadingStatus({ status: RequestStatus.DENIED }));
9494
} else {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Object.defineProperty(window, 'location', {
1414
describe('setExportCookie', () => {
1515
it('should set the export cookie with the provided date and completed status', () => {
1616
const cookiesSetMock = jest.spyOn(Cookies.prototype, 'set');
17-
const date = '2023-07-24';
17+
const date = moment('2023-07-24').valueOf();
1818
const completed = true;
1919
setExportCookie(date, completed);
2020

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import { LAST_EXPORT_COOKIE_NAME, SUCCESS_DATE_FORMAT } from './data/constants';
77
/**
88
* Sets an export-related cookie with the provided information.
99
*
10-
* @param {Date} date - Date of export.
10+
* @param date - Date of export (unix timestamp).
1111
* @param {boolean} completed - Indicates if export was completed successfully.
1212
* @returns {void}
1313
*/
14-
export const setExportCookie = (date, completed) => {
14+
export const setExportCookie = (date: number, completed: boolean): void => {
1515
const cookies = new Cookies();
1616
cookies.set(LAST_EXPORT_COOKIE_NAME, { date, completed }, { path: window.location.pathname });
1717
};
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable max-len */
22
import React, { useEffect } from 'react';
3-
import PropTypes from 'prop-types';
43
import { useDispatch, useSelector } from 'react-redux';
54
import { useIntl } from '@edx/frontend-platform/i18n';
65
import {
@@ -24,7 +23,7 @@ import ImportSidebar from './import-sidebar/ImportSidebar';
2423
import FileSection from './file-section/FileSection';
2524
import messages from './messages';
2625

27-
const CourseImportPage = ({ courseId }) => {
26+
const CourseImportPage = ({ courseId }: { courseId: string }) => {
2827
const intl = useIntl();
2928
const dispatch = useDispatch();
3029
const cookies = new Cookies();
@@ -104,8 +103,4 @@ const CourseImportPage = ({ courseId }) => {
104103
);
105104
};
106105

107-
CourseImportPage.propTypes = {
108-
courseId: PropTypes.string.isRequired,
109-
};
110-
111106
export default CourseImportPage;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function fetchImportStatus(courseId, fileName) {
3030
}
3131
dispatch(updateLoadingStatus(RequestStatus.SUCCESSFUL));
3232
return true;
33-
} catch (error) {
33+
} catch (error: any) {
3434
if (error.response && error.response.status === 403) {
3535
dispatch(updateLoadingStatus(RequestStatus.DENIED));
3636
} else {

0 commit comments

Comments
 (0)