All files / src/components/Settings/Permissions types.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86                                                                                                                                              5x                            
export type BulkSelectArgs = {
  checked: boolean;
  isIndeterminate: boolean;
  allData: string[];
  callback?: (val: boolean) => void;
  filterOnly?: boolean;
};
 
export type PermissionType = "Acquirer" | "Merchant" | "Enterprise";
 
export type TPermission = {
  id: string;
  name: string;
  description?: string;
  isDeny: boolean;
  actionName: string;
  resourceName: string;
  categoryName: string;
  sectionName: string;
  createdAt: number;
  updatedAt: number;
  isAttached: boolean;
  isGlobal: boolean;
  processorName: string;
};
 
export type PermissionResponseType = {
  section: string;
  permissions: TPermission[];
};
 
export type TPermissionQueryData = {
  data: PermissionResponseType[];
  total: number;
};
 
export interface PermissionGroupProps {
  groupKey: string;
  memberId: number;
  permissions?: TPermission[];
  selectedValues?: string[];
  handleBulkSelect: (arg: BulkSelectArgs) => void;
  triggerGroupSelectionReset?: boolean;
  hasSearchOrFilter?: boolean;
  isEditAllowed: boolean;
  onSingleSelect: (checked: boolean, id: string) => void;
  isDirty: boolean;
}
 
export interface PermissionGroupHeaderProps {
  groupKey: string;
  permissions?: TPermission[] | string[];
  isIndeterminate?: boolean;
  isAllGroupSelected?: boolean;
  showModified: boolean;
  onSelectAllGroup: (
    event: React.ChangeEvent<HTMLInputElement>,
    checked: boolean,
  ) => void;
  isAttachAccessPolicyAllowed?: boolean;
  isSelectType?: boolean;
  memberId: number;
}
 
export interface ActionButtonProps {
  selected: boolean;
  variant: PermissionActionVariant;
  disabled?: boolean;
  onClick?: () => void;
}
 
export const PERMISSION_ACTIONS = [
  { label: "Allow", value: "allow", variant: "success" },
  { label: "Deny", value: "deny", variant: "error" },
] as const;
 
export type PermissionActionType = (typeof PERMISSION_ACTIONS)[number]["value"];
export type PermissionActionVariant =
  (typeof PERMISSION_ACTIONS)[number]["variant"];
 
export type BulkActionType = "allow" | "deny" | "detach";
export type BulkActionObject = {
  label: string;
  value: BulkActionType;
};