richie-education 2.28.2-dev39 → 2.28.2-dev53
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/api/joanie.ts +12 -16
- package/js/api/lms/dummy.ts +1 -12
- package/js/components/ContractFrame/AbstractContractFrame.spec.tsx +16 -9
- package/js/components/ContractFrame/AbstractContractFrame.tsx +28 -23
- package/js/components/ContractFrame/LearnerContractFrame.tsx +2 -2
- package/js/components/ContractFrame/_styles.scss +6 -14
- package/js/components/CreditCardSelector/index.spec.tsx +7 -7
- package/js/components/CreditCardSelector/index.tsx +2 -2
- package/js/components/DownloadContractButton/index.spec.tsx +1 -1
- package/js/components/OpenEdxFullNameForm/index.spec.tsx +229 -0
- package/js/components/OpenEdxFullNameForm/index.tsx +7 -7
- package/js/components/PaymentInterfaces/LyraPopIn.tsx +2 -2
- package/js/components/PaymentInterfaces/PayplugLightbox.tsx +1 -1
- package/js/components/PaymentInterfaces/__mocks__/index.tsx +1 -4
- package/js/components/PaymentInterfaces/types.ts +5 -2
- package/js/components/PurchaseButton/index.spec.tsx +69 -37
- package/js/components/SaleTunnel/AddressSelector/index.spec.tsx +2 -1
- package/js/components/SaleTunnel/CertificateSaleTunnel/index.tsx +2 -2
- package/js/components/SaleTunnel/CredentialSaleTunnel/index.tsx +6 -10
- package/js/components/SaleTunnel/GenericSaleTunnel.tsx +75 -41
- package/js/components/SaleTunnel/SaleTunnelInformation/index.tsx +0 -30
- package/js/components/SaleTunnel/SaleTunnelSavePaymentMethod/_styles.scss +12 -0
- package/js/components/SaleTunnel/SaleTunnelSavePaymentMethod/index.tsx +160 -0
- package/js/components/SaleTunnel/SaleTunnelSuccess/index.tsx +15 -29
- package/js/components/SaleTunnel/Sponsors/SaleTunnelSponsors.tsx +5 -0
- package/js/components/SaleTunnel/SubscriptionButton/_styles.scss +7 -0
- package/js/components/SaleTunnel/SubscriptionButton/index.tsx +201 -0
- package/js/components/SaleTunnel/_styles.scss +10 -1
- package/js/components/SaleTunnel/hooks/useTerms.tsx +0 -77
- package/js/components/SaleTunnel/index.credential.spec.tsx +12 -21
- package/js/components/SaleTunnel/index.full-process.spec.tsx +110 -48
- package/js/components/SaleTunnel/index.spec.tsx +330 -779
- package/js/components/SignContractButton/index.omniscientOrders.spec.tsx +16 -11
- package/js/components/SignContractButton/index.spec.tsx +16 -20
- package/js/components/SignContractButton/index.tsx +3 -1
- package/js/hooks/useCreditCards/index.spec.tsx +70 -6
- package/js/hooks/useCreditCards/index.ts +49 -11
- package/js/hooks/useOrders/index.spec.tsx +322 -0
- package/js/hooks/{useOrders.ts → useOrders/index.ts} +40 -14
- package/js/hooks/useProductOrder/index.spec.tsx +77 -60
- package/js/hooks/useProductOrder/index.tsx +2 -2
- package/js/hooks/useResources/useResourcesRoot.ts +1 -0
- package/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.spec.tsx +1 -1
- package/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.tsx +4 -2
- package/js/pages/TeacherDashboardContractsLayout/components/ContractActionsBar/index.spec.tsx +8 -5
- package/js/pages/TeacherDashboardContractsLayout/components/SignOrganizationContractButton/index.spec.tsx +8 -9
- package/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx +1 -1
- package/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.tsx +1 -6
- package/js/settings/settings.test.ts +11 -2
- package/js/types/Joanie.ts +49 -34
- package/js/utils/OrderHelper/index.ts +38 -42
- package/js/utils/test/factories/joanie.ts +36 -51
- package/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.tsx +8 -18
- package/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.spec.tsx +26 -32
- package/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.tsx +11 -6
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx +7 -6
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.tsx +9 -10
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx +3 -1
- package/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.useUnionResource.cache.spec.tsx +6 -7
- package/js/widgets/Dashboard/components/DashboardItem/Order/OrderPaymentDetailsModal/index.tsx +28 -8
- package/js/widgets/Dashboard/components/DashboardItem/Order/OrderPaymentRetryModal/index.tsx +2 -5
- package/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.spec.tsx +18 -71
- package/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.tsx +34 -35
- package/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateMessage/index.tsx +27 -24
- package/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.spec.tsx +18 -73
- package/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.tsx +32 -16
- package/js/widgets/Dashboard/components/DashboardOrderLoader/index.tsx +3 -11
- package/js/widgets/Dashboard/components/Signature/SignatureDummy.tsx +25 -3
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/EnrollableCourseRunList.tsx +2 -6
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/index.spec.tsx +7 -14
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.spec.tsx +7 -5
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.tsx +5 -7
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.spec.tsx +242 -332
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx +12 -13
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.tsx +10 -21
- package/js/widgets/SyllabusCourseRunsList/components/CourseRunEnrollment/index.joanie.spec.tsx +2 -2
- package/package.json +1 -1
- package/scss/components/_index.scss +2 -1
- package/js/components/PaymentButton/_styles.scss +0 -27
- package/js/components/SaleTunnel/GenericPaymentButton/index.tsx +0 -333
- package/js/components/SaleTunnel/SaleTunnelNotValidated/index.tsx +0 -70
- package/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/ProductSignatureHeader/index.tsx +0 -41
package/js/api/joanie.ts
CHANGED
|
@@ -79,9 +79,9 @@ export const getRoutes = () => {
|
|
|
79
79
|
},
|
|
80
80
|
creditCards: {
|
|
81
81
|
get: `${baseUrl}/credit-cards/:id/`,
|
|
82
|
-
create: `${baseUrl}/credit-cards/`,
|
|
83
82
|
update: `${baseUrl}/credit-cards/:id/`,
|
|
84
83
|
delete: `${baseUrl}/credit-cards/:id/`,
|
|
84
|
+
tokenize: `${baseUrl}/credit-cards/tokenize-card/`,
|
|
85
85
|
},
|
|
86
86
|
addresses: {
|
|
87
87
|
get: `${baseUrl}/addresses/:id/`,
|
|
@@ -90,15 +90,15 @@ export const getRoutes = () => {
|
|
|
90
90
|
delete: `${baseUrl}/addresses/:id/`,
|
|
91
91
|
},
|
|
92
92
|
orders: {
|
|
93
|
-
|
|
93
|
+
cancel: `${baseUrl}/orders/:id/cancel/`,
|
|
94
94
|
create: `${baseUrl}/orders/`,
|
|
95
|
-
submit: `${baseUrl}/orders/:id/submit/`,
|
|
96
95
|
get: `${baseUrl}/orders/:id/`,
|
|
97
96
|
invoice: {
|
|
98
97
|
download: `${baseUrl}/orders/:id/invoice/`,
|
|
99
98
|
},
|
|
100
99
|
submit_for_signature: `${baseUrl}/orders/:id/submit_for_signature/`,
|
|
101
100
|
submit_installment_payment: `${baseUrl}/orders/:id/submit_installment_payment/`,
|
|
101
|
+
set_payment_method: `${baseUrl}/orders/:id/payment-method/`,
|
|
102
102
|
},
|
|
103
103
|
certificates: {
|
|
104
104
|
download: `${baseUrl}/certificates/:id/download/`,
|
|
@@ -229,11 +229,6 @@ const API = (): Joanie.API => {
|
|
|
229
229
|
get: async (filters?: ResourcesQuery) => {
|
|
230
230
|
return fetchWithJWT(buildApiUrl(ROUTES.user.creditCards.get, filters)).then(checkStatus);
|
|
231
231
|
},
|
|
232
|
-
create: async (creditCard) =>
|
|
233
|
-
fetchWithJWT(ROUTES.user.creditCards.create, {
|
|
234
|
-
method: 'POST',
|
|
235
|
-
body: JSON.stringify(creditCard),
|
|
236
|
-
}).then(checkStatus),
|
|
237
232
|
update: async ({ id, ...creditCard }) => {
|
|
238
233
|
return fetchWithJWT(ROUTES.user.creditCards.update.replace(':id', id), {
|
|
239
234
|
method: 'PUT',
|
|
@@ -244,6 +239,8 @@ const API = (): Joanie.API => {
|
|
|
244
239
|
fetchWithJWT(ROUTES.user.creditCards.delete.replace(':id', id), {
|
|
245
240
|
method: 'DELETE',
|
|
246
241
|
}).then(checkStatus),
|
|
242
|
+
tokenize: async () =>
|
|
243
|
+
fetchWithJWT(ROUTES.user.creditCards.tokenize, { method: 'POST' }).then(checkStatus),
|
|
247
244
|
},
|
|
248
245
|
addresses: {
|
|
249
246
|
get: (id?: string) => {
|
|
@@ -265,10 +262,9 @@ const API = (): Joanie.API => {
|
|
|
265
262
|
}).then(checkStatus),
|
|
266
263
|
},
|
|
267
264
|
orders: {
|
|
268
|
-
|
|
269
|
-
return fetchWithJWT(ROUTES.user.orders.
|
|
265
|
+
cancel: async (id) => {
|
|
266
|
+
return fetchWithJWT(ROUTES.user.orders.cancel.replace(':id', id), {
|
|
270
267
|
method: 'POST',
|
|
271
|
-
body: payment_id ? JSON.stringify({ payment_id }) : undefined,
|
|
272
268
|
}).then(checkStatus);
|
|
273
269
|
},
|
|
274
270
|
create: async (payload) =>
|
|
@@ -276,11 +272,6 @@ const API = (): Joanie.API => {
|
|
|
276
272
|
method: 'POST',
|
|
277
273
|
body: JSON.stringify(payload),
|
|
278
274
|
}).then(checkStatus),
|
|
279
|
-
submit: async ({ id, ...payload }) =>
|
|
280
|
-
fetchWithJWT(ROUTES.user.orders.submit.replace(':id', id), {
|
|
281
|
-
method: 'PATCH',
|
|
282
|
-
body: JSON.stringify(payload),
|
|
283
|
-
}).then(checkStatus),
|
|
284
275
|
get: async (filters) => {
|
|
285
276
|
return fetchWithJWT(buildApiUrl(ROUTES.user.orders.get, filters)).then(checkStatus);
|
|
286
277
|
},
|
|
@@ -301,6 +292,11 @@ const API = (): Joanie.API => {
|
|
|
301
292
|
method: 'POST',
|
|
302
293
|
body: JSON.stringify(payload),
|
|
303
294
|
}).then(checkStatus),
|
|
295
|
+
set_payment_method: async ({ id, ...payload }) =>
|
|
296
|
+
fetchWithJWT(ROUTES.user.orders.set_payment_method.replace(':id', id), {
|
|
297
|
+
method: 'POST',
|
|
298
|
+
body: JSON.stringify(payload),
|
|
299
|
+
}).then(checkStatus),
|
|
304
300
|
},
|
|
305
301
|
enrollments: {
|
|
306
302
|
create: async (payload) =>
|
package/js/api/lms/dummy.ts
CHANGED
|
@@ -68,7 +68,7 @@ const API = (APIConf: LMSBackend | AuthenticationBackend): APILms => {
|
|
|
68
68
|
|
|
69
69
|
const dummyOpenEdxApiProfile: OpenEdxApiProfile = {
|
|
70
70
|
username: 'j_do',
|
|
71
|
-
name: 'John
|
|
71
|
+
name: 'John Doe',
|
|
72
72
|
email: 'j.do@whois.net',
|
|
73
73
|
country: 'fr',
|
|
74
74
|
level_of_education: OpenEdxLevelOfEducation.MASTER_OR_PROFESSIONNAL_DEGREE,
|
|
@@ -112,17 +112,6 @@ const API = (APIConf: LMSBackend | AuthenticationBackend): APILms => {
|
|
|
112
112
|
account: {
|
|
113
113
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
114
114
|
get: (username: string): Promise<OpenEdxApiProfile> => {
|
|
115
|
-
return Promise.resolve({
|
|
116
|
-
username: 'j_do',
|
|
117
|
-
name: 'John Do',
|
|
118
|
-
email: 'j.do@whois.net',
|
|
119
|
-
country: 'fr',
|
|
120
|
-
level_of_education: OpenEdxLevelOfEducation.MASTER_OR_PROFESSIONNAL_DEGREE,
|
|
121
|
-
gender: OpenEdxGender.MALE,
|
|
122
|
-
year_of_birth: '1971',
|
|
123
|
-
'pref-lang': OpenEdxLanguageIsoCode.ENGLISH,
|
|
124
|
-
language_proficiencies: [{ code: OpenEdxLanguageIsoCode.ENGLISH }],
|
|
125
|
-
} as OpenEdxApiProfile);
|
|
126
115
|
return Promise.resolve(dummyOpenEdxApiProfile);
|
|
127
116
|
},
|
|
128
117
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -4,6 +4,7 @@ import fetchMock from 'fetch-mock';
|
|
|
4
4
|
import { render, screen, waitFor, act } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
import { PropsWithChildren } from 'react';
|
|
7
|
+
import { CunninghamProvider } from '@openfun/cunningham-react';
|
|
7
8
|
import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie';
|
|
8
9
|
import { createTestQueryClient } from 'utils/test/createTestQueryClient';
|
|
9
10
|
import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider';
|
|
@@ -33,11 +34,13 @@ jest.mock('settings', () => ({
|
|
|
33
34
|
describe('<AbstractContractFrame />', () => {
|
|
34
35
|
const Wrapper = ({ children }: PropsWithChildren) => {
|
|
35
36
|
return (
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
<CunninghamProvider>
|
|
38
|
+
<QueryClientProvider client={createTestQueryClient({ user: true })}>
|
|
39
|
+
<IntlProvider locale="en">
|
|
40
|
+
<JoanieSessionProvider>{children}</JoanieSessionProvider>
|
|
41
|
+
</IntlProvider>
|
|
42
|
+
</QueryClientProvider>
|
|
43
|
+
</CunninghamProvider>
|
|
41
44
|
);
|
|
42
45
|
};
|
|
43
46
|
|
|
@@ -78,7 +81,7 @@ describe('<AbstractContractFrame />', () => {
|
|
|
78
81
|
expect(await screen.findByTestId('dashboard-contract-frame')).toBeInTheDocument();
|
|
79
82
|
|
|
80
83
|
const user = userEvent.setup();
|
|
81
|
-
await user.click(screen.getByRole('button', { name: '
|
|
84
|
+
await user.click(screen.getByRole('button', { name: 'close' }));
|
|
82
85
|
expect(mockOnClose).toHaveBeenCalled();
|
|
83
86
|
});
|
|
84
87
|
|
|
@@ -115,6 +118,7 @@ describe('<AbstractContractFrame />', () => {
|
|
|
115
118
|
const mockCheckSignature = jest.fn(async () => checkSignatureDeferred.promise);
|
|
116
119
|
const mockOnDone = jest.fn();
|
|
117
120
|
const mockOnClose = jest.fn();
|
|
121
|
+
fetchMock.post('https://joanie.endpoint/api/v1.0/signature/notifications/', 200);
|
|
118
122
|
|
|
119
123
|
await act(async () => {
|
|
120
124
|
render(
|
|
@@ -176,6 +180,7 @@ describe('<AbstractContractFrame />', () => {
|
|
|
176
180
|
const mockCheckSignature = jest.fn(async () => checkSignatureDeferred.promise);
|
|
177
181
|
const mockOnDone = jest.fn();
|
|
178
182
|
const mockOnClose = jest.fn();
|
|
183
|
+
fetchMock.post('https://joanie.endpoint/api/v1.0/signature/notifications/', 200);
|
|
179
184
|
|
|
180
185
|
await act(async () => {
|
|
181
186
|
render(
|
|
@@ -222,7 +227,7 @@ describe('<AbstractContractFrame />', () => {
|
|
|
222
227
|
// have been called
|
|
223
228
|
await expectBannerError('An error happened while verifying signature. Please come back later.');
|
|
224
229
|
expect(mockOnDone).not.toHaveBeenCalled();
|
|
225
|
-
button = screen.getByRole('button', { name: '
|
|
230
|
+
button = screen.getByRole('button', { name: 'close' });
|
|
226
231
|
await user.click(button);
|
|
227
232
|
|
|
228
233
|
expect(mockOnClose).toHaveBeenCalledTimes(1);
|
|
@@ -237,6 +242,7 @@ describe('<AbstractContractFrame />', () => {
|
|
|
237
242
|
const mockCheckSignature = jest.fn(async () => checkSignatureDeferred.promise);
|
|
238
243
|
const mockOnDone = jest.fn();
|
|
239
244
|
const mockOnClose = jest.fn();
|
|
245
|
+
fetchMock.post('https://joanie.endpoint/api/v1.0/signature/notifications/', 200);
|
|
240
246
|
|
|
241
247
|
await act(async () => {
|
|
242
248
|
render(
|
|
@@ -285,7 +291,7 @@ describe('<AbstractContractFrame />', () => {
|
|
|
285
291
|
'The signature is taking more time than expected ... please come back later.',
|
|
286
292
|
);
|
|
287
293
|
expect(mockOnDone).not.toHaveBeenCalled();
|
|
288
|
-
button = screen.getByRole('button', { name: '
|
|
294
|
+
button = screen.getByRole('button', { name: 'close' });
|
|
289
295
|
await user.click(button);
|
|
290
296
|
|
|
291
297
|
expect(mockOnClose).toHaveBeenCalledTimes(1);
|
|
@@ -300,6 +306,7 @@ describe('<AbstractContractFrame />', () => {
|
|
|
300
306
|
const mockCheckSignature = jest.fn(async () => checkSignatureDeferred.promise);
|
|
301
307
|
const mockOnDone = jest.fn();
|
|
302
308
|
const mockOnClose = jest.fn();
|
|
309
|
+
fetchMock.post('https://joanie.endpoint/api/v1.0/signature/notifications/', 200);
|
|
303
310
|
|
|
304
311
|
await act(async () => {
|
|
305
312
|
render(
|
|
@@ -323,7 +330,7 @@ describe('<AbstractContractFrame />', () => {
|
|
|
323
330
|
);
|
|
324
331
|
|
|
325
332
|
// Dummy signature interface should have been rendered
|
|
326
|
-
const button = screen.getByRole('button', { name: '
|
|
333
|
+
const button = screen.getByRole('button', { name: 'close' });
|
|
327
334
|
await user.click(button);
|
|
328
335
|
|
|
329
336
|
expect(mockOnClose).toHaveBeenCalledTimes(1);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { lazy, Suspense, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { Button, Loader } from '@openfun/cunningham-react';
|
|
2
|
+
import { Button, Loader, Modal, ModalSize } from '@openfun/cunningham-react';
|
|
3
3
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
4
|
-
import { Modal } from 'components/Modal';
|
|
5
4
|
import { Maybe } from 'types/utils';
|
|
6
5
|
import { CONTRACT_SETTINGS } from 'settings';
|
|
7
6
|
import Banner, { BannerType } from 'components/Banner';
|
|
8
7
|
import { SuccessIcon } from 'components/SuccessIcon';
|
|
8
|
+
import { noop } from 'utils';
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
/!\ This component should not be used directly, only its implementations should be.
|
|
@@ -63,7 +63,7 @@ export const messages = defineMessages({
|
|
|
63
63
|
},
|
|
64
64
|
finishedDescription: {
|
|
65
65
|
defaultMessage:
|
|
66
|
-
'You will receive an email once your contract will be fully signed. You can now
|
|
66
|
+
'You will receive an email once your contract will be fully signed. You can now finalize your subscription.',
|
|
67
67
|
description: 'Message displayed inside the contract signin modal when the contract is signed.',
|
|
68
68
|
id: 'components.DashboardItem.Order.ContractFrame.finishedDescription',
|
|
69
69
|
},
|
|
@@ -109,15 +109,16 @@ export interface SignatureProps {
|
|
|
109
109
|
invitationLink: string;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
const AbstractContractFrame = ({ isOpen, ...props }: Props) => {
|
|
112
|
+
const AbstractContractFrame = ({ isOpen, onClose = noop, ...props }: Props) => {
|
|
113
113
|
return (
|
|
114
114
|
<Modal
|
|
115
115
|
isOpen={isOpen}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
closeOnClickOutside={false}
|
|
117
|
+
closeOnEsc={false}
|
|
118
|
+
onClose={onClose}
|
|
119
|
+
size={ModalSize.LARGE}
|
|
119
120
|
>
|
|
120
|
-
<ContractFrameContent {...props} />
|
|
121
|
+
<ContractFrameContent {...props} onClose={onClose} />
|
|
121
122
|
</Modal>
|
|
122
123
|
);
|
|
123
124
|
};
|
|
@@ -220,11 +221,13 @@ const ContractFrameContent = ({
|
|
|
220
221
|
|
|
221
222
|
const renderLoadingContract = () => {
|
|
222
223
|
return (
|
|
223
|
-
<div className="
|
|
224
|
+
<div className="ContractFrame__container">
|
|
224
225
|
<h3 className="ContractFrame__caption">
|
|
225
226
|
<FormattedMessage {...messages.loadingContract} />
|
|
226
227
|
</h3>
|
|
227
|
-
<
|
|
228
|
+
<div className="ContractFrame__footer">
|
|
229
|
+
<Loader />
|
|
230
|
+
</div>
|
|
228
231
|
</div>
|
|
229
232
|
);
|
|
230
233
|
};
|
|
@@ -256,20 +259,20 @@ const ContractFrameContent = ({
|
|
|
256
259
|
</Suspense>
|
|
257
260
|
)}
|
|
258
261
|
{step === ContractSteps.POLLING && (
|
|
259
|
-
<div className="
|
|
260
|
-
<
|
|
261
|
-
<
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
<
|
|
265
|
-
|
|
266
|
-
|
|
262
|
+
<div className="ContractFrame__container">
|
|
263
|
+
<h3 className="ContractFrame__caption">
|
|
264
|
+
<FormattedMessage {...messages.polling} />
|
|
265
|
+
</h3>
|
|
266
|
+
<p className="ContractFrame__content">
|
|
267
|
+
<FormattedMessage {...messages.pollingDescription} />
|
|
268
|
+
</p>
|
|
269
|
+
<div className="ContractFrame__footer">
|
|
270
|
+
<Loader />
|
|
267
271
|
</div>
|
|
268
|
-
<Loader />
|
|
269
272
|
</div>
|
|
270
273
|
)}
|
|
271
274
|
{step === ContractSteps.FINISHED && (
|
|
272
|
-
<div className="
|
|
275
|
+
<div className="ContractFrame__container">
|
|
273
276
|
<SuccessIcon />
|
|
274
277
|
<h3 className="ContractFrame__caption">
|
|
275
278
|
<FormattedMessage {...messages.finishedCaption} />
|
|
@@ -277,9 +280,11 @@ const ContractFrameContent = ({
|
|
|
277
280
|
<p className="ContractFrame__content">
|
|
278
281
|
<FormattedMessage {...messages.finishedDescription} />
|
|
279
282
|
</p>
|
|
280
|
-
<
|
|
281
|
-
<
|
|
282
|
-
|
|
283
|
+
<div className="ContractFrame__footer">
|
|
284
|
+
<Button onClick={onClose}>
|
|
285
|
+
<FormattedMessage {...messages.finishedButton} />
|
|
286
|
+
</Button>
|
|
287
|
+
</div>
|
|
283
288
|
</div>
|
|
284
289
|
)}
|
|
285
290
|
</div>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useQueryClient } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { Order, AbstractNestedOrder } from 'types/Joanie';
|
|
3
3
|
import { useJoanieApi } from 'contexts/JoanieApiContext';
|
|
4
4
|
import AbstractContractFrame, {
|
|
5
5
|
AbstractProps,
|
|
6
6
|
} from 'components/ContractFrame/AbstractContractFrame';
|
|
7
7
|
|
|
8
8
|
interface Props extends AbstractProps {
|
|
9
|
-
order:
|
|
9
|
+
order: Order | AbstractNestedOrder;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const LearnerContractFrame = ({ order, onDone, ...props }: Props) => {
|
|
@@ -17,15 +17,13 @@ iframe#lex-persona {
|
|
|
17
17
|
|
|
18
18
|
.ContractFrame {
|
|
19
19
|
&__modal-body {
|
|
20
|
-
padding:
|
|
20
|
+
padding: 1.5rem 3rem;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
&
|
|
23
|
+
&__container {
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: column;
|
|
26
26
|
align-items: center;
|
|
27
|
-
padding: 3rem 0;
|
|
28
|
-
gap: 4rem;
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
&__caption {
|
|
@@ -33,16 +31,6 @@ iframe#lex-persona {
|
|
|
33
31
|
font-size: 1.5rem;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
&__finished {
|
|
37
|
-
display: flex;
|
|
38
|
-
flex-direction: column;
|
|
39
|
-
align-items: center;
|
|
40
|
-
|
|
41
|
-
button {
|
|
42
|
-
margin-top: 2.5rem;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
34
|
&__content {
|
|
47
35
|
color: r-theme-val(contract-frame, content-color);
|
|
48
36
|
font-size: 0.875rem;
|
|
@@ -59,4 +47,8 @@ iframe#lex-persona {
|
|
|
59
47
|
align-items: center;
|
|
60
48
|
gap: 2rem;
|
|
61
49
|
}
|
|
50
|
+
|
|
51
|
+
&__footer {
|
|
52
|
+
margin-top: 2.5rem;
|
|
53
|
+
}
|
|
62
54
|
}
|
|
@@ -53,11 +53,11 @@ describe('CreditCardSelector', () => {
|
|
|
53
53
|
render(<Wrapper />);
|
|
54
54
|
|
|
55
55
|
// During loading state, the spinner should be displayed and the current selected card should not be displayed.
|
|
56
|
-
expect(screen.queryByText('
|
|
56
|
+
expect(screen.queryByText('Use another credit card')).not.toBeInTheDocument();
|
|
57
57
|
await expectSpinner();
|
|
58
58
|
await expectNoSpinner();
|
|
59
59
|
|
|
60
|
-
screen.getByText('Use another credit card
|
|
60
|
+
screen.getByText('Use another credit card');
|
|
61
61
|
|
|
62
62
|
// As the user has no credit card, the edit button should not be displayed.
|
|
63
63
|
expect(
|
|
@@ -206,7 +206,7 @@ describe('CreditCardSelector', () => {
|
|
|
206
206
|
await user.click(editButton);
|
|
207
207
|
|
|
208
208
|
const radio = screen.getByRole('radio', {
|
|
209
|
-
name: /Use another credit card
|
|
209
|
+
name: /Use another credit card/i,
|
|
210
210
|
});
|
|
211
211
|
await user.click(radio);
|
|
212
212
|
|
|
@@ -216,7 +216,7 @@ describe('CreditCardSelector', () => {
|
|
|
216
216
|
await user.click(submitButton);
|
|
217
217
|
|
|
218
218
|
expect(screen.queryByTestId('credit-card-selector-modal')).not.toBeInTheDocument();
|
|
219
|
-
screen.getByText('Use another credit card
|
|
219
|
+
screen.getByText('Use another credit card');
|
|
220
220
|
expect(contextRef.current.creditCard).toBeUndefined();
|
|
221
221
|
});
|
|
222
222
|
|
|
@@ -244,15 +244,15 @@ describe('CreditCardSelector', () => {
|
|
|
244
244
|
await screen.findByTestId('credit-card-' + mainCreditCard.id);
|
|
245
245
|
screen.getByText(mainCreditCard.title!);
|
|
246
246
|
screen.getByText('Ends with •••• ' + mainCreditCard.last_numbers);
|
|
247
|
-
expect(screen.queryByText('Add new credit card during payment')).not.toBeInTheDocument();
|
|
248
247
|
expect(contextRef.current.creditCard!.id).toEqual(mainCreditCard.id);
|
|
249
248
|
|
|
250
249
|
const user = userEvent.setup();
|
|
251
|
-
const button = screen.getByRole('button', { name: /use another credit card
|
|
250
|
+
const button = screen.getByRole('button', { name: /use another credit card/i });
|
|
252
251
|
await user.click(button);
|
|
253
252
|
|
|
254
253
|
expect(screen.queryByTestId('credit-card-selector-modal')).not.toBeInTheDocument();
|
|
255
|
-
screen.getByText('Use another credit card
|
|
254
|
+
screen.getByText('Use another credit card');
|
|
255
|
+
expect(button).not.toBeInTheDocument();
|
|
256
256
|
expect(contextRef.current.creditCard).toBeUndefined();
|
|
257
257
|
});
|
|
258
258
|
|
|
@@ -35,7 +35,7 @@ const messages = defineMessages({
|
|
|
35
35
|
creditCardEmptyInlineDescription: {
|
|
36
36
|
id: 'components.SaleTunnel.CreditCardSelector.creditCardEmptyInlineDescription',
|
|
37
37
|
description: 'Description for the empty credit card inline',
|
|
38
|
-
defaultMessage: 'Use another credit card
|
|
38
|
+
defaultMessage: 'Use another credit card',
|
|
39
39
|
},
|
|
40
40
|
modalTitle: {
|
|
41
41
|
id: 'components.SaleTunnel.CreditCardSelector.modalTitle',
|
|
@@ -122,7 +122,7 @@ export const CreditCardSelector = ({
|
|
|
122
122
|
<Button
|
|
123
123
|
onClick={() => setCreditCard(undefined)}
|
|
124
124
|
size="small"
|
|
125
|
-
color="
|
|
125
|
+
color="secondary"
|
|
126
126
|
className="mt-t"
|
|
127
127
|
fullWidth={isMobile}
|
|
128
128
|
>
|
|
@@ -5,8 +5,8 @@ import userEvent from '@testing-library/user-event';
|
|
|
5
5
|
import { QueryClientProvider } from '@tanstack/react-query';
|
|
6
6
|
import fetchMock from 'fetch-mock';
|
|
7
7
|
import { faker } from '@faker-js/faker';
|
|
8
|
-
import { ContractFactory, CredentialOrderFactory } from 'utils/test/factories/joanie';
|
|
9
8
|
import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie';
|
|
9
|
+
import { ContractFactory, CredentialOrderFactory } from 'utils/test/factories/joanie';
|
|
10
10
|
import { createTestQueryClient } from 'utils/test/createTestQueryClient';
|
|
11
11
|
import JoanieApiProvider from 'contexts/JoanieApiContext';
|
|
12
12
|
import { alert } from 'utils/indirection/window';
|