-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CIF-1400 - MyAccount - Account Information Page #409
Conversation
Create the Account Details component in AEM
Update unit tests for the Account Details component
* add a form validator for the password field (along with unit tests) * switch to a named export for the Portal component * add unit tests
… the source file instead of from `index.js`
Codecov Report
@@ Coverage Diff @@
## master #409 +/- ##
============================================
+ Coverage 86.11% 86.28% +0.17%
Complexity 950 950
============================================
Files 188 198 +10
Lines 4918 5053 +135
Branches 697 729 +32
============================================
+ Hits 4235 4360 +125
- Misses 541 551 +10
Partials 142 142
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
I think if you move the queries out of the |
* Configure Jest to ignore all the graphql files in the project, regardless of location. * Fixed bug which was causing the update mutation to be run regardless if the data was changed or not.
@herzog31 Definitely, and we also validate all queries with https://github.com/adobe/aem-core-cif-components/blob/master/react-components/src/queries/__test__/validateQueries.test.js so let's keep them all in that same folder. |
* move the queries in the `queries` folder * fix a warning in an unit test
import { useQuery, useMutation } from '@apollo/react-hooks'; | ||
import { useUserContext } from '../../context/UserContext'; | ||
|
||
const useAccountDetails = props => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this hook stores state, I think it would be appropriate to use a React context here. So you don't need to pass all the exported logic and state here via props to child components like EditModal
and EditForm
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are only a few components under this tree, I don't see any reason to use a React Context just to manage the state of a modal. In general, I don't see any problem with passing state down to child components for trivial matters. I see React Contexts for cross-cutting concerns, like make some "context data" available to components that are not part of the same sub-tree.
|
||
const OPTIONS_DEFAULTS = { behavior: 'smooth', block: 'center' }; | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we add a note or copyright header here, since this is taken from PWA studio?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original component doesn't have a copyright header - https://github.com/magento/pwa-studio/blob/develop/packages/peregrine/lib/hooks/useScrollIntoView.js
I'll add a link to the original code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a problem actually. IIUC Magento uses OSL 3.0 which requires to publish any used code under OSL 3.0 as well which is incompatible with our Apache 2.0 license. I think we need to double check that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they use OSL 3.0 which is not compatible with our license IIUC.
I'll revert the change and use a different method just to be safe.
…ponents into features/CIF-1400
* The password field is not cleared after the form submit * If a form error is thrown the error field is not cleared when the form is "Cancelled"
…o features/CIF-1400
Description
This PR adds the implementation of the
AccountDetails
components along with a few helper components. As a first, I included the GraphQL queries in the component's folders instead of the./queries
folder since that folder already grew too large.I added a
Dialog
component which renders the edit form in a modal dialog. This component was directly taken from Venia.I added a
Password
field component to render the password field which features a "toggle" that shows the password in clear case.PR in Venia: adobe/aem-cif-guides-venia#63
Related Issue
CIF-1400
Motivation and Context
As a shopper, I want to update my personal data such as name, e-mail, and password.
How Has This Been Tested?
Prerequisites: fresh instance of AEM (on-prem or cloud)
1/ Install Venia with the development version of AEM Core CIF React Components
2/ Login with an existing user
3/ Click the "Account information" link.
4/ Check that the Account Details page opens correctly and retrieves the correct data
5/ Click the "Edit" button
6/ Check that the modal dialog opens and it's pre-filled with the correct data.
7/ Change any of the data (either name or e-mail) and click "Save".
8/ Check that the data is refreshed.
9/ Click the Edit button again
10/ Change the password - check that you get the validation error when you try to use the same password
11/ Click "Save"
12/ Sign out and sign in again with the new password - it should work.
Screenshots (if appropriate):
## Types of changes
Checklist: