Skip to content
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

PWA-3078::The user is unable to get any message once the account is c… #4131

Merged
merged 8 commits into from
Oct 4, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ const initialProps = {
getCartDetailsQuery: 'getCartDetailsQuery',
setDefaultUsername: jest.fn(),
showCreateAccount: jest.fn(),
showForgotPassword: jest.fn()
showForgotPassword: jest.fn(),
handleTriggerClick: jest.fn()
};

const clearCacheData = jest.fn();
Expand Down
5 changes: 4 additions & 1 deletion packages/peregrine/lib/talons/SignIn/useSignIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useEventingContext } from '../../context/eventing';

export const useSignIn = props => {
const {
handleTriggerClick,
getCartDetailsQuery,
setDefaultUsername,
showCreateAccount,
Expand Down Expand Up @@ -66,6 +67,7 @@ export const useSignIn = props => {
const handleSubmit = useCallback(
async ({ email, password }) => {
setIsSigningIn(true);
handleTriggerClick();
try {
// Get source cart id (guest cart id).
const sourceCartId = cartId;
Expand Down Expand Up @@ -142,7 +144,8 @@ export const useSignIn = props => {
fetchUserDetails,
getCartDetails,
fetchCartDetails,
dispatch
dispatch,
handleTriggerClick
]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports[`it renders a loading indicator when appropriate 1`] = `
</span>
<span
aria-atomic="true"
aria-label="Toggle My Account Menu"
aria-label="Hiundefined"
aria-live="polite"
className="text"
>
Expand Down
11 changes: 7 additions & 4 deletions packages/venia-ui/lib/components/AccountChip/accountChip.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ const AccountChip = props => {
const classes = useStyle(defaultClasses, props.classes);
const { formatMessage } = useIntl();

const ariaLabelMyMenu = formatMessage({
id: 'accountTrigger.ariaLabelMyMenu',
defaultMessage: 'Toggle My Account Menu'
});
const ariaLabelMyMenu =
currentUser != null
? formatMessage({
id: 'Hi' + currentUser.firstname,
defaultMessage: 'Hi' + currentUser.firstname
})
: '';

const ariaLabel = isUserSignedIn ? ariaLabelMyMenu : '';

Expand Down
7 changes: 6 additions & 1 deletion packages/venia-ui/lib/components/AccountMenu/accountMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import ForgotPassword from '../ForgotPassword';
import defaultClasses from './accountMenu.module.css';

const AccountMenu = React.forwardRef((props, ref) => {
const { accountMenuIsOpen, setAccountMenuIsOpen } = props;
const {
handleTriggerClick,
accountMenuIsOpen,
setAccountMenuIsOpen
} = props;
const talonProps = useAccountMenu({
accountMenuIsOpen,
setAccountMenuIsOpen
Expand Down Expand Up @@ -67,6 +71,7 @@ const AccountMenu = React.forwardRef((props, ref) => {
default: {
dropdownContents = (
<SignIn
handleTriggerClick={handleTriggerClick}
classes={{
modal_active: classes.loading
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Array [
</div>,
<require('../AccountMenu')
accountMenuIsOpen={false}
handleTriggerClick={[MockFunction handleTriggerClick]}
/>,
]
`;
1 change: 1 addition & 0 deletions packages/venia-ui/lib/components/Header/accountTrigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const AccountTrigger = props => {
</div>
<Suspense fallback={null}>
<AccountMenu
handleTriggerClick={handleTriggerClick}
ref={accountMenuRef}
accountMenuIsOpen={accountMenuIsOpen}
setAccountMenuIsOpen={setAccountMenuIsOpen}
Expand Down
2 changes: 2 additions & 0 deletions packages/venia-ui/lib/components/SignIn/signIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import GoogleRecaptcha from '../GoogleReCaptcha';
const SignIn = props => {
const classes = useStyle(defaultClasses, props.classes);
const {
handleTriggerClick,
setDefaultUsername,
showCreateAccount,
showForgotPassword,
Expand All @@ -27,6 +28,7 @@ const SignIn = props => {

const { formatMessage } = useIntl();
const talonProps = useSignIn({
handleTriggerClick,
getCartDetailsQuery: GET_CART_DETAILS_QUERY,
setDefaultUsername,
showCreateAccount,
Expand Down