-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish order confirmation page (#401)
* Add ability to pass initial values to create account * Prefill create account after order confirmation * Add tests
- Loading branch information
1 parent
2650c5d
commit 1fbbf74
Showing
11 changed files
with
130 additions
and
47 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
import darkThemeClasses from './darkTheme.css'; | ||
|
||
export { default } from './button'; | ||
export { darkThemeClasses } from './darkTheme'; | ||
export { darkThemeClasses }; |
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
16 changes: 16 additions & 0 deletions
16
packages/venia-concept/src/components/Checkout/Receipt/asyncActions.js
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,16 @@ | ||
import { resetCheckout } from 'src/actions/checkout/asyncActions'; | ||
import { getAccountInformation } from './selectors'; | ||
|
||
export const handleCreateAccount = history => async (dispatch, getState) => { | ||
const accountInfo = getAccountInformation(getState()); | ||
|
||
await dispatch(resetCheckout()); | ||
|
||
history.push(`/create-account?${new URLSearchParams(accountInfo)}`); | ||
}; | ||
|
||
export const handleContinueShopping = history => async dispatch => { | ||
await dispatch(resetCheckout()); | ||
|
||
history.push('/'); | ||
}; |
4 changes: 2 additions & 2 deletions
4
packages/venia-concept/src/components/Checkout/Receipt/receipt.css
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
13 changes: 9 additions & 4 deletions
13
packages/venia-concept/src/components/Checkout/Receipt/receiptContainer.js
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 |
---|---|---|
@@ -1,12 +1,17 @@ | ||
import { connect } from 'react-redux'; | ||
import { resetCheckout } from 'src/actions/checkout'; | ||
import { compose } from 'redux'; | ||
import { withRouter } from 'react-router-dom'; | ||
import actions from './actions'; | ||
import { handleCreateAccount, handleContinueShopping } from './asyncActions'; | ||
import Receipt from './receipt'; | ||
import { getOrderInformation } from './selectors'; | ||
|
||
const { reset } = actions; | ||
|
||
export default connect( | ||
state => ({ order: getOrderInformation(state) }), | ||
{ resetCheckout, reset } | ||
export default compose( | ||
connect( | ||
state => ({ order: getOrderInformation(state) }), | ||
{ handleContinueShopping, reset, handleCreateAccount } | ||
), | ||
withRouter | ||
)(Receipt); |
12 changes: 12 additions & 0 deletions
12
packages/venia-concept/src/components/Checkout/Receipt/selectors.js
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 |
---|---|---|
@@ -1 +1,13 @@ | ||
export const getOrderInformation = ({ checkoutReceipt: { order } }) => order; | ||
|
||
export const getAccountInformation = ({ | ||
checkoutReceipt: { | ||
order: { | ||
billing_address: { | ||
email, | ||
firstname: firstName, | ||
lastname: lastName | ||
} = {} | ||
} | ||
} | ||
}) => ({ email, firstName, lastName }); |