richie-education 3.3.2-dev16 → 3.3.2-dev25
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/.eslintrc.json +0 -3
- package/.storybook/preview.tsx +49 -24
- package/cunningham.cjs +1 -0
- package/i18n/compile-translations.js +12 -10
- package/i18n/locales/ar-SA.json +20 -0
- package/i18n/locales/es-ES.json +20 -0
- package/i18n/locales/fa-IR.json +20 -0
- package/i18n/locales/fr-CA.json +20 -0
- package/i18n/locales/fr-FR.json +21 -1
- package/i18n/locales/ko-KR.json +20 -0
- package/i18n/locales/pt-PT.json +42 -22
- package/i18n/locales/ru-RU.json +20 -0
- package/i18n/locales/vi-VN.json +20 -0
- package/jest.config.js +5 -0
- package/js/components/AddressesManagement/AddressForm/index.stories.tsx +1 -1
- package/js/components/AddressesManagement/AddressForm/index.tsx +4 -3
- package/js/components/AddressesManagement/index.stories.tsx +1 -1
- package/js/components/AddressesManagement/index.tsx +5 -3
- package/js/components/Badge/index.stories.tsx +1 -1
- package/js/components/Badge/index.tsx +1 -1
- package/js/components/Banner/index.stories.tsx +1 -1
- package/js/components/CourseGlimpse/index.stories.tsx +1 -1
- package/js/components/CourseGlimpseList/index.stories.tsx +1 -1
- package/js/components/CreditCardSelector/index.tsx +11 -3
- package/js/components/DownloadCertificateButton/index.tsx +2 -1
- package/js/components/DownloadContractButton/index.tsx +7 -1
- package/js/components/Form/Form/index.tsx +4 -2
- package/js/components/Icon/index.stories.tsx +2 -1
- package/js/components/Modal/index.stories.tsx +1 -1
- package/js/components/Modal/index.tsx +2 -1
- package/js/components/OpenEdxFullNameForm/index.stories.tsx +1 -1
- package/js/components/OpenEdxFullNameForm/index.tsx +2 -2
- package/js/components/PurchaseButton/index.stories.tsx +1 -1
- package/js/components/RegisteredAddress/index.stories.tsx +1 -1
- package/js/components/RegisteredAddress/index.tsx +4 -2
- package/js/components/SaleTunnel/AddressSelector/CreateAddressFormModal.tsx +1 -1
- package/js/components/SaleTunnel/AddressSelector/EditAddressFormModal.tsx +1 -1
- package/js/components/SaleTunnel/AddressSelector/index.tsx +4 -2
- package/js/components/SaleTunnel/SaleTunnelInformation/SaleTunnelInformationGroup.tsx +4 -3
- package/js/components/SaleTunnel/SaleTunnelInformation/SaleTunnelInformationSingular.tsx +8 -2
- package/js/components/SaleTunnel/index.stories.tsx +1 -1
- package/js/components/Spinner/index.stories.tsx +1 -1
- package/js/components/Tabs/index.stories.tsx +1 -1
- package/js/components/Tabs/index.tsx +2 -1
- package/js/components/TeacherDashboardCourseList/index.tsx +2 -1
- package/js/hooks/useAddressesManagement.tsx +4 -2
- package/js/hooks/useCreditCards/index.ts +6 -4
- package/js/hooks/useDashboardAddressForm.tsx +3 -3
- package/js/hooks/useMatchMedia.ts +1 -1
- package/js/hooks/useResources/useResourcesRoot.ts +1 -1
- package/js/hooks/useUnionResource/index.ts +6 -2
- package/js/hooks/useUnionResource/utils/fetchEntity.ts +1 -0
- package/js/pages/DashboardAddressesManagement/DashboardAddressBox.tsx +3 -3
- package/js/pages/DashboardAddressesManagement/DashboardCreateAddress.stories.tsx +1 -1
- package/js/pages/DashboardAddressesManagement/DashboardCreateAddress.tsx +1 -1
- package/js/pages/DashboardAddressesManagement/DashboardEditAddress.stories.tsx +1 -1
- package/js/pages/DashboardAddressesManagement/DashboardEditAddress.tsx +3 -2
- package/js/pages/DashboardAddressesManagement/index.stories.tsx +1 -1
- package/js/pages/DashboardAddressesManagement/index.tsx +1 -1
- package/js/pages/DashboardCourses/index.tsx +2 -1
- package/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.stories.tsx +1 -1
- package/js/pages/DashboardCreditCardsManagement/DashboardCreditCardBox.tsx +3 -3
- package/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.stories.tsx +1 -1
- package/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.tsx +3 -2
- package/js/pages/DashboardCreditCardsManagement/index.stories.tsx +1 -1
- package/js/pages/DashboardOpenEdxProfile/index.stories.tsx +1 -1
- package/js/pages/TeacherDashboardContractsLayout/components/BulkDownloadContractButton/index.tsx +4 -2
- package/js/pages/TeacherDashboardContractsLayout/components/SignOrganizationContractButton/index.tsx +2 -1
- package/js/pages/TeacherDashboardContractsLayout/hooks/useCheckContractArchiveExists/index.spec.tsx +4 -4
- package/js/pages/TeacherDashboardContractsLayout/hooks/useDownloadContractArchive/index.spec.tsx +8 -9
- package/js/pages/TeacherDashboardContractsLayout/hooks/useDownloadContractArchive/index.tsx +14 -3
- package/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.tsx +6 -1
- package/js/pages/TeacherDashboardCourseLoader/CourseRunList/utils.tsx +2 -1
- package/js/pages/TeacherDashboardOrganizationAgreements/BulkAgreementContractButton.tsx +4 -2
- package/js/pages/TeacherDashboardOrganizationAgreements/SignOrganizationAgreementButton.tsx +2 -1
- package/js/pages/TeacherDashboardOrganizationQuotes/index.tsx +2 -1
- package/js/translations/ar-SA.json +1 -1
- package/js/translations/es-ES.json +1 -1
- package/js/translations/fa-IR.json +1 -1
- package/js/translations/fr-CA.json +1 -1
- package/js/translations/fr-FR.json +1 -1
- package/js/translations/ko-KR.json +1 -1
- package/js/translations/pt-PT.json +1 -1
- package/js/translations/ru-RU.json +1 -1
- package/js/translations/vi-VN.json +1 -1
- package/js/utils/ProductHelper/index.spec.ts +1 -1
- package/js/utils/StorybookHelper/index.tsx +3 -6
- package/js/utils/cunningham-tokens.ts +1111 -142
- package/js/utils/errors/handle.spec.ts +3 -3
- package/js/utils/react-query/useSessionMutation/index.ts +8 -3
- package/js/widgets/Dashboard/components/DashboardAvatar/index.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardBox/index.stories.tsx +13 -5
- package/js/widgets/Dashboard/components/DashboardBreadcrumbs/index.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardBreadcrumbs/index.tsx +3 -2
- package/js/widgets/Dashboard/components/DashboardCard/index.spec.tsx +13 -2
- package/js/widgets/Dashboard/components/DashboardCard/index.stories.tsx +12 -4
- package/js/widgets/Dashboard/components/DashboardCard/index.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/BatchOrder/BatchOrderPaymentModal/BatchOrderPaymentManager.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/BatchOrder/BatchOrderPaymentModal/index.tsx +2 -1
- package/js/widgets/Dashboard/components/DashboardItem/Certificate/index.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/Contract/index.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.tsx +8 -4
- package/js/widgets/Dashboard/components/DashboardItem/Enrollment/DashboardItemEnrollment.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderReadonly.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderWritable.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/Order/Installment/index.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/Order/OrderPaymentRetryModal/index.tsx +2 -1
- package/js/widgets/Dashboard/components/DashboardItem/Order/OrganizationBlock/index.tsx +6 -3
- package/js/widgets/Dashboard/components/DashboardItem/index.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardItem/index.tsx +2 -1
- package/js/widgets/Dashboard/components/DashboardListAvatar/index.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/DashboardSidebar/index.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/LearnerDashboardSidebar/index.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/ProtectedOutlet/AuthenticatedOutlet.spec.tsx +1 -1
- package/js/widgets/Dashboard/components/ProtectedOutlet/ProtectedOutlet.spec.tsx +1 -1
- package/js/widgets/Dashboard/components/SearchBar/index.tsx +2 -1
- package/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx +1 -1
- package/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.stories.tsx +1 -1
- package/js/widgets/Dashboard/index.spec.tsx +1 -1
- package/js/widgets/Search/components/SearchFilterValueParent/index.stories.tsx +1 -1
- package/js/widgets/Search/components/SearchFiltersPane/index.tsx +2 -1
- package/js/widgets/Slider/index.stories.tsx +1 -1
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.stories.tsx +1 -1
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.stories.tsx +1 -1
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx +1 -1
- package/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.tsx +4 -2
- package/js/widgets/SyllabusCourseRunsList/components/SyllabusCourseRun/index.stories.tsx +1 -1
- package/js/widgets/SyllabusCourseRunsList/components/SyllabusCourseRunCompacted/index.stories.tsx +41 -0
- package/js/widgets/UserLogin/index.stories.tsx +1 -1
- package/package.json +75 -75
- package/scss/vendors/css/cunningham-tokens.css +1259 -154
- package/scss/vendors/cunningham-tokens.scss +1479 -150
- package/tsconfig.json +1 -1
- package/webpack.config.js +6 -0
|
@@ -19,12 +19,12 @@ jest.mock('@sentry/browser', () => ({
|
|
|
19
19
|
|
|
20
20
|
describe('handle', () => {
|
|
21
21
|
it('should initialize sentry', () => {
|
|
22
|
-
expect(Sentry.init).
|
|
23
|
-
expect(Sentry.setTag).
|
|
22
|
+
expect(Sentry.init).toHaveBeenCalledTimes(1);
|
|
23
|
+
expect(Sentry.setTag).toHaveBeenCalledTimes(1);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it('should report error to sentry', () => {
|
|
27
27
|
handle(new Error('An error for test'));
|
|
28
|
-
expect(Sentry.captureException).
|
|
28
|
+
expect(Sentry.captureException).toHaveBeenCalledTimes(1);
|
|
29
29
|
});
|
|
30
30
|
});
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
MutationFunctionContext,
|
|
3
|
+
UseMutationOptions,
|
|
4
|
+
UseMutationResult,
|
|
5
|
+
} from '@tanstack/react-query';
|
|
2
6
|
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
3
7
|
import { HttpError, HttpStatusCode } from 'utils/errors/HttpError';
|
|
4
8
|
|
|
@@ -18,13 +22,14 @@ export function useSessionMutation<TData = unknown, TVariables = void, TContext
|
|
|
18
22
|
error: HttpError,
|
|
19
23
|
variables: TVariables,
|
|
20
24
|
context: TContext | undefined,
|
|
25
|
+
mutationContext: MutationFunctionContext,
|
|
21
26
|
) => {
|
|
22
|
-
if (error.code === HttpStatusCode.UNAUTHORIZED) {
|
|
27
|
+
if (error && error.code === HttpStatusCode.UNAUTHORIZED) {
|
|
23
28
|
await queryClient.invalidateQueries({ queryKey: ['user'], exact: true });
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
if (options?.onError) {
|
|
27
|
-
return options.onError(error, variables, context);
|
|
32
|
+
return options.onError(error, variables, context, mutationContext);
|
|
28
33
|
}
|
|
29
34
|
};
|
|
30
35
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { UserFactory } from 'utils/test/factories/richie';
|
|
3
3
|
import { OrganizationFactory } from 'utils/test/factories/joanie';
|
|
4
4
|
import { DashboardAvatar, DashboardAvatarVariantEnum } from '.';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { Button } from '@openfun/cunningham-react';
|
|
3
3
|
import { DashboardBox } from './index';
|
|
4
4
|
|
|
@@ -25,8 +25,12 @@ export const Default: Story = {
|
|
|
25
25
|
),
|
|
26
26
|
footer: (
|
|
27
27
|
<>
|
|
28
|
-
<Button color="primary">
|
|
29
|
-
|
|
28
|
+
<Button color="brand" variant="primary">
|
|
29
|
+
Delete
|
|
30
|
+
</Button>
|
|
31
|
+
<Button color="brand" variant="primary">
|
|
32
|
+
Update
|
|
33
|
+
</Button>
|
|
30
34
|
</>
|
|
31
35
|
),
|
|
32
36
|
},
|
|
@@ -43,8 +47,12 @@ export const NoHeader: Story = {
|
|
|
43
47
|
),
|
|
44
48
|
footer: (
|
|
45
49
|
<>
|
|
46
|
-
<Button color="primary">
|
|
47
|
-
|
|
50
|
+
<Button color="brand" variant="primary">
|
|
51
|
+
Delete
|
|
52
|
+
</Button>
|
|
53
|
+
<Button color="brand" variant="primary">
|
|
54
|
+
Update
|
|
55
|
+
</Button>
|
|
48
56
|
</>
|
|
49
57
|
),
|
|
50
58
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { createMemoryRouter, Outlet, RouteObject, RouterProvider } from 'react-router';
|
|
3
3
|
import { defineMessages } from 'react-intl';
|
|
4
4
|
import { DashboardBreadcrumbsProvider } from 'widgets/Dashboard/contexts/DashboardBreadcrumbsContext';
|
|
@@ -60,7 +60,8 @@ export const DashboardBreadcrumbs = () => {
|
|
|
60
60
|
<RouterButton
|
|
61
61
|
href={backPath}
|
|
62
62
|
size="nano"
|
|
63
|
-
color="
|
|
63
|
+
color="brand"
|
|
64
|
+
variant="tertiary"
|
|
64
65
|
icon={<span className="material-icons">chevron_left</span>}
|
|
65
66
|
>
|
|
66
67
|
<FormattedMessage {...messages.back} />
|
|
@@ -69,7 +70,7 @@ export const DashboardBreadcrumbs = () => {
|
|
|
69
70
|
|
|
70
71
|
{breadcrumbs.map((breadcrumb) => (
|
|
71
72
|
<li key={breadcrumb.pathname}>
|
|
72
|
-
<RouterButton href={breadcrumb.pathname} size="nano" color="tertiary
|
|
73
|
+
<RouterButton href={breadcrumb.pathname} size="nano" color="brand" variant="tertiary">
|
|
73
74
|
{breadcrumb.name}
|
|
74
75
|
</RouterButton>
|
|
75
76
|
</li>
|
|
@@ -5,7 +5,14 @@ import { DashboardCard } from '.';
|
|
|
5
5
|
describe('<DashboardCard/>', () => {
|
|
6
6
|
it('opens and closes', async () => {
|
|
7
7
|
render(
|
|
8
|
-
<DashboardCard
|
|
8
|
+
<DashboardCard
|
|
9
|
+
header="My header"
|
|
10
|
+
footer={
|
|
11
|
+
<Button color="brand" variant="primary">
|
|
12
|
+
Update
|
|
13
|
+
</Button>
|
|
14
|
+
}
|
|
15
|
+
>
|
|
9
16
|
Content here
|
|
10
17
|
</DashboardCard>,
|
|
11
18
|
);
|
|
@@ -23,7 +30,11 @@ describe('<DashboardCard/>', () => {
|
|
|
23
30
|
<DashboardCard
|
|
24
31
|
defaultExpanded={false}
|
|
25
32
|
header="My header"
|
|
26
|
-
footer={
|
|
33
|
+
footer={
|
|
34
|
+
<Button color="brand" variant="primary">
|
|
35
|
+
Update
|
|
36
|
+
</Button>
|
|
37
|
+
}
|
|
27
38
|
>
|
|
28
39
|
Content here
|
|
29
40
|
</DashboardCard>,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { Button } from '@openfun/cunningham-react';
|
|
3
3
|
import { DashboardBox } from '../DashboardBox';
|
|
4
4
|
import { DashboardCard } from './index';
|
|
@@ -26,7 +26,11 @@ export const Default: Story = {
|
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
28
|
),
|
|
29
|
-
footer:
|
|
29
|
+
footer: (
|
|
30
|
+
<Button color="brand" variant="primary">
|
|
31
|
+
Update
|
|
32
|
+
</Button>
|
|
33
|
+
),
|
|
30
34
|
},
|
|
31
35
|
};
|
|
32
36
|
|
|
@@ -39,8 +43,12 @@ export const WithBoxes: Story = {
|
|
|
39
43
|
header={<>Address used by default</>}
|
|
40
44
|
footer={
|
|
41
45
|
<>
|
|
42
|
-
<Button color="primary">
|
|
43
|
-
|
|
46
|
+
<Button color="brand" variant="primary">
|
|
47
|
+
Remove
|
|
48
|
+
</Button>
|
|
49
|
+
<Button color="brand" variant="primary">
|
|
50
|
+
Edit
|
|
51
|
+
</Button>
|
|
44
52
|
</>
|
|
45
53
|
}
|
|
46
54
|
>
|
|
@@ -64,7 +64,7 @@ export const DashboardCard = ({
|
|
|
64
64
|
<header className="dashboard-card__header">
|
|
65
65
|
<div>{header}</div>
|
|
66
66
|
{expandable && (
|
|
67
|
-
<Button onClick={toggle} color="tertiary" size="small">
|
|
67
|
+
<Button onClick={toggle} color="brand" variant="tertiary" size="small">
|
|
68
68
|
<Icon
|
|
69
69
|
name={IconTypeEnum.CHEVRON_DOWN_OUTLINE}
|
|
70
70
|
data-testid="dashboard-card__header__toggle"
|
|
@@ -48,7 +48,7 @@ export const BatchOrderPaymentManager = ({ batchOrder }: BatchPaymentManagerProp
|
|
|
48
48
|
footer={
|
|
49
49
|
<div className="content">
|
|
50
50
|
<FormattedMessage {...messages.batchOrderPayment} />
|
|
51
|
-
<Button size="small" color="primary" onClick={retryModal.open}>
|
|
51
|
+
<Button size="small" color="brand" variant="primary" onClick={retryModal.open}>
|
|
52
52
|
<FormattedMessage
|
|
53
53
|
{...messages.paymentNeededButton}
|
|
54
54
|
values={{
|
package/js/widgets/Dashboard/components/DashboardItem/BatchOrder/BatchOrderPaymentModal/index.tsx
CHANGED
|
@@ -172,7 +172,8 @@ export const BatchOrderPaymentModal = ({ batchOrder, ...props }: Props) => {
|
|
|
172
172
|
hideCloseButton={state === ComponentStates.LOADING}
|
|
173
173
|
actions={
|
|
174
174
|
<Button
|
|
175
|
-
color="
|
|
175
|
+
color="brand"
|
|
176
|
+
variant="primary"
|
|
176
177
|
size="small"
|
|
177
178
|
fullWidth={true}
|
|
178
179
|
onClick={pay}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { DashboardItemCertificate } from 'widgets/Dashboard/components/DashboardItem/Certificate/index';
|
|
3
3
|
import { StorybookHelper } from 'utils/StorybookHelper';
|
|
4
4
|
import { Certificate } from 'types/Joanie';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { DashboardItemContract } from 'widgets/Dashboard/components/DashboardItem/Contract/index';
|
|
3
3
|
import { StorybookHelper } from 'utils/StorybookHelper';
|
|
4
4
|
import { Contract, NestedCredentialOrder } from 'types/Joanie';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { createMemoryRouter, RouterProvider } from 'react-router';
|
|
3
3
|
import { faker } from '@faker-js/faker';
|
|
4
4
|
import { TargetCourseFactory } from 'utils/test/factories/joanie';
|
|
@@ -243,7 +243,8 @@ export const DashboardItemCourseEnrollingRun = ({
|
|
|
243
243
|
SHOW_ACCESS_COURSE_PRIORITIES.includes(courseRun.state.priority) && (
|
|
244
244
|
<div>
|
|
245
245
|
<Button
|
|
246
|
-
color="
|
|
246
|
+
color="brand"
|
|
247
|
+
variant="secondary"
|
|
247
248
|
size="small"
|
|
248
249
|
href={courseRun.resource_link}
|
|
249
250
|
data-testid="dashboard-item-enrollment__button"
|
|
@@ -257,7 +258,8 @@ export const DashboardItemCourseEnrollingRun = ({
|
|
|
257
258
|
<div>
|
|
258
259
|
<Button
|
|
259
260
|
disabled={!isOpenedForEnrollment || !canEnroll}
|
|
260
|
-
color="
|
|
261
|
+
color="brand"
|
|
262
|
+
variant="tertiary"
|
|
261
263
|
size="small"
|
|
262
264
|
onClick={enroll}
|
|
263
265
|
title={!canEnroll ? intl.formatMessage(messages.cannotEnroll) : ''}
|
|
@@ -287,7 +289,8 @@ const NotEnrolled = ({
|
|
|
287
289
|
</div>
|
|
288
290
|
{!hideEnrollButtons && (
|
|
289
291
|
<RouterButton
|
|
290
|
-
color="
|
|
292
|
+
color="brand"
|
|
293
|
+
variant="secondary"
|
|
291
294
|
size="small"
|
|
292
295
|
href={notEnrolledUrl}
|
|
293
296
|
data-testid="dashboard-item-enrollment__button"
|
|
@@ -327,7 +330,8 @@ export const Enrolled = ({
|
|
|
327
330
|
</div>
|
|
328
331
|
{SHOW_ACCESS_COURSE_PRIORITIES.includes(enrollment.course_run.state.priority) && (
|
|
329
332
|
<Button
|
|
330
|
-
color="
|
|
333
|
+
color="brand"
|
|
334
|
+
variant="secondary"
|
|
331
335
|
size="small"
|
|
332
336
|
href={enrollment.course_run.resource_link}
|
|
333
337
|
data-testid="dashboard-item-enrollment__button"
|
package/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.tsx
CHANGED
|
@@ -210,7 +210,7 @@ const FailedInstallmentManager = ({ order, updateOrder }: FailedInstallmentManag
|
|
|
210
210
|
return (
|
|
211
211
|
<>
|
|
212
212
|
<div className="dashboard-splitted-card__item__actions">
|
|
213
|
-
<Button size="small" color="primary" onClick={installmentRetryModal.open}>
|
|
213
|
+
<Button size="small" color="brand" variant="primary" onClick={installmentRetryModal.open}>
|
|
214
214
|
<FormattedMessage
|
|
215
215
|
{...messages.paymentNeededButton}
|
|
216
216
|
values={{
|
package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderReadonly.stories.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { createMemoryRouter, RouterProvider } from 'react-router';
|
|
3
3
|
import { CredentialOrder, OrderState, Product, TargetCourse } from 'types/Joanie';
|
|
4
4
|
import {
|
package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderWritable.stories.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { CredentialOrder, OrderState, Product, TargetCourse } from 'types/Joanie';
|
|
3
3
|
import { QueryStateFactory } from 'utils/test/factories/reactQuery';
|
|
4
4
|
import {
|
|
@@ -162,7 +162,7 @@ const InstallmentManager = ({ order }: Props) => {
|
|
|
162
162
|
<FormattedMessage {...messages.paymentLabel} />
|
|
163
163
|
</div>
|
|
164
164
|
<div className="dashboard-splitted-card__item__actions">
|
|
165
|
-
<Button size="small" color="secondary" onClick={modal.open}>
|
|
165
|
+
<Button size="small" color="brand" variant="secondary" onClick={modal.open}>
|
|
166
166
|
<FormattedMessage {...messages.paymentButton} />
|
|
167
167
|
</Button>
|
|
168
168
|
</div>
|
package/js/widgets/Dashboard/components/DashboardItem/Order/OrderPaymentRetryModal/index.tsx
CHANGED
|
@@ -166,7 +166,8 @@ export const OrderPaymentRetryModal = ({ installment, order, ...props }: Props)
|
|
|
166
166
|
hideCloseButton={state === ComponentStates.LOADING}
|
|
167
167
|
actions={
|
|
168
168
|
<Button
|
|
169
|
-
color="
|
|
169
|
+
color="brand"
|
|
170
|
+
variant="primary"
|
|
170
171
|
size="small"
|
|
171
172
|
fullWidth={true}
|
|
172
173
|
onClick={pay}
|
|
@@ -100,7 +100,8 @@ const OrganizationBlock = ({ order, product }: Props) => {
|
|
|
100
100
|
<FormattedMessage {...messages.organizationMailContactLabel} />
|
|
101
101
|
<Button
|
|
102
102
|
size="small"
|
|
103
|
-
color="
|
|
103
|
+
color="brand"
|
|
104
|
+
variant="tertiary"
|
|
104
105
|
href={'mailto:' + (organization.contact_email ?? '')}
|
|
105
106
|
>
|
|
106
107
|
{organization.contact_email}
|
|
@@ -112,7 +113,8 @@ const OrganizationBlock = ({ order, product }: Props) => {
|
|
|
112
113
|
<FormattedMessage {...messages.organizationPhoneContactLabel} />
|
|
113
114
|
<Button
|
|
114
115
|
size="small"
|
|
115
|
-
color="
|
|
116
|
+
color="brand"
|
|
117
|
+
variant="tertiary"
|
|
116
118
|
href={'tel:' + (organization.contact_phone ?? '')}
|
|
117
119
|
>
|
|
118
120
|
{organization.contact_phone}
|
|
@@ -124,7 +126,8 @@ const OrganizationBlock = ({ order, product }: Props) => {
|
|
|
124
126
|
<FormattedMessage {...messages.organizationDpoContactLabel} />
|
|
125
127
|
<Button
|
|
126
128
|
size="small"
|
|
127
|
-
color="
|
|
129
|
+
color="brand"
|
|
130
|
+
variant="tertiary"
|
|
128
131
|
href={'mailto:' + (organization.dpo_email ?? '')}
|
|
129
132
|
>
|
|
130
133
|
{organization.dpo_email}
|
|
@@ -92,7 +92,8 @@ const DashboardItemMore = ({ more }: { more: ReactNode }) => {
|
|
|
92
92
|
<div className="selector dashboard-item__block__head__more">
|
|
93
93
|
<Button
|
|
94
94
|
icon={<Icon name={IconTypeEnum.MORE} />}
|
|
95
|
-
color="
|
|
95
|
+
color="brand"
|
|
96
|
+
variant="tertiary"
|
|
96
97
|
size="small"
|
|
97
98
|
aria-label={intl.formatMessage(messages.moreLabel)}
|
|
98
99
|
{...getToggleButtonProps()}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { createMemoryRouter, RouterProvider } from 'react-router';
|
|
3
3
|
import { UserFactory } from 'utils/test/factories/richie';
|
|
4
4
|
import { StorybookHelper } from 'utils/StorybookHelper';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { createMemoryRouter, RouterProvider } from 'react-router';
|
|
3
3
|
import { UserFactory } from 'utils/test/factories/richie';
|
|
4
4
|
import { LearnerDashboardSidebar } from 'widgets/Dashboard/components/LearnerDashboardSidebar';
|
|
@@ -47,7 +47,7 @@ describe('<AuthenticatedOutlet />', () => {
|
|
|
47
47
|
await screen.findByTestId('route-restricted');
|
|
48
48
|
|
|
49
49
|
// location.replace should not have been called
|
|
50
|
-
expect(location.replace).not.
|
|
50
|
+
expect(location.replace).not.toHaveBeenCalled();
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
it('should redirect to provided path if user is anonymous', () => {
|
|
@@ -39,7 +39,7 @@ describe('<ProtectedOutlet />', () => {
|
|
|
39
39
|
screen.getByTestId('route-restricted');
|
|
40
40
|
|
|
41
41
|
// location.replace should not have been called
|
|
42
|
-
expect(location.replace).not.
|
|
42
|
+
expect(location.replace).not.toHaveBeenCalled();
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
it('should redirect to provided path if isAllowed is false', () => {
|
|
@@ -59,7 +59,8 @@ const SearchBar = ({ onSubmit }: SearchBarProps) => {
|
|
|
59
59
|
className="dashboard-search-bar__input"
|
|
60
60
|
type="button"
|
|
61
61
|
size="small"
|
|
62
|
-
color="
|
|
62
|
+
color="brand"
|
|
63
|
+
variant="tertiary"
|
|
63
64
|
icon={<span className="material-icons">close</span>}
|
|
64
65
|
onClick={clear}
|
|
65
66
|
aria-label={intl.formatMessage(messages.clearSearchButtonLabel)}
|
package/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { createMemoryRouter, RouterProvider } from 'react-router';
|
|
3
3
|
import fetchMock from 'fetch-mock';
|
|
4
4
|
import { UserFactory } from 'utils/test/factories/richie';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { createMemoryRouter, RouterProvider } from 'react-router';
|
|
3
3
|
import { UserFactory } from 'utils/test/factories/richie';
|
|
4
4
|
import { TeacherDashboardProfileSidebar } from 'widgets/Dashboard/components/TeacherDashboardProfileSidebar';
|
|
@@ -82,7 +82,7 @@ describe('<Dashboard />', () => {
|
|
|
82
82
|
|
|
83
83
|
await expectNoSpinner('Loading orders and enrollments...');
|
|
84
84
|
|
|
85
|
-
expect(location.replace).not.
|
|
85
|
+
expect(location.replace).not.toHaveBeenCalled();
|
|
86
86
|
expectUrlMatchLocationDisplayed(LearnerDashboardPaths.COURSES);
|
|
87
87
|
});
|
|
88
88
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { StorybookHelper } from 'utils/StorybookHelper';
|
|
3
3
|
import { HistoryProvider } from 'hooks/useHistory';
|
|
4
4
|
import { SearchFilterValueParent } from '.';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { CertificationDefinitionFactory, OrderLiteFactory } from 'utils/test/factories/joanie';
|
|
3
3
|
import JoanieApiProvider from 'contexts/JoanieApiContext';
|
|
4
4
|
import { StorybookHelper } from 'utils/StorybookHelper';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { QueryClientProvider } from '@tanstack/react-query';
|
|
3
3
|
import { CredentialOrderFactory, TargetCourseFactory } from 'utils/test/factories/joanie';
|
|
4
4
|
import { StorybookHelper } from 'utils/StorybookHelper';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { QueryClientProvider } from '@tanstack/react-query';
|
|
3
3
|
import fetchMock from 'fetch-mock';
|
|
4
4
|
import { StorybookHelper } from 'utils/StorybookHelper';
|
|
@@ -69,7 +69,8 @@ const CourseWishButton = ({ course }: Props) => {
|
|
|
69
69
|
return user ? (
|
|
70
70
|
<>
|
|
71
71
|
<Button
|
|
72
|
-
color="
|
|
72
|
+
color="brand"
|
|
73
|
+
variant="primary"
|
|
73
74
|
onClick={isWished ? removeFromWishlist : addToWishlist}
|
|
74
75
|
fullWidth
|
|
75
76
|
disabled={componentState === ComponentStates.LOADING}
|
|
@@ -87,7 +88,8 @@ const CourseWishButton = ({ course }: Props) => {
|
|
|
87
88
|
</>
|
|
88
89
|
) : (
|
|
89
90
|
<Button
|
|
90
|
-
color="
|
|
91
|
+
color="brand"
|
|
92
|
+
variant="primary"
|
|
91
93
|
onClick={login}
|
|
92
94
|
fullWidth
|
|
93
95
|
disabled={componentState === ComponentStates.LOADING}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { CourseRunFactory, PacedCourseFactory } from 'utils/test/factories/richie';
|
|
3
3
|
import { StorybookHelper } from 'utils/StorybookHelper';
|
|
4
4
|
import { CourseCertificateOffer, CourseOffer } from '../../../../types/Course';
|
package/js/widgets/SyllabusCourseRunsList/components/SyllabusCourseRunCompacted/index.stories.tsx
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { CourseRunFactory } from 'utils/test/factories/richie';
|
|
3
|
+
import { StorybookHelper } from 'utils/StorybookHelper';
|
|
4
|
+
import { CourseCertificateOffer, CourseOffer } from 'types/Course';
|
|
5
|
+
import { SyllabusCourseRunCompacted } from '.';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: SyllabusCourseRunCompacted,
|
|
9
|
+
render: (args) => StorybookHelper.wrapInApp(<SyllabusCourseRunCompacted {...args} />),
|
|
10
|
+
} as Meta<typeof SyllabusCourseRunCompacted>;
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof SyllabusCourseRunCompacted>;
|
|
13
|
+
|
|
14
|
+
const courseRun = CourseRunFactory().one();
|
|
15
|
+
|
|
16
|
+
const singleDateCourseRun = {
|
|
17
|
+
...courseRun,
|
|
18
|
+
start: null,
|
|
19
|
+
enrollment_start: null,
|
|
20
|
+
title: 'Certificate Product',
|
|
21
|
+
price_currency: 'EUR',
|
|
22
|
+
offer: CourseOffer.FREE,
|
|
23
|
+
certificate_offer: CourseCertificateOffer.PAID,
|
|
24
|
+
certificate_price: 100,
|
|
25
|
+
discounted_price: null,
|
|
26
|
+
discount: null,
|
|
27
|
+
} as any;
|
|
28
|
+
|
|
29
|
+
const course = {
|
|
30
|
+
id: '038c4f92-542a-4652-8537-322a75297b75',
|
|
31
|
+
code: 'IYfwh',
|
|
32
|
+
is_self_paced: true,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const CertificateSyllabusSingleDate: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
courseRun: singleDateCourseRun,
|
|
38
|
+
course,
|
|
39
|
+
showLanguages: true,
|
|
40
|
+
},
|
|
41
|
+
};
|