All files / apps/timeOff/src/screens/TimeOffV2 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 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                                                                                                                                                           
export type TimeOffV2StackParamList = {
  ChooseApproversAndObservers: undefined;
  ChooseDate: undefined;
  ChooseReason: undefined;
  Preview: undefined;
};
 
export enum TimeOffStep {
  APPROVERS = 'ChooseApproversAndObservers',
  DATE = 'ChooseDate',
  REASON = 'ChooseReason',
  PREVIEW = 'Preview',
}
 
export interface TimeOffV2Form {
  approvers: string[];
  observers: string[];
  start?: Date;
  end?: Date;
  note?: string;
  requester?: string;
}
 
export interface TimeOffV2State {
  form: TimeOffV2Form;
  isSearchOpen: boolean;
  isDatePickerOpen: boolean;
  isReasonInputOpen: boolean;
  isSubmitting: boolean;
  isOnBehalf: boolean;
}
 
export interface TimeOffV2Actions {
  toggleApprover: (id: string) => void;
  toggleObserver: (id: string) => void;
  toggleExtraUser: (id: string) => void;
  changeDate: (start: Date, end: Date) => void;
  changeReason: (reason: string) => void;
  toggleSearch: () => void;
  closeSearch: (options?: { keepOnBehalf?: boolean }) => void;
  closeDatePicker: () => void;
  closeReasonInput: () => void;
  setDatePickerOpen: (isOpen: boolean) => void;
  setReasonInputOpen: (isOpen: boolean) => void;
  registerCloseReasonInput: (close: () => void) => void;
  setSubmitting: (isSubmitting: boolean) => void;
  handleOpenOnBehalf: () => void;
  setIsOnBehalf: (isOnBehalf: boolean) => void;
  resetApproversAndObservers: () => void;
}
 
export interface TimeOffV2ContextValue {
  state: TimeOffV2State;
  actions: TimeOffV2Actions;
}
 
export interface TimeOffV2AuthAdapter {
  getAccessToken: () => Promise<string | null>;
  onUnauthorized?: () => void;
}
 
export interface TimeOffV2EnvConfig {
  baseApiUrl: string;
  spaceApiUrl: string;
  basicAuthUsername: string;
  basicAuthPassword: string;
}
 
export interface TimeOffV2RemoteProps {
  onClose?: () => void;
  onSubmitSuccess?: () => void;
  onSubmitError?: (error: unknown) => void;
  setFabOffset?: (offset: number) => void;
  auth?: Partial<TimeOffV2AuthAdapter>;
  env?: Partial<TimeOffV2EnvConfig>;
  featureFlags?: Record<string, boolean>;
}