User Selectors

getUserData

Retrieves the user data object from the store.

Usage

import { getUserData } from '@shopgate/engage/user';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getUserData } from '@shopgate/pwa-common/selectors/user'

Parameters

  • state (Object) required: The application state.

Returns

(Object|null): The user data. If no user data is found, it returns null.

The user data will match the getUser pipeline response.


isUserLoggedIn

Retrieves whether the user is logged in from the user data in the store.

Usage

import { isUserLoggedIn } from '@shopgate/engage/user';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { isUserLoggedIn } from '@shopgate/pwa-common/selectors/user'

Parameters

  • state (Object) required: The application state.

Returns

(boolean): Whether the user is logged in.


getUserDisplayName

Retrieves the display name ({firstName} {lastName}) for a user from the user data in the store.

Usage

import { getUserDisplayName } from '@shopgate/engage/user';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getUserDisplayName } from '@shopgate/pwa-common/selectors/user'

Parameters

  • state (Object) required: The application state.

Returns

(string|null): The display name for a user. If no data is found, it returns null.


getUserFirstName

Retrieves the first name for a user from the user data in the store.

Usage

import { getUserFirstName } from '@shopgate/engage/user';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getUserFirstName } from '@shopgate/pwa-common/selectors/user'

Parameters

  • state (Object) required: The application state.

Returns

(string|null): The first name for a user. If no data is found, it returns null.


getUserEmail

Retrieves the email for the currently logged in user.

Usage

import { getUserEmail } from '@shopgate/engage/user';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getUserEmail } from '@shopgate/pwa-common/selectors/user'

Parameters

  • state (Object) required: The application state.

Returns

(string|null): The email for the user. If no data is found, it returns null.


isUserLoginDisabled

Retrieves whether the user login is disabled from the user data in the store.

Usage

import { isUserLoginDisabled } from '@shopgate/engage/user';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { isUserLoginDisabled } from '@shopgate/pwa-common/selectors/user'

Parameters

  • state (Object) required: The application state.

Returns

(boolean): Whether the user login is disabled.


getRegisterUrl

Retrieves the registration URL from the data in the store.

Usage

import { getRegisterUrl } from '@shopgate/engage/user';

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { getRegisterUrl } from '@shopgate/pwa-common/selectors/user'

Parameters

  • state (Object) required: The application state.

Returns

(string|null): The registration URL. If no URL is found, it returns null.