import { Ref, ComputedRef } from 'vue'; import { GraphQLClient, FavoriteList } from '@propeller-commerce/propeller-sdk-v2'; import { AnyUser } from '@propeller-commerce/propeller-v2-core-ui'; export interface FavoriteListFormData { name: string; isDefault: boolean; } /** What a favorite-list mutation did — see `onListChanged`. */ export interface FavoriteListChange { action: 'created' | 'updated' | 'deleted'; listId?: string | number; name?: string; isDefault?: boolean; } export interface UseFavoritesOptions { graphqlClient: GraphQLClient; user: Ref; language?: Ref; onCreate?: (data: FavoriteListFormData) => void; onEdit?: (id: string, data: FavoriteListFormData) => void; onDelete?: (id: string) => void; /** * Called after a list mutation succeeds. * * The `change` argument is optional so existing zero-argument callbacks keep * working, but without it a host cannot tell a create from a delete — which * makes the composable useless for analytics, audit trails or optimistic UI * that needs to know WHAT happened rather than merely THAT something did. */ onListChanged?: (change?: FavoriteListChange) => void; } export interface UseFavoritesReturn { lists: Ref; loading: Ref; saving: Ref; error: Ref; editingListId: Ref; editListName: Ref; editSetAsDefault: Ref; newListName: Ref; newSetAsDefault: Ref; listToDelete: Ref; fetchLists: () => void; startEdit: (list: FavoriteList) => void; cancelEdit: () => void; updateList: (listId: string) => Promise; confirmDelete: (list: FavoriteList) => void; deleteList: () => Promise; createList: (name: string, isDefault: boolean) => Promise; addToList: (listId: string, productId?: number, clusterId?: number) => Promise; removeFromList: (listId: string, productId?: number | number[], clusterId?: number | number[]) => Promise; isProductInList: (listId: string, productId: number) => ComputedRef; } export declare function useFavorites(options: UseFavoritesOptions): UseFavoritesReturn;