All files / src/features/Merchants/MerchantsTable types.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46                                                                                           
import { GiveSearchBarProps } from "@shared/SearchBar/GiveSearchBar";
import { ButtonProps as GiveButtonProps } from "@shared/Button/GiveButton.types";
import { ReactNode } from "react";
 
export type TOption = {
  value: string;
  label: string;
  id?: number | string;
  Image?: ReactNode;
  imageUrl?: string;
  onClick?: (option: TOption) => void;
};
 
export type DropdownFilterProps = {
  options: TOption[];
  queryKey: string;
  menuWidth?: number;
  searchBarProps?: GiveSearchBarProps;
  isLoading?: boolean;
  isFetchingNextPage?: boolean;
  onEndReached?: () => void;
  onCloseEmptyState?: () => void;
  buttonProps?: Omit<
    GiveButtonProps,
    "label" | "onClick" | "endIcon" | "startIcon" | "size"
  >;
  disabled?: boolean;
};
 
export type UseDropdownFilterParams = {
  queryKey: string; // e.g. "approvalStateName" | "riskLevelLabelDisplayName"
  options: TOption[];
};
 
/**
 * Build query string for API / URL
 * - Returns empty string if 'all' is selected
 * - Toggles selection if already applied
 */
export type BuildQueryStringArgs = {
  option: TOption;
  queryKey: string;
  currentFilters?: TOption[]; // current applied filters for this queryKey
  otherValues: Record<string, any>; // everything else except watchlist
};