All files / src/features/Settings/Team types.ts

100% Statements 2/2
50% Branches 1/2
100% Functions 1/1
100% Lines 2/2

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            1x 25x                                                
import { EMAIL_REGEX } from "@validation/regex";
import { MemberRoleName } from "@customTypes/team.member";
import * as yup from "yup";
import { VALIDATION_MESSAGES } from "@validation/messages";
import { ProcessorValue } from "@features/Merchants/MerchantSidePanel/types";
 
export const AddTeamMemberSchema = (requireProcessor: boolean) =>
  yup.object().shape({
    emailList: yup
      .array()
      .of(
        yup
          .string()
          .matches(EMAIL_REGEX, VALIDATION_MESSAGES.INVALID_EMAIL_ADDRESS)
          .required(VALIDATION_MESSAGES.EMAIL_REQUIRED),
      )
      .min(1, "At least one email is required")
      .required(VALIDATION_MESSAGES.EMAIL_LIST_REQUIRED),
    processor: requireProcessor
      ? yup.string().required("Processor is required")
      : yup.string().optional(),
  });
 
export interface IAddTeamMemberModal {
  roleName: string;
  roleValue: MemberRoleName;
}
export interface AddTeamMemberFormValues {
  emailList: string[];
  processor: ProcessorValue;
}