@wearejh/m2-pwa-user-gql
v0.56.0
Published
GQL implementation of m2-pwa-user — drop-in replacement that swaps REST epics for Apollo GraphQL
Keywords
Readme
@wearejh/m2-pwa-user-gql
Drop-in GQL replacement for @wearejh/m2-pwa-user.
Overview
Provides the same Redux actions, reducer, types, and hooks as m2-pwa-user but replaces the three REST-based epics with Apollo GraphQL equivalents:
| Epic | REST | GQL mutation / query |
|------|------|----------------------|
| signInEpic | POST /V1/integration/customer/token + GET /V1/customers/me | generateCustomerToken + customer |
| refreshEpic | GET /V1/customers/me | customer |
| createAccountEpic | POST /V1/customers | createCustomerV2 |
The non-REST epics (hydrateEpic, persistUserEpic, resetUserState) are re-exported directly from m2-pwa-user — they are unchanged.
Usage
Replace your import:
- import { userRegister } from '@wearejh/m2-pwa-user';
+ import { userRegister } from '@wearejh/m2-pwa-user-gql';Everything else — actions, hooks, reducer shape — stays the same.
Epic overrides
Like cartRegister in m2-pwa-cart-gql, userRegister accepts a partial overrides map:
import { userRegister } from '@wearejh/m2-pwa-user-gql';
import { myCustomSignInEpic } from './myCustomSignIn';
const register = userRegister({ signInEpic: myCustomSignInEpic });GQL queries
lib/queries/generateCustomerToken.graphql— sign-in mutationlib/queries/getCustomer.graphql— fetch customer data (used by sign-in and refresh)lib/queries/createCustomer.graphql— register mutation
