import {useShopActionQuery} from '../../internal/reactQuery' import {useShopActions} from '../../internal/useShopActions' import { DataHookOptionsBase, DataHookReturnsBase, BuyerAttributes, } from '../../types' export interface UseBuyerAttributesParams extends DataHookOptionsBase {} export interface UseBuyerAttributesReturns extends DataHookReturnsBase { buyerAttributes: BuyerAttributes | null } export const useBuyerAttributes = ( params?: UseBuyerAttributesParams ): UseBuyerAttributesReturns => { const {skip, ...shopActionParams} = params || {} const {getBuyerAttributes} = useShopActions() const {data, ...rest} = useShopActionQuery( ['buyerAttributes', shopActionParams], getBuyerAttributes, shopActionParams, {skip} ) return { ...rest, buyerAttributes: data, } } /** * The `useBuyerAttributes` hook fetches shopping preference signals for personalization. Returns `genderAffinity` (MALE, FEMALE, or NEUTRAL) and `categoryAffinities` (list of product taxonomy categories the user engages with). Use this data to customize product recommendations, filter content, or tailor messaging. This is privacy-sensitive data derived from the user's Shop activity, always handle respectfully and transparently in your UI. * * * > Caution: This hook requires adding the following scopes to the manifest file: * > * > `profile` * > * > For more details, see [manifest.json](/docs/api/shop-minis/manifest-file). * * @publicDocs */ export type UseBuyerAttributesGeneratedType = ( params?: UseBuyerAttributesParams ) => UseBuyerAttributesReturns