@commercetools-frontend/permissions
Version:
React components to declaratively handle MC permissions
25 lines (24 loc) • 974 B
TypeScript
import { ComponentType } from 'react';
type TPermissionName = string;
type TActionRightName = string;
type TActionRightGroup = string;
type TDemandedActionRight = {
group: TActionRightGroup;
name: TActionRightName;
};
type TDemandedDataFence = {
group: string;
name: string;
type: string;
};
type TSelectDataFenceData = (demandedDataFenceWithActualValues: TDemandedDataFence & {
actualDataFenceValues: string[];
}) => string[] | null;
type TOptions<OwnProps extends {}> = {
shouldMatchSomePermissions?: boolean;
actionRights?: TDemandedActionRight[];
dataFences?: TDemandedDataFence[];
getSelectDataFenceData?: (ownProps: OwnProps) => TSelectDataFenceData;
};
declare const branchOnPermissions: <OwnProps extends {}>(demandedPermissions: TPermissionName[], FallbackComponent: ComponentType<unknown>, options?: TOptions<OwnProps>) => (Component: ComponentType<OwnProps>) => ComponentType<OwnProps>;
export default branchOnPermissions;