-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨(frontend) create SaleTunnelNotValidated step
Currently, after payment success, if we reach the poll limit, we only display an error message to explain to the user it has to wait as its order validation its too long. It works but it's good for UX as user has to close the payment modal at the payment step. That's why we decided to create a SaleTunnelNotValidated. This component is shown when the poll limit is reach and it helps the user to understand that it has to wait a little bit to start its training.
- Loading branch information
Showing
10 changed files
with
161 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
src/frontend/js/components/SaleTunnel/SaleTunnelNotValidated/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; | ||
import { Button } from '@openfun/cunningham-react'; | ||
import { generatePath } from 'react-router-dom'; | ||
import WarningIcon from 'components/WarningIcon'; | ||
import { getDashboardBasename } from 'widgets/Dashboard/hooks/useDashboardRouter/getDashboardBasename'; | ||
import { useSaleTunnelContext } from 'components/SaleTunnel/GenericSaleTunnel'; | ||
import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRoutesPaths'; | ||
import { ProductType } from 'types/Joanie'; | ||
|
||
const messages = defineMessages({ | ||
apology: { | ||
defaultMessage: "Sorry, you'll have to wait a little longer!", | ||
description: 'Text displayed to thank user for his order', | ||
id: 'components.SaleTunnelSuccessNotValidated.apology', | ||
}, | ||
title: { | ||
defaultMessage: 'It takes too long to validate your order.', | ||
description: 'Message to confirm that order has been created', | ||
id: 'components.SaleTunnelSuccessNotValidated.title', | ||
}, | ||
description: { | ||
defaultMessage: | ||
'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.', | ||
description: "Text to remind that order's invoice will be send by email soon", | ||
id: 'components.SaleTunnelSuccessNotValidated.description', | ||
}, | ||
cta: { | ||
defaultMessage: 'Close', | ||
description: 'Label to the call to action to close sale tunnel', | ||
id: 'components.SaleTunnelSuccessNotValidated.cta', | ||
}, | ||
}); | ||
|
||
const SaleTunnelNotValidated = ({ closeModal }: { closeModal: () => void }) => { | ||
const intl = useIntl(); | ||
const { order, product } = useSaleTunnelContext(); | ||
return ( | ||
<section className="sale-tunnel-end" data-testid="generic-sale-tunnel-not-validated-step"> | ||
<header className="sale-tunnel-end__header"> | ||
<WarningIcon /> | ||
<h3 className="sale-tunnel-end__title"> | ||
<FormattedMessage {...messages.apology} /> | ||
</h3> | ||
</header> | ||
<p className="sale-tunnel-end__content"> | ||
<FormattedMessage {...messages.title} /> | ||
<br /> | ||
<FormattedMessage {...messages.description} /> | ||
</p> | ||
<footer className="sale-tunnel-end__footer"> | ||
{product.type === ProductType.CREDENTIAL ? ( | ||
<Button | ||
href={ | ||
getDashboardBasename(intl.locale) + | ||
generatePath(LearnerDashboardPaths.ORDER, { orderId: order!.id }) | ||
} | ||
> | ||
<FormattedMessage {...messages.cta} /> | ||
</Button> | ||
) : ( | ||
<Button onClick={closeModal}> | ||
<FormattedMessage {...messages.cta} /> | ||
</Button> | ||
)} | ||
</footer> | ||
</section> | ||
); | ||
}; | ||
|
||
export default SaleTunnelNotValidated; |
63 changes: 0 additions & 63 deletions
63
src/frontend/js/components/SaleTunnel/SaleTunnelSuccess/_styles.scss
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.