richie-education 2.28.2-dev39 → 2.28.2-dev58

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 (102) hide show
  1. package/.eslintrc.json +11 -2
  2. package/i18n/locales/ar-SA.json +209 -125
  3. package/i18n/locales/es-ES.json +210 -126
  4. package/i18n/locales/fa-IR.json +209 -125
  5. package/i18n/locales/fr-CA.json +209 -125
  6. package/i18n/locales/fr-FR.json +209 -125
  7. package/i18n/locales/ko-KR.json +209 -125
  8. package/i18n/locales/pt-PT.json +212 -128
  9. package/i18n/locales/ru-RU.json +209 -125
  10. package/i18n/locales/vi-VN.json +209 -125
  11. package/js/api/joanie.ts +14 -17
  12. package/js/api/lms/dummy.ts +1 -12
  13. package/js/components/ContractFrame/AbstractContractFrame.spec.tsx +16 -9
  14. package/js/components/ContractFrame/AbstractContractFrame.tsx +32 -25
  15. package/js/components/ContractFrame/LearnerContractFrame.tsx +2 -2
  16. package/js/components/ContractFrame/_styles.scss +6 -14
  17. package/js/components/CreditCardSelector/index.spec.tsx +7 -7
  18. package/js/components/CreditCardSelector/index.tsx +2 -2
  19. package/js/components/DownloadContractButton/index.spec.tsx +1 -1
  20. package/js/components/OpenEdxFullNameForm/index.spec.tsx +229 -0
  21. package/js/components/OpenEdxFullNameForm/index.tsx +7 -7
  22. package/js/components/PaymentInterfaces/LyraPopIn.tsx +2 -2
  23. package/js/components/PaymentInterfaces/PayplugLightbox.tsx +1 -1
  24. package/js/components/PaymentInterfaces/__mocks__/index.tsx +1 -4
  25. package/js/components/PaymentInterfaces/types.ts +5 -2
  26. package/js/components/PurchaseButton/index.spec.tsx +69 -37
  27. package/js/components/SaleTunnel/AddressSelector/index.spec.tsx +2 -1
  28. package/js/components/SaleTunnel/CertificateSaleTunnel/index.tsx +2 -2
  29. package/js/components/SaleTunnel/CredentialSaleTunnel/index.tsx +6 -10
  30. package/js/components/SaleTunnel/GenericSaleTunnel.tsx +75 -41
  31. package/js/components/SaleTunnel/SaleTunnelInformation/index.tsx +0 -30
  32. package/js/components/SaleTunnel/SaleTunnelSavePaymentMethod/_styles.scss +12 -0
  33. package/js/components/SaleTunnel/SaleTunnelSavePaymentMethod/index.tsx +160 -0
  34. package/js/components/SaleTunnel/SaleTunnelSuccess/index.tsx +15 -29
  35. package/js/components/SaleTunnel/Sponsors/SaleTunnelSponsors.tsx +5 -0
  36. package/js/components/SaleTunnel/SubscriptionButton/_styles.scss +7 -0
  37. package/js/components/SaleTunnel/SubscriptionButton/index.tsx +202 -0
  38. package/js/components/SaleTunnel/_styles.scss +10 -1
  39. package/js/components/SaleTunnel/hooks/useTerms.tsx +0 -77
  40. package/js/components/SaleTunnel/index.credential.spec.tsx +12 -21
  41. package/js/components/SaleTunnel/index.full-process.spec.tsx +110 -48
  42. package/js/components/SaleTunnel/index.spec.tsx +330 -779
  43. package/js/components/SignContractButton/index.omniscientOrders.spec.tsx +16 -11
  44. package/js/components/SignContractButton/index.spec.tsx +16 -20
  45. package/js/components/SignContractButton/index.tsx +3 -1
  46. package/js/hooks/useCreditCards/index.spec.tsx +70 -6
  47. package/js/hooks/useCreditCards/index.ts +49 -11
  48. package/js/hooks/useOrders/index.spec.tsx +322 -0
  49. package/js/hooks/{useOrders.ts → useOrders/index.ts} +40 -14
  50. package/js/hooks/useProductOrder/index.spec.tsx +77 -60
  51. package/js/hooks/useProductOrder/index.tsx +2 -2
  52. package/js/hooks/useResources/useResourcesRoot.ts +1 -0
  53. package/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.spec.tsx +1 -1
  54. package/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.tsx +4 -2
  55. package/js/pages/TeacherDashboardContractsLayout/components/ContractActionsBar/index.spec.tsx +8 -5
  56. package/js/pages/TeacherDashboardContractsLayout/components/SignOrganizationContractButton/index.spec.tsx +8 -9
  57. package/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx +1 -1
  58. package/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.tsx +1 -6
  59. package/js/settings/settings.test.ts +11 -2
  60. package/js/translations/ar-SA.json +1 -1
  61. package/js/translations/es-ES.json +1 -1
  62. package/js/translations/fa-IR.json +1 -1
  63. package/js/translations/fr-CA.json +1 -1
  64. package/js/translations/fr-FR.json +1 -1
  65. package/js/translations/ko-KR.json +1 -1
  66. package/js/translations/pt-PT.json +1 -1
  67. package/js/translations/ru-RU.json +1 -1
  68. package/js/translations/vi-VN.json +1 -1
  69. package/js/types/Joanie.ts +49 -34
  70. package/js/utils/OrderHelper/index.ts +38 -42
  71. package/js/utils/search/getSuggestionsSection/index.spec.ts +3 -2
  72. package/js/utils/test/factories/joanie.ts +36 -51
  73. package/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.tsx +8 -18
  74. package/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.spec.tsx +26 -32
  75. package/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.tsx +11 -6
  76. package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx +7 -6
  77. package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.tsx +9 -10
  78. package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx +3 -1
  79. package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.useUnionResource.cache.spec.tsx +6 -7
  80. package/js/widgets/Dashboard/components/DashboardItem/Order/OrderPaymentDetailsModal/index.tsx +28 -8
  81. package/js/widgets/Dashboard/components/DashboardItem/Order/OrderPaymentRetryModal/index.tsx +4 -6
  82. package/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.spec.tsx +18 -71
  83. package/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.tsx +34 -35
  84. package/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateMessage/index.tsx +27 -24
  85. package/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.spec.tsx +18 -73
  86. package/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.tsx +32 -16
  87. package/js/widgets/Dashboard/components/DashboardOrderLoader/index.tsx +3 -11
  88. package/js/widgets/Dashboard/components/Signature/SignatureDummy.tsx +25 -3
  89. package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/EnrollableCourseRunList.tsx +2 -6
  90. package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/index.spec.tsx +7 -14
  91. package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.spec.tsx +7 -5
  92. package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.tsx +5 -7
  93. package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.spec.tsx +242 -332
  94. package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx +12 -13
  95. package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.tsx +10 -21
  96. package/js/widgets/SyllabusCourseRunsList/components/CourseRunEnrollment/index.joanie.spec.tsx +2 -2
  97. package/package.json +27 -27
  98. package/scss/components/_index.scss +2 -1
  99. package/js/components/PaymentButton/_styles.scss +0 -27
  100. package/js/components/SaleTunnel/GenericPaymentButton/index.tsx +0 -333
  101. package/js/components/SaleTunnel/SaleTunnelNotValidated/index.tsx +0 -70
  102. package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/ProductSignatureHeader/index.tsx +0 -41
