richie-education 2.16.0 → 2.17.0
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 +9 -1
- package/.storybook/__mocks__/utils/context.ts +15 -0
- package/.storybook/main.js +22 -13
- package/.storybook/preview-head.html +1 -1
- package/.storybook/preview.tsx +14 -11
- package/i18n/locales/ar-SA.json +314 -82
- package/i18n/locales/es-ES.json +310 -78
- package/i18n/locales/fa-IR.json +269 -37
- package/i18n/locales/fr-CA.json +337 -105
- package/i18n/locales/fr-FR.json +270 -38
- package/i18n/locales/pt-PT.json +269 -37
- package/i18n/locales/ru-RU.json +339 -107
- package/jest/setup.ts +5 -0
- package/js/components/AddressesManagement/AddressForm.spec.tsx +34 -17
- package/js/components/AddressesManagement/AddressForm.tsx +18 -46
- package/js/components/AddressesManagement/ValidationErrors.ts +37 -0
- package/js/components/AddressesManagement/_styles.scss +1 -1
- package/js/components/AddressesManagement/index.spec.tsx +14 -11
- package/js/components/AddressesManagement/index.tsx +132 -196
- package/js/components/AddressesManagement/validationSchema.spec.ts +38 -16
- package/js/components/AddressesManagement/validationSchema.ts +23 -37
- package/js/components/Button/index.spec.tsx +36 -0
- package/js/components/Button/index.stories.tsx +26 -0
- package/js/components/Button/index.tsx +35 -0
- package/js/components/CourseProductCertificateItem/index.spec.tsx +4 -4
- package/js/components/CourseProductCertificateItem/index.tsx +1 -1
- package/js/components/CourseProductCourseRuns/CourseRunList.tsx +13 -1
- package/js/components/CourseProductCourseRuns/CourseRunSection.tsx +4 -2
- package/js/components/CourseProductCourseRuns/EnrollableCourseRunList.tsx +55 -30
- package/js/components/CourseProductCourseRuns/EnrolledCourseRun.tsx +23 -11
- package/js/components/CourseProductCourseRuns/_styles.scss +79 -64
- package/js/components/CourseProductCourseRuns/index.spec.tsx +96 -49
- package/js/components/CourseProductItem/CourseRunItem.tsx +93 -0
- package/js/components/CourseProductItem/_styles.scss +1 -0
- package/js/components/CourseProductItem/index.spec.tsx +33 -12
- package/js/components/CourseProductItem/index.tsx +5 -48
- package/js/components/CourseProductsList/index.spec.tsx +10 -9
- package/js/components/CourseProductsList/index.tsx +20 -5
- package/js/components/Dashboard/DashboardTest.tsx +17 -0
- package/js/components/Dashboard/index.spec.tsx +69 -0
- package/js/components/Dashboard/index.tsx +24 -0
- package/js/components/DashboardAddressesManagement/DashboardAddressBox.tsx +77 -0
- package/js/components/DashboardAddressesManagement/DashboardCreateAddress.spec.tsx +221 -0
- package/js/components/DashboardAddressesManagement/DashboardCreateAddress.stories.tsx +26 -0
- package/js/components/DashboardAddressesManagement/DashboardCreateAddress.tsx +55 -0
- package/js/components/DashboardAddressesManagement/DashboardCreateAddressLoader.tsx +11 -0
- package/js/components/DashboardAddressesManagement/DashboardEditAddress.spec.tsx +174 -0
- package/js/components/DashboardAddressesManagement/DashboardEditAddress.stories.tsx +29 -0
- package/js/components/DashboardAddressesManagement/DashboardEditAddress.tsx +84 -0
- package/js/components/DashboardAddressesManagement/DashboardEditAddressLoader.tsx +33 -0
- package/js/components/DashboardAddressesManagement/_styles.scss +52 -0
- package/js/components/DashboardAddressesManagement/index.spec.tsx +356 -0
- package/js/components/DashboardAddressesManagement/index.stories.tsx +26 -0
- package/js/components/DashboardAddressesManagement/index.tsx +92 -0
- package/js/components/DashboardBox/_styles.scss +33 -0
- package/js/components/DashboardBox/index.spec.tsx +15 -0
- package/js/components/DashboardBox/index.stories.tsx +61 -0
- package/js/components/DashboardBox/index.tsx +17 -0
- package/js/components/DashboardCard/_styles.scss +64 -0
- package/js/components/DashboardCard/index.spec.tsx +20 -0
- package/js/components/DashboardCard/index.stories.tsx +47 -0
- package/js/components/DashboardCard/index.tsx +68 -0
- package/js/components/DashboardCreditCardsManagement/CreditCardBrandLogo.stories.tsx +35 -0
- package/js/components/DashboardCreditCardsManagement/CreditCardBrandLogo.tsx +16 -0
- package/js/components/DashboardCreditCardsManagement/DashboardCreditCardBox.tsx +126 -0
- package/js/components/DashboardCreditCardsManagement/DashboardEditCreditCard.spec.tsx +355 -0
- package/js/components/DashboardCreditCardsManagement/DashboardEditCreditCard.stories.tsx +25 -0
- package/js/components/DashboardCreditCardsManagement/DashboardEditCreditCard.tsx +187 -0
- package/js/components/DashboardCreditCardsManagement/DashboardEditCreditCardLoader.tsx +35 -0
- package/js/components/DashboardCreditCardsManagement/_styles.scss +151 -0
- package/js/components/DashboardCreditCardsManagement/index.spec.tsx +444 -0
- package/js/components/DashboardCreditCardsManagement/index.stories.tsx +22 -0
- package/js/components/DashboardCreditCardsManagement/index.tsx +94 -0
- package/js/components/DashboardItem/DashboardItemEnrollment.spec.tsx +92 -0
- package/js/components/DashboardItem/DashboardItemEnrollment.stories.tsx +31 -0
- package/js/components/DashboardItem/DashboardItemEnrollment.tsx +23 -0
- package/js/components/DashboardItem/DashboardItemEnrollmentFooter.tsx +75 -0
- package/js/components/DashboardItem/DashboardItemOrder.spec.tsx +97 -0
- package/js/components/DashboardItem/DashboardItemOrder.stories.tsx +46 -0
- package/js/components/DashboardItem/DashboardItemOrder.tsx +102 -0
- package/js/components/DashboardItem/DashboardSubItem.tsx +17 -0
- package/js/components/DashboardItem/DashboardSubItemsList.tsx +15 -0
- package/js/components/DashboardItem/_styles.scss +161 -0
- package/js/components/DashboardItem/index.spec.tsx +34 -0
- package/js/components/DashboardItem/index.stories.tsx +22 -0
- package/js/components/DashboardItem/index.tsx +35 -0
- package/js/components/DashboardItem/mock.stories.ts +28 -0
- package/js/components/DashboardPreferences/_styles.scss +5 -0
- package/js/components/DashboardPreferences/index.tsx +30 -0
- package/js/components/Form/CheckboxField.stories.tsx +1 -1
- package/js/components/Form/CountrySelectField.tsx +22 -0
- package/js/components/Form/Field.stories.tsx +3 -0
- package/js/components/Form/Inputs.tsx +27 -13
- package/js/components/Form/RadioField.stories.tsx +1 -1
- package/js/components/Form/SelectField.stories.tsx +1 -1
- package/js/components/Form/TextAreaField.stories.tsx +1 -1
- package/js/components/Form/TextField.stories.tsx +1 -1
- package/js/components/Form/index.spec.tsx +6 -0
- package/js/components/Icon/index.tsx +8 -3
- package/js/components/Modal/_styles.scss +22 -4
- package/js/components/Modal/index.spec.tsx +64 -20
- package/js/components/Modal/index.stories.tsx +8 -12
- package/js/components/Modal/index.tsx +45 -3
- package/js/components/PaymentButton/index.spec.tsx +24 -13
- package/js/components/PaymentButton/index.tsx +24 -6
- package/js/components/ProtectedOutlet/AuthenticatedOutlet.spec.tsx +126 -0
- package/js/components/ProtectedOutlet/AuthenticatedOutlet.tsx +16 -0
- package/js/components/ProtectedOutlet/ProtectedOutlet.spec.tsx +80 -0
- package/js/components/ProtectedOutlet/ProtectedOutlet.tsx +26 -0
- package/js/components/ProtectedOutlet/index.tsx +4 -0
- package/js/components/Root/index.tsx +1 -1
- package/js/components/SaleTunnel/index.spec.tsx +25 -10
- package/js/components/SaleTunnel/index.tsx +48 -20
- package/js/components/SaleTunnelStepPayment/_styles.scss +1 -0
- package/js/components/SaleTunnelStepPayment/index.spec.tsx +12 -12
- package/js/components/SaleTunnelStepPayment/index.tsx +25 -10
- package/js/components/SaleTunnelStepValidation/_styles.scss +1 -0
- package/js/components/SaleTunnelStepValidation/index.spec.tsx +3 -3
- package/js/components/SaleTunnelStepValidation/index.tsx +3 -3
- package/js/components/SearchFilterGroupModal/_styles.scss +0 -8
- package/js/components/SearchFilterGroupModal/index.spec.tsx +3 -3
- package/js/components/SearchFilterGroupModal/index.tsx +3 -17
- package/js/components/SearchFiltersPane/index.spec.tsx +25 -8
- package/js/components/SearchFiltersPane/index.tsx +1 -1
- package/js/components/StepBreadcrumb/index.spec.tsx +39 -9
- package/js/components/StepBreadcrumb/index.tsx +23 -0
- package/js/data/CourseCodeProvider/index.spec.tsx +2 -2
- package/js/data/SessionProvider/BaseSessionProvider.tsx +1 -1
- package/js/data/SessionProvider/JoanieSessionProvider.spec.tsx +2 -2
- package/js/data/SessionProvider/JoanieSessionProvider.tsx +6 -6
- package/js/data/SessionProvider/no-authentication.spec.tsx +2 -2
- package/js/data/useCourseSearch/index.spec.tsx +1 -1
- package/js/data/useFilterValue/index.spec.tsx +1 -1
- package/js/data/useStaticFilters/index.spec.tsx +2 -2
- package/js/data/useStaticFilters/index.tsx +1 -1
- package/js/hooks/useAddresses.ts +84 -8
- package/js/hooks/useAddressesManagement.tsx +86 -0
- package/js/hooks/useCourse.ts +1 -1
- package/js/hooks/useCreditCards/index.spec.tsx +113 -0
- package/js/hooks/useCreditCards/index.ts +124 -0
- package/js/hooks/useCreditCardsManagement.tsx +45 -0
- package/js/hooks/useDashboardAddressForm.tsx +136 -0
- package/js/hooks/useRouteInfo/index.spec.tsx +68 -0
- package/js/hooks/useRouteInfo/index.ts +16 -0
- package/js/hooks/useStepManager/index.ts +1 -1
- package/js/index.tsx +1 -2
- 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/pt-PT.json +1 -1
- package/js/translations/ru-RU.json +1 -1
- package/js/types/Joanie.ts +15 -6
- package/js/types/utils.ts +2 -0
- package/js/utils/CreditCardHelper/index.spec.tsx +47 -0
- package/js/utils/CreditCardHelper/index.tsx +39 -0
- package/js/utils/StorybookHelper/index.tsx +23 -0
- package/js/utils/StringHelper/index.spec.tsx +29 -0
- package/js/utils/StringHelper/index.ts +14 -0
- package/js/utils/api/joanie.ts +6 -5
- package/js/utils/api/lms/openedx-hawthorn.spec.ts +1 -1
- package/js/utils/api/web-analytics/google_analytics.spec.ts +1 -1
- package/js/utils/api/web-analytics/google_tag_manager.spec.ts +1 -1
- package/js/utils/errors/handle.spec.ts +5 -1
- package/js/utils/react-query/useSessionMutation/index.spec.tsx +2 -2
- package/js/utils/react-query/useSessionQuery/index.spec.tsx +2 -2
- package/js/utils/react-query/useSessionQuery/index.ts +4 -4
- package/js/utils/routers/dashboard/index.tsx +123 -0
- package/js/utils/routers/dashboard/useDashboardRouter/getDashboardBasename.ts +9 -0
- package/js/utils/routers/dashboard/useDashboardRouter/index.spec.tsx +22 -0
- package/js/utils/routers/dashboard/useDashboardRouter/index.tsx +145 -0
- package/js/utils/test/expectFetchCall.ts +12 -0
- package/js/utils/test/factories.ts +43 -33
- package/js/utils/useDateFormat.tsx +7 -3
- package/package.json +40 -37
- package/scss/colors/_theme.scss +42 -0
- package/scss/components/_index.scss +6 -0
- package/scss/objects/_buttons.scss +4 -1
- package/scss/objects/_form.scss +37 -1
- package/scss/tools/_buttons.scss +5 -0
- package/webpack.config.js +3 -6
- package/js/components/DashBoard/index.spec.tsx +0 -38
- package/js/components/DashBoard/index.tsx +0 -5
- package/js/hooks/useCreditCards.ts +0 -57
package/.eslintrc.json
CHANGED
|
@@ -42,6 +42,13 @@
|
|
|
42
42
|
"import/extensions": "off",
|
|
43
43
|
"import/no-cycle": ["off"],
|
|
44
44
|
"import/no-dynamic-require": "off",
|
|
45
|
+
"import/order": [
|
|
46
|
+
"error",
|
|
47
|
+
{
|
|
48
|
+
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
|
|
49
|
+
"alphabetize": { "order": "ignore" }
|
|
50
|
+
}
|
|
51
|
+
],
|
|
45
52
|
"import/prefer-default-export": "off",
|
|
46
53
|
"jsx-a11y/click-events-have-key-events": "off",
|
|
47
54
|
"jsx-a11y/label-has-associated-control": "warn",
|
|
@@ -76,6 +83,7 @@
|
|
|
76
83
|
"react/style-prop-object": ["error", { "allow": ["FormattedNumber"] }]
|
|
77
84
|
},
|
|
78
85
|
"settings": {
|
|
79
|
-
"polyfills": ["fetch", "Promise"]
|
|
86
|
+
"polyfills": ["fetch", "Promise"],
|
|
87
|
+
"import/resolver": "webpack"
|
|
80
88
|
}
|
|
81
89
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ContextFactory } from 'utils/test/factories';
|
|
2
|
+
|
|
3
|
+
let context = {
|
|
4
|
+
joanie_backend: {
|
|
5
|
+
endpoint: 'http://localhost:8071',
|
|
6
|
+
},
|
|
7
|
+
authentication: {
|
|
8
|
+
backend: 'dummy',
|
|
9
|
+
endpoint: 'http://localhost:8073',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
(window as any).__richie_frontend_context__ = {
|
|
14
|
+
context: ContextFactory(context).generate(),
|
|
15
|
+
};
|
package/.storybook/main.js
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
|
+
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
|
1
2
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
stories: [
|
|
4
|
+
'../stories/**/*.stories.mdx',
|
|
5
|
+
'../stories/**/*.stories.@(js|jsx|ts|tsx)',
|
|
6
|
+
'../js/**/*.stories.@(js|jsx|ts|tsx)',
|
|
6
7
|
],
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
addons: [
|
|
9
|
+
'@storybook/addon-links',
|
|
10
|
+
'@storybook/addon-essentials',
|
|
11
|
+
'@storybook/addon-interactions',
|
|
11
12
|
],
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
framework: '@storybook/react',
|
|
14
|
+
core: {
|
|
15
|
+
builder: '@storybook/builder-webpack5',
|
|
15
16
|
},
|
|
16
|
-
staticDirs: [
|
|
17
|
-
}
|
|
17
|
+
staticDirs: [
|
|
18
|
+
{ from: '../../richie/static', to: '/static' },
|
|
19
|
+
{ from: '../../richie/apps/core/static', to: '/static' },
|
|
20
|
+
'../../richie/apps/core/templates/richie',
|
|
21
|
+
],
|
|
22
|
+
webpackFinal: async (config, { configType }) => {
|
|
23
|
+
config.resolve.plugins = [new TsconfigPathsPlugin()];
|
|
24
|
+
return config;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<link rel=
|
|
1
|
+
<link rel='stylesheet' type='text/css' href='/static/richie/css/main.css'>
|
package/.storybook/preview.tsx
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { useState } from
|
|
2
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { IntlProvider } from 'react-intl';
|
|
3
|
+
import { useAsyncEffect } from '../js/utils/useAsyncEffect';
|
|
4
|
+
import './__mocks__/utils/context';
|
|
3
5
|
|
|
4
6
|
export const parameters = {
|
|
5
|
-
actions: {argTypesRegex:
|
|
7
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
6
8
|
controls: {
|
|
7
9
|
matchers: {
|
|
8
10
|
color: /(background|color)$/i,
|
|
9
11
|
date: /Date$/,
|
|
10
12
|
},
|
|
11
13
|
},
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
+
};
|
|
14
15
|
|
|
15
|
-
const IconsWrapper = props => {
|
|
16
|
+
const IconsWrapper = (props) => {
|
|
16
17
|
const [symbols, setSymbols] = useState('');
|
|
17
18
|
|
|
18
19
|
useAsyncEffect(async () => {
|
|
@@ -23,7 +24,7 @@ const IconsWrapper = props => {
|
|
|
23
24
|
|
|
24
25
|
return (
|
|
25
26
|
<div>
|
|
26
|
-
<div dangerouslySetInnerHTML={{__html: symbols}}/>
|
|
27
|
+
<div dangerouslySetInnerHTML={{ __html: symbols }} />
|
|
27
28
|
{props.children}
|
|
28
29
|
</div>
|
|
29
30
|
);
|
|
@@ -31,8 +32,10 @@ const IconsWrapper = props => {
|
|
|
31
32
|
|
|
32
33
|
export const decorators = [
|
|
33
34
|
(Story) => (
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
|
|
35
|
+
<IntlProvider locale="en">
|
|
36
|
+
<IconsWrapper>
|
|
37
|
+
<Story />
|
|
38
|
+
</IconsWrapper>
|
|
39
|
+
</IntlProvider>
|
|
37
40
|
),
|
|
38
|
-
];
|
|
41
|
+
];
|