richie-education 2.25.0-b2.dev168 → 2.25.0-b2.dev170
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/js/components/CourseGlimpse/utils.ts +6 -8
- package/js/components/SaleTunnel/components/SaleTunnelStepResume/index.tsx +4 -3
- package/js/components/SignContractButton/index.tsx +5 -5
- package/js/pages/DashboardAddressesManagement/DashboardCreateAddress.spec.tsx +2 -1
- package/js/pages/DashboardAddressesManagement/DashboardCreateAddressLoader.tsx +1 -1
- package/js/pages/DashboardAddressesManagement/DashboardEditAddress.spec.tsx +2 -1
- package/js/pages/DashboardAddressesManagement/DashboardEditAddressLoader.tsx +1 -1
- package/js/pages/DashboardAddressesManagement/index.spec.tsx +2 -1
- package/js/pages/DashboardCertificates/index.spec.tsx +2 -1
- package/js/pages/DashboardContracts/index.spec.tsx +2 -1
- package/js/pages/DashboardCourses/index.spec.tsx +2 -1
- package/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.spec.tsx +2 -1
- package/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCardLoader.tsx +1 -1
- package/js/pages/DashboardCreditCardsManagement/index.spec.tsx +2 -1
- package/js/pages/DashboardOrderLayout/index.spec.tsx +2 -1
- package/js/pages/DashboardOrderLayout/index.tsx +5 -8
- package/js/pages/DashboardPreferences/index.tsx +2 -1
- package/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.spec.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.tsx +4 -5
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx +2 -1
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.useUnionResource.cache.spec.tsx +2 -1
- package/js/widgets/Dashboard/components/LearnerDashboardSidebar/index.tsx +5 -7
- package/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/index.spec.tsx +4 -5
- package/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/index.tsx +7 -13
- package/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/utils.ts +1 -1
- package/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.tsx +4 -8
- package/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.tsx +4 -4
- package/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx +4 -4
- package/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.tsx +4 -7
- package/js/widgets/Dashboard/hooks/useDashboardRouter/index.tsx +9 -15
- package/js/widgets/Dashboard/index.spec.tsx +1 -1
- package/js/widgets/Dashboard/utils/dashboardRoutes.tsx +14 -43
- package/js/widgets/Dashboard/utils/learnerRoutes.tsx +14 -24
- package/js/widgets/Dashboard/utils/learnerRoutesPaths.tsx +70 -0
- package/js/widgets/Dashboard/utils/teacherDashboardPaths.tsx +106 -0
- package/js/widgets/Dashboard/utils/teacherRoutes.tsx +22 -81
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/ProductSignatureHeader/index.tsx +4 -3
- package/package.json +1 -1
- package/js/widgets/Dashboard/utils/learnerRouteMessages.tsx +0 -125
- package/js/widgets/Dashboard/utils/teacherRouteMessages.tsx +0 -194
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { IntlShape } from 'react-intl';
|
|
2
|
+
import { generatePath } from 'react-router-dom';
|
|
2
3
|
import { Course as RichieCourse, isRichieCourse } from 'types/Course';
|
|
3
|
-
import { getDashboardRoutePath } from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
4
|
-
import { TeacherDashboardPaths } from 'widgets/Dashboard/utils/teacherRouteMessages';
|
|
5
4
|
import {
|
|
6
5
|
CourseListItem as JoanieCourse,
|
|
7
6
|
CourseProductRelation,
|
|
8
7
|
isCourseProductRelation,
|
|
9
8
|
} from 'types/Joanie';
|
|
9
|
+
import { TeacherDashboardPaths } from 'widgets/Dashboard/utils/teacherDashboardPaths';
|
|
10
10
|
import { CourseGlimpseCourse } from '.';
|
|
11
11
|
|
|
12
12
|
const getCourseGlimpsePropsFromCourseProductRelation = (
|
|
@@ -14,17 +14,16 @@ const getCourseGlimpsePropsFromCourseProductRelation = (
|
|
|
14
14
|
intl: IntlShape,
|
|
15
15
|
organizationId?: string,
|
|
16
16
|
): CourseGlimpseCourse => {
|
|
17
|
-
const getRoutePath = getDashboardRoutePath(intl);
|
|
18
17
|
const courseRouteParams = {
|
|
19
18
|
courseId: courseProductRelation.course.id,
|
|
20
19
|
courseProductRelationId: courseProductRelation.id,
|
|
21
20
|
};
|
|
22
21
|
const courseRoute = organizationId
|
|
23
|
-
?
|
|
22
|
+
? generatePath(TeacherDashboardPaths.ORGANIZATION_PRODUCT, {
|
|
24
23
|
...courseRouteParams,
|
|
25
24
|
organizationId,
|
|
26
25
|
})
|
|
27
|
-
:
|
|
26
|
+
: generatePath(TeacherDashboardPaths.COURSE_PRODUCT, courseRouteParams);
|
|
28
27
|
return {
|
|
29
28
|
id: courseProductRelation.id,
|
|
30
29
|
code: courseProductRelation.course.code,
|
|
@@ -67,16 +66,15 @@ const getCourseGlimpsePropsFromJoanieCourse = (
|
|
|
67
66
|
intl: IntlShape,
|
|
68
67
|
organizationId?: string,
|
|
69
68
|
): CourseGlimpseCourse => {
|
|
70
|
-
const getRoutePath = getDashboardRoutePath(intl);
|
|
71
69
|
const courseRouteParams = {
|
|
72
70
|
courseId: course.id,
|
|
73
71
|
};
|
|
74
72
|
const courseRoute = organizationId
|
|
75
|
-
?
|
|
73
|
+
? generatePath(TeacherDashboardPaths.ORGANIZATION_COURSE_GENERAL_INFORMATION, {
|
|
76
74
|
...courseRouteParams,
|
|
77
75
|
organizationId,
|
|
78
76
|
})
|
|
79
|
-
:
|
|
77
|
+
: generatePath(TeacherDashboardPaths.COURSE_GENERAL_INFORMATION, courseRouteParams);
|
|
80
78
|
return {
|
|
81
79
|
id: course.id,
|
|
82
80
|
code: course.code,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Button } from '@openfun/cunningham-react';
|
|
2
2
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
3
|
+
import { generatePath } from 'react-router-dom';
|
|
3
4
|
import { SuccessIcon } from 'components/SuccessIcon';
|
|
4
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
5
5
|
import { getDashboardBasename } from 'widgets/Dashboard/hooks/useDashboardRouter/getDashboardBasename';
|
|
6
6
|
import { useSaleTunnelContext } from 'components/SaleTunnel/context';
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
8
9
|
|
|
9
10
|
const messages = defineMessages({
|
|
10
11
|
congratulations: {
|
|
@@ -72,7 +73,7 @@ export const SaleTunnelStepResume = ({ next }: SaleTunnelStepResumeProps) => {
|
|
|
72
73
|
<Button
|
|
73
74
|
href={
|
|
74
75
|
getDashboardBasename(intl.locale) +
|
|
75
|
-
|
|
76
|
+
generatePath(LearnerDashboardPaths.ORDER, { orderId: order!.id })
|
|
76
77
|
}
|
|
77
78
|
>
|
|
78
79
|
<FormattedMessage {...messages.ctaSignature} />
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Button } from '@openfun/cunningham-react';
|
|
2
|
-
import { FormattedMessage, defineMessages
|
|
2
|
+
import { FormattedMessage, defineMessages } from 'react-intl';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
+
import { generatePath } from 'react-router-dom';
|
|
4
5
|
import { LearnerContractFrame } from 'components/ContractFrame';
|
|
5
6
|
import { Contract, ContractState, CredentialOrder, NestedCredentialOrder } from 'types/Joanie';
|
|
6
7
|
import { RouterButton } from 'widgets/Dashboard/components/RouterButton';
|
|
7
|
-
import { getDashboardRoutePath } from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
8
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
9
8
|
import DownloadContractButton from 'components/DownloadContractButton';
|
|
10
9
|
import { Maybe } from 'types/utils';
|
|
11
10
|
import { ContractHelper } from 'utils/ContractHelper';
|
|
12
11
|
|
|
12
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
13
|
+
|
|
13
14
|
const messages = defineMessages({
|
|
14
15
|
contractSignActionLabel: {
|
|
15
16
|
id: 'components.SignContractButton.contractSignActionLabel',
|
|
@@ -42,11 +43,10 @@ interface SignContractButtonLinkProps {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
const SignContractButtonLink = ({ orderId, className }: SignContractButtonLinkProps) => {
|
|
45
|
-
const getRoutePath = getDashboardRoutePath(useIntl());
|
|
46
46
|
return (
|
|
47
47
|
<RouterButton
|
|
48
48
|
size="small"
|
|
49
|
-
href={
|
|
49
|
+
href={generatePath(LearnerDashboardPaths.ORDER, {
|
|
50
50
|
orderId,
|
|
51
51
|
})}
|
|
52
52
|
className={className}
|
|
@@ -9,7 +9,6 @@ import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/fac
|
|
|
9
9
|
import { AddressFactory } from 'utils/test/factories/joanie';
|
|
10
10
|
import { SessionProvider } from 'contexts/SessionContext';
|
|
11
11
|
import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest';
|
|
12
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
13
12
|
import { Address } from 'types/Joanie';
|
|
14
13
|
import { expectFetchCall } from 'utils/test/expectFetchCall';
|
|
15
14
|
import { expectBreadcrumbsToEqualParts } from 'utils/test/expectBreadcrumbsToEqualParts';
|
|
@@ -18,6 +17,8 @@ import { expectBannerError } from 'utils/test/expectBanner';
|
|
|
18
17
|
import { changeSelect } from 'components/Form/test-utils';
|
|
19
18
|
import { HttpStatusCode } from 'utils/errors/HttpError';
|
|
20
19
|
|
|
20
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
21
|
+
|
|
21
22
|
jest.mock('utils/context', () => ({
|
|
22
23
|
__esModule: true,
|
|
23
24
|
default: mockRichieContextFactory({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
2
1
|
import { useDashboardNavigate } from 'widgets/Dashboard/hooks/useDashboardRouter';
|
|
2
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
3
3
|
import { DashboardCreateAddress } from './DashboardCreateAddress';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -14,13 +14,14 @@ import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/fac
|
|
|
14
14
|
import { AddressFactory } from 'utils/test/factories/joanie';
|
|
15
15
|
import { SessionProvider } from 'contexts/SessionContext';
|
|
16
16
|
import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest';
|
|
17
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
18
17
|
import { expectFetchCall } from 'utils/test/expectFetchCall';
|
|
19
18
|
import { expectBreadcrumbsToEqualParts } from 'utils/test/expectBreadcrumbsToEqualParts';
|
|
20
19
|
import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider';
|
|
21
20
|
import { createTestQueryClient } from 'utils/test/createTestQueryClient';
|
|
22
21
|
import { HttpStatusCode } from 'utils/errors/HttpError';
|
|
23
22
|
|
|
23
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
24
|
+
|
|
24
25
|
jest.mock('utils/context', () => ({
|
|
25
26
|
__esModule: true,
|
|
26
27
|
default: mockRichieContextFactory({
|
|
@@ -2,9 +2,9 @@ import { useParams } from 'react-router-dom';
|
|
|
2
2
|
import Banner, { BannerType } from 'components/Banner';
|
|
3
3
|
import { Spinner } from 'components/Spinner';
|
|
4
4
|
import { useAddress } from 'hooks/useAddresses';
|
|
5
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
6
5
|
import { useDashboardNavigate } from 'widgets/Dashboard/hooks/useDashboardRouter';
|
|
7
6
|
import { useBreadcrumbsPlaceholders } from 'hooks/useBreadcrumbsPlaceholders';
|
|
7
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
8
8
|
import { DashboardEditAddress } from './DashboardEditAddress';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -15,7 +15,6 @@ import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/fac
|
|
|
15
15
|
import { AddressFactory } from 'utils/test/factories/joanie';
|
|
16
16
|
import { SessionProvider } from 'contexts/SessionContext';
|
|
17
17
|
import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest';
|
|
18
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
19
18
|
import * as Joanie from 'types/Joanie';
|
|
20
19
|
import { expectBreadcrumbsToEqualParts } from 'utils/test/expectBreadcrumbsToEqualParts';
|
|
21
20
|
import { resolveAll } from 'utils/resolveAll';
|
|
@@ -23,6 +22,8 @@ import { createTestQueryClient } from 'utils/test/createTestQueryClient';
|
|
|
23
22
|
import { expectBannerError } from 'utils/test/expectBanner';
|
|
24
23
|
import { HttpStatusCode } from 'utils/errors/HttpError';
|
|
25
24
|
|
|
25
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
26
|
+
|
|
26
27
|
jest.mock('utils/context', () => ({
|
|
27
28
|
__esModule: true,
|
|
28
29
|
default: mockRichieContextFactory({
|
|
@@ -13,10 +13,11 @@ import { Deferred } from 'utils/test/deferred';
|
|
|
13
13
|
import { History, HistoryContext } from 'hooks/useHistory';
|
|
14
14
|
import { SessionProvider } from 'contexts/SessionContext';
|
|
15
15
|
import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest';
|
|
16
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
17
16
|
import { CertificateFactory } from 'utils/test/factories/joanie';
|
|
18
17
|
import { HttpStatusCode } from 'utils/errors/HttpError';
|
|
19
18
|
|
|
19
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
20
|
+
|
|
20
21
|
jest.mock('utils/context', () => ({
|
|
21
22
|
__esModule: true,
|
|
22
23
|
default: mockRichieContextFactory({
|
|
@@ -13,9 +13,10 @@ import { Deferred } from 'utils/test/deferred';
|
|
|
13
13
|
import { History, HistoryContext } from 'hooks/useHistory';
|
|
14
14
|
import { SessionProvider } from 'contexts/SessionContext';
|
|
15
15
|
import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest';
|
|
16
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
17
16
|
import { ContractFactory } from 'utils/test/factories/joanie';
|
|
18
17
|
|
|
18
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
19
|
+
|
|
19
20
|
jest.mock('utils/context', () => ({
|
|
20
21
|
__esModule: true,
|
|
21
22
|
default: mockRichieContextFactory({
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
CredentialOrderFactory,
|
|
11
11
|
} from 'utils/test/factories/joanie';
|
|
12
12
|
import { createTestQueryClient } from 'utils/test/createTestQueryClient';
|
|
13
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
14
13
|
import { CourseLight, CourseProductRelation, Enrollment, CredentialOrder } from 'types/Joanie';
|
|
15
14
|
import { expectNoSpinner, expectSpinner } from 'utils/test/expectSpinner';
|
|
16
15
|
import { expectBannerError, expectBannerInfo, expectNoBannerInfo } from 'utils/test/expectBanner';
|
|
@@ -23,6 +22,8 @@ import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper';
|
|
|
23
22
|
import { render } from 'utils/test/render';
|
|
24
23
|
import { BaseJoanieAppWrapper } from 'utils/test/wrappers/BaseJoanieAppWrapper';
|
|
25
24
|
|
|
25
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
26
|
+
|
|
26
27
|
jest.mock('utils/context', () => ({
|
|
27
28
|
__esModule: true,
|
|
28
29
|
default: mockRichieContextFactory({
|
|
@@ -14,13 +14,14 @@ import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/fac
|
|
|
14
14
|
import { CreditCardFactory } from 'utils/test/factories/joanie';
|
|
15
15
|
import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest';
|
|
16
16
|
import { SessionProvider } from 'contexts/SessionContext';
|
|
17
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
18
17
|
import { expectFetchCall } from 'utils/test/expectFetchCall';
|
|
19
18
|
import { expectBreadcrumbsToEqualParts } from 'utils/test/expectBreadcrumbsToEqualParts';
|
|
20
19
|
import { createTestQueryClient } from 'utils/test/createTestQueryClient';
|
|
21
20
|
import { expectBannerError } from 'utils/test/expectBanner';
|
|
22
21
|
import { HttpStatusCode } from 'utils/errors/HttpError';
|
|
23
22
|
|
|
23
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
24
|
+
|
|
24
25
|
jest.mock('utils/context', () => ({
|
|
25
26
|
__esModule: true,
|
|
26
27
|
default: mockRichieContextFactory({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useParams } from 'react-router-dom';
|
|
2
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
3
2
|
import { useDashboardNavigate } from 'widgets/Dashboard/hooks/useDashboardRouter';
|
|
4
3
|
import { useCreditCard } from 'hooks/useCreditCards';
|
|
5
4
|
import { Spinner } from 'components/Spinner';
|
|
6
5
|
import Banner, { BannerType } from 'components/Banner';
|
|
7
6
|
import { useBreadcrumbsPlaceholders } from 'hooks/useBreadcrumbsPlaceholders';
|
|
7
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
8
8
|
import { DashboardEditCreditCard } from './DashboardEditCreditCard';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -16,7 +16,6 @@ import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/fac
|
|
|
16
16
|
import { CreditCardFactory } from 'utils/test/factories/joanie';
|
|
17
17
|
import { SessionProvider } from 'contexts/SessionContext';
|
|
18
18
|
import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest';
|
|
19
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
20
19
|
import { CreditCard } from 'types/Joanie';
|
|
21
20
|
import { confirm } from 'utils/indirection/window';
|
|
22
21
|
import { expectBreadcrumbsToEqualParts } from 'utils/test/expectBreadcrumbsToEqualParts';
|
|
@@ -24,6 +23,8 @@ import { createTestQueryClient } from 'utils/test/createTestQueryClient';
|
|
|
24
23
|
import { expectBannerError } from 'utils/test/expectBanner';
|
|
25
24
|
import { HttpStatusCode } from 'utils/errors/HttpError';
|
|
26
25
|
|
|
26
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
27
|
+
|
|
27
28
|
jest.mock('utils/context', () => ({
|
|
28
29
|
__esModule: true,
|
|
29
30
|
default: mockRichieContextFactory({
|
|
@@ -6,12 +6,13 @@ import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/fac
|
|
|
6
6
|
import { CredentialOrder } from 'types/Joanie';
|
|
7
7
|
import { CredentialOrderFactory, TargetCourseFactory } from 'utils/test/factories/joanie';
|
|
8
8
|
import { mockCourseProductWithOrder } from 'utils/test/mockCourseProductWithOrder';
|
|
9
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
10
9
|
import { createTestQueryClient } from 'utils/test/createTestQueryClient';
|
|
11
10
|
import { SessionProvider } from 'contexts/SessionContext';
|
|
12
11
|
import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest';
|
|
13
12
|
import { expectUrlMatchLocationDisplayed } from 'utils/test/expectUrlMatchLocationDisplayed';
|
|
14
13
|
|
|
14
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
15
|
+
|
|
15
16
|
jest.mock('utils/context', () => ({
|
|
16
17
|
__esModule: true,
|
|
17
18
|
default: mockRichieContextFactory({
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { Outlet, useParams } from 'react-router-dom';
|
|
1
|
+
import { generatePath, Outlet, useParams } from 'react-router-dom';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
getDashboardRouteLabel,
|
|
6
|
-
getDashboardRoutePath,
|
|
7
|
-
} from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
8
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
4
|
+
import { getDashboardRouteLabel } from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
9
5
|
import { DashboardLayout } from 'widgets/Dashboard/components/DashboardLayout';
|
|
10
6
|
import { useOmniscientOrder } from 'hooks/useOrders';
|
|
11
7
|
import { useBreadcrumbsPlaceholders } from 'hooks/useBreadcrumbsPlaceholders';
|
|
@@ -13,6 +9,8 @@ import { CourseLight, Product } from 'types/Joanie';
|
|
|
13
9
|
import { LearnerDashboardSidebar } from 'widgets/Dashboard/components/LearnerDashboardSidebar';
|
|
14
10
|
import { useCourseProduct } from 'hooks/useCourseProducts';
|
|
15
11
|
|
|
12
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
13
|
+
|
|
16
14
|
export const DashboardOrderLayout = () => {
|
|
17
15
|
const params = useParams<{ orderId: string }>();
|
|
18
16
|
const order = useOmniscientOrder(params.orderId);
|
|
@@ -23,13 +21,12 @@ export const DashboardOrderLayout = () => {
|
|
|
23
21
|
});
|
|
24
22
|
const product = courseProduct?.item?.product;
|
|
25
23
|
const intl = useIntl();
|
|
26
|
-
const getRoutePath = getDashboardRoutePath(intl);
|
|
27
24
|
const getRouteLabel = getDashboardRouteLabel(intl);
|
|
28
25
|
|
|
29
26
|
const links = useMemo(
|
|
30
27
|
() => [
|
|
31
28
|
{
|
|
32
|
-
to:
|
|
29
|
+
to: generatePath(LearnerDashboardPaths.ORDER, { orderId: params.orderId! }),
|
|
33
30
|
label: getRouteLabel(LearnerDashboardPaths.ORDER_RUNS),
|
|
34
31
|
},
|
|
35
32
|
],
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DashboardCreditCardsManagement } from 'pages/DashboardCreditCardsManagement';
|
|
2
2
|
import { DashboardAddressesManagement } from 'pages/DashboardAddressesManagement';
|
|
3
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
4
3
|
import { useDashboardNavigate } from 'widgets/Dashboard/hooks/useDashboardRouter';
|
|
5
4
|
|
|
5
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* This component relies on react-router.
|
|
8
9
|
*/
|
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
} from 'utils/test/factories/joanie';
|
|
17
17
|
import { Priority } from 'types';
|
|
18
18
|
import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest';
|
|
19
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
20
19
|
import { expectNoSpinner } from 'utils/test/expectSpinner';
|
|
21
20
|
import { PER_PAGE } from 'settings';
|
|
22
21
|
import { SaleTunnelProps } from 'components/SaleTunnel';
|
|
23
22
|
import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper';
|
|
24
23
|
import { render } from 'utils/test/render';
|
|
25
24
|
import { BaseJoanieAppWrapper } from 'utils/test/wrappers/BaseJoanieAppWrapper';
|
|
25
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
26
26
|
import ProductCertificateFooter from '.';
|
|
27
27
|
|
|
28
28
|
jest.mock('utils/context', () => ({
|
|
@@ -39,7 +39,7 @@ import { HttpStatusCode } from 'utils/errors/HttpError';
|
|
|
39
39
|
import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper';
|
|
40
40
|
import { render } from 'utils/test/render';
|
|
41
41
|
import { BaseJoanieAppWrapper } from 'utils/test/wrappers/BaseJoanieAppWrapper';
|
|
42
|
-
import { LearnerDashboardPaths } from '
|
|
42
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
43
43
|
import { DashboardTest } from '../../DashboardTest';
|
|
44
44
|
import { DashboardItemOrder } from './DashboardItemOrder';
|
|
45
45
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FormattedMessage, useIntl, defineMessages } from 'react-intl';
|
|
2
2
|
import { Button } from '@openfun/cunningham-react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import { generatePath } from 'react-router-dom';
|
|
4
5
|
import { CourseLight, CredentialOrder, Product } from 'types/Joanie';
|
|
5
6
|
import { Icon, IconTypeEnum } from 'components/Icon';
|
|
6
7
|
import { CoursesHelper } from 'utils/CoursesHelper';
|
|
@@ -9,13 +10,12 @@ import { Spinner } from 'components/Spinner';
|
|
|
9
10
|
import { DashboardSubItem } from 'widgets/Dashboard/components/DashboardItem/DashboardSubItem';
|
|
10
11
|
import { DashboardItemCertificate } from 'widgets/Dashboard/components/DashboardItem/Certificate';
|
|
11
12
|
import { RouterButton } from 'widgets/Dashboard/components/RouterButton';
|
|
12
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
13
|
-
import { getDashboardRoutePath } from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
14
13
|
import { useCourseProduct } from 'hooks/useCourseProducts';
|
|
15
14
|
import { OrderHelper } from 'utils/OrderHelper';
|
|
16
15
|
import ContractStatus from 'components/ContractStatus';
|
|
17
16
|
import SignContractButton from 'components/SignContractButton';
|
|
18
17
|
import { AddressView } from 'components/Address';
|
|
18
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
19
19
|
import { DashboardSubItemsList } from '../DashboardSubItemsList';
|
|
20
20
|
import { DashboardItemCourseEnrolling } from '../CourseEnrolling';
|
|
21
21
|
import { DashboardItem } from '../index';
|
|
@@ -138,7 +138,6 @@ export const DashboardItemOrder = ({
|
|
|
138
138
|
});
|
|
139
139
|
const { product } = courseProductRelation || {};
|
|
140
140
|
const needsSignature = OrderHelper.orderNeedsSignature(order, product?.contract_definition);
|
|
141
|
-
const getRoutePath = getDashboardRoutePath(useIntl());
|
|
142
141
|
|
|
143
142
|
return (
|
|
144
143
|
<div className="dashboard-item-order">
|
|
@@ -168,7 +167,7 @@ export const DashboardItemOrder = ({
|
|
|
168
167
|
<RouterButton
|
|
169
168
|
size="small"
|
|
170
169
|
className="dashboard-item__button"
|
|
171
|
-
href={
|
|
170
|
+
href={generatePath(LearnerDashboardPaths.ORDER, { orderId: order.id })}
|
|
172
171
|
data-testid="dashboard-item-order__button"
|
|
173
172
|
>
|
|
174
173
|
{intl.formatMessage(messages.accessCourse)}
|
|
@@ -203,7 +202,7 @@ export const DashboardItemOrder = ({
|
|
|
203
202
|
targetCourse,
|
|
204
203
|
order,
|
|
205
204
|
)}
|
|
206
|
-
notEnrolledUrl={
|
|
205
|
+
notEnrolledUrl={generatePath(LearnerDashboardPaths.ORDER, {
|
|
207
206
|
orderId: order.id,
|
|
208
207
|
})}
|
|
209
208
|
hideEnrollButtons={needsSignature}
|
package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx
CHANGED
|
@@ -11,12 +11,13 @@ import {
|
|
|
11
11
|
TargetCourseFactory,
|
|
12
12
|
} from 'utils/test/factories/joanie';
|
|
13
13
|
import { mockCourseProductWithOrder } from 'utils/test/mockCourseProductWithOrder';
|
|
14
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
15
14
|
import { expectBannerError } from 'utils/test/expectBanner';
|
|
16
15
|
import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper';
|
|
17
16
|
import { render } from 'utils/test/render';
|
|
18
17
|
import { BaseJoanieAppWrapper } from 'utils/test/wrappers/BaseJoanieAppWrapper';
|
|
19
18
|
|
|
19
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
20
|
+
|
|
20
21
|
jest.mock('utils/context', () => ({
|
|
21
22
|
__esModule: true,
|
|
22
23
|
default: mockRichieContextFactory({
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
TargetCourseFactory,
|
|
12
12
|
} from 'utils/test/factories/joanie';
|
|
13
13
|
import { mockCourseProductWithOrder } from 'utils/test/mockCourseProductWithOrder';
|
|
14
|
-
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages';
|
|
15
14
|
import { Deferred } from 'utils/test/deferred';
|
|
16
15
|
import { expectNoSpinner, expectSpinner } from 'utils/test/expectSpinner';
|
|
17
16
|
import { CONTRACT_SETTINGS } from 'settings';
|
|
@@ -19,6 +18,8 @@ import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper';
|
|
|
19
18
|
import { render } from 'utils/test/render';
|
|
20
19
|
import { BaseJoanieAppWrapper } from 'utils/test/wrappers/BaseJoanieAppWrapper';
|
|
21
20
|
|
|
21
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
22
|
+
|
|
22
23
|
jest.mock('utils/context', () => ({
|
|
23
24
|
__esModule: true,
|
|
24
25
|
default: mockRichieContextFactory({
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { defineMessages, useIntl } from 'react-intl';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
getDashboardRouteLabel,
|
|
6
|
-
getDashboardRoutePath,
|
|
7
|
-
} from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
3
|
+
import { generatePath } from 'react-router-dom';
|
|
4
|
+
import { getDashboardRouteLabel } from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
8
5
|
import {
|
|
9
6
|
DashboardSidebar,
|
|
10
7
|
DashboardSidebarProps,
|
|
@@ -12,6 +9,8 @@ import {
|
|
|
12
9
|
import { useSession } from 'contexts/SessionContext';
|
|
13
10
|
import { UserHelper } from 'utils/UserHelper';
|
|
14
11
|
|
|
12
|
+
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
|
|
13
|
+
|
|
15
14
|
const messages = defineMessages({
|
|
16
15
|
header: {
|
|
17
16
|
id: 'components.StudentDashboardSidebar.header',
|
|
@@ -29,7 +28,6 @@ export const LearnerDashboardSidebar = (props: Partial<DashboardSidebarProps>) =
|
|
|
29
28
|
const intl = useIntl();
|
|
30
29
|
const { user } = useSession();
|
|
31
30
|
|
|
32
|
-
const getRoutePath = getDashboardRoutePath(intl);
|
|
33
31
|
const getRouteLabel = getDashboardRouteLabel(intl);
|
|
34
32
|
|
|
35
33
|
const links = useMemo(
|
|
@@ -40,7 +38,7 @@ export const LearnerDashboardSidebar = (props: Partial<DashboardSidebarProps>) =
|
|
|
40
38
|
LearnerDashboardPaths.CONTRACTS,
|
|
41
39
|
LearnerDashboardPaths.PREFERENCES,
|
|
42
40
|
].map((path) => ({
|
|
43
|
-
to:
|
|
41
|
+
to: generatePath(path),
|
|
44
42
|
label: getRouteLabel(path),
|
|
45
43
|
})),
|
|
46
44
|
[],
|
|
@@ -3,11 +3,6 @@ import { screen } from '@testing-library/react';
|
|
|
3
3
|
import { createIntl } from 'react-intl';
|
|
4
4
|
import { CourseListItem } from 'types/Joanie';
|
|
5
5
|
import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie';
|
|
6
|
-
import {
|
|
7
|
-
TEACHER_DASHBOARD_ROUTE_LABELS,
|
|
8
|
-
TeacherDashboardPaths,
|
|
9
|
-
} from 'widgets/Dashboard/utils/teacherRouteMessages';
|
|
10
|
-
|
|
11
6
|
import {
|
|
12
7
|
CourseFactory,
|
|
13
8
|
CourseProductRelationFactory,
|
|
@@ -16,6 +11,10 @@ import {
|
|
|
16
11
|
import { expectNoSpinner } from 'utils/test/expectSpinner';
|
|
17
12
|
import { render } from 'utils/test/render';
|
|
18
13
|
import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper';
|
|
14
|
+
import {
|
|
15
|
+
TEACHER_DASHBOARD_ROUTE_LABELS,
|
|
16
|
+
TeacherDashboardPaths,
|
|
17
|
+
} from 'widgets/Dashboard/utils/teacherDashboardPaths';
|
|
19
18
|
import { TeacherDashboardCourseSidebar, messages } from '.';
|
|
20
19
|
|
|
21
20
|
jest.mock('utils/context', () => ({
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
|
2
|
-
import { useParams } from 'react-router-dom';
|
|
2
|
+
import { generatePath, useParams } from 'react-router-dom';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import { capitalize } from 'lodash-es';
|
|
5
5
|
import { DashboardSidebar, MenuLink } from 'widgets/Dashboard/components/DashboardSidebar';
|
|
6
|
-
import {
|
|
7
|
-
getDashboardRouteLabel,
|
|
8
|
-
getDashboardRoutePath,
|
|
9
|
-
} from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
6
|
+
import { getDashboardRouteLabel } from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
10
7
|
import { useCourse } from 'hooks/useCourses';
|
|
11
8
|
import { Spinner } from 'components/Spinner';
|
|
12
9
|
import { Icon, IconTypeEnum } from 'components/Icon';
|
|
13
10
|
import { useCourseProductRelation } from 'hooks/useCourseProductRelation';
|
|
14
|
-
import { TeacherDashboardPaths } from 'widgets/Dashboard/utils/
|
|
11
|
+
import { TeacherDashboardPaths } from 'widgets/Dashboard/utils/teacherDashboardPaths';
|
|
15
12
|
import ContractNavLink from '../DashboardSidebar/components/ContractNavLink';
|
|
16
13
|
import { getMenuRoutes } from './utils';
|
|
17
14
|
|
|
@@ -40,7 +37,6 @@ export const messages = defineMessages({
|
|
|
40
37
|
|
|
41
38
|
export const TeacherDashboardCourseSidebar = () => {
|
|
42
39
|
const intl = useIntl();
|
|
43
|
-
const getRoutePath = getDashboardRoutePath(intl);
|
|
44
40
|
const getRouteLabel = getDashboardRouteLabel(intl);
|
|
45
41
|
const {
|
|
46
42
|
organizationId: routeOrganizationId,
|
|
@@ -86,12 +82,11 @@ export const TeacherDashboardCourseSidebar = () => {
|
|
|
86
82
|
);
|
|
87
83
|
|
|
88
84
|
const getMenuLinkFromPath = (basePath: TeacherDashboardPaths) => {
|
|
89
|
-
const path =
|
|
90
|
-
organizationId: routeOrganizationId,
|
|
91
|
-
courseId: routeCourseId,
|
|
92
|
-
courseProductRelationId: routeCourseProductRelationId,
|
|
85
|
+
const path = generatePath(basePath, {
|
|
86
|
+
organizationId: routeOrganizationId ?? '',
|
|
87
|
+
courseId: routeCourseId ?? '',
|
|
88
|
+
courseProductRelationId: routeCourseProductRelationId ?? '',
|
|
93
89
|
});
|
|
94
|
-
|
|
95
90
|
const menuLink: MenuLink = {
|
|
96
91
|
to: path,
|
|
97
92
|
label: getRouteLabel(basePath),
|
|
@@ -114,7 +109,6 @@ export const TeacherDashboardCourseSidebar = () => {
|
|
|
114
109
|
|
|
115
110
|
return menuLink;
|
|
116
111
|
};
|
|
117
|
-
|
|
118
112
|
const menuLinkList = useMemo(
|
|
119
113
|
() =>
|
|
120
114
|
getMenuRoutes({
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
2
|
-
import { useParams } from 'react-router-dom';
|
|
2
|
+
import { generatePath, useParams } from 'react-router-dom';
|
|
3
3
|
import { Spinner } from 'components/Spinner';
|
|
4
4
|
import { useOrganization } from 'hooks/useOrganizations';
|
|
5
5
|
import { DashboardSidebar, MenuLink } from 'widgets/Dashboard/components/DashboardSidebar';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
getDashboardRoutePath,
|
|
9
|
-
} from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
10
|
-
import { TeacherDashboardPaths } from 'widgets/Dashboard/utils/teacherRouteMessages';
|
|
6
|
+
import { getDashboardRouteLabel } from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
7
|
+
import { TeacherDashboardPaths } from 'widgets/Dashboard/utils/teacherDashboardPaths';
|
|
11
8
|
import { DashboardAvatar, DashboardAvatarVariantEnum } from '../DashboardAvatar';
|
|
12
9
|
import ContractNavLink from '../DashboardSidebar/components/ContractNavLink';
|
|
13
10
|
|
|
@@ -26,7 +23,6 @@ const messages = defineMessages({
|
|
|
26
23
|
|
|
27
24
|
export const TeacherDashboardOrganizationSidebar = () => {
|
|
28
25
|
const intl = useIntl();
|
|
29
|
-
const getRoutePath = getDashboardRoutePath(intl);
|
|
30
26
|
const getRouteLabel = getDashboardRouteLabel(intl);
|
|
31
27
|
const { organizationId, courseProductRelationId } = useParams<{
|
|
32
28
|
organizationId: string;
|
|
@@ -38,7 +34,7 @@ export const TeacherDashboardOrganizationSidebar = () => {
|
|
|
38
34
|
} = useOrganization(organizationId);
|
|
39
35
|
|
|
40
36
|
const getMenuLinkFromPath = (basePath: TeacherDashboardPaths) => {
|
|
41
|
-
const path =
|
|
37
|
+
const path = generatePath(basePath, { organizationId } as any);
|
|
42
38
|
|
|
43
39
|
const menuLink: MenuLink = {
|
|
44
40
|
to: path,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
2
|
-
import { Link } from 'react-router-dom';
|
|
2
|
+
import { generatePath, Link } from 'react-router-dom';
|
|
3
3
|
import { Organization } from 'types/Joanie';
|
|
4
|
-
import { getDashboardRoutePath } from 'widgets/Dashboard/utils/dashboardRoutes';
|
|
5
|
-
import { TeacherDashboardPaths } from 'widgets/Dashboard/utils/teacherRouteMessages';
|
|
6
4
|
import { StringHelper } from 'utils/StringHelper';
|
|
7
5
|
|
|
6
|
+
import { TeacherDashboardPaths } from 'widgets/Dashboard/utils/teacherDashboardPaths';
|
|
7
|
+
|
|
8
8
|
export const messages = defineMessages({
|
|
9
9
|
organizationsTitle: {
|
|
10
10
|
id: 'components.TeacherDashboardProfileSidebar.OrganizationLinks.organizationsTitle',
|
|
@@ -33,7 +33,7 @@ const OrganizationLinks = ({ organizations }: OrganizationLinksProps) => {
|
|
|
33
33
|
{organizations.map((organization) => (
|
|
34
34
|
<Link
|
|
35
35
|
key={organization.id}
|
|
36
|
-
to={
|
|
36
|
+
to={generatePath(TeacherDashboardPaths.ORGANIZATION_COURSES, {
|
|
37
37
|
organizationId: organization.id,
|
|
38
38
|
})}
|
|
39
39
|
className="dashboard-sidebar__organization-section__link"
|