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.
Files changed (136) hide show
  1. package/.eslintrc.json +0 -3
  2. package/.storybook/preview.tsx +49 -24
  3. package/cunningham.cjs +1 -0
  4. package/i18n/compile-translations.js +12 -10
  5. package/i18n/locales/ar-SA.json +20 -0
  6. package/i18n/locales/es-ES.json +20 -0
  7. package/i18n/locales/fa-IR.json +20 -0
  8. package/i18n/locales/fr-CA.json +20 -0
  9. package/i18n/locales/fr-FR.json +21 -1
  10. package/i18n/locales/ko-KR.json +20 -0
  11. package/i18n/locales/pt-PT.json +42 -22
  12. package/i18n/locales/ru-RU.json +20 -0
  13. package/i18n/locales/vi-VN.json +20 -0
  14. package/jest.config.js +5 -0
  15. package/js/components/AddressesManagement/AddressForm/index.stories.tsx +1 -1
  16. package/js/components/AddressesManagement/AddressForm/index.tsx +4 -3
  17. package/js/components/AddressesManagement/index.stories.tsx +1 -1
  18. package/js/components/AddressesManagement/index.tsx +5 -3
  19. package/js/components/Badge/index.stories.tsx +1 -1
  20. package/js/components/Badge/index.tsx +1 -1
  21. package/js/components/Banner/index.stories.tsx +1 -1
  22. package/js/components/CourseGlimpse/index.stories.tsx +1 -1
  23. package/js/components/CourseGlimpseList/index.stories.tsx +1 -1
  24. package/js/components/CreditCardSelector/index.tsx +11 -3
  25. package/js/components/DownloadCertificateButton/index.tsx +2 -1
  26. package/js/components/DownloadContractButton/index.tsx +7 -1
  27. package/js/components/Form/Form/index.tsx +4 -2
  28. package/js/components/Icon/index.stories.tsx +2 -1
  29. package/js/components/Modal/index.stories.tsx +1 -1
  30. package/js/components/Modal/index.tsx +2 -1
  31. package/js/components/OpenEdxFullNameForm/index.stories.tsx +1 -1
  32. package/js/components/OpenEdxFullNameForm/index.tsx +2 -2
  33. package/js/components/PurchaseButton/index.stories.tsx +1 -1
  34. package/js/components/RegisteredAddress/index.stories.tsx +1 -1
  35. package/js/components/RegisteredAddress/index.tsx +4 -2
  36. package/js/components/SaleTunnel/AddressSelector/CreateAddressFormModal.tsx +1 -1
  37. package/js/components/SaleTunnel/AddressSelector/EditAddressFormModal.tsx +1 -1
  38. package/js/components/SaleTunnel/AddressSelector/index.tsx +4 -2
  39. package/js/components/SaleTunnel/SaleTunnelInformation/SaleTunnelInformationGroup.tsx +4 -3
  40. package/js/components/SaleTunnel/SaleTunnelInformation/SaleTunnelInformationSingular.tsx +8 -2
  41. package/js/components/SaleTunnel/index.stories.tsx +1 -1
  42. package/js/components/Spinner/index.stories.tsx +1 -1
  43. package/js/components/Tabs/index.stories.tsx +1 -1
  44. package/js/components/Tabs/index.tsx +2 -1
  45. package/js/components/TeacherDashboardCourseList/index.tsx +2 -1
  46. package/js/hooks/useAddressesManagement.tsx +4 -2
  47. package/js/hooks/useCreditCards/index.ts +6 -4
  48. package/js/hooks/useDashboardAddressForm.tsx +3 -3
  49. package/js/hooks/useMatchMedia.ts +1 -1
  50. package/js/hooks/useResources/useResourcesRoot.ts +1 -1
  51. package/js/hooks/useUnionResource/index.ts +6 -2
  52. package/js/hooks/useUnionResource/utils/fetchEntity.ts +1 -0
  53. package/js/pages/DashboardAddressesManagement/DashboardAddressBox.tsx +3 -3
  54. package/js/pages/DashboardAddressesManagement/DashboardCreateAddress.stories.tsx +1 -1
  55. package/js/pages/DashboardAddressesManagement/DashboardCreateAddress.tsx +1 -1
  56. package/js/pages/DashboardAddressesManagement/DashboardEditAddress.stories.tsx +1 -1
  57. package/js/pages/DashboardAddressesManagement/DashboardEditAddress.tsx +3 -2
  58. package/js/pages/DashboardAddressesManagement/index.stories.tsx +1 -1
  59. package/js/pages/DashboardAddressesManagement/index.tsx +1 -1
  60. package/js/pages/DashboardCourses/index.tsx +2 -1
  61. package/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.stories.tsx +1 -1
  62. package/js/pages/DashboardCreditCardsManagement/DashboardCreditCardBox.tsx +3 -3
  63. package/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.stories.tsx +1 -1
  64. package/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.tsx +3 -2
  65. package/js/pages/DashboardCreditCardsManagement/index.stories.tsx +1 -1
  66. package/js/pages/DashboardOpenEdxProfile/index.stories.tsx +1 -1
  67. package/js/pages/TeacherDashboardContractsLayout/components/BulkDownloadContractButton/index.tsx +4 -2
  68. package/js/pages/TeacherDashboardContractsLayout/components/SignOrganizationContractButton/index.tsx +2 -1
  69. package/js/pages/TeacherDashboardContractsLayout/hooks/useCheckContractArchiveExists/index.spec.tsx +4 -4
  70. package/js/pages/TeacherDashboardContractsLayout/hooks/useDownloadContractArchive/index.spec.tsx +8 -9
  71. package/js/pages/TeacherDashboardContractsLayout/hooks/useDownloadContractArchive/index.tsx +14 -3
  72. package/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.tsx +6 -1
  73. package/js/pages/TeacherDashboardCourseLoader/CourseRunList/utils.tsx +2 -1
  74. package/js/pages/TeacherDashboardOrganizationAgreements/BulkAgreementContractButton.tsx +4 -2
  75. package/js/pages/TeacherDashboardOrganizationAgreements/SignOrganizationAgreementButton.tsx +2 -1
  76. package/js/pages/TeacherDashboardOrganizationQuotes/index.tsx +2 -1
  77. package/js/translations/ar-SA.json +1 -1
  78. package/js/translations/es-ES.json +1 -1
  79. package/js/translations/fa-IR.json +1 -1
  80. package/js/translations/fr-CA.json +1 -1
  81. package/js/translations/fr-FR.json +1 -1
  82. package/js/translations/ko-KR.json +1 -1
  83. package/js/translations/pt-PT.json +1 -1
  84. package/js/translations/ru-RU.json +1 -1
  85. package/js/translations/vi-VN.json +1 -1
  86. package/js/utils/ProductHelper/index.spec.ts +1 -1
  87. package/js/utils/StorybookHelper/index.tsx +3 -6
  88. package/js/utils/cunningham-tokens.ts +1111 -142
  89. package/js/utils/errors/handle.spec.ts +3 -3
  90. package/js/utils/react-query/useSessionMutation/index.ts +8 -3
  91. package/js/widgets/Dashboard/components/DashboardAvatar/index.stories.tsx +1 -1
  92. package/js/widgets/Dashboard/components/DashboardBox/index.stories.tsx +13 -5
  93. package/js/widgets/Dashboard/components/DashboardBreadcrumbs/index.stories.tsx +1 -1
  94. package/js/widgets/Dashboard/components/DashboardBreadcrumbs/index.tsx +3 -2
  95. package/js/widgets/Dashboard/components/DashboardCard/index.spec.tsx +13 -2
  96. package/js/widgets/Dashboard/components/DashboardCard/index.stories.tsx +12 -4
  97. package/js/widgets/Dashboard/components/DashboardCard/index.tsx +1 -1
  98. package/js/widgets/Dashboard/components/DashboardItem/BatchOrder/BatchOrderPaymentModal/BatchOrderPaymentManager.tsx +1 -1
  99. package/js/widgets/Dashboard/components/DashboardItem/BatchOrder/BatchOrderPaymentModal/index.tsx +2 -1
  100. package/js/widgets/Dashboard/components/DashboardItem/Certificate/index.stories.tsx +1 -1
  101. package/js/widgets/Dashboard/components/DashboardItem/Contract/index.stories.tsx +1 -1
  102. package/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.stories.tsx +1 -1
  103. package/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.tsx +8 -4
  104. package/js/widgets/Dashboard/components/DashboardItem/Enrollment/DashboardItemEnrollment.stories.tsx +1 -1
  105. package/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.tsx +1 -1
  106. package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderReadonly.stories.tsx +1 -1
  107. package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderWritable.stories.tsx +1 -1
  108. package/js/widgets/Dashboard/components/DashboardItem/Order/Installment/index.tsx +1 -1
  109. package/js/widgets/Dashboard/components/DashboardItem/Order/OrderPaymentRetryModal/index.tsx +2 -1
  110. package/js/widgets/Dashboard/components/DashboardItem/Order/OrganizationBlock/index.tsx +6 -3
  111. package/js/widgets/Dashboard/components/DashboardItem/index.stories.tsx +1 -1
  112. package/js/widgets/Dashboard/components/DashboardItem/index.tsx +2 -1
  113. package/js/widgets/Dashboard/components/DashboardListAvatar/index.stories.tsx +1 -1
  114. package/js/widgets/Dashboard/components/DashboardSidebar/index.stories.tsx +1 -1
  115. package/js/widgets/Dashboard/components/LearnerDashboardSidebar/index.stories.tsx +1 -1
  116. package/js/widgets/Dashboard/components/ProtectedOutlet/AuthenticatedOutlet.spec.tsx +1 -1
  117. package/js/widgets/Dashboard/components/ProtectedOutlet/ProtectedOutlet.spec.tsx +1 -1
  118. package/js/widgets/Dashboard/components/SearchBar/index.tsx +2 -1
  119. package/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx +1 -1
  120. package/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.stories.tsx +1 -1
  121. package/js/widgets/Dashboard/index.spec.tsx +1 -1
  122. package/js/widgets/Search/components/SearchFilterValueParent/index.stories.tsx +1 -1
  123. package/js/widgets/Search/components/SearchFiltersPane/index.tsx +2 -1
  124. package/js/widgets/Slider/index.stories.tsx +1 -1
  125. package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.stories.tsx +1 -1
  126. package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.stories.tsx +1 -1
  127. package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx +1 -1
  128. package/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.tsx +4 -2
  129. package/js/widgets/SyllabusCourseRunsList/components/SyllabusCourseRun/index.stories.tsx +1 -1
  130. package/js/widgets/SyllabusCourseRunsList/components/SyllabusCourseRunCompacted/index.stories.tsx +41 -0
  131. package/js/widgets/UserLogin/index.stories.tsx +1 -1
  132. package/package.json +75 -75
  133. package/scss/vendors/css/cunningham-tokens.css +1259 -154
  134. package/scss/vendors/cunningham-tokens.scss +1479 -150
  135. package/tsconfig.json +1 -1
  136. 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).toBeCalledTimes(1);
