richie-education 3.5.2-dev12 → 3.5.2-dev18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -1
- package/.storybook/main.js +1 -1
- package/babel.config.js +23 -8
- package/js/hooks/useCourseProductUnion/index.spec.tsx +2 -2
- package/js/hooks/usePrevious.ts +1 -1
- package/js/pages/DashboardAddressesManagement/index.spec.tsx +2 -1
- package/js/pages/DashboardCreditCardsManagement/index.spec.tsx +5 -3
- package/js/utils/test/factories/factories.ts +1 -1
- package/js/utils/test/mockPaginatedResponse.ts +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx +3 -1
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.tsx +9 -11
- package/js/widgets/Dashboard/components/DashboardItem/Order/OrderWithdrawalModal/index.tsx +2 -2
- package/package.json +11 -11
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
24.21.0
|
package/.storybook/main.js
CHANGED
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
stories: ['../stories/**/*.stories.@(js|jsx|ts|tsx)', '../js/**/*.stories.@(js|jsx|ts|tsx)'],
|
|
13
13
|
addons: [
|
|
14
14
|
getAbsolutePath('@storybook/addon-links'),
|
|
15
|
-
getAbsolutePath('@storybook/addon-webpack5-compiler-
|
|
15
|
+
getAbsolutePath('@storybook/addon-webpack5-compiler-swc'),
|
|
16
16
|
],
|
|
17
17
|
framework: {
|
|
18
18
|
name: getAbsolutePath('@storybook/react-webpack5'),
|
package/babel.config.js
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
plugins: [
|
|
3
3
|
[
|
|
4
|
-
'
|
|
4
|
+
'polyfill-corejs3',
|
|
5
5
|
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
idInterpolationPattern: '[sha512:contenthash:base64:6]',
|
|
6
|
+
method: 'usage-global',
|
|
7
|
+
version: require('core-js/package.json').version,
|
|
9
8
|
},
|
|
10
9
|
],
|
|
11
|
-
|
|
10
|
+
],
|
|
11
|
+
overrides: [
|
|
12
|
+
{
|
|
13
|
+
exclude: /node_modules/,
|
|
14
|
+
plugins: [
|
|
15
|
+
[
|
|
16
|
+
'formatjs',
|
|
17
|
+
{
|
|
18
|
+
ast: true,
|
|
19
|
+
idInterpolationPattern: '[sha512:contenthash:base64:6]',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
],
|
|
23
|
+
},
|
|
12
24
|
],
|
|
13
25
|
presets: [
|
|
14
26
|
[
|
|
15
27
|
'@babel/preset-env',
|
|
16
28
|
{
|
|
17
|
-
corejs: 3,
|
|
18
29
|
forceAllTransforms: true,
|
|
19
30
|
targets: 'last 1 version, >0.2%, IE 11',
|
|
20
|
-
useBuiltIns: 'usage',
|
|
21
31
|
},
|
|
22
32
|
],
|
|
23
33
|
[
|
|
@@ -26,6 +36,11 @@ module.exports = {
|
|
|
26
36
|
runtime: 'automatic',
|
|
27
37
|
},
|
|
28
38
|
],
|
|
29
|
-
|
|
39
|
+
[
|
|
40
|
+
'@babel/preset-typescript',
|
|
41
|
+
{
|
|
42
|
+
onlyRemoveTypeImports: false,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
30
45
|
],
|
|
31
46
|
};
|
|
@@ -73,7 +73,7 @@ describe('useCourseProductUnion', () => {
|
|
|
73
73
|
);
|
|
74
74
|
const { result } = renderUseCourseProductUnion();
|
|
75
75
|
await waitFor(() => expect(result.current.isLoading).toBe(false));
|
|
76
|
-
expect(result.current.data.length).toBe(PER_PAGE);
|
|
76
|
+
await waitFor(() => expect(result.current.data.length).toBe(PER_PAGE));
|
|
77
77
|
nbApiCalls += 1; // courses page 1
|
|
78
78
|
nbApiCalls += 1; // offerings page 1
|
|
79
79
|
const calledUrls = fetchMock.calls().map((call) => call[0]);
|
|
@@ -103,7 +103,7 @@ describe('useCourseProductUnion', () => {
|
|
|
103
103
|
);
|
|
104
104
|
const { result } = renderUseCourseProductUnion({ organizationId: 'DUMMY_ORGANIZATION_ID' });
|
|
105
105
|
await waitFor(() => expect(result.current.isLoading).toBe(false));
|
|
106
|
-
expect(result.current.data.length).toBe(PER_PAGE);
|
|
106
|
+
await waitFor(() => expect(result.current.data.length).toBe(PER_PAGE));
|
|
107
107
|
nbApiCalls += 1; // courses page 1
|
|
108
108
|
nbApiCalls += 1; // offerings page 1
|
|
109
109
|
const calledUrls = fetchMock.calls().map((call) => call[0]);
|
package/js/hooks/usePrevious.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
queryByText,
|
|
8
8
|
render,
|
|
9
9
|
screen,
|
|
10
|
+
waitFor,
|
|
10
11
|
} from '@testing-library/react';
|
|
11
12
|
import fetchMock from 'fetch-mock';
|
|
12
13
|
import {
|
|
@@ -143,7 +144,7 @@ describe('<DashboardAddressesManagement/>', () => {
|
|
|
143
144
|
expect(fetchMock.called(deleteUrl)).toBe(true);
|
|
144
145
|
|
|
145
146
|
// The address does not appear anymore in the list.
|
|
146
|
-
expect(screen.queryByText(address.title)).toBeNull();
|
|
147
|
+
await waitFor(() => expect(screen.queryByText(address.title)).toBeNull());
|
|
147
148
|
|
|
148
149
|
// No error is shown.
|
|
149
150
|
expect(screen.queryByText('An error occurred', { exact: false })).toBeNull();
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import fetchMock from 'fetch-mock';
|
|
2
2
|
import {
|
|
3
3
|
act,
|
|
4
|
+
findByText,
|
|
4
5
|
fireEvent,
|
|
5
6
|
getByRole,
|
|
6
7
|
getByText,
|
|
7
8
|
queryByRole,
|
|
8
9
|
queryByText,
|
|
9
10
|
screen,
|
|
11
|
+
waitFor,
|
|
10
12
|
} from '@testing-library/react';
|
|
11
13
|
import { faker } from '@faker-js/faker';
|
|
12
14
|
import {
|
|
@@ -229,7 +231,7 @@ describe('<DashboardCreditCardsManagement/>', () => {
|
|
|
229
231
|
expect(screen.queryByText('An error occurred', { exact: false })).toBeNull();
|
|
230
232
|
|
|
231
233
|
// The address does not appear anymore in the list.
|
|
232
|
-
expect(screen.queryByText(creditCard.title!)).toBeNull();
|
|
234
|
+
await waitFor(() => expect(screen.queryByText(creditCard.title!)).toBeNull());
|
|
233
235
|
});
|
|
234
236
|
|
|
235
237
|
it('deletes a main credit card', async () => {
|
|
@@ -269,7 +271,7 @@ describe('<DashboardCreditCardsManagement/>', () => {
|
|
|
269
271
|
expect(screen.queryByText('An error occurred', { exact: false })).toBeNull();
|
|
270
272
|
|
|
271
273
|
// The address does not appear anymore in the list.
|
|
272
|
-
expect(screen.queryByText(creditCard.title!)).toBeNull();
|
|
274
|
+
await waitFor(() => expect(screen.queryByText(creditCard.title!)).toBeNull());
|
|
273
275
|
});
|
|
274
276
|
|
|
275
277
|
it('promotes a credit card', async () => {
|
|
@@ -310,7 +312,7 @@ describe('<DashboardCreditCardsManagement/>', () => {
|
|
|
310
312
|
|
|
311
313
|
// Assert that "Default credit card" is displayed on the credit card's box.
|
|
312
314
|
creditCardContainer = screen.getByTestId('dashboard-credit-card__' + creditCard.id);
|
|
313
|
-
|
|
315
|
+
await findByText(creditCardContainer, 'Default credit card');
|
|
314
316
|
|
|
315
317
|
// No error is shown.
|
|
316
318
|
expect(screen.queryByText('An error occurred', { exact: false })).toBeNull();
|
|
@@ -40,7 +40,7 @@ const setUndefinedValues = (obj: any) => {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
type Factory<TData> = (override?: Subset<TData>) => FactoryInterface<TData>;
|
|
43
|
-
export const factory = <TData>(builder: FactoryBuilder<TData>): Factory<TData> => {
|
|
43
|
+
export const factory = <TData extends unknown>(builder: FactoryBuilder<TData>): Factory<TData> => {
|
|
44
44
|
const mergeData = (data: TData, override: Subset<TData>): TData => {
|
|
45
45
|
const customizer = (_objValue: any, srcValue: any) => {
|
|
46
46
|
if (Array.isArray(srcValue)) {
|
|
@@ -208,7 +208,9 @@ describe('<DashboardItemOrder/>', () => {
|
|
|
208
208
|
const withdrawnOnDate = new Intl.DateTimeFormat('en', DEFAULT_DATE_FORMAT).format(
|
|
209
209
|
new Date(order.withdrawn_confirmation_at!),
|
|
210
210
|
);
|
|
211
|
-
await screen.findByText(`
|
|
211
|
+
await screen.findByText(`You withdrew from this order on ${withdrawnOnDate}.`, {
|
|
212
|
+
exact: false,
|
|
213
|
+
});
|
|
212
214
|
expect(screen.queryByRole('link', { name: 'View details' })).not.toBeInTheDocument();
|
|
213
215
|
order.target_courses.forEach((course) => {
|
|
214
216
|
expect(
|
|
@@ -53,8 +53,8 @@ const messages = defineMessages({
|
|
|
53
53
|
},
|
|
54
54
|
withdrawnOn: {
|
|
55
55
|
id: 'components.DashboardItemOrder.withdrawnOn',
|
|
56
|
-
description: '
|
|
57
|
-
defaultMessage: '
|
|
56
|
+
description: 'Message displayed once a withdrawal request has been confirmed',
|
|
57
|
+
defaultMessage: 'You withdrew from this order on {date}.',
|
|
58
58
|
},
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -118,15 +118,13 @@ export const DashboardItemOrder = ({
|
|
|
118
118
|
<>
|
|
119
119
|
<Icon name={isWithdrawn ? IconTypeEnum.ROUND_CLOSE : IconTypeEnum.SCHOOL} />
|
|
120
120
|
<span>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
/>
|
|
129
|
-
</>
|
|
121
|
+
{isWithdrawn && order.withdrawn_confirmation_at ? (
|
|
122
|
+
<FormattedMessage
|
|
123
|
+
{...messages.withdrawnOn}
|
|
124
|
+
values={{ date: formatDate(order.withdrawn_confirmation_at) }}
|
|
125
|
+
/>
|
|
126
|
+
) : (
|
|
127
|
+
<OrderStateLearnerMessage order={order} />
|
|
130
128
|
)}
|
|
131
129
|
</span>
|
|
132
130
|
</>
|
|
@@ -81,7 +81,7 @@ const messages = defineMessages({
|
|
|
81
81
|
},
|
|
82
82
|
accountLinkRefresh: {
|
|
83
83
|
id: 'components.DashboardItemOrder.OrderWithdrawalModal.accountLinkRefresh',
|
|
84
|
-
defaultMessage: '
|
|
84
|
+
defaultMessage: 'and log out. The changes will be visible the next time you log in.',
|
|
85
85
|
description: 'Label of the account refresh information',
|
|
86
86
|
},
|
|
87
87
|
submit: {
|
|
@@ -263,7 +263,7 @@ export const OrderWithdrawalModal = ({
|
|
|
263
263
|
href={(AuthenticationApi!.account as KeycloakAccountApi).updateUrl()}
|
|
264
264
|
>
|
|
265
265
|
<FormattedMessage {...messages.accountLinkLabel} />
|
|
266
|
-
</a>
|
|
266
|
+
</a>{' '}
|
|
267
267
|
<FormattedMessage {...messages.accountLinkRefresh} />
|
|
268
268
|
</p>
|
|
269
269
|
)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "richie-education",
|
|
3
|
-
"version": "3.5.2-
|
|
3
|
+
"version": "3.5.2-dev18",
|
|
4
4
|
"description": "A CMS to build learning portals for Open Education",
|
|
5
5
|
"main": "sandbox/manage.py",
|
|
6
6
|
"scripts": {
|
|
@@ -39,12 +39,11 @@
|
|
|
39
39
|
"not op_mini all"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@babel/core": "
|
|
43
|
-
"@babel/plugin-
|
|
44
|
-
"@babel/
|
|
45
|
-
"@babel/preset-
|
|
46
|
-
"@babel/preset-
|
|
47
|
-
"@babel/preset-typescript": "7.28.5",
|
|
42
|
+
"@babel/core": "8.0.6",
|
|
43
|
+
"@babel/plugin-transform-modules-commonjs": "8.0.1",
|
|
44
|
+
"@babel/preset-env": "8.0.2",
|
|
45
|
+
"@babel/preset-react": "8.0.1",
|
|
46
|
+
"@babel/preset-typescript": "8.0.1",
|
|
48
47
|
"@emotion/react": "^11.14.0",
|
|
49
48
|
"@emotion/styled": "^11.14.1",
|
|
50
49
|
"@faker-js/faker": "10.3.0",
|
|
@@ -80,8 +79,9 @@
|
|
|
80
79
|
"@typescript-eslint/eslint-plugin": "8.56.1",
|
|
81
80
|
"@typescript-eslint/parser": "8.56.1",
|
|
82
81
|
"babel-jest": "30.2.0",
|
|
83
|
-
"babel-loader": "10.
|
|
84
|
-
"babel-plugin-
|
|
82
|
+
"babel-loader": "10.1.1",
|
|
83
|
+
"babel-plugin-formatjs": "13.0.6",
|
|
84
|
+
"babel-plugin-polyfill-corejs3": "1.0.0",
|
|
85
85
|
"bootstrap": ">=4.6.0 <5",
|
|
86
86
|
"classnames": "2.5.1",
|
|
87
87
|
"cljs-merge": "1.1.1",
|
|
@@ -149,11 +149,11 @@
|
|
|
149
149
|
"workerDirectory": "../richie/static/richie/js"
|
|
150
150
|
},
|
|
151
151
|
"volta": {
|
|
152
|
-
"node": "
|
|
152
|
+
"node": "24.21.0",
|
|
153
153
|
"yarn": "1.22.22"
|
|
154
154
|
},
|
|
155
155
|
"devDependencies": {
|
|
156
|
-
"@storybook/addon-webpack5-compiler-
|
|
156
|
+
"@storybook/addon-webpack5-compiler-swc": "4.0.3",
|
|
157
157
|
"@storybook/addon-links": "10.2.13",
|
|
158
158
|
"@storybook/react": "10.2.13",
|
|
159
159
|
"@storybook/react-webpack5": "10.2.13",
|