@@ -1,70 +0,0 @@
1
- import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
2
- import { Button } from '@openfun/cunningham-react';
3
- import { generatePath } from 'react-router-dom';
4
- import WarningIcon from 'components/WarningIcon';
5
- import { getDashboardBasename } from 'widgets/Dashboard/hooks/useDashboardRouter/getDashboardBasename';
6
- import { useSaleTunnelContext } from 'components/SaleTunnel/GenericSaleTunnel';
7
- import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
8
- import { ProductType } from 'types/Joanie';
9
-
10
- const messages = defineMessages({
11
- apology: {
12
- defaultMessage: "Sorry, you'll have to wait a little longer!",
13
- description: 'Text displayed to thank user for his order',
14
- id: 'components.SaleTunnelSuccessNotValidated.apology',
15
- },
16
- title: {
17
- defaultMessage: 'It takes too long to validate your order.',
18
- description: 'Message to confirm that order has been created',
19
- id: 'components.SaleTunnelSuccessNotValidated.title',
20
- },
21
- description: {
22
- defaultMessage:
23
- 'Your payment has succeeded but your order validation is taking too long, you can close this dialog and come back later. You will receive your invoice by email in a few moments.',
24
- description: "Text to remind that order's invoice will be send by email soon",
25
- id: 'components.SaleTunnelSuccessNotValidated.description',
26
- },
27
- cta: {
28
- defaultMessage: 'Close',
29
- description: 'Label to the call to action to close sale tunnel',
30
- id: 'components.SaleTunnelSuccessNotValidated.cta',
31
- },
32
- });
33
-
34
- const SaleTunnelNotValidated = ({ closeModal }: { closeModal: () => void }) => {
35
- const intl = useIntl();
36
- const { order, product } = useSaleTunnelContext();
37
- return (
38
- <section className="sale-tunnel-end" data-testid="generic-sale-tunnel-not-validated-step">
39
- <header className="sale-tunnel-end__header">
40
- <WarningIcon />
41
- <h3 className="sale-tunnel-end__title">
42
- <FormattedMessage {...messages.apology} />
43
- </h3>
44
- </header>
45
- <p className="sale-tunnel-end__content">
46
- <FormattedMessage {...messages.title} />
47
- <br />
48
- <FormattedMessage {...messages.description} />
49
- </p>
50
- <footer className="sale-tunnel-end__footer">
51
- {product.type === ProductType.CREDENTIAL ? (
52
- <Button
53
- href={
54
- getDashboardBasename(intl.locale) +
55
- generatePath(LearnerDashboardPaths.ORDER, { orderId: order!.id })
56
- }
57
- >
58
- <FormattedMessage {...messages.cta} />
59
- </Button>
60
- ) : (
61
- <Button onClick={closeModal}>
62
- <FormattedMessage {...messages.cta} />
63
- </Button>
64
- )}
65
- </footer>
66
- </section>
67
- );
68
- };
69
-
70
- export default SaleTunnelNotValidated;
@@ -1,41 +0,0 @@
1
- import { Button } from '@openfun/cunningham-react';
2
- import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
3
- import { generatePath } from 'react-router-dom';
4
- import Banner, { BannerType } from 'components/Banner';
5
- import { getDashboardBasename } from 'widgets/Dashboard/hooks/useDashboardRouter/getDashboardBasename';
6
- import { Order } from 'types/Joanie';
7
-
8
- import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths';
9
-
10
- const messages = defineMessages({
11
- signatureNeeded: {
12
- defaultMessage: 'You need to sign your training contract before enrolling to course runs',
13
- description: 'Banner displayed when the contract is not signed on the syllabus',
14
- id: 'components.CourseProductItem.signatureNeeded',
15
- },
16
- contractSignActionLabel: {
17
- id: 'components.CourseProductItem.contractSignActionLabel',
18
- description: 'Label of "sign contract" action on the syllabus.',
19
- defaultMessage: 'Sign your training contract',
20
- },
21
- });
22
-
23
- export const ProductSignatureHeader = ({ order }: { order?: Order }) => {
24
- const intl = useIntl();
25
- return (
26
- <>
27
- <Banner message={intl.formatMessage(messages.signatureNeeded)} type={BannerType.ERROR} />
28
- <Button
29
- fullWidth={true}
30
- className="mb-s"
31
- size="small"
32
- href={
33
- getDashboardBasename(intl.locale) +
34
- generatePath(LearnerDashboardPaths.ORDER, { orderId: order!.id })
35
- }
36
- >
37
- <FormattedMessage {...messages.contractSignActionLabel} />
38
- </Button>
39
- </>
40
- );
41
- };