23
- expect(Sentry.setTag).toBeCalledTimes(1);
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).toBeCalledTimes(1);
28
+ expect(Sentry.captureException).toHaveBeenCalledTimes(1);
29
29
  });
30
30
  });
@@ -1,4 +1,8 @@
1
- import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
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">Delete</Button>
29
- <Button color="primary">Update</Button>
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">Delete</Button>
47
- <Button color="primary">Update</Button>
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="tertiary-text"
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-text">
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 header="My header" footer={<Button color="primary">Update</Button>}>
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={<Button color="primary">Update</Button>}
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: <Button color="primary">Update</Button>,
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">Remove</Button>
43
- <Button color="primary">Edit</Button>
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={{
@@ -172,7 +172,8 @@ export const BatchOrderPaymentModal = ({ batchOrder, ...props }: Props) => {
172
172
  hideCloseButton={state === ComponentStates.LOADING}
173
173
  actions={
174
174
  <Button
175
- color="primary"
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="secondary"
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="tertiary"
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="secondary"
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="secondary"
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"
@@ -1,4 +1,4 @@
1
- import { Meta, StoryObj } from '@storybook/react';
1
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { enrollment } from '../stories.mock';
3
3
  import { DashboardItemEnrollment } from './DashboardItemEnrollment';
4
4
 
@@ -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={{
@@ -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 {
@@ -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>
@@ -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="primary"
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="tertiary"
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="tertiary"
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="tertiary"
129
+ color="brand"
130
+ variant="tertiary"
128
131
  href={'mailto:' + (organization.dpo_email ?? '')}
129
132
  >
130
133
  {organization.dpo_email}
@@ -1,4 +1,4 @@
1
- import { Meta, StoryObj } from '@storybook/react';
1
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { DashboardItem, DEMO_IMAGE_URL } from './index';
3
3
 
4
4
  export default {
@@ -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="tertiary"
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 { PropsWithChildren } from 'react';
3
3
  import { tokens } from 'utils/cunningham-tokens';
4
4
  import DashboardListAvatar from '.';
@@ -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.toBeCalled();
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.toBeCalled();
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="tertiary"
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)}
@@ -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.toBeCalled();
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 '.';
@@ -76,7 +76,8 @@ export const SearchFiltersPane = ({
76
76
  <FormattedMessage {...messages.filter} />
77
77
  </h2>
78
78
  <Button
79
- color="secondary"
79
+ color="brand"
80
+ variant="secondary"
80
81
  size="small"
81
82
  className={c({
82
83
  'search-filters-pane__clear--hidden': !activeFilterCount,
@@ -1,4 +1,4 @@
1
- import { Meta, StoryObj } from '@storybook/react';
1
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { IntlProvider } from 'react-intl';
3
3
  import { Slide } from './types';
4
4
  import Slider 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="primary"
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="primary"
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';
@@ -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
+ };
@@ -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 { RichieContextFactory } from 'utils/test/factories/richie';
4
4
  import UserLogin from '.';