Engine: Wishlist
The server-backed wishlist: WishlistProvider and useWishlistContext.
Generated from packages/engine/src/wishlist/: 1 files, 6 exported symbols. Signatures and types are shown as written in the source.
@magenxcommerce/engine/wishlist/wishlist-context
packages/engine/src/wishlist/wishlist-context.tsxclient
WISHLIST_STORAGE_KEY const
const WISHLIST_STORAGE_KEY = "magenx_wishlist"localStorage key for the guest (logged-out) wishlist mirror.
WishlistEntry interface
Normalized wishlist line shared by both guest (localStorage) and customer (Magento GraphQL) modes. Membership is keyed on sku — the stable cross-system identifier, since Magento's wishlist is sku-based. In customer mode wishlistItemId is set and used for removal (Magento removes by item id, not sku).
| Member | Type | Description |
|---|---|---|
sku | string | |
wishlistItemId? | string | |
name | string | |
url_key | string | |
image_url? | string | |
price? | number | |
currency? | string | |
stock_status? | "IN_STOCK" | "OUT_OF_STOCK" |
WishlistProduct interface
Minimal product shape needed to save an item (a ProductInterface satisfies it).
| Member | Type | Description |
|---|---|---|
sku | string | |
name | string | |
url_key | string | |
uid? | string | |
stock_status? | "IN_STOCK" | "OUT_OF_STOCK" | |
image? | { url?: string | null } | null | |
price_range? | { minimum_price?: { final_price?: { value?: number; currency?: string } | null; } | null; } | null |
WishlistContextValue interface
| Member | Type | Description |
|---|---|---|
items | WishlistEntry[] | |
count | number | |
loading | boolean | |
hydrated | boolean | True once client storage has been read — avoids SSR hydration mismatch. |
isInWishlist | (sku: string) => boolean | |
add | (product: WishlistProduct) => Promise<{ error?: string }> | |
remove | (sku: string) => Promise<void> | |
toggle | (product: WishlistProduct, event?: ReactMouseEvent) => void |
WishlistProvider function
WishlistProvider({ children }: { children: ReactNode })useWishlistContext function
useWishlistContext(): WishlistContextValue